Here's a patch to fix the recent removal of readdir() in the file_operations struct for the 3.11 Linux kernel release that will be in Ubuntu 13.10 release. Not extensively tested but works fine for me.
(I had to paste it here inline since Attachment upload is broken under Chrome on Linux... which means TABs are not preserved)
Usage (Debian/Ubuntu-specific):
1) Try to install Parallells Tools 9.x, let it fail (this will install Xorg 1.14 driver just fine)
2) Save the patch (from Code block below) into a file, perhaps called "patch" in your home directory
3) cd /usr/src/parallels-tools-9.0.23062.920702
4) sudo patch -l -p1 < ~/patch
5) sudo dkms build parallels-tools/9.0.23062.920702 --all
6) sudo dkms install parallels-tools/9.0.23062.920702 --all
7) dkms status # should show it installed for all kernels
7) If successfully installed, reboot
NOTE: If there is a more recent version of 9.0.x Tools and Linux 3.11 is /still/ not supported (which will not surprise me for the next year), try substituting the full 9.0.x version number above.
(I had to paste it here inline since Attachment upload is broken under Chrome on Linux... which means TABs are not preserved)
Usage (Debian/Ubuntu-specific):
1) Try to install Parallells Tools 9.x, let it fail (this will install Xorg 1.14 driver just fine)
2) Save the patch (from Code block below) into a file, perhaps called "patch" in your home directory
3) cd /usr/src/parallels-tools-9.0.23062.920702
4) sudo patch -l -p1 < ~/patch
5) sudo dkms build parallels-tools/9.0.23062.920702 --all
6) sudo dkms install parallels-tools/9.0.23062.920702 --all
7) dkms status # should show it installed for all kernels
7) If successfully installed, reboot
NOTE: If there is a more recent version of 9.0.x Tools and Linux 3.11 is /still/ not supported (which will not surprise me for the next year), try substituting the full 9.0.x version number above.
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,
};