Code:
diff --git a/prl_fs/SharedFolders/Guest/Linux/prl_fs/file.c b/prl_fs/SharedFolders/Guest/Linux/prl_fs/file.c
index 68bbaa1..ae7544d 100644
--- a/prl_fs/SharedFolders/Guest/Linux/prl_fs/file.c
+++ b/prl_fs/SharedFolders/Guest/Linux/prl_fs/file.c
@@ -85,7 +85,11 @@ static unsigned char prlfs_filetype_table[PRLFS_FILE_TYPE_MAX] = {
DT_LNK,
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+static int prlfs_fill_dir(struct file *filp, struct dir_context *ctx,
+#else
static int prlfs_fill_dir(struct file *filp, void *dirent, filldir_t filldir,
+#endif
loff_t *pos, void *buf, int buflen)
{
struct super_block *sb;
@@ -138,7 +142,11 @@ static int prlfs_fill_dir(struct file *filp, void *dirent, filldir_t filldir,
DPRINTK("filldir: name %s len %d, offset %lld, "
"de->type %d -> type %d\n",
de->name, name_len, (*pos), de->file_type, type);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+ err = dir_emit(ctx, de->name, name_len, ino, type);
+#else
err = filldir(dirent, de->name, name_len, (*pos), ino, type);
+#endif
if (err < 0)
goto out;
@@ -150,7 +158,11 @@ out:
return ret;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+static int prlfs_iterate(struct file *filp, struct dir_context *ctx)
+#else
static int prlfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
+#endif
{
struct prlfs_file_info pfi;
struct super_block *sb;
@@ -160,7 +172,11 @@ static int prlfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
DPRINTK("ENTER\n");
ret = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+ init_pfi(&pfi, PFD(filp)->fd, PFD(filp)->sfid, ctx->pos, 0);
+#else
init_pfi(&pfi, PFD(filp)->fd, PFD(filp)->sfid, filp->f_pos, 0);
+#endif
assert(filp->f_dentry);
assert(filp->f_dentry->d_sb);
sb = filp->f_dentry->d_sb;
@@ -178,7 +194,11 @@ static int prlfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
break;
prev_offset = pfi.offset;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+ ret = prlfs_fill_dir(filp, ctx,
+#else
ret = prlfs_fill_dir(filp, dirent, filldir,
+#endif
&pfi.offset, buf, len);
if (ret < 0)
break;
@@ -186,7 +206,11 @@ static int prlfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
break;
}
kfree(buf);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+ ctx->pos = pfi.offset;
+#else
filp->f_pos = pfi.offset;
+#endif
out:
DPRINTK("EXIT returning %d\n", ret);
return ret;
@@ -397,13 +421,21 @@ struct file_operations prlfs_file_fops = {
struct file_operations prlfs_dir_fops = {
.open = prlfs_open,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+ .iterate = prlfs_iterate,
+#else
.readdir = prlfs_readdir,
+#endif
.release = prlfs_release,
.read = generic_read_dir,
};
struct file_operations prlfs_root_fops = {
.open = prlfs_open,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+ .iterate = prlfs_iterate,
+#else
.readdir = prlfs_readdir,
+#endif
.read = generic_read_dir,
};