Page MenuHomeFreeBSD

D53131.1792094015.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D53131.1792094015.diff

diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c
--- a/usr.sbin/quot/quot.c
+++ b/usr.sbin/quot/quot.c
@@ -88,11 +88,7 @@
* Due to the size of modern disks, we must cast intermediate
* values to 64 bits to prevent potential overflows.
*/
-#ifdef COMPAT
-#define SIZE(n) (n)
-#else
#define SIZE(n) ((int)(((intmax_t)(n) * 512 + blocksize - 1) / blocksize))
-#endif
#define INOCNT(fs) ((fs)->fs_ipg)
#define INOSZ(fs) \
@@ -153,27 +149,13 @@
return ((union dinode *)di2);
}
-#ifdef COMPAT
-#define actualblocks(fs, dp) (DIP(fs, dp, di_blocks) / 2)
-#else
#define actualblocks(fs, dp) DIP(fs, dp, di_blocks)
-#endif
static int virtualblocks(struct fs *super, union dinode *dp)
{
off_t nblk, sz;
sz = DIP(super, dp, di_size);
-#ifdef COMPAT
- if (lblkno(super, sz) >= UFS_NDADDR) {
- nblk = blkroundup(super, sz);
- if (sz == nblk)
- nblk += super->fs_bsize;
- }
-
- return sz / 1024;
-
-#else /* COMPAT */
if (lblkno(super, sz) >= UFS_NDADDR) {
nblk = blkroundup(super, sz);
@@ -188,15 +170,11 @@
nblk = fragroundup(super, sz);
return nblk / 512;
-#endif /* COMPAT */
}
static int
isfree(struct fs *super, union dinode *dp)
{
-#ifdef COMPAT
- return (DIP(super, dp, di_mode) & IFMT) == 0;
-#else /* COMPAT */
switch (DIP(super, dp, di_mode) & IFMT) {
case IFIFO:
@@ -213,7 +191,6 @@
default:
errx(1, "unknown IFMT 0%o", DIP(super, dp, di_mode) & IFMT);
}
-#endif
}
static struct user {
@@ -324,11 +301,7 @@
usr->spc30 += blks;
}
-#ifdef COMPAT
-#define FSZCNT 500
-#else
#define FSZCNT 512
-#endif
static struct fsizes {
struct fsizes *fsz_next;
daddr_t fsz_first, fsz_last;
@@ -360,30 +333,12 @@
int i;
maxino = super->fs_ncg * super->fs_ipg - 1;
-#ifdef COMPAT
- if (!(fsizes = (struct fsizes *)malloc(sizeof(struct fsizes))))
- errx(1, "allocate fsize structure");
-#endif /* COMPAT */
for (inode = 0; inode < maxino; inode++) {
if ((dp = get_inode(fd, super, inode)) != NULL &&
-#ifdef COMPAT
- ((DIP(super, dp, di_mode) & IFMT) == IFREG ||
- (DIP(super, dp, di_mode) & IFMT) == IFDIR)
-#else /* COMPAT */
!isfree(super, dp)
-#endif /* COMPAT */
) {
sz = estimate ? virtualblocks(super, dp) :
actualblocks(super, dp);
-#ifdef COMPAT
- if (sz >= FSZCNT) {
- fsizes->fsz_count[FSZCNT-1]++;
- fsizes->fsz_sz[FSZCNT-1] += sz;
- } else {
- fsizes->fsz_count[sz]++;
- fsizes->fsz_sz[sz] += sz;
- }
-#else /* COMPAT */
ksz = SIZE(sz);
for (fsp = &fsizes; (fp = *fsp); fsp = &fp->fsz_next) {
if (ksz < fp->fsz_last)
@@ -403,7 +358,6 @@
}
fp->fsz_count[ksz % FSZCNT]++;
fp->fsz_sz[ksz % FSZCNT] += sz;
-#endif /* COMPAT */
}
}
sz = 0;
@@ -500,11 +454,7 @@
static void
usage(void)
{
-#ifdef COMPAT
- fprintf(stderr, "usage: quot [-cfhnv] [-a | filesystem ...]\n");
-#else /* COMPAT */
fprintf(stderr, "usage: quot [-cfhknv] [-a | filesystem ...]\n");
-#endif /* COMPAT */
exit(1);
}
@@ -551,9 +501,7 @@
int ch, cnt;
func = douser;
-#ifndef COMPAT
header = getbsize(&headerlen, &blocksize);
-#endif
while ((ch = getopt(argc, argv, "acfhknv")) != -1) {
switch (ch) {
case 'a':
@@ -568,11 +516,9 @@
case 'h':
estimate = true;
break;
-#ifndef COMPAT
case 'k':
blocksize = 1024;
break;
-#endif /* COMPAT */
case 'n':
func = donames;
break;

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 15, 7:53 PM (3 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30412894
Default Alt Text
D53131.1792094015.diff (3 KB)

Event Timeline