[PATCH] VFS: change struct file to use struct path

This patch changes struct file to use struct path instead of having
independent pointers to struct dentry and struct vfsmount, and converts all
users of f_{dentry,vfsmnt} in fs/ to use f_path.{dentry,mnt}.

Additionally, it adds two #define's to make the transition easier for users of
the f_dentry and f_vfsmnt.

Signed-off-by: Josef "Jeff" Sipek <jsipek@cs.sunysb.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Josef "Jeff" Sipek 2006-12-08 02:36:35 -08:00 committed by Linus Torvalds
parent b65d34fd46
commit 0f7fc9e4d0
32 changed files with 141 additions and 139 deletions

View file

@ -274,7 +274,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) ||
N_TRSIZE(ex) || N_DRSIZE(ex) || N_TRSIZE(ex) || N_DRSIZE(ex) ||
i_size_read(bprm->file->f_dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { i_size_read(bprm->file->f_path.dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
return -ENOEXEC; return -ENOEXEC;
} }
@ -389,7 +389,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
{ {
printk(KERN_WARNING printk(KERN_WARNING
"fd_offset is not page aligned. Please convert program: %s\n", "fd_offset is not page aligned. Please convert program: %s\n",
bprm->file->f_dentry->d_name.name); bprm->file->f_path.dentry->d_name.name);
error_time = jiffies; error_time = jiffies;
} }
@ -469,7 +469,7 @@ static int load_aout_library(struct file *file)
int retval; int retval;
struct exec ex; struct exec ex;
inode = file->f_dentry->d_inode; inode = file->f_path.dentry->d_inode;
retval = -ENOEXEC; retval = -ENOEXEC;
error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
@ -506,7 +506,7 @@ static int load_aout_library(struct file *file)
{ {
printk(KERN_WARNING printk(KERN_WARNING
"N_TXTOFF is not page aligned. Please convert library: %s\n", "N_TXTOFF is not page aligned. Please convert library: %s\n",
file->f_dentry->d_name.name); file->f_path.dentry->d_name.name);
error_time = jiffies; error_time = jiffies;
} }
down_write(&current->mm->mmap_sem); down_write(&current->mm->mmap_sem);

View file

@ -1190,7 +1190,7 @@ static int maydump(struct vm_area_struct *vma)
/* Dump shared memory only if mapped from an anonymous file. */ /* Dump shared memory only if mapped from an anonymous file. */
if (vma->vm_flags & VM_SHARED) if (vma->vm_flags & VM_SHARED)
return vma->vm_file->f_dentry->d_inode->i_nlink == 0; return vma->vm_file->f_path.dentry->d_inode->i_nlink == 0;
/* If it hasn't been written to, don't write it out */ /* If it hasn't been written to, don't write it out */
if (!vma->anon_vma) if (!vma->anon_vma)

View file

@ -855,7 +855,7 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
dynamic_error: dynamic_error:
printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n", printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n",
what, file->f_dentry->d_inode->i_ino); what, file->f_path.dentry->d_inode->i_ino);
return -ELIBBAD; return -ELIBBAD;
} }
@ -1186,7 +1186,7 @@ static int maydump(struct vm_area_struct *vma)
/* Dump shared memory only if mapped from an anonymous file. */ /* Dump shared memory only if mapped from an anonymous file. */
if (vma->vm_flags & VM_SHARED) { if (vma->vm_flags & VM_SHARED) {
if (vma->vm_file->f_dentry->d_inode->i_nlink == 0) { if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) {
kdcore("%08lx: %08lx: no (share)", vma->vm_start, vma->vm_flags); kdcore("%08lx: %08lx: no (share)", vma->vm_start, vma->vm_flags);
return 1; return 1;
} }

View file

@ -429,7 +429,7 @@ static int load_flat_file(struct linux_binprm * bprm,
int ret; int ret;
hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */
inode = bprm->file->f_dentry->d_inode; inode = bprm->file->f_path.dentry->d_inode;
text_len = ntohl(hdr->data_start); text_len = ntohl(hdr->data_start);
data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start); data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start);

View file

@ -542,7 +542,7 @@ static void kill_node(Node *e)
static ssize_t static ssize_t
bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos) bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
{ {
Node *e = file->f_dentry->d_inode->i_private; Node *e = file->f_path.dentry->d_inode->i_private;
loff_t pos = *ppos; loff_t pos = *ppos;
ssize_t res; ssize_t res;
char *page; char *page;
@ -576,7 +576,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct dentry *root; struct dentry *root;
Node *e = file->f_dentry->d_inode->i_private; Node *e = file->f_path.dentry->d_inode->i_private;
int res = parse_command(buffer, count); int res = parse_command(buffer, count);
switch (res) { switch (res) {
@ -584,7 +584,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
break; break;
case 2: set_bit(Enabled, &e->flags); case 2: set_bit(Enabled, &e->flags);
break; break;
case 3: root = dget(file->f_vfsmnt->mnt_sb->s_root); case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
mutex_lock(&root->d_inode->i_mutex); mutex_lock(&root->d_inode->i_mutex);
kill_node(e); kill_node(e);
@ -610,7 +610,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
Node *e; Node *e;
struct inode *inode; struct inode *inode;
struct dentry *root, *dentry; struct dentry *root, *dentry;
struct super_block *sb = file->f_vfsmnt->mnt_sb; struct super_block *sb = file->f_path.mnt->mnt_sb;
int err = 0; int err = 0;
e = create_entry(buffer, count); e = create_entry(buffer, count);
@ -699,7 +699,7 @@ static ssize_t bm_status_write(struct file * file, const char __user * buffer,
switch (res) { switch (res) {
case 1: enabled = 0; break; case 1: enabled = 0; break;
case 2: enabled = 1; break; case 2: enabled = 1; break;
case 3: root = dget(file->f_vfsmnt->mnt_sb->s_root); case 3: root = dget(file->f_path.mnt->mnt_sb->s_root);
mutex_lock(&root->d_inode->i_mutex); mutex_lock(&root->d_inode->i_mutex);
while (!list_empty(&entries)) while (!list_empty(&entries))

View file

@ -190,7 +190,7 @@ static int blkdev_commit_write(struct file *file, struct page *page, unsigned fr
/* /*
* private llseek: * private llseek:
* for a block special file file->f_dentry->d_inode->i_size is zero * for a block special file file->f_path.dentry->d_inode->i_size is zero
* so we compute the size by hand (just as in block_read/write above) * so we compute the size by hand (just as in block_read/write above)
*/ */
static loff_t block_llseek(struct file *file, loff_t offset, int origin) static loff_t block_llseek(struct file *file, loff_t offset, int origin)
@ -1013,7 +1013,7 @@ static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags,
struct dentry fake_dentry = {}; struct dentry fake_dentry = {};
fake_file.f_mode = mode; fake_file.f_mode = mode;
fake_file.f_flags = flags; fake_file.f_flags = flags;
fake_file.f_dentry = &fake_dentry; fake_file.f_path.dentry = &fake_dentry;
fake_dentry.d_inode = bdev->bd_inode; fake_dentry.d_inode = bdev->bd_inode;
return do_open(bdev, &fake_file, for_part); return do_open(bdev, &fake_file, for_part);

View file

@ -232,7 +232,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user
file = fget(fd); file = fget(fd);
if (!file) if (!file)
goto out; goto out;
error = vfs_statfs(file->f_dentry, &tmp); error = vfs_statfs(file->f_path.dentry, &tmp);
if (!error) if (!error)
error = put_compat_statfs(buf, &tmp); error = put_compat_statfs(buf, &tmp);
fput(file); fput(file);
@ -303,7 +303,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
file = fget(fd); file = fget(fd);
if (!file) if (!file)
goto out; goto out;
error = vfs_statfs(file->f_dentry, &tmp); error = vfs_statfs(file->f_path.dentry, &tmp);
if (!error) if (!error)
error = put_compat_statfs64(buf, &tmp); error = put_compat_statfs64(buf, &tmp);
fput(file); fput(file);
@ -365,7 +365,7 @@ static void compat_ioctl_error(struct file *filp, unsigned int fd,
/* find the name of the device. */ /* find the name of the device. */
path = (char *)__get_free_page(GFP_KERNEL); path = (char *)__get_free_page(GFP_KERNEL);
if (path) { if (path) {
fn = d_path(filp->f_dentry, filp->f_vfsmnt, path, PAGE_SIZE); fn = d_path(filp->f_path.dentry, filp->f_path.mnt, path, PAGE_SIZE);
if (IS_ERR(fn)) if (IS_ERR(fn))
fn = "?"; fn = "?";
} }
@ -416,7 +416,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
case FIBMAP: case FIBMAP:
case FIGETBSZ: case FIGETBSZ:
case FIONREAD: case FIONREAD:
if (S_ISREG(filp->f_dentry->d_inode->i_mode)) if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
break; break;
/*FALL THROUGH*/ /*FALL THROUGH*/
@ -438,7 +438,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
goto found_handler; goto found_handler;
} }
if (S_ISSOCK(filp->f_dentry->d_inode->i_mode) && if (S_ISSOCK(filp->f_path.dentry->d_inode->i_mode) &&
cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
error = siocdevprivate_ioctl(fd, cmd, arg); error = siocdevprivate_ioctl(fd, cmd, arg);
} else { } else {
@ -1259,7 +1259,7 @@ out:
if (iov != iovstack) if (iov != iovstack)
kfree(iov); kfree(iov);
if ((ret + (type == READ)) > 0) { if ((ret + (type == READ)) > 0) {
struct dentry *dentry = file->f_dentry; struct dentry *dentry = file->f_path.dentry;
if (type == READ) if (type == READ)
fsnotify_access(dentry); fsnotify_access(dentry);
else else

View file

@ -1177,7 +1177,7 @@ static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar
static int vt_check(struct file *file) static int vt_check(struct file *file)
{ {
struct tty_struct *tty; struct tty_struct *tty;
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
if (file->f_op->ioctl != tty_ioctl) if (file->f_op->ioctl != tty_ioctl)
return -EINVAL; return -EINVAL;

View file

@ -42,7 +42,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)
struct dnotify_struct **prev; struct dnotify_struct **prev;
struct inode *inode; struct inode *inode;
inode = filp->f_dentry->d_inode; inode = filp->f_path.dentry->d_inode;
if (!S_ISDIR(inode->i_mode)) if (!S_ISDIR(inode->i_mode))
return; return;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
@ -74,7 +74,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
} }
if (!dir_notify_enable) if (!dir_notify_enable)
return -EINVAL; return -EINVAL;
inode = filp->f_dentry->d_inode; inode = filp->f_path.dentry->d_inode;
if (!S_ISDIR(inode->i_mode)) if (!S_ISDIR(inode->i_mode))
return -ENOTDIR; return -ENOTDIR;
dn = kmem_cache_alloc(dn_cache, GFP_KERNEL); dn = kmem_cache_alloc(dn_cache, GFP_KERNEL);

View file

@ -694,9 +694,9 @@ restart:
file_list_lock(); file_list_lock();
list_for_each(p, &sb->s_files) { list_for_each(p, &sb->s_files) {
struct file *filp = list_entry(p, struct file, f_u.fu_list); struct file *filp = list_entry(p, struct file, f_u.fu_list);
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) { if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) {
struct dentry *dentry = dget(filp->f_dentry); struct dentry *dentry = dget(filp->f_path.dentry);
file_list_unlock(); file_list_unlock();
sb->dq_op->initialize(inode, type); sb->dq_op->initialize(inode, type);
dput(dentry); dput(dentry);

View file

@ -795,8 +795,8 @@ static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
goto eexit_4; goto eexit_4;
dentry->d_op = &eventpollfs_dentry_operations; dentry->d_op = &eventpollfs_dentry_operations;
d_add(dentry, inode); d_add(dentry, inode);
file->f_vfsmnt = mntget(eventpoll_mnt); file->f_path.mnt = mntget(eventpoll_mnt);
file->f_dentry = dentry; file->f_path.dentry = dentry;
file->f_mapping = inode->i_mapping; file->f_mapping = inode->i_mapping;
file->f_pos = 0; file->f_pos = 0;

View file

@ -912,7 +912,7 @@ EXPORT_SYMBOL(flush_old_exec);
int prepare_binprm(struct linux_binprm *bprm) int prepare_binprm(struct linux_binprm *bprm)
{ {
int mode; int mode;
struct inode * inode = bprm->file->f_dentry->d_inode; struct inode * inode = bprm->file->f_path.dentry->d_inode;
int retval; int retval;
mode = inode->i_mode; mode = inode->i_mode;
@ -922,7 +922,7 @@ int prepare_binprm(struct linux_binprm *bprm)
bprm->e_uid = current->euid; bprm->e_uid = current->euid;
bprm->e_gid = current->egid; bprm->e_gid = current->egid;
if(!(bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)) { if(!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)) {
/* Set-uid? */ /* Set-uid? */
if (mode & S_ISUID) { if (mode & S_ISUID) {
current->personality &= ~PER_CLEAR_ON_SETID; current->personality &= ~PER_CLEAR_ON_SETID;
@ -1519,10 +1519,10 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
0600); 0600);
if (IS_ERR(file)) if (IS_ERR(file))
goto fail_unlock; goto fail_unlock;
inode = file->f_dentry->d_inode; inode = file->f_path.dentry->d_inode;
if (inode->i_nlink > 1) if (inode->i_nlink > 1)
goto close_fail; /* multiple links - don't dump */ goto close_fail; /* multiple links - don't dump */
if (!ispipe && d_unhashed(file->f_dentry)) if (!ispipe && d_unhashed(file->f_path.dentry))
goto close_fail; goto close_fail;
/* AK: actually i see no reason to not allow this for named pipes etc., /* AK: actually i see no reason to not allow this for named pipes etc.,
@ -1533,7 +1533,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
goto close_fail; goto close_fail;
if (!file->f_op->write) if (!file->f_op->write)
goto close_fail; goto close_fail;
if (!ispipe && do_truncate(file->f_dentry, 0, 0, file) != 0) if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
goto close_fail; goto close_fail;
retval = binfmt->core_dump(signr, regs, file); retval = binfmt->core_dump(signr, regs, file);

View file

@ -204,7 +204,7 @@ asmlinkage long sys_dup(unsigned int fildes)
static int setfl(int fd, struct file * filp, unsigned long arg) static int setfl(int fd, struct file * filp, unsigned long arg)
{ {
struct inode * inode = filp->f_dentry->d_inode; struct inode * inode = filp->f_path.dentry->d_inode;
int error = 0; int error = 0;
/* /*

View file

@ -152,8 +152,8 @@ EXPORT_SYMBOL(fput);
*/ */
void fastcall __fput(struct file *file) void fastcall __fput(struct file *file)
{ {
struct dentry *dentry = file->f_dentry; struct dentry *dentry = file->f_path.dentry;
struct vfsmount *mnt = file->f_vfsmnt; struct vfsmount *mnt = file->f_path.mnt;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
might_sleep(); might_sleep();
@ -176,8 +176,8 @@ void fastcall __fput(struct file *file)
put_write_access(inode); put_write_access(inode);
put_pid(file->f_owner.pid); put_pid(file->f_owner.pid);
file_kill(file); file_kill(file);
file->f_dentry = NULL; file->f_path.dentry = NULL;
file->f_vfsmnt = NULL; file->f_path.mnt = NULL;
file_free(file); file_free(file);
dput(dentry); dput(dentry);
mntput(mnt); mntput(mnt);
@ -271,7 +271,7 @@ int fs_may_remount_ro(struct super_block *sb)
file_list_lock(); file_list_lock();
list_for_each(p, &sb->s_files) { list_for_each(p, &sb->s_files) {
struct file *file = list_entry(p, struct file, f_u.fu_list); struct file *file = list_entry(p, struct file, f_u.fu_list);
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
/* File with pending delete? */ /* File with pending delete? */
if (inode->i_nlink == 0) if (inode->i_nlink == 0)

View file

@ -1200,7 +1200,7 @@ EXPORT_SYMBOL(touch_atime);
void file_update_time(struct file *file) void file_update_time(struct file *file)
{ {
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
struct timespec now; struct timespec now;
int sync_it = 0; int sync_it = 0;

View file

@ -570,9 +570,9 @@ asmlinkage long sys_inotify_init(void)
dev->ih = ih; dev->ih = ih;
filp->f_op = &inotify_fops; filp->f_op = &inotify_fops;
filp->f_vfsmnt = mntget(inotify_mnt); filp->f_path.mnt = mntget(inotify_mnt);
filp->f_dentry = dget(inotify_mnt->mnt_root); filp->f_path.dentry = dget(inotify_mnt->mnt_root);
filp->f_mapping = filp->f_dentry->d_inode->i_mapping; filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping;
filp->f_mode = FMODE_READ; filp->f_mode = FMODE_READ;
filp->f_flags = O_RDONLY; filp->f_flags = O_RDONLY;
filp->private_data = dev; filp->private_data = dev;

View file

@ -31,7 +31,7 @@ static long do_ioctl(struct file *filp, unsigned int cmd,
goto out; goto out;
} else if (filp->f_op->ioctl) { } else if (filp->f_op->ioctl) {
lock_kernel(); lock_kernel();
error = filp->f_op->ioctl(filp->f_dentry->d_inode, error = filp->f_op->ioctl(filp->f_path.dentry->d_inode,
filp, cmd, arg); filp, cmd, arg);
unlock_kernel(); unlock_kernel();
} }
@ -45,7 +45,7 @@ static int file_ioctl(struct file *filp, unsigned int cmd,
{ {
int error; int error;
int block; int block;
struct inode * inode = filp->f_dentry->d_inode; struct inode * inode = filp->f_path.dentry->d_inode;
int __user *p = (int __user *)arg; int __user *p = (int __user *)arg;
switch (cmd) { switch (cmd) {
@ -137,17 +137,17 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon
break; break;
case FIOQSIZE: case FIOQSIZE:
if (S_ISDIR(filp->f_dentry->d_inode->i_mode) || if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) ||
S_ISREG(filp->f_dentry->d_inode->i_mode) || S_ISREG(filp->f_path.dentry->d_inode->i_mode) ||
S_ISLNK(filp->f_dentry->d_inode->i_mode)) { S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) {
loff_t res = inode_get_bytes(filp->f_dentry->d_inode); loff_t res = inode_get_bytes(filp->f_path.dentry->d_inode);
error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0; error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0;
} }
else else
error = -ENOTTY; error = -ENOTTY;
break; break;
default: default:
if (S_ISREG(filp->f_dentry->d_inode->i_mode)) if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
error = file_ioctl(filp, cmd, arg); error = file_ioctl(filp, cmd, arg);
else else
error = do_ioctl(filp, cmd, arg); error = do_ioctl(filp, cmd, arg);

View file

@ -63,7 +63,7 @@ int dcache_dir_open(struct inode *inode, struct file *file)
{ {
static struct qstr cursor_name = {.len = 1, .name = "."}; static struct qstr cursor_name = {.len = 1, .name = "."};
file->private_data = d_alloc(file->f_dentry, &cursor_name); file->private_data = d_alloc(file->f_path.dentry, &cursor_name);
return file->private_data ? 0 : -ENOMEM; return file->private_data ? 0 : -ENOMEM;
} }
@ -76,7 +76,7 @@ int dcache_dir_close(struct inode *inode, struct file *file)
loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin) loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
{ {
mutex_lock(&file->f_dentry->d_inode->i_mutex); mutex_lock(&file->f_path.dentry->d_inode->i_mutex);
switch (origin) { switch (origin) {
case 1: case 1:
offset += file->f_pos; offset += file->f_pos;
@ -84,7 +84,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
if (offset >= 0) if (offset >= 0)
break; break;
default: default:
mutex_unlock(&file->f_dentry->d_inode->i_mutex); mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
return -EINVAL; return -EINVAL;
} }
if (offset != file->f_pos) { if (offset != file->f_pos) {
@ -96,8 +96,8 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
spin_lock(&dcache_lock); spin_lock(&dcache_lock);
list_del(&cursor->d_u.d_child); list_del(&cursor->d_u.d_child);
p = file->f_dentry->d_subdirs.next; p = file->f_path.dentry->d_subdirs.next;
while (n && p != &file->f_dentry->d_subdirs) { while (n && p != &file->f_path.dentry->d_subdirs) {
struct dentry *next; struct dentry *next;
next = list_entry(p, struct dentry, d_u.d_child); next = list_entry(p, struct dentry, d_u.d_child);
if (!d_unhashed(next) && next->d_inode) if (!d_unhashed(next) && next->d_inode)
@ -108,7 +108,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin)
spin_unlock(&dcache_lock); spin_unlock(&dcache_lock);
} }
} }
mutex_unlock(&file->f_dentry->d_inode->i_mutex); mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
return offset; return offset;
} }
@ -126,7 +126,7 @@ static inline unsigned char dt_type(struct inode *inode)
int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
{ {
struct dentry *dentry = filp->f_dentry; struct dentry *dentry = filp->f_path.dentry;
struct dentry *cursor = filp->private_data; struct dentry *cursor = filp->private_data;
struct list_head *p, *q = &cursor->d_u.d_child; struct list_head *p, *q = &cursor->d_u.d_child;
ino_t ino; ino_t ino;

View file

@ -321,7 +321,7 @@ static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
start = filp->f_pos; start = filp->f_pos;
break; break;
case SEEK_END: case SEEK_END:
start = i_size_read(filp->f_dentry->d_inode); start = i_size_read(filp->f_path.dentry->d_inode);
break; break;
default: default:
return -EINVAL; return -EINVAL;
@ -371,7 +371,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
start = filp->f_pos; start = filp->f_pos;
break; break;
case SEEK_END: case SEEK_END:
start = i_size_read(filp->f_dentry->d_inode); start = i_size_read(filp->f_path.dentry->d_inode);
break; break;
default: default:
return -EINVAL; return -EINVAL;
@ -672,7 +672,7 @@ posix_test_lock(struct file *filp, struct file_lock *fl,
struct file_lock *cfl; struct file_lock *cfl;
lock_kernel(); lock_kernel();
for (cfl = filp->f_dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) { for (cfl = filp->f_path.dentry->d_inode->i_flock; cfl; cfl = cfl->fl_next) {
if (!IS_POSIX(cfl)) if (!IS_POSIX(cfl))
continue; continue;
if (posix_locks_conflict(cfl, fl)) if (posix_locks_conflict(cfl, fl))
@ -734,7 +734,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
{ {
struct file_lock *new_fl = NULL; struct file_lock *new_fl = NULL;
struct file_lock **before; struct file_lock **before;
struct inode * inode = filp->f_dentry->d_inode; struct inode * inode = filp->f_path.dentry->d_inode;
int error = 0; int error = 0;
int found = 0; int found = 0;
@ -1018,7 +1018,7 @@ static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request
*/ */
int posix_lock_file(struct file *filp, struct file_lock *fl) int posix_lock_file(struct file *filp, struct file_lock *fl)
{ {
return __posix_lock_file_conf(filp->f_dentry->d_inode, fl, NULL); return __posix_lock_file_conf(filp->f_path.dentry->d_inode, fl, NULL);
} }
EXPORT_SYMBOL(posix_lock_file); EXPORT_SYMBOL(posix_lock_file);
@ -1033,7 +1033,7 @@ EXPORT_SYMBOL(posix_lock_file);
int posix_lock_file_conf(struct file *filp, struct file_lock *fl, int posix_lock_file_conf(struct file *filp, struct file_lock *fl,
struct file_lock *conflock) struct file_lock *conflock)
{ {
return __posix_lock_file_conf(filp->f_dentry->d_inode, fl, conflock); return __posix_lock_file_conf(filp->f_path.dentry->d_inode, fl, conflock);
} }
EXPORT_SYMBOL(posix_lock_file_conf); EXPORT_SYMBOL(posix_lock_file_conf);
@ -1333,8 +1333,8 @@ int fcntl_getlease(struct file *filp)
int type = F_UNLCK; int type = F_UNLCK;
lock_kernel(); lock_kernel();
time_out_leases(filp->f_dentry->d_inode); time_out_leases(filp->f_path.dentry->d_inode);
for (fl = filp->f_dentry->d_inode->i_flock; fl && IS_LEASE(fl); for (fl = filp->f_path.dentry->d_inode->i_flock; fl && IS_LEASE(fl);
fl = fl->fl_next) { fl = fl->fl_next) {
if (fl->fl_file == filp) { if (fl->fl_file == filp) {
type = fl->fl_type & ~F_INPROGRESS; type = fl->fl_type & ~F_INPROGRESS;
@ -1359,7 +1359,7 @@ int fcntl_getlease(struct file *filp)
static int __setlease(struct file *filp, long arg, struct file_lock **flp) static int __setlease(struct file *filp, long arg, struct file_lock **flp)
{ {
struct file_lock *fl, **before, **my_before = NULL, *lease; struct file_lock *fl, **before, **my_before = NULL, *lease;
struct dentry *dentry = filp->f_dentry; struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
int error, rdlease_count = 0, wrlease_count = 0; int error, rdlease_count = 0, wrlease_count = 0;
@ -1448,7 +1448,7 @@ out:
int setlease(struct file *filp, long arg, struct file_lock **lease) int setlease(struct file *filp, long arg, struct file_lock **lease)
{ {
struct dentry *dentry = filp->f_dentry; struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
int error; int error;
@ -1482,7 +1482,7 @@ EXPORT_SYMBOL(setlease);
int fcntl_setlease(unsigned int fd, struct file *filp, long arg) int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
{ {
struct file_lock fl, *flp = &fl; struct file_lock fl, *flp = &fl;
struct dentry *dentry = filp->f_dentry; struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
int error; int error;
@ -1692,7 +1692,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
if (copy_from_user(&flock, l, sizeof(flock))) if (copy_from_user(&flock, l, sizeof(flock)))
goto out; goto out;
inode = filp->f_dentry->d_inode; inode = filp->f_path.dentry->d_inode;
/* Don't allow mandatory locks on files that may be memory mapped /* Don't allow mandatory locks on files that may be memory mapped
* and shared. * and shared.
@ -1835,7 +1835,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
if (copy_from_user(&flock, l, sizeof(flock))) if (copy_from_user(&flock, l, sizeof(flock)))
goto out; goto out;
inode = filp->f_dentry->d_inode; inode = filp->f_path.dentry->d_inode;
/* Don't allow mandatory locks on files that may be memory mapped /* Don't allow mandatory locks on files that may be memory mapped
* and shared. * and shared.
@ -1922,7 +1922,7 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
* posix_lock_file(). Another process could be setting a lock on this * posix_lock_file(). Another process could be setting a lock on this
* file at the same time, but we wouldn't remove that lock anyway. * file at the same time, but we wouldn't remove that lock anyway.
*/ */
if (!filp->f_dentry->d_inode->i_flock) if (!filp->f_path.dentry->d_inode->i_flock)
return; return;
lock.fl_type = F_UNLCK; lock.fl_type = F_UNLCK;
@ -1951,7 +1951,7 @@ EXPORT_SYMBOL(locks_remove_posix);
*/ */
void locks_remove_flock(struct file *filp) void locks_remove_flock(struct file *filp)
{ {
struct inode * inode = filp->f_dentry->d_inode; struct inode * inode = filp->f_path.dentry->d_inode;
struct file_lock *fl; struct file_lock *fl;
struct file_lock **before; struct file_lock **before;
@ -2020,7 +2020,7 @@ static void lock_get_status(char* out, struct file_lock *fl, int id, char *pfx)
struct inode *inode = NULL; struct inode *inode = NULL;
if (fl->fl_file != NULL) if (fl->fl_file != NULL)
inode = fl->fl_file->f_dentry->d_inode; inode = fl->fl_file->f_path.dentry->d_inode;
out += sprintf(out, "%d:%s ", id, pfx); out += sprintf(out, "%d:%s ", id, pfx);
if (IS_POSIX(fl)) { if (IS_POSIX(fl)) {

View file

@ -297,7 +297,7 @@ int vfs_permission(struct nameidata *nd, int mask)
*/ */
int file_permission(struct file *file, int mask) int file_permission(struct file *file, int mask)
{ {
return permission(file->f_dentry->d_inode, mask, NULL); return permission(file->f_path.dentry->d_inode, mask, NULL);
} }
/* /*
@ -333,7 +333,7 @@ int get_write_access(struct inode * inode)
int deny_write_access(struct file * file) int deny_write_access(struct file * file)
{ {
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (atomic_read(&inode->i_writecount) > 0) { if (atomic_read(&inode->i_writecount) > 0) {
@ -368,7 +368,7 @@ void path_release_on_umount(struct nameidata *nd)
*/ */
void release_open_intent(struct nameidata *nd) void release_open_intent(struct nameidata *nd)
{ {
if (nd->intent.open.file->f_dentry == NULL) if (nd->intent.open.file->f_path.dentry == NULL)
put_filp(nd->intent.open.file); put_filp(nd->intent.open.file);
else else
fput(nd->intent.open.file); fput(nd->intent.open.file);
@ -1138,7 +1138,7 @@ static int fastcall do_path_lookup(int dfd, const char *name,
if (!file) if (!file)
goto out_fail; goto out_fail;
dentry = file->f_dentry; dentry = file->f_path.dentry;
retval = -ENOTDIR; retval = -ENOTDIR;
if (!S_ISDIR(dentry->d_inode->i_mode)) if (!S_ISDIR(dentry->d_inode->i_mode))
@ -1148,7 +1148,7 @@ static int fastcall do_path_lookup(int dfd, const char *name,
if (retval) if (retval)
goto fput_fail; goto fput_fail;
nd->mnt = mntget(file->f_vfsmnt); nd->mnt = mntget(file->f_path.mnt);
nd->dentry = dget(dentry); nd->dentry = dget(dentry);
fput_light(file, fput_needed); fput_light(file, fput_needed);

View file

@ -165,7 +165,7 @@ asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
file = fget(fd); file = fget(fd);
if (!file) if (!file)
goto out; goto out;
error = vfs_statfs_native(file->f_dentry, &tmp); error = vfs_statfs_native(file->f_path.dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT; error = -EFAULT;
fput(file); fput(file);
@ -186,7 +186,7 @@ asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user
file = fget(fd); file = fget(fd);
if (!file) if (!file)
goto out; goto out;
error = vfs_statfs64(file->f_dentry, &tmp); error = vfs_statfs64(file->f_path.dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT; error = -EFAULT;
fput(file); fput(file);
@ -302,7 +302,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
if (file->f_flags & O_LARGEFILE) if (file->f_flags & O_LARGEFILE)
small = 0; small = 0;
dentry = file->f_dentry; dentry = file->f_path.dentry;
inode = dentry->d_inode; inode = dentry->d_inode;
error = -EINVAL; error = -EINVAL;
if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE)) if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
@ -448,8 +448,8 @@ asmlinkage long sys_fchdir(unsigned int fd)
if (!file) if (!file)
goto out; goto out;
dentry = file->f_dentry; dentry = file->f_path.dentry;
mnt = file->f_vfsmnt; mnt = file->f_path.mnt;
inode = dentry->d_inode; inode = dentry->d_inode;
error = -ENOTDIR; error = -ENOTDIR;
@ -503,7 +503,7 @@ asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
if (!file) if (!file)
goto out; goto out;
dentry = file->f_dentry; dentry = file->f_path.dentry;
inode = dentry->d_inode; inode = dentry->d_inode;
audit_inode(NULL, inode); audit_inode(NULL, inode);
@ -662,7 +662,7 @@ asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
if (!file) if (!file)
goto out; goto out;
dentry = file->f_dentry; dentry = file->f_path.dentry;
audit_inode(NULL, dentry->d_inode); audit_inode(NULL, dentry->d_inode);
error = chown_common(dentry, user, group); error = chown_common(dentry, user, group);
fput(file); fput(file);
@ -688,8 +688,8 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
} }
f->f_mapping = inode->i_mapping; f->f_mapping = inode->i_mapping;
f->f_dentry = dentry; f->f_path.dentry = dentry;
f->f_vfsmnt = mnt; f->f_path.mnt = mnt;
f->f_pos = 0; f->f_pos = 0;
f->f_op = fops_get(inode->i_fop); f->f_op = fops_get(inode->i_fop);
file_move(f, &inode->i_sb->s_files); file_move(f, &inode->i_sb->s_files);
@ -723,8 +723,8 @@ cleanup_all:
if (f->f_mode & FMODE_WRITE) if (f->f_mode & FMODE_WRITE)
put_write_access(inode); put_write_access(inode);
file_kill(f); file_kill(f);
f->f_dentry = NULL; f->f_path.dentry = NULL;
f->f_vfsmnt = NULL; f->f_path.mnt = NULL;
cleanup_file: cleanup_file:
put_filp(f); put_filp(f);
dput(dentry); dput(dentry);
@ -822,7 +822,7 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)
/* Pick up the filp from the open intent */ /* Pick up the filp from the open intent */
filp = nd->intent.open.file; filp = nd->intent.open.file;
/* Has the filesystem initialised the file for us? */ /* Has the filesystem initialised the file for us? */
if (filp->f_dentry == NULL) if (filp->f_path.dentry == NULL)
filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL); filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL);
else else
path_release(nd); path_release(nd);
@ -965,7 +965,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
put_unused_fd(fd); put_unused_fd(fd);
fd = PTR_ERR(f); fd = PTR_ERR(f);
} else { } else {
fsnotify_open(f->f_dentry); fsnotify_open(f->f_path.dentry);
fd_install(fd, f); fd_install(fd, f);
} }
} }

View file

@ -222,7 +222,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
unsigned long nr_segs, loff_t pos) unsigned long nr_segs, loff_t pos)
{ {
struct file *filp = iocb->ki_filp; struct file *filp = iocb->ki_filp;
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe; struct pipe_inode_info *pipe;
int do_wakeup; int do_wakeup;
ssize_t ret; ssize_t ret;
@ -335,7 +335,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
unsigned long nr_segs, loff_t ppos) unsigned long nr_segs, loff_t ppos)
{ {
struct file *filp = iocb->ki_filp; struct file *filp = iocb->ki_filp;
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe; struct pipe_inode_info *pipe;
ssize_t ret; ssize_t ret;
int do_wakeup; int do_wakeup;
@ -520,7 +520,7 @@ static int
pipe_ioctl(struct inode *pino, struct file *filp, pipe_ioctl(struct inode *pino, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe; struct pipe_inode_info *pipe;
int count, buf, nrbufs; int count, buf, nrbufs;
@ -548,7 +548,7 @@ static unsigned int
pipe_poll(struct file *filp, poll_table *wait) pipe_poll(struct file *filp, poll_table *wait)
{ {
unsigned int mask; unsigned int mask;
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe = inode->i_pipe; struct pipe_inode_info *pipe = inode->i_pipe;
int nrbufs; int nrbufs;
@ -601,7 +601,7 @@ pipe_release(struct inode *inode, int decr, int decw)
static int static int
pipe_read_fasync(int fd, struct file *filp, int on) pipe_read_fasync(int fd, struct file *filp, int on)
{ {
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
int retval; int retval;
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
@ -618,7 +618,7 @@ pipe_read_fasync(int fd, struct file *filp, int on)
static int static int
pipe_write_fasync(int fd, struct file *filp, int on) pipe_write_fasync(int fd, struct file *filp, int on)
{ {
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
int retval; int retval;
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
@ -635,7 +635,7 @@ pipe_write_fasync(int fd, struct file *filp, int on)
static int static int
pipe_rdwr_fasync(int fd, struct file *filp, int on) pipe_rdwr_fasync(int fd, struct file *filp, int on)
{ {
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct pipe_inode_info *pipe = inode->i_pipe; struct pipe_inode_info *pipe = inode->i_pipe;
int retval; int retval;
@ -914,8 +914,8 @@ struct file *create_write_pipe(void)
*/ */
dentry->d_flags &= ~DCACHE_UNHASHED; dentry->d_flags &= ~DCACHE_UNHASHED;
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
f->f_vfsmnt = mntget(pipe_mnt); f->f_path.mnt = mntget(pipe_mnt);
f->f_dentry = dentry; f->f_path.dentry = dentry;
f->f_mapping = inode->i_mapping; f->f_mapping = inode->i_mapping;
f->f_flags = O_WRONLY; f->f_flags = O_WRONLY;
@ -935,8 +935,8 @@ struct file *create_write_pipe(void)
void free_write_pipe(struct file *f) void free_write_pipe(struct file *f)
{ {
mntput(f->f_vfsmnt); mntput(f->f_path.mnt);
dput(f->f_dentry); dput(f->f_path.dentry);
put_filp(f); put_filp(f);
} }
@ -947,9 +947,9 @@ struct file *create_read_pipe(struct file *wrf)
return ERR_PTR(-ENFILE); return ERR_PTR(-ENFILE);
/* Grab pipe from the writer */ /* Grab pipe from the writer */
f->f_vfsmnt = mntget(wrf->f_vfsmnt); f->f_path.mnt = mntget(wrf->f_path.mnt);
f->f_dentry = dget(wrf->f_dentry); f->f_path.dentry = dget(wrf->f_path.dentry);
f->f_mapping = wrf->f_dentry->d_inode->i_mapping; f->f_mapping = wrf->f_path.dentry->d_inode->i_mapping;
f->f_pos = 0; f->f_pos = 0;
f->f_flags = O_RDONLY; f->f_flags = O_RDONLY;

View file

@ -64,13 +64,13 @@ loff_t remote_llseek(struct file *file, loff_t offset, int origin)
lock_kernel(); lock_kernel();
switch (origin) { switch (origin) {
case 2: case 2:
offset += i_size_read(file->f_dentry->d_inode); offset += i_size_read(file->f_path.dentry->d_inode);
break; break;
case 1: case 1:
offset += file->f_pos; offset += file->f_pos;
} }
retval = -EINVAL; retval = -EINVAL;
if (offset>=0 && offset<=file->f_dentry->d_inode->i_sb->s_maxbytes) { if (offset>=0 && offset<=file->f_path.dentry->d_inode->i_sb->s_maxbytes) {
if (offset != file->f_pos) { if (offset != file->f_pos) {
file->f_pos = offset; file->f_pos = offset;
file->f_version = 0; file->f_version = 0;
@ -95,7 +95,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
lock_kernel(); lock_kernel();
switch (origin) { switch (origin) {
case 2: case 2:
offset += i_size_read(file->f_dentry->d_inode); offset += i_size_read(file->f_path.dentry->d_inode);
break; break;
case 1: case 1:
offset += file->f_pos; offset += file->f_pos;
@ -203,7 +203,7 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count
if (unlikely((pos < 0) || (loff_t) (pos + count) < 0)) if (unlikely((pos < 0) || (loff_t) (pos + count) < 0))
goto Einval; goto Einval;
inode = file->f_dentry->d_inode; inode = file->f_path.dentry->d_inode;
if (unlikely(inode->i_flock && MANDATORY_LOCK(inode))) { if (unlikely(inode->i_flock && MANDATORY_LOCK(inode))) {
int retval = locks_mandatory_area( int retval = locks_mandatory_area(
read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE,
@ -273,7 +273,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
else else
ret = do_sync_read(file, buf, count, pos); ret = do_sync_read(file, buf, count, pos);
if (ret > 0) { if (ret > 0) {
fsnotify_access(file->f_dentry); fsnotify_access(file->f_path.dentry);
current->rchar += ret; current->rchar += ret;
} }
current->syscr++; current->syscr++;
@ -331,7 +331,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
else else
ret = do_sync_write(file, buf, count, pos); ret = do_sync_write(file, buf, count, pos);
if (ret > 0) { if (ret > 0) {
fsnotify_modify(file->f_dentry); fsnotify_modify(file->f_path.dentry);
current->wchar += ret; current->wchar += ret;
} }
current->syscw++; current->syscw++;
@ -628,9 +628,9 @@ out:
kfree(iov); kfree(iov);
if ((ret + (type == READ)) > 0) { if ((ret + (type == READ)) > 0) {
if (type == READ) if (type == READ)
fsnotify_access(file->f_dentry); fsnotify_access(file->f_path.dentry);
else else
fsnotify_modify(file->f_dentry); fsnotify_modify(file->f_path.dentry);
} }
return ret; return ret;
} }
@ -722,7 +722,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
if (!(in_file->f_mode & FMODE_READ)) if (!(in_file->f_mode & FMODE_READ))
goto fput_in; goto fput_in;
retval = -EINVAL; retval = -EINVAL;
in_inode = in_file->f_dentry->d_inode; in_inode = in_file->f_path.dentry->d_inode;
if (!in_inode) if (!in_inode)
goto fput_in; goto fput_in;
if (!in_file->f_op || !in_file->f_op->sendfile) if (!in_file->f_op || !in_file->f_op->sendfile)
@ -754,7 +754,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
retval = -EINVAL; retval = -EINVAL;
if (!out_file->f_op || !out_file->f_op->sendpage) if (!out_file->f_op || !out_file->f_op->sendpage)
goto fput_out; goto fput_out;
out_inode = out_file->f_dentry->d_inode; out_inode = out_file->f_path.dentry->d_inode;
retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count);
if (retval < 0) if (retval < 0)
goto fput_out; goto fput_out;

View file

@ -21,7 +21,7 @@
int vfs_readdir(struct file *file, filldir_t filler, void *buf) int vfs_readdir(struct file *file, filldir_t filler, void *buf)
{ {
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
int res = -ENOTDIR; int res = -ENOTDIR;
if (!file->f_op || !file->f_op->readdir) if (!file->f_op || !file->f_op->readdir)
goto out; goto out;

View file

@ -269,7 +269,7 @@ EXPORT_SYMBOL(seq_lseek);
/** /**
* seq_release - free the structures associated with sequential file. * seq_release - free the structures associated with sequential file.
* @file: file in question * @file: file in question
* @inode: file->f_dentry->d_inode * @inode: file->f_path.dentry->d_inode
* *
* Frees the structures associated with sequential file; can be used * Frees the structures associated with sequential file; can be used
* as ->f_op->release() if you don't have private data to destroy. * as ->f_op->release() if you don't have private data to destroy.

View file

@ -844,7 +844,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
ssize_t ret; ssize_t ret;
int err; int err;
err = remove_suid(out->f_dentry); err = remove_suid(out->f_path.dentry);
if (unlikely(err)) if (unlikely(err))
return err; return err;
@ -890,10 +890,10 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
ssize_t ret; ssize_t ret;
int err; int err;
err = should_remove_suid(out->f_dentry); err = should_remove_suid(out->f_path.dentry);
if (unlikely(err)) { if (unlikely(err)) {
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
err = __remove_suid(out->f_dentry, err); err = __remove_suid(out->f_path.dentry, err);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
if (err) if (err)
return err; return err;
@ -1008,7 +1008,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
* randomly drop data for eg socket -> socket splicing. Use the * randomly drop data for eg socket -> socket splicing. Use the
* piped splicing for that! * piped splicing for that!
*/ */
i_mode = in->f_dentry->d_inode->i_mode; i_mode = in->f_path.dentry->d_inode->i_mode;
if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode)))
return -EINVAL; return -EINVAL;
@ -1132,7 +1132,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
loff_t offset, *off; loff_t offset, *off;
long ret; long ret;
pipe = pipe_info(in->f_dentry->d_inode); pipe = pipe_info(in->f_path.dentry->d_inode);
if (pipe) { if (pipe) {
if (off_in) if (off_in)
return -ESPIPE; return -ESPIPE;
@ -1153,7 +1153,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
return ret; return ret;
} }
pipe = pipe_info(out->f_dentry->d_inode); pipe = pipe_info(out->f_path.dentry->d_inode);
if (pipe) { if (pipe) {
if (off_out) if (off_out)
return -ESPIPE; return -ESPIPE;
@ -1321,7 +1321,7 @@ static long do_vmsplice(struct file *file, const struct iovec __user *iov,
.ops = &user_page_pipe_buf_ops, .ops = &user_page_pipe_buf_ops,
}; };
pipe = pipe_info(file->f_dentry->d_inode); pipe = pipe_info(file->f_path.dentry->d_inode);
if (!pipe) if (!pipe)
return -EBADF; return -EBADF;
if (unlikely(nr_segs > UIO_MAXIOV)) if (unlikely(nr_segs > UIO_MAXIOV))
@ -1549,8 +1549,8 @@ static int link_pipe(struct pipe_inode_info *ipipe,
static long do_tee(struct file *in, struct file *out, size_t len, static long do_tee(struct file *in, struct file *out, size_t len,
unsigned int flags) unsigned int flags)
{ {
struct pipe_inode_info *ipipe = pipe_info(in->f_dentry->d_inode); struct pipe_inode_info *ipipe = pipe_info(in->f_path.dentry->d_inode);
struct pipe_inode_info *opipe = pipe_info(out->f_dentry->d_inode); struct pipe_inode_info *opipe = pipe_info(out->f_path.dentry->d_inode);
int ret = -EINVAL; int ret = -EINVAL;
/* /*

View file

@ -102,7 +102,7 @@ int vfs_fstat(unsigned int fd, struct kstat *stat)
int error = -EBADF; int error = -EBADF;
if (f) { if (f) {
error = vfs_getattr(f->f_vfsmnt, f->f_dentry, stat); error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat);
fput(f); fput(f);
} }
return error; return error;

View file

@ -570,7 +570,7 @@ static void mark_files_ro(struct super_block *sb)
file_list_lock(); file_list_lock();
list_for_each_entry(f, &sb->s_files, f_u.fu_list) { list_for_each_entry(f, &sb->s_files, f_u.fu_list) {
if (S_ISREG(f->f_dentry->d_inode->i_mode) && file_count(f)) if (S_ISREG(f->f_path.dentry->d_inode->i_mode) && file_count(f))
f->f_mode &= ~FMODE_WRITE; f->f_mode &= ~FMODE_WRITE;
} }
file_list_unlock(); file_list_unlock();

View file

@ -94,7 +94,7 @@ long do_fsync(struct file *file, int datasync)
* livelocks in fsync_buffers_list(). * livelocks in fsync_buffers_list().
*/ */
mutex_lock(&mapping->host->i_mutex); mutex_lock(&mapping->host->i_mutex);
err = file->f_op->fsync(file, file->f_dentry, datasync); err = file->f_op->fsync(file, file->f_path.dentry, datasync);
if (!ret) if (!ret)
ret = err; ret = err;
mutex_unlock(&mapping->host->i_mutex); mutex_unlock(&mapping->host->i_mutex);
@ -223,7 +223,7 @@ asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
if (!file) if (!file)
goto out; goto out;
i_mode = file->f_dentry->d_inode->i_mode; i_mode = file->f_path.dentry->d_inode->i_mode;
ret = -ESPIPE; ret = -ESPIPE;
if (!S_ISREG(i_mode) && !S_ISBLK(i_mode) && !S_ISDIR(i_mode) && if (!S_ISREG(i_mode) && !S_ISBLK(i_mode) && !S_ISDIR(i_mode) &&
!S_ISLNK(i_mode)) !S_ISLNK(i_mode))

View file

@ -268,7 +268,7 @@ sys_fsetxattr(int fd, char __user *name, void __user *value,
f = fget(fd); f = fget(fd);
if (!f) if (!f)
return error; return error;
dentry = f->f_dentry; dentry = f->f_path.dentry;
audit_inode(NULL, dentry->d_inode); audit_inode(NULL, dentry->d_inode);
error = setxattr(dentry, name, value, size, flags); error = setxattr(dentry, name, value, size, flags);
fput(f); fput(f);
@ -351,7 +351,7 @@ sys_fgetxattr(int fd, char __user *name, void __user *value, size_t size)
f = fget(fd); f = fget(fd);
if (!f) if (!f)
return error; return error;
error = getxattr(f->f_dentry, name, value, size); error = getxattr(f->f_path.dentry, name, value, size);
fput(f); fput(f);
return error; return error;
} }
@ -423,7 +423,7 @@ sys_flistxattr(int fd, char __user *list, size_t size)
f = fget(fd); f = fget(fd);
if (!f) if (!f)
return error; return error;
error = listxattr(f->f_dentry, list, size); error = listxattr(f->f_path.dentry, list, size);
fput(f); fput(f);
return error; return error;
} }
@ -484,7 +484,7 @@ sys_fremovexattr(int fd, char __user *name)
f = fget(fd); f = fget(fd);
if (!f) if (!f)
return error; return error;
dentry = f->f_dentry; dentry = f->f_path.dentry;
audit_inode(NULL, dentry->d_inode); audit_inode(NULL, dentry->d_inode);
error = removexattr(dentry, name); error = removexattr(dentry, name);
fput(f); fput(f);

View file

@ -269,6 +269,7 @@ extern int dir_notify_enable;
#include <linux/types.h> #include <linux/types.h>
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <linux/dcache.h> #include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/kobject.h> #include <linux/kobject.h>
@ -711,8 +712,9 @@ struct file {
struct list_head fu_list; struct list_head fu_list;
struct rcu_head fu_rcuhead; struct rcu_head fu_rcuhead;
} f_u; } f_u;
struct dentry *f_dentry; struct path f_path;
struct vfsmount *f_vfsmnt; #define f_dentry f_path.dentry
#define f_vfsmnt f_path.mnt
const struct file_operations *f_op; const struct file_operations *f_op;
atomic_t f_count; atomic_t f_count;
unsigned int f_flags; unsigned int f_flags;
@ -1224,7 +1226,7 @@ extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
static inline void file_accessed(struct file *file) static inline void file_accessed(struct file *file)
{ {
if (!(file->f_flags & O_NOATIME)) if (!(file->f_flags & O_NOATIME))
touch_atime(file->f_vfsmnt, file->f_dentry); touch_atime(file->f_path.mnt, file->f_path.dentry);
} }
int sync_inode(struct inode *inode, struct writeback_control *wbc); int sync_inode(struct inode *inode, struct writeback_control *wbc);
@ -1615,7 +1617,7 @@ static inline void put_write_access(struct inode * inode)
static inline void allow_write_access(struct file *file) static inline void allow_write_access(struct file *file)
{ {
if (file) if (file)
atomic_inc(&file->f_dentry->d_inode->i_writecount); atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
} }
extern int do_pipe(int *); extern int do_pipe(int *);
extern struct file *create_read_pipe(struct file *f); extern struct file *create_read_pipe(struct file *f);

View file

@ -164,7 +164,7 @@ static inline void fsnotify_open(struct dentry *dentry)
*/ */
static inline void fsnotify_close(struct file *file) static inline void fsnotify_close(struct file *file)
{ {
struct dentry *dentry = file->f_dentry; struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
const char *name = dentry->d_name.name; const char *name = dentry->d_name.name;
mode_t mode = file->f_mode; mode_t mode = file->f_mode;