mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 03:31:26 +00:00
scst: Port to Linux kernel v4.6
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6835 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1371,7 +1371,7 @@ retry:
|
||||
set_fs(KERNEL_DS);
|
||||
res = vfs_writev(file,
|
||||
(struct iovec __force __user *)iop,
|
||||
count, &off);
|
||||
count, &off, 0);
|
||||
set_fs(oldfs);
|
||||
TRACE_WRITE("sid %#Lx, cid %u, res %d, iov_len %zd",
|
||||
(unsigned long long int)conn->session->sid,
|
||||
|
||||
@@ -212,6 +212,25 @@ static inline struct inode *file_inode(const struct file *f)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
|
||||
static inline ssize_t vfs_readv_backport(struct file *file,
|
||||
const struct iovec __user *vec,
|
||||
unsigned long vlen, loff_t *pos,
|
||||
int flags)
|
||||
{
|
||||
return vfs_readv(file, vec, vlen, pos);
|
||||
}
|
||||
static inline ssize_t vfs_writev_backport(struct file *file,
|
||||
const struct iovec __user *vec,
|
||||
unsigned long vlen, loff_t *pos,
|
||||
int flags)
|
||||
{
|
||||
return vfs_writev(file, vec, vlen, pos);
|
||||
}
|
||||
#define vfs_readv vfs_readv_backport
|
||||
#define vfs_writev vfs_writev_backport
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
|
||||
static inline int vfs_fsync_backport(struct file *file, int datasync)
|
||||
{
|
||||
@@ -325,6 +344,21 @@ static inline bool list_entry_in_list(const struct list_head *entry)
|
||||
#define lockdep_assert_held(l) do { (void)(l); } while (0)
|
||||
#endif
|
||||
|
||||
/* <linux/kernel.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
|
||||
static inline long get_user_pages_backport(unsigned long start,
|
||||
unsigned long nr_pages,
|
||||
int write, int force,
|
||||
struct page **pages,
|
||||
struct vm_area_struct **vmas)
|
||||
{
|
||||
return get_user_pages(current, current->mm, start, nr_pages, write,
|
||||
force, pages, vmas);
|
||||
}
|
||||
#define get_user_pages get_user_pages_backport
|
||||
#endif
|
||||
|
||||
/* <linux/preempt.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
|
||||
|
||||
@@ -1267,8 +1267,8 @@ static int dev_user_map_buf(struct scst_user_cmd *ucmd, unsigned long ubuff,
|
||||
(ucmd->cmd != NULL) ? ucmd->cmd->bufflen : -1);
|
||||
|
||||
down_read(&tsk->mm->mmap_sem);
|
||||
rc = get_user_pages(tsk, tsk->mm, ubuff, ucmd->num_data_pages,
|
||||
1/*writable*/, 0/*don't force*/, ucmd->data_pages, NULL);
|
||||
rc = get_user_pages(ubuff, ucmd->num_data_pages, 1/*writable*/,
|
||||
0/*don't force*/, ucmd->data_pages, NULL);
|
||||
up_read(&tsk->mm->mmap_sem);
|
||||
|
||||
/* get_user_pages() flushes dcache */
|
||||
|
||||
@@ -2023,8 +2023,8 @@ static int vdisk_format_dif(struct scst_cmd *cmd, uint64_t start_lba,
|
||||
full_len, (long long)loff);
|
||||
|
||||
/* WRITE */
|
||||
err = vfs_writev(fd, (struct iovec __force __user *)iv, iv_count,
|
||||
&loff);
|
||||
err = vfs_writev(fd, (struct iovec __force __user *)iv,
|
||||
iv_count, &loff, 0);
|
||||
if (err < 0) {
|
||||
PRINT_ERROR("Formatting DIF write() returned %lld from "
|
||||
"%zd", (long long)err, full_len);
|
||||
@@ -5860,7 +5860,7 @@ static int vdev_read_dif_tags(struct vdisk_cmd_params *p)
|
||||
|
||||
/* READ */
|
||||
err = vfs_readv(fd, (struct iovec __force __user *)iv, iv_count,
|
||||
&loff);
|
||||
&loff, 0);
|
||||
if ((err < 0) || (err < full_len)) {
|
||||
unsigned long flags;
|
||||
|
||||
@@ -5994,8 +5994,8 @@ restart:
|
||||
TRACE_DBG("Writing DIF: eiv_count %d, full_len %zd", eiv_count, full_len);
|
||||
|
||||
/* WRITE */
|
||||
err = vfs_writev(fd, (struct iovec __force __user *)eiv, eiv_count,
|
||||
&loff);
|
||||
err = vfs_writev(fd, (struct iovec __force __user *)eiv,
|
||||
eiv_count, &loff, 0);
|
||||
if (err < 0) {
|
||||
unsigned long flags;
|
||||
|
||||
@@ -6141,7 +6141,7 @@ static enum compl_status_e fileio_exec_read(struct vdisk_cmd_params *p)
|
||||
|
||||
/* READ */
|
||||
err = vfs_readv(fd, (struct iovec __force __user *)iv, iv_count,
|
||||
&loff);
|
||||
&loff, 0);
|
||||
if ((err < 0) || (err < full_len)) {
|
||||
PRINT_ERROR("readv() returned %lld from %zd",
|
||||
(unsigned long long int)err,
|
||||
@@ -6334,8 +6334,8 @@ restart:
|
||||
TRACE_DBG("Writing: eiv_count %d, full_len %zd", eiv_count, full_len);
|
||||
|
||||
/* WRITE */
|
||||
err = vfs_writev(fd, (struct iovec __force __user *)eiv, eiv_count,
|
||||
&loff);
|
||||
err = vfs_writev(fd, (struct iovec __force __user *)eiv,
|
||||
eiv_count, &loff, 0);
|
||||
if (err < 0) {
|
||||
PRINT_ERROR("write() returned %lld from %zd",
|
||||
(unsigned long long int)err,
|
||||
|
||||
Reference in New Issue
Block a user