summaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-03-13 20:55:15 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-03-13 20:55:15 +0000
commit1471f525455788c20b130690e0f104df451aeb43 (patch)
tree3778beba56558beb9a9548ea5b467e9c44ea966f /fs/open.c
parente80d2c5456d30ebba5b0eb8a9d33e17d815d4d83 (diff)
Merge with Linux 2.3.51.
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/open.c b/fs/open.c
index e7b119df7..6b11f4ab0 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -4,6 +4,7 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*/
+#include <linux/string.h>
#include <linux/mm.h>
#include <linux/utime.h>
#include <linux/file.h>
@@ -21,13 +22,10 @@ asmlinkage long sys_statfs(const char * path, struct statfs * buf)
dentry = namei(path);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
- struct inode * inode = dentry->d_inode;
- struct super_block * sb = inode->i_sb;
-
- error = -ENODEV;
- if (sb && sb->s_op && sb->s_op->statfs)
- error = sb->s_op->statfs(sb, buf, sizeof(struct statfs));
-
+ struct statfs tmp;
+ error = vfs_statfs(dentry->d_inode->i_sb, &tmp);
+ if (!error && copy_to_user(buf, &tmp, sizeof(struct statfs)))
+ error = -EFAULT;
dput(dentry);
}
unlock_kernel();
@@ -37,18 +35,17 @@ asmlinkage long sys_statfs(const char * path, struct statfs * buf)
asmlinkage long sys_fstatfs(unsigned int fd, struct statfs * buf)
{
struct file * file;
- struct super_block * sb;
+ struct statfs tmp;
int error;
error = -EBADF;
file = fget(fd);
if (!file)
goto out;
- error = -ENODEV;
- sb = file->f_dentry->d_inode->i_sb;
lock_kernel();
- if (sb && sb->s_op && sb->s_op->statfs)
- error = sb->s_op->statfs(sb, buf, sizeof(struct statfs));
+ error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
+ if (!error && copy_to_user(buf, &tmp, sizeof(struct statfs)))
+ error = -EFAULT;
unlock_kernel();
fput(file);
out: