Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Use accessor functions for the version field of the lfs supe...
details: https://anonhg.NetBSD.org/src/rev/e08a73d8db55
branches: trunk
changeset: 809809:e08a73d8db55
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Aug 02 18:14:16 2015 +0000
description:
Use accessor functions for the version field of the lfs superblock.
I thought at first maybe the cases that test the version should be
rolled into the accessors, but on the whole I think the conclusion on
that is no.
diffstat:
libexec/lfs_cleanerd/lfs_cleanerd.c | 4 ++--
sbin/dump_lfs/lfs_inode.c | 10 +++++-----
sbin/fsck_lfs/lfs.c | 14 +++++++-------
sbin/fsck_lfs/pass5.c | 6 +++---
sbin/fsck_lfs/segwrite.c | 12 ++++++------
sbin/fsck_lfs/setup.c | 6 +++---
sbin/newfs_lfs/make_lfs.c | 18 +++++++++---------
sbin/scan_ffs/scan_ffs.c | 10 +++++-----
sys/ufs/lfs/lfs_accessors.h | 16 ++++++++--------
sys/ufs/lfs/lfs_alloc.c | 10 +++++-----
sys/ufs/lfs/lfs_debug.c | 6 +++---
sys/ufs/lfs/lfs_itimes.c | 6 +++---
sys/ufs/lfs/lfs_rfw.c | 10 +++++-----
sys/ufs/lfs/lfs_segment.c | 16 ++++++++--------
sys/ufs/lfs/lfs_syscalls.c | 6 +++---
sys/ufs/lfs/lfs_vfsops.c | 14 +++++++-------
usr.sbin/dumplfs/dumplfs.c | 34 +++++++++++++++++-----------------
17 files changed, 99 insertions(+), 99 deletions(-)
diffs (truncated from 866 to 300 lines):
diff -r 7b4a8de2f589 -r e08a73d8db55 libexec/lfs_cleanerd/lfs_cleanerd.c
--- a/libexec/lfs_cleanerd/lfs_cleanerd.c Sun Aug 02 18:12:59 2015 +0000
+++ b/libexec/lfs_cleanerd/lfs_cleanerd.c Sun Aug 02 18:14:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.42 2015/08/02 18:10:07 dholland Exp $ */
+/* $NetBSD: lfs_cleanerd.c,v 1.43 2015/08/02 18:14:16 dholland Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -258,7 +258,7 @@
free(sbuf);
/* If this is not a version 2 filesystem, complain and exit */
- if (fs->lfs_version != 2) {
+ if (lfs_sb_getversion(fs) != 2) {
syslog(LOG_ERR, "%s: not a version 2 LFS", fsname);
return -1;
}
diff -r 7b4a8de2f589 -r e08a73d8db55 sbin/dump_lfs/lfs_inode.c
--- a/sbin/dump_lfs/lfs_inode.c Sun Aug 02 18:12:59 2015 +0000
+++ b/sbin/dump_lfs/lfs_inode.c Sun Aug 02 18:14:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_inode.c,v 1.21 2015/07/24 06:59:31 dholland Exp $ */
+/* $NetBSD: lfs_inode.c,v 1.22 2015/08/02 18:14:16 dholland Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: lfs_inode.c,v 1.21 2015/07/24 06:59:31 dholland Exp $");
+__RCSID("$NetBSD: lfs_inode.c,v 1.22 2015/08/02 18:14:16 dholland Exp $");
#endif
#endif /* not lint */
@@ -115,7 +115,7 @@
msg("Warning: secondary superblock at 0x%" PRIx64 " bad magic\n",
LFS_FSBTODB(sblock, (off_t)lfs_sb_getsboff(sblock, 1)));
} else {
- if (sblock->lfs_version > 1) {
+ if (lfs_sb_getversion(sblock) > 1) {
if (lfs_sb_getserial(&u.lfss) < lfs_sb_getserial(sblock)) {
memcpy(sblock, u.tbuf, sizeof(u.tbuf));
sboff = lfs_fsbtob(sblock, (off_t)lfs_sb_getsboff(sblock, 1));
@@ -147,14 +147,14 @@
spcl.c_flags = iswap32(iswap32(spcl.c_flags) | DR_NEWINODEFMT);
ufsi.ufs_dsize = LFS_FSBTODB(sblock, lfs_sb_getsize(sblock));
- if (sblock->lfs_version == 1)
+ if (lfs_sb_getversion(sblock) == 1)
ufsi.ufs_dsize = lfs_sb_getsize(sblock) >> lfs_sb_getblktodb(sblock);
ufsi.ufs_bsize = lfs_sb_getbsize(sblock);
ufsi.ufs_bshift = lfs_sb_getbshift(sblock);
ufsi.ufs_fsize = lfs_sb_getfsize(sblock);
ufsi.ufs_frag = lfs_sb_getfrag(sblock);
ufsi.ufs_fsatoda = lfs_sb_getfsbtodb(sblock);
- if (sblock->lfs_version == 1)
+ if (lfs_sb_getversion(sblock) == 1)
ufsi.ufs_fsatoda = 0;
ufsi.ufs_nindir = lfs_sb_getnindir(sblock);
ufsi.ufs_inopb = lfs_sb_getinopb(sblock);
diff -r 7b4a8de2f589 -r e08a73d8db55 sbin/fsck_lfs/lfs.c
--- a/sbin/fsck_lfs/lfs.c Sun Aug 02 18:12:59 2015 +0000
+++ b/sbin/fsck_lfs/lfs.c Sun Aug 02 18:14:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.50 2015/08/02 18:10:08 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.51 2015/08/02 18:14:16 dholland Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -526,7 +526,7 @@
}
/* Compatibility */
- if (fs->lfs_version < 2) {
+ if (lfs_sb_getversion(fs) < 2) {
lfs_sb_setsumsize(fs, LFS_V1_SUMMARY_SIZE);
lfs_sb_setibsize(fs, lfs_sb_getbsize(fs));
lfs_sb_sets0addr(fs, lfs_sb_getsboff(fs, 0));
@@ -695,11 +695,11 @@
(uintmax_t) lfs_sb_getserial(sb0),
(uintmax_t) lfs_sb_getserial(sb1));
- if ((sb0->lfs_version == 1 &&
+ if ((lfs_sb_getversion(sb0) == 1 &&
lfs_sb_getotstamp(sb0) != lfs_sb_getotstamp(sb1)) ||
- (sb0->lfs_version > 1 &&
+ (lfs_sb_getversion(sb0) > 1 &&
lfs_sb_getserial(sb0) != lfs_sb_getserial(sb1))) {
- if (sb0->lfs_version == 1) {
+ if (lfs_sb_getversion(sb0) == 1) {
if (lfs_sb_getotstamp(sb0) > lfs_sb_getotstamp(sb1)) {
osb = sb1;
nsb = sb0;
@@ -756,7 +756,7 @@
/* Count the blocks. */
nblocks = howmany(sp->ss_ninos, LFS_INOPB(fs));
- bc = nblocks << (fs->lfs_version > 1 ? lfs_sb_getffshift(fs) : lfs_sb_getbshift(fs));
+ bc = nblocks << (lfs_sb_getversion(fs) > 1 ? lfs_sb_getffshift(fs) : lfs_sb_getbshift(fs));
assert(bc >= 0);
fp = (FINFO *) (sp + 1);
@@ -926,7 +926,7 @@
max = i + lfs_sb_getifpb(fs);
lfs_sb_subbfree(fs, lfs_btofsb(fs, lfs_sb_getbsize(fs)));
- if (fs->lfs_version == 1) {
+ if (lfs_sb_getversion(fs) == 1) {
for (ifp_v1 = (IFILE_V1 *)bp->b_data; i < max; ++ifp_v1) {
ifp_v1->if_version = 1;
ifp_v1->if_daddr = LFS_UNUSED_DADDR;
diff -r 7b4a8de2f589 -r e08a73d8db55 sbin/fsck_lfs/pass5.c
--- a/sbin/fsck_lfs/pass5.c Sun Aug 02 18:12:59 2015 +0000
+++ b/sbin/fsck_lfs/pass5.c Sun Aug 02 18:14:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass5.c,v 1.33 2015/08/02 18:08:12 dholland Exp $ */
+/* $NetBSD: pass5.c,v 1.34 2015/08/02 18:14:16 dholland Exp $ */
/*-
* Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@@ -120,7 +120,7 @@
avail += lfs_segtod(fs, 1);
if (su->su_flags & SEGUSE_SUPERBLOCK)
avail -= lfs_btofsb(fs, LFS_SBPAD);
- if (i == 0 && fs->lfs_version > 1 &&
+ if (i == 0 && lfs_sb_getversion(fs) > 1 &&
lfs_sb_gets0addr(fs) < lfs_btofsb(fs, LFS_LABELPAD))
avail -= lfs_btofsb(fs, LFS_LABELPAD) -
lfs_sb_gets0addr(fs);
@@ -169,7 +169,7 @@
}
labelskew = 0;
- if (fs->lfs_version > 1 &&
+ if (lfs_sb_getversion(fs) > 1 &&
lfs_sb_gets0addr(fs) < lfs_btofsb(fs, LFS_LABELPAD))
labelskew = lfs_btofsb(fs, LFS_LABELPAD);
if (lfs_sb_getbfree(fs) > lfs_sb_getdsize(fs) - bb - labelskew ||
diff -r 7b4a8de2f589 -r e08a73d8db55 sbin/fsck_lfs/segwrite.c
--- a/sbin/fsck_lfs/segwrite.c Sun Aug 02 18:12:59 2015 +0000
+++ b/sbin/fsck_lfs/segwrite.c Sun Aug 02 18:14:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: segwrite.c,v 1.34 2015/07/28 05:09:34 dholland Exp $ */
+/* $NetBSD: segwrite.c,v 1.35 2015/08/02 18:14:16 dholland Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -635,7 +635,7 @@
}
brelse(bp, 0);
/* Segment zero could also contain the labelpad */
- if (fs->lfs_version > 1 && sp->seg_number == 0 &&
+ if (lfs_sb_getversion(fs) > 1 && sp->seg_number == 0 &&
lfs_sb_gets0addr(fs) < lfs_btofsb(fs, LFS_LABELPAD)) {
lfs_sb_addoffset(fs, lfs_btofsb(fs, LFS_LABELPAD) - lfs_sb_gets0addr(fs));
sp->seg_bytes_left -= LFS_LABELPAD - lfs_fsbtob(fs, lfs_sb_gets0addr(fs));
@@ -771,7 +771,7 @@
ninos = (ssp->ss_ninos + LFS_INOPB(fs) - 1) / LFS_INOPB(fs);
sup->su_nbytes += ssp->ss_ninos * LFS_DINODE1_SIZE;
- if (fs->lfs_version == 1)
+ if (lfs_sb_getversion(fs) == 1)
sup->su_olastmod = write_time;
else
sup->su_lastmod = write_time;
@@ -789,7 +789,7 @@
* block (the summary block) is skipped. Set the create time here
* so that it's guaranteed to be later than the inode mod times.
*/
- if (fs->lfs_version == 1)
+ if (lfs_sb_getversion(fs) == 1)
el_size = sizeof(u_long);
else
el_size = sizeof(u_int32_t);
@@ -805,7 +805,7 @@
bremfree(*bpp);
(*bpp)->b_flags |= B_BUSY;
}
- if (fs->lfs_version == 1)
+ if (lfs_sb_getversion(fs) == 1)
ssp->ss_ocreate = write_time;
else {
ssp->ss_create = write_time;
@@ -999,7 +999,7 @@
struct ubuf *bp;
/* Set timestamp of this version of the superblock */
- if (fs->lfs_version == 1)
+ if (lfs_sb_getversion(fs) == 1)
lfs_sb_setotstamp(fs, write_time);
lfs_sb_settstamp(fs, write_time);
diff -r 7b4a8de2f589 -r e08a73d8db55 sbin/fsck_lfs/setup.c
--- a/sbin/fsck_lfs/setup.c Sun Aug 02 18:12:59 2015 +0000
+++ b/sbin/fsck_lfs/setup.c Sun Aug 02 18:14:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setup.c,v 1.51 2015/08/02 18:10:08 dholland Exp $ */
+/* $NetBSD: setup.c,v 1.52 2015/08/02 18:14:16 dholland Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -272,7 +272,7 @@
}
fp = (FINFO *)(sp + 1);
bc = howmany(sp->ss_ninos, LFS_INOPB(fs)) <<
- (fs->lfs_version > 1 ? lfs_sb_getffshift(fs) :
+ (lfs_sb_getversion(fs) > 1 ? lfs_sb_getffshift(fs) :
lfs_sb_getbshift(fs));
for (i = 0; i < sp->ss_nfinfo; i++) {
bc += fp->fi_lastlength + ((fp->fi_nblocks - 1)
@@ -334,7 +334,7 @@
pwarn("lfs_frag = %lu\n", (unsigned long) lfs_sb_getfrag(fs));
pwarn("lfs_inopb = %lu\n", (unsigned long) lfs_sb_getinopb(fs));
}
- if (fs->lfs_version == 1)
+ if (lfs_sb_getversion(fs) == 1)
maxfsblock = lfs_blkstofrags(fs, lfs_sb_getsize(fs));
else
maxfsblock = lfs_sb_getsize(fs);
diff -r 7b4a8de2f589 -r e08a73d8db55 sbin/newfs_lfs/make_lfs.c
--- a/sbin/newfs_lfs/make_lfs.c Sun Aug 02 18:12:59 2015 +0000
+++ b/sbin/newfs_lfs/make_lfs.c Sun Aug 02 18:14:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make_lfs.c,v 1.38 2015/08/02 18:11:36 dholland Exp $ */
+/* $NetBSD: make_lfs.c,v 1.39 2015/08/02 18:14:16 dholland Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
#if 0
static char sccsid[] = "@(#)lfs.c 8.5 (Berkeley) 5/24/95";
#else
-__RCSID("$NetBSD: make_lfs.c,v 1.38 2015/08/02 18:11:36 dholland Exp $");
+__RCSID("$NetBSD: make_lfs.c,v 1.39 2015/08/02 18:14:16 dholland Exp $");
#endif
#endif /* not lint */
@@ -346,7 +346,7 @@
/* Set version first of all since it is used to compute other fields */
- fs->lfs_version = version;
+ lfs_sb_setversion(fs, version);
/* If partition is not an LFS partition, warn that that is the case */
if (strcmp(dkw->dkw_ptype, DKW_PTYPE_LFS) != 0) {
@@ -421,7 +421,7 @@
lfs_sb_setnindir(fs, bsize / sizeof(int32_t));
}
- if (fs->lfs_version == 1) {
+ if (lfs_sb_getversion(fs) == 1) {
lfs_sb_setsumsize(fs, LFS_V1_SUMMARY_SIZE);
lfs_sb_setsegshift(fs, lfs_log2(ssize));
if (1 << lfs_sb_getsegshift(fs) != ssize)
@@ -527,8 +527,8 @@
* Now that we've determined what we're going to do, announce it
* to the user.
*/
- printf("Creating a version %d LFS", fs->lfs_version);
- if (fs->lfs_version > 1)
+ printf("Creating a version %d LFS", lfs_sb_getversion(fs));
+ if (lfs_sb_getversion(fs) > 1)
printf(" with roll-forward ident 0x%x", lfs_sb_getident(fs));
printf("\n");
fssize = (double)lfs_sb_getnseg(fs);
@@ -589,7 +589,7 @@
sb_addr = ((i * sb_interval) * lfs_segtod(fs, 1))
+ lfs_sb_getsboff(fs, 0);
/* Segment 0 eats the label, except for version 1 */
- if (fs->lfs_version > 1 && lfs_sb_gets0addr(fs) < label_fsb)
+ if (lfs_sb_getversion(fs) > 1 && lfs_sb_gets0addr(fs) < label_fsb)
sb_addr -= label_fsb - start;
if (sb_addr + sizeof(struct dlfs)
>= LFS_DBTOFSB(fs, dkw->dkw_size))
@@ -789,7 +789,7 @@
lfs_sb_addavail(fs, lfs_segtod(fs, 1));
if (segp->su_flags & SEGUSE_SUPERBLOCK)
lfs_sb_subavail(fs, lfs_btofsb(fs, LFS_SBPAD));
- if (i == 0 && fs->lfs_version > 1 &&
+ if (i == 0 && lfs_sb_getversion(fs) > 1 &&
lfs_sb_gets0addr(fs) < lfs_btofsb(fs, LFS_LABELPAD))
lfs_sb_subavail(fs, lfs_btofsb(fs, LFS_LABELPAD) -
lfs_sb_gets0addr(fs));
@@ -803,7 +803,7 @@
lfs_sb_subavail(fs, lfs_segtod(fs, (lfs_sb_getminfreeseg(fs) - (lfs_sb_getminfreeseg(fs) / 2))));
labelskew = 0;
- if (fs->lfs_version > 1 && lfs_sb_gets0addr(fs) < lfs_btofsb(fs, LFS_LABELPAD))
+ if (lfs_sb_getversion(fs) > 1 && lfs_sb_gets0addr(fs) < lfs_btofsb(fs, LFS_LABELPAD))
labelskew = lfs_btofsb(fs, LFS_LABELPAD);
lfs_sb_setbfree(fs, lfs_sb_getdsize(fs) - labelskew - (ubb + bb) / 2);
diff -r 7b4a8de2f589 -r e08a73d8db55 sbin/scan_ffs/scan_ffs.c
--- a/sbin/scan_ffs/scan_ffs.c Sun Aug 02 18:12:59 2015 +0000
+++ b/sbin/scan_ffs/scan_ffs.c Sun Aug 02 18:14:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scan_ffs.c,v 1.29 2015/08/02 18:08:12 dholland Exp $ */
Home |
Main Index |
Thread Index |
Old Index