patch-1.3.16 linux/fs/super.c

Next file: linux/fs/sysv/dir.c
Previous file: linux/fs/smbfs/proc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.15/linux/fs/super.c linux/fs/super.c
@@ -254,6 +254,38 @@
 		sb->s_op->put_super(sb);
 }
 
+asmlinkage int sys_ustat(dev_t dev, struct ustat * ubuf)
+{
+        struct super_block *s;
+        struct ustat tmp;
+        struct statfs sbuf;
+        unsigned long old_fs;
+        int error;
+
+        s = get_super(dev);
+        if (s == NULL)
+                return -EINVAL;
+
+        if (!(s->s_op->statfs))
+                return -ENOSYS;
+
+        error = verify_area(VERIFY_WRITE,ubuf,sizeof(struct ustat));
+        if (error)
+                return error;
+
+        old_fs = get_fs();
+        set_fs(get_ds());
+        s->s_op->statfs(s,&sbuf,sizeof(struct statfs));
+        set_fs(old_fs);
+
+        memset(&tmp,0,sizeof(struct ustat));
+        tmp.f_tfree = sbuf.f_bfree;
+        tmp.f_tinode = sbuf.f_ffree;
+
+        memcpy_tofs(ubuf,&tmp,sizeof(struct ustat));
+        return 0;
+}
+
 static struct super_block * read_super(dev_t dev,const char *name,int flags,
 				       void *data, int silent)
 {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this