Subject: Minor correction to statfs(2) (#287) Index: sys/ufs_syscalls2.c 2.11BSD Description: 'df' shows too much space in use. 'statfs(2)' on a filesystem with quotas enabled was not returning the quota enabled bit (MNT_QUOTA) in the mount flags. Repeat-By: Have an empty file system. Do a 'df' (with the version of 'df' supplied in updates #283-286). Notice that the space used is not 0. Fix: The 'statfs' syscall was not subtracting out the blocks allocated to the inodes in the filesystem. Also a couple of items which will be needed in the near future were left out of mount.h. In quota_kern.c setting/clearning the MNT_QUOTA bit in the mount flags was overlooked. To install the update, cut where indicated and save to a file (/tmp/287). Then: patch -p0 < /tmp/287 cd /sys/YOUR_KERNEL make make install fastboot And with that it's time to take the rest of the year off. Updates are available via anonymous FTP to the system FTP.IIPO.GTEGSC.COM in the directory /pub/2.11BSD. Happy New Year everyone! ----------------------------cut here--------------------- *** /usr/src/sys/sys/ufs_syscalls2.c.old Sun Dec 24 15:37:23 1995 --- /usr/src/sys/sys/ufs_syscalls2.c Fri Dec 29 19:36:27 1995 *************** *** 1,5 **** /* ! * @(#) ufs_syscalls2.c (2.11BSD) 1995/12/24 * * ufs_syscalls was getting too large. New UFS related system calls are * placed in this file. --- 1,5 ---- /* ! * @(#) ufs_syscalls2.c 1.1 (2.11BSD) 1995/12/29 * * ufs_syscalls was getting too large. New UFS related system calls are * placed in this file. *************** *** 67,73 **** sfsp->f_type = MOUNT_UFS; sfsp->f_bsize = MAXBSIZE; sfsp->f_iosize = MAXBSIZE; ! sfsp->f_blocks = fs->fs_fsize; sfsp->f_bfree = fs->fs_tfree; sfsp->f_bavail = fs->fs_tfree; sfsp->f_files = (fs->fs_isize - 2) * INOPB; --- 67,73 ---- sfsp->f_type = MOUNT_UFS; sfsp->f_bsize = MAXBSIZE; sfsp->f_iosize = MAXBSIZE; ! sfsp->f_blocks = fs->fs_fsize - fs->fs_isize; sfsp->f_bfree = fs->fs_tfree; sfsp->f_bavail = fs->fs_tfree; sfsp->f_files = (fs->fs_isize - 2) * INOPB; *** /usr/src/sys/sys/quota_kern.c.old Sat Nov 26 23:20:31 1994 --- /usr/src/sys/sys/quota_kern.c Fri Dec 29 20:05:23 1995 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)quota_kern.c 7.1.2 (2.11BSD GTE) 11/26/94 * * I'll say it here and not every other place i've had to hack: * Mike Karels was right - " just buy a vax...". i have traded cpu cycles --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)quota_kern.c 7.1.3 (2.11BSD GTE) 1995/12/29 * * I'll say it here and not every other place i've had to hack: * Mike Karels was right - " just buy a vax...". i have traded cpu cycles *************** *** 726,731 **** --- 726,732 ---- * quota file for this file system. */ mp->m_qinod = ip; + mp->m_flags |= MNT_QUOTA; i = mp - mount; for (q = quota; q < quotaNQUOTA; q++) if ((q->q_flags & Q_NDQ) == 0) { *************** *** 805,809 **** --- 806,811 ---- irele(mp->m_qinod); QUOTAMAP(); mp->m_qinod = NULL; + mp->m_flags &= ~MNT_QUOTA; } #endif *** /usr/src/sys/h/mount.h.old Tue Dec 26 17:36:48 1995 --- /usr/src/sys/h/mount.h Fri Dec 29 20:10:20 1995 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)mount.h 7.2.2 (2.11BSD GTE) 1995/12/24 */ /* --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)mount.h 7.2.3 (2.11BSD GTE) 1995/12/29 */ /* *************** *** 35,41 **** --- 35,48 ---- */ #define MOUNT_NONE 0 #define MOUNT_UFS 1 /* Fast Filesystem */ + #define MOUNT_MAXTYPE 1 + #define INITMOUNTNAMES { \ + "none", /* 0 MOUNT_NONE */ \ + "ufs", /* 1 MOUNT_UFS */ \ + 0, \ + } + /* * Mount structure. * One allocated on every mount. *************** *** 64,75 **** /* * Mount flags. */ ! #define MNT_RDONLY 0x00000001 /* read only filesystem */ ! #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */ ! #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ ! #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ ! #define MNT_NODEV 0x00000010 /* don't interpret special files */ ! #define MNT_VISFLAGMASK 0x000000ff /* user visible flags */ /* * Flags for various system call interfaces. --- 71,97 ---- /* * Mount flags. */ ! #define MNT_RDONLY 0x0001 /* read only filesystem */ ! #define MNT_SYNCHRONOUS 0x0002 /* file system written synchronously */ ! #define MNT_NOEXEC 0x0004 /* can't exec from filesystem */ ! #define MNT_NOSUID 0x0008 /* don't honor setuid bits on fs */ ! #define MNT_NODEV 0x0010 /* don't interpret special files */ ! ! /* ! * Flags set by internal operations. ! */ ! #define MNT_QUOTA 0x0020 /* quotas are enabled on filesystem */ ! ! /* ! * Mask of flags that are visible to statfs(). ! */ ! #define MNT_VISFLAGMASK 0x0fff ! ! /* ! * filesystem control flags. The high 4 bits are used for this. Since NFS ! * support will never be a problem we can avoid making the flags into a 'long. ! */ ! #define MNT_UPDATE 0x1000 /* not a real mount, just an update */ /* * Flags for various system call interfaces. *** /VERSION.old Wed Dec 27 11:22:23 1995 --- /VERSION Fri Dec 29 21:19:38 1995 *************** *** 1,4 **** ! Current Patch Level: 286 2.11 BSD ============ --- 1,4 ---- ! Current Patch Level: 287 2.11 BSD ============