Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Fix minor bitrot in #if 0 or otherwise disabled ...



details:   https://anonhg.NetBSD.org/src/rev/4c605a79282f
branches:  trunk
changeset: 811065:4c605a79282f
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Oct 10 22:34:33 2015 +0000

description:
Fix minor bitrot in #if 0 or otherwise disabled code.

diffstat:

 sys/ufs/lfs/lfs_alloc.c    |  11 ++++++-----
 sys/ufs/lfs/lfs_segment.c  |   6 +++---
 sys/ufs/lfs/lfs_syscalls.c |  12 +++++++-----
 3 files changed, 16 insertions(+), 13 deletions(-)

diffs (121 lines):

diff -r 2845ed38e175 -r 4c605a79282f sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c   Sat Oct 10 22:34:19 2015 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c   Sat Oct 10 22:34:33 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_alloc.c,v 1.130 2015/09/13 07:53:37 dholland Exp $ */
+/*     $NetBSD: lfs_alloc.c,v 1.131 2015/10/10 22:34:33 dholland Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.130 2015/09/13 07:53:37 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.131 2015/10/10 22:34:33 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -327,7 +327,8 @@
        ino_t ino, maxino;
 
        maxino = ((fs->lfs_ivnode->v_size >> lfs_sb_getbshift(fs)) -
-                 lfs_sb_getcleansz(fs) - lfs_sb_getsegtabsz(fs)) * fs->lfs_ifpb;
+                 lfs_sb_getcleansz(fs) - lfs_sb_getsegtabsz(fs)) *
+               lfs_sb_getifpb(fs);
        for (ino = maxino - 1; ino > LFS_UNUSED_INUM; --ino) {
                if (ISSET_BITMAP_FREE(fs, ino) == 0)
                        break;
@@ -602,8 +603,8 @@
                        lfs_truncate(vp, 0, 0, NOCRED);
                        vput(vp);
                        LFS_SEGENTRY(sup, fs, segno, bp);
-                       KASSERT(sup->su_nbytes >= LFS_DINODE1_SIZE);
-                       sup->su_nbytes -= LFS_DINODE1_SIZE;
+                       KASSERT(sup->su_nbytes >= DINOSIZE(fs));
+                       sup->su_nbytes -= DINOSIZE(fs);
                        LFS_WRITESEGENTRY(sup, fs, segno, bp);
 
                        /* Set up to fall through to next section */
diff -r 2845ed38e175 -r 4c605a79282f sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Sat Oct 10 22:34:19 2015 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Sat Oct 10 22:34:33 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.261 2015/10/10 22:33:31 dholland Exp $       */
+/*     $NetBSD: lfs_segment.c,v 1.262 2015/10/10 22:34:33 dholland Exp $       */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.261 2015/10/10 22:33:31 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.262 2015/10/10 22:34:33 dholland Exp $");
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {                                         \
@@ -2232,7 +2232,7 @@
                                if (copyin((void *)(*bpp)->b_saveaddr +
                                           byteoffset, dp, el_size)) {
                                        panic("lfs_writeseg: copyin failed [1]:"
-                                               " ino %d blk %" PRId64,
+                                               " ino %" PRIu64 " blk %" PRId64,
                                                VTOI((*bpp)->b_vp)->i_number,
                                                (*bpp)->b_lblkno);
                                }
diff -r 2845ed38e175 -r 4c605a79282f sys/ufs/lfs/lfs_syscalls.c
--- a/sys/ufs/lfs/lfs_syscalls.c        Sat Oct 10 22:34:19 2015 +0000
+++ b/sys/ufs/lfs/lfs_syscalls.c        Sat Oct 10 22:34:33 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_syscalls.c,v 1.170 2015/09/01 06:08:37 dholland Exp $      */
+/*     $NetBSD: lfs_syscalls.c,v 1.171 2015/10/10 22:34:33 dholland Exp $      */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.170 2015/09/01 06:08:37 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.171 2015/10/10 22:34:33 dholland Exp $");
 
 #ifndef LFS
 # define LFS           /* for prototypes in syscallargs.h */
@@ -122,7 +122,7 @@
        if ((error = copyin(SCARG(uap, fsidp), &fsid, sizeof(fsid_t))) != 0)
                return (error);
 
-       if ((mntp = vfs_getvfs(fsidp)) == NULL) 
+       if ((mntp = vfs_getvfs(&fsid)) == NULL) 
                return (ENOENT);
        fs = VFSTOULFS(mntp)->um_lfs;
 
@@ -136,7 +136,7 @@
                            blkcnt * sizeof(BLOCK_INFO))) != 0)
                goto out;
 
-       if ((error = lfs_markv(p, &fsid, blkiov, blkcnt)) == 0)
+       if ((error = lfs_markv(l, &fsid, blkiov, blkcnt)) == 0)
                copyout(blkiov, SCARG(uap, blkiov),
                        blkcnt * sizeof(BLOCK_INFO));
     out:
@@ -551,15 +551,17 @@
        fs = VFSTOULFS(mntp)->um_lfs;
 
        blkcnt = SCARG(uap, blkcnt);
+#if SIZE_T_MAX <= UINT_MAX
        if ((u_int) blkcnt > SIZE_T_MAX / sizeof(BLOCK_INFO))
                return (EINVAL);
+#endif
        KERNEL_LOCK(1, NULL);
        blkiov = lfs_malloc(fs, blkcnt * sizeof(BLOCK_INFO), LFS_NB_BLKIOV);
        if ((error = copyin(SCARG(uap, blkiov), blkiov,
                            blkcnt * sizeof(BLOCK_INFO))) != 0)
                goto out;
 
-       if ((error = lfs_bmapv(p, &fsid, blkiov, blkcnt)) == 0)
+       if ((error = lfs_bmapv(l, &fsid, blkiov, blkcnt)) == 0)
                copyout(blkiov, SCARG(uap, blkiov),
                        blkcnt * sizeof(BLOCK_INFO));
     out:



Home | Main Index | Thread Index | Old Index