diff options
author | Jan Blunck <jblunck@suse.de> | 2008-02-14 22:34:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-15 00:13:33 -0500 |
commit | 4ac9137858e08a19f29feac4e1f4df7c268b0ba5 (patch) | |
tree | f5b5d84fd12fcc2b0ba0e7ce1a79ff381ad8f5dd /arch | |
parent | c5e725f33b733a77de622e91b6ba5645fcf070be (diff) |
Embed a struct path into struct nameidata instead of nd->{dentry,mnt}
This is the central patch of a cleanup series. In most cases there is no good
reason why someone would want to use a dentry for itself. This series reflects
that fact and embeds a struct path into nameidata.
Together with the other patches of this series
- it enforced the correct order of getting/releasing the reference count on
<dentry,vfsmount> pairs
- it prepares the VFS for stacking support since it is essential to have a
struct path in every place where the stack can be traversed
- it reduces the overall code size:
without patch series:
text data bss dec hex filename
5321639 858418 715768 6895825 6938d1 vmlinux
with patch series:
text data bss dec hex filename
5320026 858418 715768 6894212 693284 vmlinux
This patch:
Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix cifs]
[akpm@linux-foundation.org: fix smack]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/osf_sys.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/sysirix.c | 6 | ||||
-rw-r--r-- | arch/parisc/hpux/sys_hpux.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/inode.c | 18 | ||||
-rw-r--r-- | arch/sparc64/solaris/fs.c | 8 | ||||
-rw-r--r-- | arch/um/drivers/mconsole_kern.c | 6 |
6 files changed, 22 insertions, 20 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 973c5c3705e3..f2bef5e14faa 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -259,7 +259,7 @@ osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bu | |||
259 | 259 | ||
260 | retval = user_path_walk(path, &nd); | 260 | retval = user_path_walk(path, &nd); |
261 | if (!retval) { | 261 | if (!retval) { |
262 | retval = do_osf_statfs(nd.dentry, buffer, bufsiz); | 262 | retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz); |
263 | path_release(&nd); | 263 | path_release(&nd); |
264 | } | 264 | } |
265 | return retval; | 265 | return retval; |
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index d70c4e0e85fb..49d6292ffa05 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c | |||
@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __user *path, | |||
694 | if (error) | 694 | if (error) |
695 | goto out; | 695 | goto out; |
696 | 696 | ||
697 | error = vfs_statfs(nd.dentry, &kbuf); | 697 | error = vfs_statfs(nd.path.dentry, &kbuf); |
698 | if (error) | 698 | if (error) |
699 | goto dput_and_out; | 699 | goto dput_and_out; |
700 | 700 | ||
@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf) | |||
1360 | error = user_path_walk(fname, &nd); | 1360 | error = user_path_walk(fname, &nd); |
1361 | if (error) | 1361 | if (error) |
1362 | goto out; | 1362 | goto out; |
1363 | error = vfs_statfs(nd.dentry, &kbuf); | 1363 | error = vfs_statfs(nd.path.dentry, &kbuf); |
1364 | if (error) | 1364 | if (error) |
1365 | goto dput_and_out; | 1365 | goto dput_and_out; |
1366 | 1366 | ||
@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user * | |||
1611 | error = user_path_walk(fname, &nd); | 1611 | error = user_path_walk(fname, &nd); |
1612 | if (error) | 1612 | if (error) |
1613 | goto out; | 1613 | goto out; |
1614 | error = vfs_statfs(nd.dentry, &kbuf); | 1614 | error = vfs_statfs(nd.path.dentry, &kbuf); |
1615 | if (error) | 1615 | if (error) |
1616 | goto dput_and_out; | 1616 | goto dput_and_out; |
1617 | 1617 | ||
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index 3e025df2dc86..d7395af3e846 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c | |||
@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *path, | |||
219 | error = user_path_walk(path, &nd); | 219 | error = user_path_walk(path, &nd); |
220 | if (!error) { | 220 | if (!error) { |
221 | struct hpux_statfs tmp; | 221 | struct hpux_statfs tmp; |
222 | error = vfs_statfs_hpux(nd.dentry, &tmp); | 222 | error = vfs_statfs_hpux(nd.path.dentry, &tmp); |
223 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 223 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
224 | error = -EFAULT; | 224 | error = -EFAULT; |
225 | path_release(&nd); | 225 | path_release(&nd); |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index e6e6559c55ed..6d1228c66c5e 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | * SPU file system | 3 | * SPU file system |
3 | * | 4 | * |
@@ -592,7 +593,7 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode, | |||
592 | 593 | ||
593 | ret = -EINVAL; | 594 | ret = -EINVAL; |
594 | /* check if we are on spufs */ | 595 | /* check if we are on spufs */ |
595 | if (nd->dentry->d_sb->s_type != &spufs_type) | 596 | if (nd->path.dentry->d_sb->s_type != &spufs_type) |
596 | goto out; | 597 | goto out; |
597 | 598 | ||
598 | /* don't accept undefined flags */ | 599 | /* don't accept undefined flags */ |
@@ -600,9 +601,9 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode, | |||
600 | goto out; | 601 | goto out; |
601 | 602 | ||
602 | /* only threads can be underneath a gang */ | 603 | /* only threads can be underneath a gang */ |
603 | if (nd->dentry != nd->dentry->d_sb->s_root) { | 604 | if (nd->path.dentry != nd->path.dentry->d_sb->s_root) { |
604 | if ((flags & SPU_CREATE_GANG) || | 605 | if ((flags & SPU_CREATE_GANG) || |
605 | !SPUFS_I(nd->dentry->d_inode)->i_gang) | 606 | !SPUFS_I(nd->path.dentry->d_inode)->i_gang) |
606 | goto out; | 607 | goto out; |
607 | } | 608 | } |
608 | 609 | ||
@@ -618,16 +619,17 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode, | |||
618 | mode &= ~current->fs->umask; | 619 | mode &= ~current->fs->umask; |
619 | 620 | ||
620 | if (flags & SPU_CREATE_GANG) | 621 | if (flags & SPU_CREATE_GANG) |
621 | return spufs_create_gang(nd->dentry->d_inode, | 622 | return spufs_create_gang(nd->path.dentry->d_inode, |
622 | dentry, nd->mnt, mode); | 623 | dentry, nd->path.mnt, mode); |
623 | else | 624 | else |
624 | return spufs_create_context(nd->dentry->d_inode, | 625 | return spufs_create_context(nd->path.dentry->d_inode, |
625 | dentry, nd->mnt, flags, mode, filp); | 626 | dentry, nd->path.mnt, flags, mode, |
627 | filp); | ||
626 | 628 | ||
627 | out_dput: | 629 | out_dput: |
628 | dput(dentry); | 630 | dput(dentry); |
629 | out_dir: | 631 | out_dir: |
630 | mutex_unlock(&nd->dentry->d_inode->i_mutex); | 632 | mutex_unlock(&nd->path.dentry->d_inode->i_mutex); |
631 | out: | 633 | out: |
632 | return ret; | 634 | return ret; |
633 | } | 635 | } |
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c index 9311bfe4f2f7..516932e9f70b 100644 --- a/arch/sparc64/solaris/fs.c +++ b/arch/sparc64/solaris/fs.c | |||
@@ -434,8 +434,8 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf) | |||
434 | 434 | ||
435 | error = user_path_walk(A(path),&nd); | 435 | error = user_path_walk(A(path),&nd); |
436 | if (!error) { | 436 | if (!error) { |
437 | struct inode * inode = nd.dentry->d_inode; | 437 | struct inode *inode = nd.path.dentry->d_inode; |
438 | error = report_statvfs(nd.mnt, inode, buf); | 438 | error = report_statvfs(nd.path.mnt, inode, buf); |
439 | path_release(&nd); | 439 | path_release(&nd); |
440 | } | 440 | } |
441 | return error; | 441 | return error; |
@@ -464,8 +464,8 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf) | |||
464 | lock_kernel(); | 464 | lock_kernel(); |
465 | error = user_path_walk(A(path), &nd); | 465 | error = user_path_walk(A(path), &nd); |
466 | if (!error) { | 466 | if (!error) { |
467 | struct inode * inode = nd.dentry->d_inode; | 467 | struct inode *inode = nd.path.dentry->d_inode; |
468 | error = report_statvfs64(nd.mnt, inode, buf); | 468 | error = report_statvfs64(nd.path.mnt, inode, buf); |
469 | path_release(&nd); | 469 | path_release(&nd); |
470 | } | 470 | } |
471 | unlock_kernel(); | 471 | unlock_kernel(); |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index ebb265c07e4d..19d579d74d27 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -145,8 +145,8 @@ void mconsole_proc(struct mc_request *req) | |||
145 | } | 145 | } |
146 | up_write(&super->s_umount); | 146 | up_write(&super->s_umount); |
147 | 147 | ||
148 | nd.dentry = super->s_root; | 148 | nd.path.dentry = super->s_root; |
149 | nd.mnt = NULL; | 149 | nd.path.mnt = NULL; |
150 | nd.flags = O_RDONLY + 1; | 150 | nd.flags = O_RDONLY + 1; |
151 | nd.last_type = LAST_ROOT; | 151 | nd.last_type = LAST_ROOT; |
152 | 152 | ||
@@ -159,7 +159,7 @@ void mconsole_proc(struct mc_request *req) | |||
159 | goto out_kill; | 159 | goto out_kill; |
160 | } | 160 | } |
161 | 161 | ||
162 | file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); | 162 | file = dentry_open(nd.path.dentry, nd.path.mnt, O_RDONLY); |
163 | if (IS_ERR(file)) { | 163 | if (IS_ERR(file)) { |
164 | mconsole_reply(req, "Failed to open file", 1, 0); | 164 | mconsole_reply(req, "Failed to open file", 1, 0); |
165 | goto out_kill; | 165 | goto out_kill; |