diff options
author | David Howells <dhowells@redhat.com> | 2006-06-23 05:02:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:42:45 -0400 |
commit | 726c334223180e3c0197cc980a432681370d4baf (patch) | |
tree | 8327b354bb3dc959a6606051ae6f8d4d035e38a2 /fs/open.c | |
parent | 454e2398be9b9fa30433fccc548db34d19aa9958 (diff) |
[PATCH] VFS: Permit filesystem to perform statfs with a known root dentry
Give the statfs superblock operation a dentry pointer rather than a superblock
pointer.
This complements the get_sb() patch. That reduced the significance of
sb->s_root, allowing NFS to place a fake root there. However, NFS does
require a dentry to use as a target for the statfs operation. This permits
the root in the vfsmount to be used instead.
linux/mount.h has been added where necessary to make allyesconfig build
successfully.
Interest has also been expressed for use with the FUSE and XFS filesystems.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nathan Scott <nathans@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -31,18 +31,18 @@ | |||
31 | 31 | ||
32 | #include <asm/unistd.h> | 32 | #include <asm/unistd.h> |
33 | 33 | ||
34 | int vfs_statfs(struct super_block *sb, struct kstatfs *buf) | 34 | int vfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
35 | { | 35 | { |
36 | int retval = -ENODEV; | 36 | int retval = -ENODEV; |
37 | 37 | ||
38 | if (sb) { | 38 | if (dentry) { |
39 | retval = -ENOSYS; | 39 | retval = -ENOSYS; |
40 | if (sb->s_op->statfs) { | 40 | if (dentry->d_sb->s_op->statfs) { |
41 | memset(buf, 0, sizeof(*buf)); | 41 | memset(buf, 0, sizeof(*buf)); |
42 | retval = security_sb_statfs(sb); | 42 | retval = security_sb_statfs(dentry); |
43 | if (retval) | 43 | if (retval) |
44 | return retval; | 44 | return retval; |
45 | retval = sb->s_op->statfs(sb, buf); | 45 | retval = dentry->d_sb->s_op->statfs(dentry, buf); |
46 | if (retval == 0 && buf->f_frsize == 0) | 46 | if (retval == 0 && buf->f_frsize == 0) |
47 | buf->f_frsize = buf->f_bsize; | 47 | buf->f_frsize = buf->f_bsize; |
48 | } | 48 | } |
@@ -52,12 +52,12 @@ int vfs_statfs(struct super_block *sb, struct kstatfs *buf) | |||
52 | 52 | ||
53 | EXPORT_SYMBOL(vfs_statfs); | 53 | EXPORT_SYMBOL(vfs_statfs); |
54 | 54 | ||
55 | static int vfs_statfs_native(struct super_block *sb, struct statfs *buf) | 55 | static int vfs_statfs_native(struct dentry *dentry, struct statfs *buf) |
56 | { | 56 | { |
57 | struct kstatfs st; | 57 | struct kstatfs st; |
58 | int retval; | 58 | int retval; |
59 | 59 | ||
60 | retval = vfs_statfs(sb, &st); | 60 | retval = vfs_statfs(dentry, &st); |
61 | if (retval) | 61 | if (retval) |
62 | return retval; | 62 | return retval; |
63 | 63 | ||
@@ -95,12 +95,12 @@ static int vfs_statfs_native(struct super_block *sb, struct statfs *buf) | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | static int vfs_statfs64(struct super_block *sb, struct statfs64 *buf) | 98 | static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf) |
99 | { | 99 | { |
100 | struct kstatfs st; | 100 | struct kstatfs st; |
101 | int retval; | 101 | int retval; |
102 | 102 | ||
103 | retval = vfs_statfs(sb, &st); | 103 | retval = vfs_statfs(dentry, &st); |
104 | if (retval) | 104 | if (retval) |
105 | return retval; | 105 | return retval; |
106 | 106 | ||
@@ -130,7 +130,7 @@ asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf) | |||
130 | error = user_path_walk(path, &nd); | 130 | error = user_path_walk(path, &nd); |
131 | if (!error) { | 131 | if (!error) { |
132 | struct statfs tmp; | 132 | struct statfs tmp; |
133 | error = vfs_statfs_native(nd.dentry->d_inode->i_sb, &tmp); | 133 | error = vfs_statfs_native(nd.dentry, &tmp); |
134 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 134 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
135 | error = -EFAULT; | 135 | error = -EFAULT; |
136 | path_release(&nd); | 136 | path_release(&nd); |
@@ -149,7 +149,7 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64 | |||
149 | error = user_path_walk(path, &nd); | 149 | error = user_path_walk(path, &nd); |
150 | if (!error) { | 150 | if (!error) { |
151 | struct statfs64 tmp; | 151 | struct statfs64 tmp; |
152 | error = vfs_statfs64(nd.dentry->d_inode->i_sb, &tmp); | 152 | error = vfs_statfs64(nd.dentry, &tmp); |
153 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 153 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
154 | error = -EFAULT; | 154 | error = -EFAULT; |
155 | path_release(&nd); | 155 | path_release(&nd); |
@@ -168,7 +168,7 @@ asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf) | |||
168 | file = fget(fd); | 168 | file = fget(fd); |
169 | if (!file) | 169 | if (!file) |
170 | goto out; | 170 | goto out; |
171 | error = vfs_statfs_native(file->f_dentry->d_inode->i_sb, &tmp); | 171 | error = vfs_statfs_native(file->f_dentry, &tmp); |
172 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 172 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
173 | error = -EFAULT; | 173 | error = -EFAULT; |
174 | fput(file); | 174 | fput(file); |
@@ -189,7 +189,7 @@ asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user | |||
189 | file = fget(fd); | 189 | file = fget(fd); |
190 | if (!file) | 190 | if (!file) |
191 | goto out; | 191 | goto out; |
192 | error = vfs_statfs64(file->f_dentry->d_inode->i_sb, &tmp); | 192 | error = vfs_statfs64(file->f_dentry, &tmp); |
193 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 193 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
194 | error = -EFAULT; | 194 | error = -EFAULT; |
195 | fput(file); | 195 | fput(file); |