fix up to use block count in inode to compute sizes
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Mon, 15 Aug 1983 13:27:57 +0000 (05:27 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Mon, 15 Aug 1983 13:27:57 +0000 (05:27 -0800)
SCCS-vsn: usr.sbin/quot/quot.c 4.5

usr/src/usr.sbin/quot/quot.c

index b575270..16a380f 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)quot.c      4.4 (Berkeley) 83/07/01";
+static char *sccsid = "@(#)quot.c      4.5 (Berkeley) 83/08/14";
 #endif
 
 /*
 #endif
 
 /*
@@ -134,21 +134,20 @@ acct(ip)
 
        if ((ip->di_mode&IFMT) == 0)
                return;
 
        if ((ip->di_mode&IFMT) == 0)
                return;
-       if (!hflg) {
+       if (hflg) {
                /*
                /*
-                * Assume that there are no holes in files.
+                * Blocks based on number of 512 byte blocks claimed by inode.
                 */
                 */
-               blks = lblkno(&sblock, ip->di_size);
-               frags = blks * sblock.fs_frag +
-                       numfrags(&sblock, dblksize(&sblock, ip, blks));
+               size = ip->di_blocks / 2;
        } else {
                /*
        } else {
                /*
-                * Actually go out and count the number of allocated blocks.
+                * Estimate based on size of file.
                 */
                 */
-               printf("Sorry, hard way not implemented yet...\n");
-               exit(1);
+               blks = lblkno(&sblock, ip->di_size);
+               frags = blks * sblock.fs_frag +
+                       numfrags(&sblock, dblksize(&sblock, ip, blks));
+               size = frags * sblock.fs_fsize / 1024;
        }
        }
-       size = frags * sblock.fs_fsize / 1024;
        if (cflg) {
                if ((ip->di_mode&IFMT)!=IFDIR && (ip->di_mode&IFMT)!=IFREG)
                        return;
        if (cflg) {
                if ((ip->di_mode&IFMT)!=IFDIR && (ip->di_mode&IFMT)!=IFREG)
                        return;