Pass credentials through the statfs() superblock operation.

Signed-off-by: David Howells <[EMAIL PROTECTED]>
---

 fs/afs/super.c     |    6 ++++--
 fs/ext3/super.c    |    6 ++++--
 fs/fat/inode.c     |    3 ++-
 fs/libfs.c         |    2 +-
 fs/nfs/super.c     |    6 +++---
 fs/open.c          |    3 ++-
 include/linux/fs.h |    4 ++--
 mm/shmem.c         |    3 ++-
 8 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/fs/afs/super.c b/fs/afs/super.c
index 82ccd94..c7d7c1c 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -35,7 +35,8 @@ static int afs_get_sb(struct file_system_type *fs_type,
 static struct inode *afs_alloc_inode(struct super_block *sb);
 static void afs_put_super(struct super_block *sb);
 static void afs_destroy_inode(struct inode *inode);
-static int afs_statfs(struct dentry *dentry, struct kstatfs *buf);
+static int afs_statfs(struct dentry *dentry, struct kstatfs *buf,
+                     struct cred *cred);
 
 struct file_system_type afs_fs_type = {
        .owner          = THIS_MODULE,
@@ -511,7 +512,8 @@ static void afs_destroy_inode(struct inode *inode)
 /*
  * return information about an AFS volume
  */
-static int afs_statfs(struct dentry *dentry, struct kstatfs *buf)
+static int afs_statfs(struct dentry *dentry, struct kstatfs *buf,
+                     struct cred *cred)
 {
        struct afs_volume_status vs;
        struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 348bb6b..29a41cc 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -59,7 +59,8 @@ static int ext3_sync_fs(struct super_block *sb, int wait);
 static const char *ext3_decode_error(struct super_block * sb, int errno,
                                     char nbuf[16]);
 static int ext3_remount (struct super_block * sb, int * flags, char * data);
-static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf);
+static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf,
+                       struct cred *cred);
 static void ext3_unlockfs(struct super_block *sb);
 static void ext3_write_super (struct super_block * sb);
 static void ext3_write_super_lockfs(struct super_block *sb);
@@ -2429,7 +2430,8 @@ restore_opts:
        return err;
 }
 
-static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
+static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf,
+                       struct cred *cred)
 {
        struct super_block *sb = dentry->d_sb;
        struct ext3_sb_info *sbi = EXT3_SB(sb);
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 519e1b4..a224325 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -537,7 +537,8 @@ static int fat_remount(struct super_block *sb, int *flags, 
char *data)
        return 0;
 }
 
-static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
+static int fat_statfs(struct dentry *dentry, struct kstatfs *buf,
+                     struct cred *cred)
 {
        struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
 
diff --git a/fs/libfs.c b/fs/libfs.c
index 107412e..e214329 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -20,7 +20,7 @@ int simple_getattr(struct vfsmount *mnt, struct dentry 
*dentry,
        return 0;
 }
 
-int simple_statfs(struct dentry *dentry, struct kstatfs *buf)
+int simple_statfs(struct dentry *dentry, struct kstatfs *buf, struct cred 
*cred)
 {
        buf->f_type = dentry->d_sb->s_magic;
        buf->f_bsize = PAGE_CACHE_SIZE;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 44e2583..524e8a1 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -220,7 +220,7 @@ static match_table_t nfs_secflavor_tokens = {
 
 
 static void nfs_umount_begin(struct vfsmount *, int);
-static int  nfs_statfs(struct dentry *, struct kstatfs *);
+static int  nfs_statfs(struct dentry *, struct kstatfs *, struct cred *);
 static int  nfs_show_options(struct seq_file *, struct vfsmount *);
 static int  nfs_show_stats(struct seq_file *, struct vfsmount *);
 static int nfs_get_sb(struct file_system_type *, int, const char *, void *,
@@ -358,9 +358,9 @@ void __exit unregister_nfs_fs(void)
 /*
  * Deliver file system statistics to userspace
  */
-static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
+static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf,
+                     struct cred *acred)
 {
-       struct cred *acred = current->cred;
        struct nfs_server *server = NFS_SB(dentry->d_sb);
        unsigned char blockbits;
        unsigned long blockres;
diff --git a/fs/open.c b/fs/open.c
index c383efe..291f875 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -30,6 +30,7 @@
 
 int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
+       struct cred *cred = current->cred;
        int retval = -ENODEV;
 
        if (dentry) {
@@ -39,7 +40,7 @@ int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
                        retval = security_sb_statfs(dentry);
                        if (retval)
                                return retval;
-                       retval = dentry->d_sb->s_op->statfs(dentry, buf);
+                       retval = dentry->d_sb->s_op->statfs(dentry, buf, cred);
                        if (retval == 0 && buf->f_frsize == 0)
                                buf->f_frsize = buf->f_bsize;
                }
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 658bdc8..2fec09a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1199,7 +1199,7 @@ struct super_operations {
        int (*sync_fs)(struct super_block *sb, int wait);
        void (*write_super_lockfs) (struct super_block *);
        void (*unlockfs) (struct super_block *);
-       int (*statfs) (struct dentry *, struct kstatfs *);
+       int (*statfs) (struct dentry *, struct kstatfs *, struct cred *);
        int (*remount_fs) (struct super_block *, int *, char *);
        void (*clear_inode) (struct inode *);
        void (*umount_begin) (struct vfsmount *, int);
@@ -1801,7 +1801,7 @@ extern int dcache_dir_close(struct inode *, struct file 
*);
 extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
 extern int dcache_readdir(struct file *, void *, filldir_t);
 extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
-extern int simple_statfs(struct dentry *, struct kstatfs *);
+extern int simple_statfs(struct dentry *, struct kstatfs *, struct cred *);
 extern int simple_link(struct dentry *, struct inode *, struct dentry *,
                       struct cred *);
 extern int simple_unlink(struct inode *, struct dentry *, struct cred *);
diff --git a/mm/shmem.c b/mm/shmem.c
index 4bcfdb8..432f023 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1682,7 +1682,8 @@ static ssize_t shmem_file_read(struct file *filp, char 
__user *buf, size_t count
        return desc.error;
 }
 
-static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
+static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf,
+                       struct cred *cred)
 {
        struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to