Source-Changes-HG archive

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

[src/trunk]: src Prefix most of the cpp macros with lfs_ and LFS_ to avoid co...



details:   https://anonhg.NetBSD.org/src/rev/e50c6f02ac70
branches:  trunk
changeset: 787450:e50c6f02ac70
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jun 18 18:18:57 2013 +0000

description:
Prefix most of the cpp macros with lfs_ and LFS_ to avoid conflicts with ffs.
This was done so that boot blocks that want to compile both FFS and LFS in
the same file work.

diffstat:

 libexec/lfs_cleanerd/coalesce.c            |   12 +-
 libexec/lfs_cleanerd/fdfs.c                |   13 +-
 libexec/lfs_cleanerd/lfs_cleanerd.c        |   32 +++---
 sbin/fsck_lfs/dir.c                        |   12 +-
 sbin/fsck_lfs/inode.c                      |   34 +++---
 sbin/fsck_lfs/lfs.c                        |   88 +++++++++---------
 sbin/fsck_lfs/pass1.c                      |    8 +-
 sbin/fsck_lfs/pass4.c                      |    8 +-
 sbin/fsck_lfs/pass5.c                      |   30 +++---
 sbin/fsck_lfs/pass6.c                      |  140 ++++++++++++++--------------
 sbin/fsck_lfs/segwrite.c                   |   98 ++++++++++----------
 sbin/fsck_lfs/setup.c                      |   26 ++--
 sbin/newfs_lfs/make_lfs.c                  |   88 +++++++++---------
 sbin/newfs_lfs/newfs.c                     |   20 ++--
 sys/arch/hp700/stand/xxboot/readufs.h      |    4 +-
 sys/arch/x68k/stand/boot_ufs/readufs.h     |    3 +-
 sys/arch/x68k/stand/boot_ufs/readufs_lfs.c |    3 +-
 sys/lib/libsa/lfsv1.c                      |    9 +-
 sys/lib/libsa/lfsv2.c                      |   12 +-
 sys/ufs/lfs/lfs.h                          |   74 +++++++-------
 sys/ufs/lfs/lfs_alloc.c                    |   16 +-
 sys/ufs/lfs/lfs_balloc.c                   |   36 +++---
 sys/ufs/lfs/lfs_bio.c                      |   16 +-
 sys/ufs/lfs/lfs_debug.c                    |   10 +-
 sys/ufs/lfs/lfs_inode.c                    |  104 ++++++++++----------
 sys/ufs/lfs/lfs_rfw.c                      |   74 +++++++-------
 sys/ufs/lfs/lfs_segment.c                  |  122 ++++++++++++------------
 sys/ufs/lfs/lfs_subr.c                     |    8 +-
 sys/ufs/lfs/lfs_syscalls.c                 |   46 ++++----
 sys/ufs/lfs/lfs_vfsops.c                   |   65 ++++++------
 sys/ufs/lfs/lfs_vnops.c                    |   30 +++---
 sys/ufs/lfs/ulfs_inode.h                   |    6 +-
 sys/ufs/lfs/ulfs_lookup.c                  |   12 +-
 sys/ufs/lfs/ulfs_readwrite.c               |   48 ++++----
 usr.sbin/dumplfs/dumplfs.c                 |   56 +++++-----
 35 files changed, 686 insertions(+), 677 deletions(-)

diffs (truncated from 4319 to 300 lines):

diff -r aff1176170ae -r e50c6f02ac70 libexec/lfs_cleanerd/coalesce.c
--- a/libexec/lfs_cleanerd/coalesce.c   Tue Jun 18 15:42:54 2013 +0000
+++ b/libexec/lfs_cleanerd/coalesce.c   Tue Jun 18 18:18:57 2013 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: coalesce.c,v 1.22 2013/06/08 21:15:30 dholland Exp $  */
+/*      $NetBSD: coalesce.c,v 1.23 2013/06/18 18:18:57 christos Exp $  */
 
 /*-
  * Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
@@ -160,7 +160,7 @@
                return COALESCE_NOINODE;
 
        /* Compute file block size, set up for bmapv */
-       onb = nb = lblkno(fs, dip->di_size);
+       onb = nb = lfs_lblkno(fs, dip->di_size);
 
        /* XXX for now, don't do any file small enough to have fragments */
        if (nb < ULFS_NDADDR) {
@@ -229,7 +229,7 @@
         * can have a break or two and it's okay.
         */
        if (nb <= 1 || noff == 0 || noff < log2int(nb) ||
-           segtod(fs, noff) * 2 < nb) {
+           lfs_segtod(fs, noff) * 2 < nb) {
                retval = COALESCE_NOTWORTHIT;
                goto out;
        } else if (debug)
@@ -241,7 +241,7 @@
        for (i = 0; i < nb; i++) {
                if (bip[i].bi_daddr <= 0)
                        continue;
-               sup = &fs->clfs_segtab[dtosn(fs, bip[i].bi_daddr)];
+               sup = &fs->clfs_segtab[lfs_dtosn(fs, bip[i].bi_daddr)];
                if (sup->flags & SEGUSE_ACTIVE)
                        bip[i].bi_daddr = LFS_UNUSED_DADDR; /* 0 */
        }
@@ -280,7 +280,7 @@
                }
 
                if (kops.ko_pread(fs->clfs_devfd, bip[i].bi_bp, bip[i].bi_size,
-                         fsbtob(fs, bip[i].bi_daddr)) < 0) {
+                         lfs_fsbtob(fs, bip[i].bi_daddr)) < 0) {
                        retval = COALESCE_EIO;
                        goto out;
                }
@@ -294,7 +294,7 @@
         * than half of the available segments, sleep until that's not
         * true any more.
         */
-       bps = segtod(fs, 1);
+       bps = lfs_segtod(fs, 1);
        for (tbip = bip; tbip < bip + nb; tbip += bps) {
                do {
                        bread(fs->lfs_ivnode, 0, fs->lfs_bsize, NOCRED, 0, &bp);
diff -r aff1176170ae -r e50c6f02ac70 libexec/lfs_cleanerd/fdfs.c
--- a/libexec/lfs_cleanerd/fdfs.c       Tue Jun 18 15:42:54 2013 +0000
+++ b/libexec/lfs_cleanerd/fdfs.c       Tue Jun 18 18:18:57 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdfs.c,v 1.9 2012/04/12 10:30:17 joerg Exp $        */
+/* $NetBSD: fdfs.c,v 1.10 2013/06/18 18:18:57 christos Exp $    */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -64,12 +64,11 @@
        struct uvnode *vp;
        int i;
 
-       fs = (struct fdfs *)malloc(sizeof(*fs));
+       fs = malloc(sizeof(*fs));
        if (fs == NULL)
                return NULL;
        if (segsize > 0) {
-               fs->fd_bufp = (struct fd_buf *)malloc(nseg *
-                                                     sizeof(struct fd_buf));
+               fs->fd_bufp = malloc(nseg * sizeof(struct fd_buf));
                if (fs->fd_bufp == NULL) {
                        free(fs);
                        return NULL;
@@ -77,7 +76,7 @@
                for (i = 0; i < nseg; i++) {
                        fs->fd_bufp[i].start = 0x0;
                        fs->fd_bufp[i].end = 0x0;
-                       fs->fd_bufp[i].buf = (char *)malloc(segsize);
+                       fs->fd_bufp[i].buf = malloc(segsize);
                        if (fs->fd_bufp[i].buf == NULL) {
                                while (--i >= 0)
                                        free(fs->fd_bufp[i].buf);
@@ -95,7 +94,7 @@
        fs->fd_bsize = bsize;
        fs->fd_ssize = segsize;
 
-       vp = (struct uvnode *) malloc(sizeof(*vp));
+       vp = malloc(sizeof(*vp));
        if (vp == NULL) {
                if (fs->fd_bufp) {
                        for (i = 0; i < nseg; i++)
@@ -190,7 +189,7 @@
                fs->fd_bufp = t;
                fs->fd_bufp[fs->fd_bufi].start = 0x0;
                fs->fd_bufp[fs->fd_bufi].end = 0x0;
-               fs->fd_bufp[fs->fd_bufi].buf = (char *)malloc(fs->fd_ssize);
+               fs->fd_bufp[fs->fd_bufi].buf = malloc(fs->fd_ssize);
                if (fs->fd_bufp[fs->fd_bufi].buf == NULL) {
                        syslog(LOG_NOTICE, "failed to allocate buffer #%d\n",
                                fs->fd_bufc);
diff -r aff1176170ae -r e50c6f02ac70 libexec/lfs_cleanerd/lfs_cleanerd.c
--- a/libexec/lfs_cleanerd/lfs_cleanerd.c       Tue Jun 18 15:42:54 2013 +0000
+++ b/libexec/lfs_cleanerd/lfs_cleanerd.c       Tue Jun 18 18:18:57 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_cleanerd.c,v 1.35 2013/06/08 21:15:30 dholland Exp $    */
+/* $NetBSD: lfs_cleanerd.c,v 1.36 2013/06/18 18:18:57 christos Exp $    */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -438,7 +438,7 @@
                 */
                if (fic >= ssp->ss_nfinfo && *iaddrp != daddr) {
                        syslog(LOG_WARNING, "%s: bad pseg at %x (seg %d)",
-                              fs->lfs_fsmnt, odaddr, dtosn(fs, odaddr));
+                              fs->lfs_fsmnt, odaddr, lfs_dtosn(fs, odaddr));
                        *bipp = bip;
                        return 0x0;
                }
@@ -487,7 +487,7 @@
                                bip[*bic - 1].bi_size = LFS_DINODE1_SIZE;
                        }
                        inoc += i;
-                       daddr += btofsb(fs, fs->lfs_ibsize);
+                       daddr += lfs_btofsb(fs, fs->lfs_ibsize);
                        --iaddrp;
                        continue;
                }
@@ -512,7 +512,7 @@
                        SEGSUM *nssp;
 
                        syslog(LOG_WARNING, "fixing short FINFO at %x (seg %d)",
-                              odaddr, dtosn(fs, odaddr));
+                              odaddr, lfs_dtosn(fs, odaddr));
                        bread(fs->clfs_devvp, odaddr, fs->lfs_fsize,
                            NOCRED, 0, &nbp);
                        nssp = (SEGSUM *)nbp->b_data;
@@ -522,7 +522,7 @@
                        bwrite(nbp);
 #endif
                        syslog(LOG_WARNING, "zero-length FINFO at %x (seg %d)",
-                              odaddr, dtosn(fs, odaddr));
+                              odaddr, lfs_dtosn(fs, odaddr));
                        continue;
                }
 
@@ -545,7 +545,7 @@
                                        fip->fi_lastlength : fs->lfs_bsize;
                                cp = fd_ptrget(fs->clfs_devvp, daddr);
                                ck = lfs_cksum_part(cp, sizeof(u_int32_t), ck);
-                               daddr += btofsb(fs, size);
+                               daddr += lfs_btofsb(fs, size);
                        }
                        fip = (FINFO *)(fip->fi_blocks + fip->fi_nblocks);
                        continue;
@@ -572,7 +572,7 @@
                        cp = fd_ptrget(fs->clfs_devvp, daddr);
                        ck = lfs_cksum_part(cp, sizeof(u_int32_t), ck);
                        bip[*bic + i].bi_bp = cp;
-                       daddr += btofsb(fs, bip[*bic + i].bi_size);
+                       daddr += lfs_btofsb(fs, bip[*bic + i].bi_size);
 
 #ifdef TEST_PATTERN
                        check_test_pattern(bip + *bic + i); /* XXXDEBUG */
@@ -613,7 +613,7 @@
         * indexed by the segment serial numbers; but it is not suitable
         * for everyday use since the copylog will be simply enormous.
          */
-       cp = fd_ptrget(fs->clfs_devvp, sntod(fs, sn));
+       cp = fd_ptrget(fs->clfs_devvp, lfs_sntod(fs, sn));
 
         fp = fopen(copylog_filename, "ab");
         if (fp != NULL) {
@@ -634,18 +634,18 @@
        int32_t daddr;
        int i, npseg;
 
-       daddr = sntod(fs, sn);
-       if (daddr < btofsb(fs, LFS_LABELPAD))
-               daddr = btofsb(fs, LFS_LABELPAD);
+       daddr = lfs_sntod(fs, sn);
+       if (daddr < lfs_btofsb(fs, LFS_LABELPAD))
+               daddr = lfs_btofsb(fs, LFS_LABELPAD);
        for (i = 0; i < LFS_MAXNUMSB; i++) {
                if (fs->lfs_sboffs[i] == daddr) {
-                       daddr += btofsb(fs, LFS_SBPAD);
+                       daddr += lfs_btofsb(fs, LFS_SBPAD);
                        break;
                }
        }
 
        /* Preload the segment buffer */
-       if (fd_preload(fs->clfs_devvp, sntod(fs, sn)) < 0)
+       if (fd_preload(fs->clfs_devvp, lfs_sntod(fs, sn)) < 0)
                return -1;
 
        if (copylog_filename)
@@ -657,8 +657,8 @@
        ++fs->clfs_nactive;
 
        npseg = 0;
-       while(dtosn(fs, daddr) == sn &&
-             dtosn(fs, daddr + btofsb(fs, fs->lfs_bsize)) == sn) {
+       while(lfs_dtosn(fs, daddr) == sn &&
+             lfs_dtosn(fs, daddr + lfs_btofsb(fs, fs->lfs_bsize)) == sn) {
                daddr = parse_pseg(fs, daddr, bipp, bic);
                if (daddr == 0x0) {
                        ++cleaner_stats.segs_error;
@@ -1237,7 +1237,7 @@
        }
 
        /* Compute theoretical "free segments" maximum based on usage */
-       fsb_per_seg = segtod(fs, 1);
+       fsb_per_seg = lfs_segtod(fs, 1);
        max_free_segs = MAX(cip->bfree, 0) / fsb_per_seg + fs->lfs_minfreeseg;
 
        dlog("%s: bfree = %d, avail = %d, clean = %d/%d",
diff -r aff1176170ae -r e50c6f02ac70 sbin/fsck_lfs/dir.c
--- a/sbin/fsck_lfs/dir.c       Tue Jun 18 15:42:54 2013 +0000
+++ b/sbin/fsck_lfs/dir.c       Tue Jun 18 18:18:57 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.31 2013/06/08 02:16:03 dholland Exp $     */
+/* $NetBSD: dir.c,v 1.32 2013/06/18 18:18:58 christos Exp $     */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -563,7 +563,7 @@
        struct ubuf *bp;
        char *cp, firstblk[LFS_DIRBLKSIZ];
 
-       lastbn = lblkno(fs, dp->di_size);
+       lastbn = lfs_lblkno(fs, dp->di_size);
        if (lastbn >= ULFS_NDADDR - 1 || dp->di_db[lastbn] == 0 || dp->di_size == 0)
                return (0);
        dp->di_db[lastbn + 1] = dp->di_db[lastbn];
@@ -571,9 +571,9 @@
        bp = getblk(vp, lastbn, fs->lfs_bsize);
        VOP_BWRITE(bp);
        dp->di_size += fs->lfs_bsize;
-       dp->di_blocks += btofsb(fs, fs->lfs_bsize);
+       dp->di_blocks += lfs_btofsb(fs, fs->lfs_bsize);
        bread(vp, dp->di_db[lastbn + 1],
-           (long) dblksize(fs, dp, lastbn + 1), NOCRED, 0, &bp);
+           (long) lfs_dblksize(fs, dp, lastbn + 1), NOCRED, 0, &bp);
        if (bp->b_flags & B_ERROR)
                goto bad;
        memcpy(firstblk, bp->b_data, LFS_DIRBLKSIZ);
@@ -587,7 +587,7 @@
                memcpy(cp, &emptydir, sizeof emptydir);
        VOP_BWRITE(bp);
        bread(vp, dp->di_db[lastbn + 1],
-           (long) dblksize(fs, dp, lastbn + 1), NOCRED, 0, &bp);
+           (long) lfs_dblksize(fs, dp, lastbn + 1), NOCRED, 0, &bp);
        if (bp->b_flags & B_ERROR)
                goto bad;
        memcpy(bp->b_data, &emptydir, sizeof emptydir);
@@ -603,7 +603,7 @@
        dp->di_db[lastbn] = dp->di_db[lastbn + 1];
        dp->di_db[lastbn + 1] = 0;
        dp->di_size -= fs->lfs_bsize;
-       dp->di_blocks -= btofsb(fs, fs->lfs_bsize);
+       dp->di_blocks -= lfs_btofsb(fs, fs->lfs_bsize);
        return (0);
 }
 
diff -r aff1176170ae -r e50c6f02ac70 sbin/fsck_lfs/inode.c
--- a/sbin/fsck_lfs/inode.c     Tue Jun 18 15:42:54 2013 +0000
+++ b/sbin/fsck_lfs/inode.c     Tue Jun 18 18:18:57 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.50 2013/06/08 02:16:03 dholland Exp $   */
+/* $NetBSD: inode.c,v 1.51 2013/06/18 18:18:58 christos Exp $   */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
        if (din_table[ino] == 0x0) {
                LFS_IENTRY(ifp, fs, ino, bp);
                din_table[ino] = ifp->if_daddr;
-               seg_table[dtosn(fs, ifp->if_daddr)].su_nbytes += LFS_DINODE1_SIZE;
+               seg_table[lfs_dtosn(fs, ifp->if_daddr)].su_nbytes += LFS_DINODE1_SIZE;
                brelse(bp, 0);
        }
        return (VTOI(vp)->i_din.ffs1_din);
@@ -149,11 +149,11 @@
                ap = dino.di_db + lbn;
                if (thisvp)
                        idesc->id_numfrags =
-                               numfrags(fs, VTOI(thisvp)->i_lfs_fragsize[lbn]);
+                               lfs_numfrags(fs, VTOI(thisvp)->i_lfs_fragsize[lbn]);
                else {
-                       if (--ndb == 0 && (offset = blkoff(fs, dino.di_size)) != 0) {
+                       if (--ndb == 0 && (offset = lfs_blkoff(fs, dino.di_size)) != 0) {
                                idesc->id_numfrags =
-                               numfrags(fs, fragroundup(fs, offset));
+                               lfs_numfrags(fs, lfs_fragroundup(fs, offset));
                        } else



Home | Main Index | Thread Index | Old Index