Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Apply IINFO in the other userland tools.
details: https://anonhg.NetBSD.org/src/rev/2c4957cb8cf2
branches: trunk
changeset: 340814:2c4957cb8cf2
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Oct 03 08:28:46 2015 +0000
description:
Apply IINFO in the other userland tools.
diffstat:
sbin/fsck_lfs/lfs.c | 21 ++++++++++-----------
usr.sbin/dumplfs/dumplfs.c | 28 ++++++++++++----------------
2 files changed, 22 insertions(+), 27 deletions(-)
diffs (150 lines):
diff -r 83b65bd18949 -r 2c4957cb8cf2 sbin/fsck_lfs/lfs.c
--- a/sbin/fsck_lfs/lfs.c Sat Oct 03 08:28:30 2015 +0000
+++ b/sbin/fsck_lfs/lfs.c Sat Oct 03 08:28:46 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs.c,v 1.63 2015/09/01 06:15:02 dholland Exp $ */
+/* $NetBSD: lfs.c,v 1.64 2015/10/03 08:28:46 dholland Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -761,7 +761,7 @@
int bc; /* Bytes in partial segment */
int nblocks;
daddr_t daddr;
- uint32_t *dp, *idp; // XXX ondisk32
+ IINFO *iibase, *iip;
struct ubuf *bp;
int i, j, k, datac, len;
u_int32_t *datap;
@@ -787,26 +787,25 @@
datap = emalloc(nblocks * sizeof(*datap));
datac = 0;
- dp = (uint32_t *) sp; /* XXX ondisk32 */
- dp += lfs_sb_getsumsize(fs) / sizeof(*dp);
- dp--;
+ iibase = SEGSUM_IINFOSTART(fs, sp);
- idp = dp;
+ iip = iibase;
daddr = pseg_addr + lfs_btofsb(fs, lfs_sb_getsumsize(fs));
fp = (FINFO *) (sp + 1);
for (i = 0, j = 0;
i < lfs_ss_getnfinfo(fs, sp) || j < howmany(lfs_ss_getninos(fs, sp), LFS_INOPB(fs)); i++) {
- if (i >= lfs_ss_getnfinfo(fs, sp) && *idp != daddr) {
+ if (i >= lfs_ss_getnfinfo(fs, sp) && lfs_ii_getblock(fs, iip) != daddr) {
pwarn("Not enough inode blocks in pseg at 0x%jx: "
"found %d, wanted %d\n",
pseg_addr, j, howmany(lfs_ss_getninos(fs, sp),
LFS_INOPB(fs)));
if (debug)
- pwarn("*idp=0x%jx, daddr=0x%jx\n",
- (uintmax_t)*idp, (intmax_t)daddr);
+ pwarn("iip=0x%jx, daddr=0x%jx\n",
+ (uintmax_t)lfs_ii_getblock(fs, iip),
+ (intmax_t)daddr);
break;
}
- while (j < howmany(lfs_ss_getninos(fs, sp), LFS_INOPB(fs)) && *idp == daddr) {
+ while (j < howmany(lfs_ss_getninos(fs, sp), LFS_INOPB(fs)) && lfs_ii_getblock(fs, iip) == daddr) {
bread(devvp, LFS_FSBTODB(fs, daddr), lfs_sb_getibsize(fs),
0, &bp);
datap[datac++] = ((u_int32_t *) (bp->b_data))[0];
@@ -814,7 +813,7 @@
++j;
daddr += lfs_btofsb(fs, lfs_sb_getibsize(fs));
- --idp;
+ iip = NEXTLOWER_IINFO(fs, iip);
}
if (i < lfs_ss_getnfinfo(fs, sp)) {
if (func)
diff -r 83b65bd18949 -r 2c4957cb8cf2 usr.sbin/dumplfs/dumplfs.c
--- a/usr.sbin/dumplfs/dumplfs.c Sat Oct 03 08:28:30 2015 +0000
+++ b/usr.sbin/dumplfs/dumplfs.c Sat Oct 03 08:28:46 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dumplfs.c,v 1.57 2015/09/01 06:12:04 dholland Exp $ */
+/* $NetBSD: dumplfs.c,v 1.58 2015/10/03 08:28:46 dholland Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)dumplfs.c 8.5 (Berkeley) 5/24/95";
#else
-__RCSID("$NetBSD: dumplfs.c,v 1.57 2015/09/01 06:12:04 dholland Exp $");
+__RCSID("$NetBSD: dumplfs.c,v 1.58 2015/10/03 08:28:46 dholland Exp $");
#endif
#endif /* not lint */
@@ -502,7 +502,7 @@
dump_sum(int fd, struct lfs *lfsp, SEGSUM *sp, int segnum, daddr_t addr)
{
FINFO *fp;
- int32_t *dp, *idp;
+ IINFO *iip, *iip2;
union lfs_blocks fipblocks;
int i, j, acc;
int ck;
@@ -560,18 +560,16 @@
}
/* Dump out inode disk addresses */
- /* XXX ondisk32 */
- dp = (int32_t *)sp;
- dp += lfs_sb_getsumsize(lfsp) / sizeof(int32_t);
+ iip = SEGSUM_IINFOSTART(lfsp, sp);
diblock = malloc(lfs_sb_getbsize(lfsp));
printf(" Inode addresses:");
numbytes = 0;
numblocks = 0;
- for (dp--, i = 0; i < lfs_ss_getninos(lfsp, sp); dp--) {
+ for (i = 0; i < lfs_ss_getninos(lfsp, sp); iip = NEXTLOWER_IINFO(lfsp, iip)) {
++numblocks;
numbytes += lfs_sb_getibsize(lfsp); /* add bytes for inode block */
- printf("\t0x%x {", *dp);
- get(fd, fsbtobyte(lfsp, *dp), diblock, lfs_sb_getibsize(lfsp));
+ printf("\t0x%jx {", (intmax_t)lfs_ii_getblock(lfsp, iip));
+ get(fd, fsbtobyte(lfsp, lfs_ii_getblock(lfsp, iip)), diblock, lfs_sb_getibsize(lfsp));
for (j = 0; i < lfs_ss_getninos(lfsp, sp) && j < LFS_INOPB(lfsp); j++, i++) {
if (j > 0)
(void)printf(", ");
@@ -619,9 +617,7 @@
* compute the data checksum. (A bad data checksum is not enough
* to prevent us from continuing, but it odes merit a warning.)
*/
- idp = (int32_t *)sp;
- idp += lfs_sb_getsumsize(lfsp) / sizeof(int32_t);
- --idp;
+ iip2 = SEGSUM_IINFOSTART(lfsp, sp);
if (lfs_sb_getversion(lfsp) == 1) {
fp = (FINFO *)((SEGSUM_V1 *)sp + 1);
el_size = sizeof(unsigned long);
@@ -635,11 +631,11 @@
addr += lfs_btofsb(lfsp, lfs_sb_getsumsize(lfsp));
buf = malloc(lfs_sb_getbsize(lfsp));
for (i = 0; i < lfs_ss_getnfinfo(lfsp, sp); i++) {
- while (addr == *idp) {
+ while (addr == lfs_ii_getblock(lfsp, iip2)) {
get(fd, fsbtobyte(lfsp, addr), buf, lfs_sb_getibsize(lfsp));
memcpy(datap + acc * el_size, buf, el_size);
addr += lfs_btofsb(lfsp, lfs_sb_getibsize(lfsp));
- --idp;
+ iip2 = NEXTLOWER_IINFO(lfsp, iip2);
++acc;
}
for (j = 0; j < lfs_fi_getnblocks(lfsp, fp); j++) {
@@ -653,11 +649,11 @@
}
fp = NEXT_FINFO(lfsp, fp);
}
- while (addr == *idp) {
+ while (addr == lfs_ii_getblock(lfsp, iip2)) {
get(fd, fsbtobyte(lfsp, addr), buf, lfs_sb_getibsize(lfsp));
memcpy(datap + acc * el_size, buf, el_size);
addr += lfs_btofsb(lfsp, lfs_sb_getibsize(lfsp));
- --idp;
+ iip2 = NEXTLOWER_IINFO(lfsp, iip2);
++acc;
}
free(buf);
Home |
Main Index |
Thread Index |
Old Index