patch-2.1.16 linux/fs/ufs/ufs_super.c
Next file: linux/fs/ufs/ufs_symlink.c
Previous file: linux/fs/super.c
Back to the patch index
Back to the overall index
- Lines: 68
- Date:
Fri Dec 13 11:37:39 1996
- Orig file:
v2.1.15/linux/fs/ufs/ufs_super.c
- Orig date:
Tue Oct 29 19:58:45 1996
diff -u --recursive --new-file v2.1.15/linux/fs/ufs/ufs_super.c linux/fs/ufs/ufs_super.c
@@ -6,7 +6,9 @@
* Laboratory for Computer Science Research Computing Facility
* Rutgers, The State University of New Jersey
*
- * $Id: ufs_super.c,v 1.17 1996/09/03 07:15:53 ecd Exp $
+ * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
+ *
+ * $Id: ufs_super.c,v 1.20 1996/11/02 18:10:12 ecd Exp $
*
*/
@@ -158,7 +160,7 @@
ufs_need_swab = 1;
sb->s_magic = ufs_swab32(usb->fs_magic);
if (sb->s_magic != UFS_MAGIC) {
- printk ("ufs_read_super: bad magic number 0x%8.8x "
+ printk ("ufs_read_super: bad magic number 0x%8.8lx "
"on dev %d/%d\n", sb->s_magic,
MAJOR(sb->s_dev), MINOR(sb->s_dev));
@@ -291,23 +293,36 @@
void ufs_statfs(struct super_block * sb, struct statfs * buf, int bufsiz)
{
struct statfs tmp;
+ struct statfs *sp = &tmp;
+ struct ufs_superblock *fsb = sb->u.ufs_sb.s_raw_sb;
+ unsigned long used, avail;
if (sb->u.ufs_sb.s_flags & UFS_DEBUG) {
printk("ufs_statfs\n"); /* XXX */
}
- tmp.f_type = sb->s_magic;
- tmp.f_bsize = sb->s_blocksize;
- tmp.f_blocks = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_dsize);
- tmp.f_bfree = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nbfree);
- tmp.f_bavail = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nbfree);
- tmp.f_files = sb->u.ufs_sb.s_ncg * sb->u.ufs_sb.s_ipg;
- tmp.f_ffree = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nifree);
- tmp.f_fsid.val[0] = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_id[0]);
- tmp.f_fsid.val[1] = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_id[1]);
- tmp.f_namelen = UFS_MAXNAMLEN;
+ sp->f_type = sb->s_magic;
+ sp->f_bsize = sb->s_blocksize;
+ sp->f_blocks = ufs_swab32(fsb->fs_dsize);
+ sp->f_bfree = ufs_swab32(fsb->fs_cstotal.cs_nbfree) *
+ ufs_swab32(fsb->fs_frag) +
+ ufs_swab32(fsb->fs_cstotal.cs_nffree);
+
+ avail = sp->f_blocks - (sp->f_blocks / 100) *
+ ufs_swab32(fsb->fs_minfree);
+ used = sp->f_blocks - sp->f_bfree;
+ if (avail > used)
+ sp->f_bavail = avail - used;
+ else
+ sp->f_bavail = 0;
+
+ sp->f_files = sb->u.ufs_sb.s_ncg * sb->u.ufs_sb.s_ipg;
+ sp->f_ffree = ufs_swab32(fsb->fs_cstotal.cs_nifree);
+ sp->f_fsid.val[0] = ufs_swab32(fsb->fs_id[0]);
+ sp->f_fsid.val[1] = ufs_swab32(fsb->fs_id[1]);
+ sp->f_namelen = UFS_MAXNAMLEN;
- copy_to_user(buf, &tmp, bufsiz);
+ copy_to_user(buf, sp, bufsiz);
return;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov