diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/linux/sharedfolders/dirops.c | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/linux/sharedfolders/dirops.c')
-rw-r--r-- | src/VBox/Additions/linux/sharedfolders/dirops.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/src/VBox/Additions/linux/sharedfolders/dirops.c b/src/VBox/Additions/linux/sharedfolders/dirops.c index f7f558a0..dcaddab1 100644 --- a/src/VBox/Additions/linux/sharedfolders/dirops.c +++ b/src/VBox/Additions/linux/sharedfolders/dirops.c @@ -233,7 +233,11 @@ static int sf_getdent(struct file *dir, char d_name[NAME_MAX]) * b. failure to compute fake inode number * c. filldir returns an error (see comment on that) */ -static int sf_dir_read (struct file *dir, void *opaque, filldir_t filldir) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) +static int sf_dir_iterate(struct file *dir, struct dir_context *ctx) +#else +static int sf_dir_read(struct file *dir, void *opaque, filldir_t filldir) +#endif { TRACE(); for (;;) @@ -257,12 +261,19 @@ static int sf_dir_read (struct file *dir, void *opaque, filldir_t filldir) /* skip erroneous entry and proceed */ LogFunc(("sf_getdent error %d\n", err)); dir->f_pos += 1; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + ctx->pos += 1; +#endif continue; } /* d_name now contains a valid entry name */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + sanity = ctx->pos + 0xbeef; +#else sanity = dir->f_pos + 0xbeef; +#endif fake_ino = sanity; if (sanity - fake_ino) { @@ -270,8 +281,14 @@ static int sf_dir_read (struct file *dir, void *opaque, filldir_t filldir) return -EINVAL; } - err = filldir(opaque, d_name, strlen(d_name), - dir->f_pos, fake_ino, DT_UNKNOWN); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + if (!dir_emit(ctx, d_name, strlen(d_name), fake_ino, DT_UNKNOWN)) + { + LogFunc(("dir_emit failed\n")); + return 0; + } +#else + err = filldir(opaque, d_name, strlen(d_name), dir->f_pos, fake_ino, DT_UNKNOWN); if (err) { LogFunc(("filldir returned error %d\n", err)); @@ -279,8 +296,12 @@ static int sf_dir_read (struct file *dir, void *opaque, filldir_t filldir) only when it runs out of space in opaque */ return 0; } +#endif dir->f_pos += 1; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + ctx->pos += 1; +#endif } BUG(); @@ -289,7 +310,11 @@ static int sf_dir_read (struct file *dir, void *opaque, filldir_t filldir) struct file_operations sf_dir_fops = { .open = sf_dir_open, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) + .iterate = sf_dir_iterate, +#else .readdir = sf_dir_read, +#endif .release = sf_dir_release, .read = generic_read_dir #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) @@ -451,13 +476,6 @@ static int sf_instantiate(struct inode *parent, struct dentry *dentry, sf_init_inode(sf_g, inode, info); sf_new_i->path = path; SET_INODE_INFO(inode, sf_new_i); - - dentry->d_time = jiffies; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) - d_set_d_op(dentry, &sf_dentry_ops); -#else - dentry->d_op = &sf_dentry_ops; -#endif sf_new_i->force_restat = 1; sf_new_i->force_reread = 0; |