Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/dumplfs Use accessors for another batch of indirect...
details: https://anonhg.NetBSD.org/src/rev/d75465670214
branches: trunk
changeset: 340815:d75465670214
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Oct 03 08:28:56 2015 +0000
description:
Use accessors for another batch of indirect block accesses, this time
in dumplfs.
diffstat:
usr.sbin/dumplfs/dumplfs.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diffs (69 lines):
diff -r 2c4957cb8cf2 -r d75465670214 usr.sbin/dumplfs/dumplfs.c
--- a/usr.sbin/dumplfs/dumplfs.c Sat Oct 03 08:28:46 2015 +0000
+++ b/usr.sbin/dumplfs/dumplfs.c Sat Oct 03 08:28:56 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dumplfs.c,v 1.58 2015/10/03 08:28:46 dholland Exp $ */
+/* $NetBSD: dumplfs.c,v 1.59 2015/10/03 08:28:56 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.58 2015/10/03 08:28:46 dholland Exp $");
+__RCSID("$NetBSD: dumplfs.c,v 1.59 2015/10/03 08:28:56 dholland Exp $");
#endif
#endif /* not lint */
@@ -277,8 +277,9 @@
char *ipage;
char *dpage;
union lfs_dinode *dip = NULL;
- /* XXX ondisk32 */
- int32_t *addrp, *dindir, *iaddrp, *indir;
+ void *dindir, *indir;
+ unsigned offset;
+ daddr_t thisblock;
daddr_t pdb;
int block_limit, i, inum, j, nblocks, psize;
@@ -346,10 +347,11 @@
err(1, "malloc");
get(fd, fsbtobyte(lfsp, lfs_dino_getib(lfsp, dip, 0)), indir, psize);
block_limit = MIN(i + lfs_sb_getnindir(lfsp), nblocks);
- for (addrp = indir; i < block_limit; i++, addrp++) {
- if (*addrp == LFS_UNUSED_DADDR)
+ for (offset = 0; i < block_limit; i++, offset++) {
+ thisblock = lfs_iblock_get(lfsp, indir, offset);
+ if (thisblock == LFS_UNUSED_DADDR)
break;
- get(fd, fsbtobyte(lfsp, *addrp), ipage, psize);
+ get(fd, fsbtobyte(lfsp, thisblock), ipage, psize);
if (i < lfs_sb_getcleansz(lfsp)) {
dump_cleaner_info(lfsp, ipage);
continue;
@@ -378,15 +380,17 @@
if (!(dindir = malloc(psize)))
err(1, "malloc");
get(fd, fsbtobyte(lfsp, lfs_dino_getib(lfsp, dip, 1)), dindir, psize);
- for (iaddrp = dindir, j = 0; j < lfs_sb_getnindir(lfsp); j++, iaddrp++) {
- if (*iaddrp == LFS_UNUSED_DADDR)
+ for (j = 0; j < lfs_sb_getnindir(lfsp); j++) {
+ thisblock = lfs_iblock_get(lfsp, dindir, j);
+ if (thisblock == LFS_UNUSED_DADDR)
break;
- get(fd, fsbtobyte(lfsp, *iaddrp), indir, psize);
+ get(fd, fsbtobyte(lfsp, thisblock), indir, psize);
block_limit = MIN(i + lfs_sb_getnindir(lfsp), nblocks);
- for (addrp = indir; i < block_limit; i++, addrp++) {
- if (*addrp == LFS_UNUSED_DADDR)
+ for (offset = 0; i < block_limit; i++, offset++) {
+ thisblock = lfs_iblock_get(lfsp, indir, offset);
+ if (thisblock == LFS_UNUSED_DADDR)
break;
- get(fd, fsbtobyte(lfsp, *addrp), ipage, psize);
+ get(fd, fsbtobyte(lfsp, thisblock), ipage, psize);
if (i < lfs_sb_getcleansz(lfsp)) {
dump_cleaner_info(lfsp, ipage);
continue;
Home |
Main Index |
Thread Index |
Old Index