Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs make these compilable with lfs debug options.



details:   https://anonhg.NetBSD.org/src/rev/3cce5e3907a5
branches:  trunk
changeset: 542407:3cce5e3907a5
user:      yamt <yamt%NetBSD.org@localhost>
date:      Mon Jan 27 23:17:56 2003 +0000

description:
make these compilable with lfs debug options.
(follow daddr_t change)

XXX maybe segment number should be 64bit.

diffstat:

 sys/ufs/lfs/lfs.h         |   4 ++--
 sys/ufs/lfs/lfs_alloc.c   |   6 +++---
 sys/ufs/lfs/lfs_segment.c |  33 ++++++++++++++++-----------------
 sys/ufs/lfs/lfs_vfsops.c  |  47 ++++++++++++++++++++++++-----------------------
 4 files changed, 45 insertions(+), 45 deletions(-)

diffs (291 lines):

diff -r 32dee1be2cad -r 3cce5e3907a5 sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Mon Jan 27 22:38:24 2003 +0000
+++ b/sys/ufs/lfs/lfs.h Mon Jan 27 23:17:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs.h,v 1.43 2003/01/24 21:55:25 fvdl Exp $    */
+/*     $NetBSD: lfs.h,v 1.44 2003/01/27 23:17:56 yamt Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -628,7 +628,7 @@
                           (fs)->lfs_ssize << (fs)->lfs_blktodb :       \
                           btofsb((fs), (fs)->lfs_ssize)) * (seg))
 #define        dtosn(fs, daddr)        /* block address to segment number */   \
-       (((daddr) - (fs)->lfs_start) / segtod((fs), 1))
+       ((uint32_t)(((daddr) - (fs)->lfs_start) / segtod((fs), 1)))
 #define sntod(fs, sn)          /* segment number to disk address */    \
        ((daddr_t)(segtod((fs), (sn)) + (fs)->lfs_start))
 
diff -r 32dee1be2cad -r 3cce5e3907a5 sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c   Mon Jan 27 22:38:24 2003 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c   Mon Jan 27 23:17:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_alloc.c,v 1.61 2003/01/25 18:12:32 tron Exp $      */
+/*     $NetBSD: lfs_alloc.c,v 1.62 2003/01/27 23:17:56 yamt Exp $      */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.61 2003/01/25 18:12:32 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.62 2003/01/27 23:17:56 yamt Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -589,7 +589,7 @@
 #ifdef DIAGNOSTIC
                if (sup->su_nbytes < DINODE_SIZE) {
                        printf("lfs_vfree: negative byte count"
-                              " (segment %" PRId64 " short by %d)\n",
+                              " (segment %" PRIu32 " short by %d)\n",
                               dtosn(fs, old_iaddr),
                               (int)DINODE_SIZE - sup->su_nbytes);
                        panic("lfs_vfree: negative byte count");
diff -r 32dee1be2cad -r 3cce5e3907a5 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Mon Jan 27 22:38:24 2003 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Mon Jan 27 23:17:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.95 2003/01/27 21:45:52 kleink Exp $  */
+/*     $NetBSD: lfs_segment.c,v 1.96 2003/01/27 23:17:57 yamt Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.95 2003/01/27 21:45:52 kleink Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.96 2003/01/27 23:17:57 yamt Exp $");
 
 #define ivndebug(vp,str) printf("ino %d: %s\n",VTOI(vp)->i_number,(str))
 
@@ -968,15 +968,14 @@
 #ifdef DIAGNOSTIC
                if (sup->su_nbytes + DINODE_SIZE * ndupino < DINODE_SIZE) {
                        printf("lfs_writeinode: negative bytes "
-                              "(segment %" PRId64 " short by %d, "
-                              "oldsn=%u, cursn=%u, daddr=%d, su_nbytes=%u, "
+                              "(segment %" PRIu32 " short by %d, "
+                              "oldsn=%" PRIu32 ", cursn=%" PRIu32
+                              ", daddr=%" PRId64 ", su_nbytes=%u, "
                               "ndupino=%d)\n",
                               dtosn(fs, daddr),
                               (int)DINODE_SIZE * (1 - sp->ndupino)
                                   - sup->su_nbytes,
-                              (unsigned int)oldsn,
-                              (unsigned int)sp->seg_number,
-                              (int)daddr,
+                              oldsn, sp->seg_number, daddr,
                               (unsigned int)sup->su_nbytes,
                               sp->ndupino);
                        panic("lfs_writeinode: negative bytes");
@@ -1079,7 +1078,7 @@
                if ((bp->b_flags & (B_BUSY|B_GATHERED)) || !match(fs, bp)) {
 #ifdef DEBUG_LFS
                        if (vp == fs->lfs_ivnode && (bp->b_flags & (B_BUSY|B_GATHERED)) == B_BUSY)
-                               printf("(%d:%lx)", bp->b_lblkno, bp->b_flags);
+                               printf("(%" PRId64 ":%lx)", bp->b_lblkno, bp->b_flags);
 #endif
                        continue;
                }
@@ -1290,7 +1289,7 @@
 #ifdef DIAGNOSTIC
                        if (sup->su_nbytes + DINODE_SIZE * ndupino < osize) {
                                printf("lfs_updatemeta: negative bytes "
-                                      "(segment %" PRId64 " short by %d)\n",
+                                      "(segment %" PRIu32 " short by %d)\n",
                                       dtosn(fs, daddr),
                                       osize - sup->su_nbytes);
                                printf("lfs_updatemeta: ino %d, lbn %" PRId64
@@ -1302,8 +1301,8 @@
                        }
 #endif
 #ifdef DEBUG_SU_NBYTES
-                       printf("seg %d -= %ld for ino %d lbn %" PRId64
-                               " db 0x%x\n",
+                       printf("seg %" PRIu32 " -= %d for ino %d lbn %" PRId64
+                               " db 0x%" PRIx64 "\n",
                                dtosn(fs, daddr), osize,
                                VTOI(sp->vp)->i_number, lbn, daddr);
 #endif
@@ -1617,10 +1616,10 @@
                if ((*bpp)->b_vp != devvp) {
                        sup->su_nbytes += (*bpp)->b_bcount;
 #ifdef DEBUG_SU_NBYTES
-               printf("seg %d += %ld for ino %d lbn %" PRId64 " db 0x%x\n",
-                      sp->seg_number, (*bpp)->b_bcount,
-                      VTOI((*bpp)->b_vp)->i_number,
-                      (*bpp)->b_lblkno, (*bpp)->b_blkno);
+               printf("seg %" PRIu32 " += %ld for ino %d lbn %" PRId64
+                   " db 0x%" PRIx64 "\n", sp->seg_number, (*bpp)->b_bcount,
+                   VTOI((*bpp)->b_vp)->i_number, (*bpp)->b_lblkno,
+                   (*bpp)->b_blkno);
 #endif
                }
        }
@@ -1859,8 +1858,8 @@
 #if defined(DEBUG) && defined(DIAGNOSTIC)
                if(dtosn(fs, dbtofsb(fs, (*bpp)->b_blkno + btodb((*bpp)->b_bcount - 1))) !=
                   dtosn(fs, dbtofsb(fs, cbp->b_blkno))) {
-                       printf("block at %" PRIx64 " (%" PRId64 "), "
-                              "cbp at %" PRIx64 " (%" PRId64 ")\n",
+                       printf("block at %" PRId64 " (%" PRIu32 "), "
+                              "cbp at %" PRId64 " (%" PRIu32 ")\n",
                                (*bpp)->b_blkno, dtosn(fs, dbtofsb(fs, (*bpp)->b_blkno)),
                               cbp->b_blkno, dtosn(fs, dbtofsb(fs, cbp->b_blkno)));
                        panic("lfs_writeseg: Segment overwrite");
diff -r 32dee1be2cad -r 3cce5e3907a5 sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c  Mon Jan 27 22:38:24 2003 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c  Mon Jan 27 23:17:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vfsops.c,v 1.88 2003/01/25 23:00:09 kleink Exp $   */
+/*     $NetBSD: lfs_vfsops.c,v 1.89 2003/01/27 23:17:57 yamt Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.88 2003/01/25 23:00:09 kleink Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.89 2003/01/27 23:17:57 yamt Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -446,7 +446,7 @@
 #ifdef DIAGNOSTIC
                if (sup->su_nbytes < size) {
                        panic("update_meta: negative bytes "
-                             "(segment %" PRId64 " short by %ld)\n",
+                             "(segment %" PRIu32 " short by %ld)\n",
                              dtosn(fs, dbtofsb(fs, odaddr)), (long)size - sup->su_nbytes);
                        sup->su_nbytes = size;
                }
@@ -465,8 +465,8 @@
        /* Now look again to make sure it worked */
        ufs_bmaparray(vp, lbn, &odaddr, &a[0], &num, NULL );
        if (dbtofsb(fs, odaddr) != ndaddr)
-               printf("update_meta: failed setting ino %d lbn %d to %x\n",
-                      ino, lbn, ndaddr);
+               printf("update_meta: failed setting ino %d lbn %" PRId64
+                   " to %" PRId64 "\n", ino, lbn, ndaddr);
 #endif
        vput(vp);
        return 0;
@@ -602,21 +602,21 @@
                                           fs->lfs_sumsize -
                                           sizeof(ssp->ss_sumsum))) {
 #ifdef DEBUG_LFS_RFW
-                       printf("Sumsum error at 0x%x\n", offset);
+                       printf("Sumsum error at 0x%" PRIx64 "\n", offset);
 #endif
                        offset = -1;
                        goto err1;
                }
                if (ssp->ss_nfinfo == 0 && ssp->ss_ninos == 0) {
 #ifdef DEBUG_LFS_RFW
-                       printf("Empty pseg at 0x%x\n", offset);
+                       printf("Empty pseg at 0x%" PRIx64 "\n", offset);
 #endif
                        offset = -1;
                        goto err1;
                }
                if (ssp->ss_create < fs->lfs_tstamp) {
 #ifdef DEBUG_LFS_RFW
-                       printf("Old data at 0x%x\n", offset);
+                       printf("Old data at 0x%" PRIx64 "\n", offset);
 #endif
                        offset = -1;
                        goto err1;
@@ -626,15 +626,16 @@
                serial = ssp->ss_serial;
                if (serial != fs->lfs_serial + 1) {
 #ifdef DEBUG_LFS_RFW
-                       printf("Unexpected serial number at 0x%x\n", offset);
+                       printf("Unexpected serial number at 0x%" PRIx64
+                           "\n", offset);
 #endif
                        offset = -1;
                        goto err1;
                }
                if (ssp->ss_ident != fs->lfs_ident) {
 #ifdef DEBUG_LFS_RFW
-                       printf("Incorrect fsid (0x%x vs 0x%x) at 0x%x\n",
-                              ssp->ss_ident, fs->lfs_ident, offset);
+                       printf("Incorrect fsid (0x%x vs 0x%x) at 0x%"
+                           PRIx64 "\n", ssp->ss_ident, fs->lfs_ident, offset);
 #endif
                        offset = -1;
                        goto err1;
@@ -731,8 +732,8 @@
           ssp->ss_datasum != cksum(datap, nblocks * sizeof(u_long)))
        {
 #ifdef DEBUG_LFS_RFW
-               printf("Datasum error at 0x%x (wanted %x got %x)\n", offset,
-                      ssp->ss_datasum, cksum(datap, nblocks *
+               printf("Datasum error at 0x%" PRIx64 " (wanted %x got %x)\n",
+                   offset, ssp->ss_datasum, cksum(datap, nblocks *
                                              sizeof(u_long)));
 #endif
                offset = -1;
@@ -748,7 +749,7 @@
                }
                offset = ssp->ss_next;
 #ifdef DEBUG_LFS_RFW
-               printf("LFS roll forward: moving on to offset 0x%x "
+               printf("LFS roll forward: moving on to offset 0x%" PRIx64
                       " -> segment %d\n", offset, dtosn(fs,offset));
 #endif
        }
@@ -1038,8 +1039,8 @@
                lastgoodpseg = oldoffset = offset = fs->lfs_offset;
                flags = 0x0;
 #ifdef DEBUG_LFS_RFW
-               printf("LFS roll forward phase 1: starting at offset 0x%x\n",
-                      offset);
+               printf("LFS roll forward phase 1: starting at offset 0x%"
+                   PRIx64 "\n", offset);
 #endif
                LFS_SEGENTRY(sup, fs, dtosn(fs, offset), bp);
                if (!(sup->su_flags & SEGUSE_DIRTY))
@@ -1059,14 +1060,14 @@
                        }
 
 #ifdef DEBUG_LFS_RFW
-                       printf("LFS roll forward phase 1: offset=0x%x\n",
-                              offset);
+                       printf("LFS roll forward phase 1: offset=0x%"
+                           PRIx64 "\n", offset);
                        if (flags & SS_DIROP) {
-                               printf("lfs_mountfs: dirops at 0x%x\n",
+                               printf("lfs_mountfs: dirops at 0x%" PRIx64 "\n",
                                       oldoffset);
                                if (!(flags & SS_CONT))
                                        printf("lfs_mountfs: dirops end "
-                                              "at 0x%x\n", oldoffset);
+                                              "at 0x%" PRIx64 "\n", oldoffset);
                        }
 #endif
                        if (!(flags & SS_CONT))
@@ -1079,7 +1080,7 @@
                               "dirops discarded\n");
                }
                printf("LFS roll forward phase 1: completed: "
-                      "lastgoodpseg=0x%x\n", lastgoodpseg);
+                      "lastgoodpseg=0x%" PRIx64 "\n", lastgoodpseg);
 #endif
                oldoffset = fs->lfs_offset;
                if (fs->lfs_offset != lastgoodpseg) {
@@ -1104,8 +1105,8 @@
                         */
                        while (offset != lastgoodpseg) {
 #ifdef DEBUG_LFS_RFW
-                               printf("LFS roll forward phase 2: 0x%x\n",
-                                      offset);
+                               printf("LFS roll forward phase 2: 0x%"
+                                   PRIx64 "\n", offset);
 #endif
                                offset = check_segsum(fs, offset, cred,
                                                      CHECK_UPDATE, NULL, p);



Home | Main Index | Thread Index | Old Index