summaryrefslogtreecommitdiffstats
path: root/libexec/lfs_cleanerd
diff options
context:
space:
mode:
authorrgrimes <rgrimes@FreeBSD.org>1995-05-30 05:51:47 +0000
committerrgrimes <rgrimes@FreeBSD.org>1995-05-30 05:51:47 +0000
commitf05428e4cd63dde97bac14b84dd146a5c00455e3 (patch)
treee1331adb5d216f2b3fa6baa6491752348d2e5f10 /libexec/lfs_cleanerd
parent6de57e42c294763c78d77b0a9a7c5a08008a378a (diff)
downloadFreeBSD-src-f05428e4cd63dde97bac14b84dd146a5c00455e3.zip
FreeBSD-src-f05428e4cd63dde97bac14b84dd146a5c00455e3.tar.gz
Remove trailing whitespace.
Diffstat (limited to 'libexec/lfs_cleanerd')
-rw-r--r--libexec/lfs_cleanerd/clean.h4
-rw-r--r--libexec/lfs_cleanerd/cleanerd.c26
-rw-r--r--libexec/lfs_cleanerd/library.c52
-rw-r--r--libexec/lfs_cleanerd/print.c2
4 files changed, 42 insertions, 42 deletions
diff --git a/libexec/lfs_cleanerd/clean.h b/libexec/lfs_cleanerd/clean.h
index 5bbece7..729d0f8 100644
--- a/libexec/lfs_cleanerd/clean.h
+++ b/libexec/lfs_cleanerd/clean.h
@@ -82,9 +82,9 @@ typedef struct fs_info {
off_t fi_ifile_length; /* length of the ifile */
} FS_INFO;
-/*
+/*
* XXX: size (in bytes) of a segment
- * should lfs_bsize be fsbtodb(fs,1), blksize(fs), or lfs_dsize?
+ * should lfs_bsize be fsbtodb(fs,1), blksize(fs), or lfs_dsize?
*/
#define seg_size(fs) ((fs)->lfs_ssize << (fs)->lfs_bshift)
diff --git a/libexec/lfs_cleanerd/cleanerd.c b/libexec/lfs_cleanerd/cleanerd.c
index 2b8566a..994992e 100644
--- a/libexec/lfs_cleanerd/cleanerd.c
+++ b/libexec/lfs_cleanerd/cleanerd.c
@@ -65,7 +65,7 @@ struct cleaner_stats {
int segs_error;
} cleaner_stats;
-struct seglist {
+struct seglist {
int sl_id; /* segment number */
int sl_cost; /* cleaning cost */
char sl_empty; /* is segment empty */
@@ -84,7 +84,7 @@ int lfs_markv __P((fsid_t *, BLOCK_INFO *, int));
/* function prototypes */
int bi_tossold __P((const void *, const void *, const void *));
-int choose_segments __P((FS_INFO *, struct seglist *,
+int choose_segments __P((FS_INFO *, struct seglist *,
int (*)(FS_INFO *, SEGUSE *)));
void clean_fs __P((FS_INFO *, int (*)(FS_INFO *, SEGUSE *)));
int clean_loop __P((FS_INFO *));
@@ -117,14 +117,14 @@ cost_benefit(fsp, su)
gettimeofday(&t, NULL);
- live = su->su_nbytes;
+ live = su->su_nbytes;
age = t.tv_sec < su->su_lastmod ? 0 : t.tv_sec - su->su_lastmod;
-
+
lfsp = &fsp->fi_lfs;
if (live == 0)
return (t.tv_sec * lblkno(lfsp, seg_size(lfsp)));
else {
- /*
+ /*
* from lfsSegUsage.c (Mendel's code).
* priority calculation is done using INTEGER arithmetic.
* sizes are in BLOCKS (that is why we use lblkno below).
@@ -212,7 +212,7 @@ main(argc, argv)
(void)printf("Cleaner going to sleep.\n");
#endif
if (lfs_segwait(&fsid, &timeout) < 0)
- err(0, "lfs_segwait: returned error\n");
+ err(0, "lfs_segwait: returned error\n");
#ifdef VERBOSE
(void)printf("Cleaner waking up.\n");
#endif
@@ -233,8 +233,8 @@ clean_loop(fsp)
* number of free blocks.
*/
max_free_segs = fsp->fi_statfsp->f_bfree / fsp->fi_lfs.lfs_ssize;
-
- /*
+
+ /*
* We will clean if there are not enough free blocks or total clean
* space is less than BUSY_LIM % of possible clean space.
*/
@@ -247,7 +247,7 @@ clean_loop(fsp)
clean_fs(fsp, cost_benefit);
return (1);
} else {
- /*
+ /*
* We will also clean if the system is reasonably idle and
* the total clean space is less then IDLE_LIM % of possible
* clean space.
@@ -256,16 +256,16 @@ clean_loop(fsp)
perror("getloadavg: failed\n");
return (-1);
}
- if (loadavg[ONE_MIN] == 0.2 && loadavg[FIVE_MIN] &&
+ if (loadavg[ONE_MIN] == 0.2 && loadavg[FIVE_MIN] &&
fsp->fi_cip->clean < max_free_segs * IDLE_LIM) {
clean_fs(fsp, cost_benefit);
printf("Cleaner running (system idle) at %s",
ctime(&now));
return (1);
}
- }
+ }
#ifdef VERBOSE
- printf("Cleaner not running at %s", ctime(&now));
+ printf("Cleaner not running at %s", ctime(&now));
#endif
return (0);
}
@@ -456,7 +456,7 @@ clean_segment(fsp, id)
}
num_blocks -= clean_blocks;
}
-
+
free(block_array);
munmap_segment(fsp, seg_buf, do_mmap);
++cleaner_stats.segs_cleaned;
diff --git a/libexec/lfs_cleanerd/library.c b/libexec/lfs_cleanerd/library.c
index 19ac0fd..62f345a 100644
--- a/libexec/lfs_cleanerd/library.c
+++ b/libexec/lfs_cleanerd/library.c
@@ -108,7 +108,7 @@ get_fs_info (lstatfsp, use_mmap)
{
FS_INFO *fsp;
int i;
-
+
fsp = (FS_INFO *)malloc(sizeof(FS_INFO));
if (fsp == NULL)
return NULL;
@@ -125,7 +125,7 @@ get_fs_info (lstatfsp, use_mmap)
/*
* If we are reading the ifile then we need to refresh it. Even if
- * we are mmapping it, it might have grown. Finally, we need to
+ * we are mmapping it, it might have grown. Finally, we need to
* refresh the file system information (statfs) info.
*/
void
@@ -134,14 +134,14 @@ reread_fs_info(fsp, use_mmap)
int use_mmap;
{
int i;
-
+
if (statfs(fsp->fi_statfsp->f_mntonname, fsp->fi_statfsp))
err(1, "reread_fs_info: statfs failed");
get_ifile (fsp, use_mmap);
}
-/*
- * Gets the superblock from disk (possibly in face of errors)
+/*
+ * Gets the superblock from disk (possibly in face of errors)
*/
int
get_superblock (fsp, sbp)
@@ -161,11 +161,11 @@ get_superblock (fsp, sbp)
get(fid, LFS_LABELPAD, sbp, sizeof(struct lfs));
close (fid);
-
+
return (0);
}
-/*
+/*
* This function will map the ifile into memory. It causes a
* fatal error on failure.
*/
@@ -209,16 +209,16 @@ get_ifile (fsp, use_mmap)
if (fsp->fi_cip)
free(fsp->fi_cip);
if (!(ifp = malloc (file_stat.st_size)))
- err (1, "get_ifile: malloc failed");
+ err (1, "get_ifile: malloc failed");
redo_read:
count = read (fid, ifp, (size_t) file_stat.st_size);
if (count < 0)
- err(1, "get_ifile: bad ifile read");
+ err(1, "get_ifile: bad ifile read");
else if (count < file_stat.st_size) {
err(0, "get_ifile");
if (lseek(fid, 0, SEEK_SET) < 0)
- err(1, "get_ifile: bad ifile lseek");
+ err(1, "get_ifile: bad ifile lseek");
goto redo_read;
}
}
@@ -249,7 +249,7 @@ redo_read:
* summary was read (it may have "died" since then). Any given
* pair will be listed at most once.
*/
-int
+int
lfs_segmapv(fsp, seg, seg_buf, blocks, bcount)
FS_INFO *fsp; /* pointer to local file system information */
int seg; /* the segment number */
@@ -345,13 +345,13 @@ lfs_segmapv(fsp, seg, seg_buf, blocks, bcount)
err0: *bcount = 0;
return (-1);
-
+
}
-/*
+/*
* This will parse a partial segment and fill in BLOCK_INFO structures
* for each block described in the segment summary. It will not include
- * blocks or inodes from files with new version numbers.
+ * blocks or inodes from files with new version numbers.
*/
void
add_blocks (fsp, bip, countp, sp, seg_buf, segaddr, psegaddr)
@@ -429,10 +429,10 @@ add_inodes (fsp, bip, countp, sp, seg_buf, seg_addr)
daddr_t *daddrp;
ino_t inum;
int i;
-
+
if (sp->ss_ninos <= 0)
return;
-
+
bp = bip + *countp;
lfsp = &fsp->fi_lfs;
#ifdef VERBOSE
@@ -444,9 +444,9 @@ add_inodes (fsp, bip, countp, sp, seg_buf, seg_addr)
--daddrp;
di = (struct dinode *)(seg_buf +
((*daddrp - seg_addr) << fsp->fi_daddr_shift));
- } else
+ } else
++di;
-
+
inum = di->di_inumber;
bp->bi_lbn = LFS_UNUSED_LBN;
bp->bi_inode = inum;
@@ -466,7 +466,7 @@ add_inodes (fsp, bip, countp, sp, seg_buf, seg_addr)
if (ifp->if_daddr == *daddrp) {
bp++;
++(*countp);
- }
+ }
}
}
}
@@ -476,7 +476,7 @@ add_inodes (fsp, bip, countp, sp, seg_buf, seg_addr)
* segment is valid or not. Returns the size of the partial segment if it
* is valid, * and 0 otherwise. Use dump_summary to figure out size of the
* the partial as well as whether or not the checksum is valid.
- */
+ */
int
pseg_valid (fsp, ssp)
FS_INFO *fsp; /* pointer to file system info */
@@ -489,7 +489,7 @@ pseg_valid (fsp, ssp)
if ((nblocks = dump_summary(&fsp->fi_lfs, ssp, 0, NULL)) <= 0 ||
nblocks > fsp->fi_lfs.lfs_ssize - 1)
return(0);
-
+
/* check data/inode block(s) checksum too */
datap = (u_long *)malloc(nblocks * sizeof(u_long));
p = (caddr_t)ssp + LFS_SUMMARY_SIZE;
@@ -499,13 +499,13 @@ pseg_valid (fsp, ssp)
}
if (cksum ((void *)datap, nblocks * sizeof(u_long)) != ssp->ss_datasum)
return (0);
-
+
return (nblocks);
}
/* #define MMAP_SEGMENT */
-/*
+/*
* read a segment into a memory buffer
*/
int
@@ -562,7 +562,7 @@ mmap_segment (fsp, segment, segbuf, use_mmap)
free(*segbuf);
return (-1);
}
-
+
if (read (fid, *segbuf, ssize) != ssize) {
err (0, "mmap_segment: bad read");
free(*segbuf);
@@ -630,7 +630,7 @@ bi_compare(a, b)
return (diff);
diff = (int)(ba->bi_daddr - bb->bi_daddr);
return (diff);
-}
+}
int
bi_toss(dummy, a, b)
@@ -665,7 +665,7 @@ toss(p, nump, size, dotoss, client)
if (dotoss(client, p, p1)) {
memmove(p, p1, i * size);
--(*nump);
- } else
+ } else
p += size;
}
}
diff --git a/libexec/lfs_cleanerd/print.c b/libexec/lfs_cleanerd/print.c
index 5c3863a..64320c5 100644
--- a/libexec/lfs_cleanerd/print.c
+++ b/libexec/lfs_cleanerd/print.c
@@ -65,7 +65,7 @@ dump_summary(lfsp, sp, flags, iaddrp)
FINFO *fp;
int ck;
- if (sp->ss_sumsum != (ck = cksum(&sp->ss_datasum,
+ if (sp->ss_sumsum != (ck = cksum(&sp->ss_datasum,
LFS_SUMMARY_SIZE - sizeof(sp->ss_sumsum))))
return(-1);
OpenPOWER on IntegriCloud