Source-Changes-HG archive

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

[src/trunk]: src Pass around struct lfs_dirheader instead of struct lfs_direct.



details:   https://anonhg.NetBSD.org/src/rev/98842e55e1ca
branches:  trunk
changeset: 340592:98842e55e1ca
user:      dholland <dholland%NetBSD.org@localhost>
date:      Tue Sep 15 15:02:25 2015 +0000

description:
Pass around struct lfs_dirheader instead of struct lfs_direct.

diffstat:

 sbin/fsck_lfs/dir.c         |  28 +++++++++++++-------------
 sbin/fsck_lfs/extern.h      |   4 +-
 sbin/fsck_lfs/fsck.h        |   4 +-
 sbin/fsck_lfs/inode.c       |   6 ++--
 sbin/fsck_lfs/pass2.c       |   8 +++---
 sbin/newfs_lfs/make_lfs.c   |   6 ++--
 sys/ufs/lfs/lfs_accessors.h |  46 ++++++++++++++++++++++----------------------
 sys/ufs/lfs/lfs_rename.c    |  10 ++++----
 sys/ufs/lfs/ulfs_dirhash.c  |  32 +++++++++++++++---------------
 sys/ufs/lfs/ulfs_dirhash.h  |   8 +++---
 sys/ufs/lfs/ulfs_extern.h   |   4 +-
 sys/ufs/lfs/ulfs_lookup.c   |  28 +++++++++++++-------------
 sys/ufs/lfs/ulfs_vnops.c    |  10 ++++----
 13 files changed, 97 insertions(+), 97 deletions(-)

diffs (truncated from 742 to 300 lines):

diff -r 79dfbeaddbb9 -r 98842e55e1ca sbin/fsck_lfs/dir.c
--- a/sbin/fsck_lfs/dir.c       Tue Sep 15 15:02:01 2015 +0000
+++ b/sbin/fsck_lfs/dir.c       Tue Sep 15 15:02:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.42 2015/09/15 15:02:01 dholland Exp $     */
+/* $NetBSD: dir.c,v 1.43 2015/09/15 15:02:25 dholland Exp $     */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -85,7 +85,7 @@
 
 static int expanddir(struct uvnode *, union lfs_dinode *, char *);
 static void freedir(ino_t, ino_t);
-static struct lfs_direct *fsck_readdir(struct uvnode *, struct inodesc *);
+static struct lfs_dirheader *fsck_readdir(struct uvnode *, struct inodesc *);
 static int lftempname(char *, ino_t);
 static int mkentry(struct inodesc *);
 static int chgino(struct inodesc *);
@@ -132,7 +132,7 @@
 int
 dirscan(struct inodesc *idesc)
 {
-       struct lfs_direct *dp;
+       struct lfs_dirheader *dp;
        struct ubuf *bp;
        int dsize, n;
        long blksiz;
@@ -156,7 +156,7 @@
            dp = fsck_readdir(vp, idesc)) {
                dsize = lfs_dir_getreclen(fs, dp);
                memcpy(dbuf, dp, (size_t) dsize);
-               idesc->id_dirp = (struct lfs_direct *) dbuf;
+               idesc->id_dirp = (struct lfs_dirheader *) dbuf;
                if ((n = (*idesc->id_func) (idesc)) & ALTERED) {
                        bread(vp, idesc->id_lblkno, blksiz, 0, &bp);
                        memcpy(bp->b_data + idesc->id_loc - dsize, dbuf,
@@ -173,10 +173,10 @@
 /*
  * get next entry in a directory.
  */
-static struct lfs_direct *
+static struct lfs_dirheader *
 fsck_readdir(struct uvnode *vp, struct inodesc *idesc)
 {
-       struct lfs_direct *dp, *ndp;
+       struct lfs_dirheader *dp, *ndp;
        struct ubuf *bp;
        long size, blksiz, fix, dploc;
 
@@ -184,7 +184,7 @@
        bread(vp, idesc->id_lblkno, blksiz, 0, &bp);
        if (idesc->id_loc % LFS_DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
            idesc->id_loc < blksiz) {
-               dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
+               dp = (struct lfs_dirheader *) (bp->b_data + idesc->id_loc);
                if (dircheck(idesc, dp))
                        goto dpok;
                brelse(bp, 0);
@@ -192,7 +192,7 @@
                        return (0);
                fix = dofix(idesc, "DIRECTORY CORRUPTED");
                bread(vp, idesc->id_lblkno, blksiz, 0, &bp);
-               dp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
+               dp = (struct lfs_dirheader *) (bp->b_data + idesc->id_loc);
                lfs_dir_setino(fs, dp, 0);
                lfs_dir_settype(fs, dp, LFS_DT_UNKNOWN);
                lfs_dir_setnamlen(fs, dp, 0);
@@ -214,14 +214,14 @@
                return NULL;
        }
        dploc = idesc->id_loc;
-       dp = (struct lfs_direct *) (bp->b_data + dploc);
+       dp = (struct lfs_dirheader *) (bp->b_data + dploc);
        idesc->id_loc += lfs_dir_getreclen(fs, dp);
        idesc->id_filesize -= lfs_dir_getreclen(fs, dp);
        if ((idesc->id_loc % LFS_DIRBLKSIZ) == 0) {
                brelse(bp, 0);
                return dp;
        }
-       ndp = (struct lfs_direct *) (bp->b_data + idesc->id_loc);
+       ndp = (struct lfs_dirheader *) (bp->b_data + idesc->id_loc);
        if (idesc->id_loc < blksiz && idesc->id_filesize > 0 &&
            dircheck(idesc, ndp) == 0) {
                brelse(bp, 0);
@@ -232,7 +232,7 @@
                        return 0;
                fix = dofix(idesc, "DIRECTORY CORRUPTED");
                bread(vp, idesc->id_lblkno, blksiz, 0, &bp);
-               dp = (struct lfs_direct *) (bp->b_data + dploc);
+               dp = (struct lfs_dirheader *) (bp->b_data + dploc);
                lfs_dir_setreclen(fs, dp, lfs_dir_getreclen(fs, dp) + size);
                if (fix)
                        VOP_BWRITE(bp);
@@ -249,7 +249,7 @@
  * This is a superset of the checks made in the kernel.
  */
 int
-dircheck(struct inodesc *idesc, struct lfs_direct *dp)
+dircheck(struct inodesc *idesc, struct lfs_dirheader *dp)
 {
        int size;
        const char *cp;
@@ -370,7 +370,7 @@
 static int
 mkentry(struct inodesc *idesc)
 {
-       struct lfs_direct *dirp = idesc->id_dirp;
+       struct lfs_dirheader *dirp = idesc->id_dirp;
        unsigned namlen;
        unsigned newreclen, oldreclen;
 
@@ -409,7 +409,7 @@
 static int
 chgino(struct inodesc *idesc)
 {
-       struct lfs_direct *dirp = idesc->id_dirp;
+       struct lfs_dirheader *dirp = idesc->id_dirp;
        int namlen;
 
        namlen = lfs_dir_getnamlen(fs, dirp);
diff -r 79dfbeaddbb9 -r 98842e55e1ca sbin/fsck_lfs/extern.h
--- a/sbin/fsck_lfs/extern.h    Tue Sep 15 15:02:01 2015 +0000
+++ b/sbin/fsck_lfs/extern.h    Tue Sep 15 15:02:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.12 2015/08/12 18:28:00 dholland Exp $  */
+/* $NetBSD: extern.h,v 1.13 2015/09/15 15:02:25 dholland Exp $  */
 
 /*
  * Copyright (c) 1994 James A. Jegers
@@ -36,7 +36,7 @@
 void ckfini(int);
 int ckinode(union lfs_dinode *, struct inodesc *);
 void clri(struct inodesc *, const char *, int);
-int dircheck(struct inodesc *, struct lfs_direct *);
+int dircheck(struct inodesc *, struct lfs_dirheader *);
 void direrror(ino_t, const char *);
 int dirscan(struct inodesc *);
 int dofix(struct inodesc *, const char *);
diff -r 79dfbeaddbb9 -r 98842e55e1ca sbin/fsck_lfs/fsck.h
--- a/sbin/fsck_lfs/fsck.h      Tue Sep 15 15:02:01 2015 +0000
+++ b/sbin/fsck_lfs/fsck.h      Tue Sep 15 15:02:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsck.h,v 1.21 2015/08/12 18:28:00 dholland Exp $    */
+/* $NetBSD: fsck.h,v 1.22 2015/09/15 15:02:25 dholland Exp $    */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -132,7 +132,7 @@
        off_t id_filesize;      /* for DATA nodes, the size of the directory */
        int id_loc;             /* for DATA nodes, current location in dir */
        int id_entryno;         /* for DATA nodes, current entry number */
-       struct lfs_direct *id_dirp;     /* for DATA nodes, ptr to current entry */
+       struct lfs_dirheader *id_dirp;  /* for DATA nodes, ptr to current entry */
        const char *id_name;    /* for DATA nodes, name to find or enter */
        char id_type;           /* type of descriptor, DATA or ADDR */
 };
diff -r 79dfbeaddbb9 -r 98842e55e1ca sbin/fsck_lfs/inode.c
--- a/sbin/fsck_lfs/inode.c     Tue Sep 15 15:02:01 2015 +0000
+++ b/sbin/fsck_lfs/inode.c     Tue Sep 15 15:02:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.66 2015/09/15 15:02:01 dholland Exp $   */
+/* $NetBSD: inode.c,v 1.67 2015/09/15 15:02:25 dholland Exp $   */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -501,7 +501,7 @@
 int
 findname(struct inodesc * idesc)
 {
-       struct lfs_direct *dirp = idesc->id_dirp;
+       struct lfs_dirheader *dirp = idesc->id_dirp;
        size_t len;
        char *buf;
 
@@ -522,7 +522,7 @@
 int
 findino(struct inodesc * idesc)
 {
-       struct lfs_direct *dirp = idesc->id_dirp;
+       struct lfs_dirheader *dirp = idesc->id_dirp;
        ino_t ino;
 
        ino = lfs_dir_getino(fs, dirp);
diff -r 79dfbeaddbb9 -r 98842e55e1ca sbin/fsck_lfs/pass2.c
--- a/sbin/fsck_lfs/pass2.c     Tue Sep 15 15:02:01 2015 +0000
+++ b/sbin/fsck_lfs/pass2.c     Tue Sep 15 15:02:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pass2.c,v 1.31 2015/09/15 15:02:01 dholland Exp $   */
+/* $NetBSD: pass2.c,v 1.32 2015/09/15 15:02:25 dholland Exp $   */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -212,12 +212,12 @@
 static int
 pass2check(struct inodesc * idesc)
 {
-       struct lfs_direct *dirp = idesc->id_dirp;
+       struct lfs_dirheader *dirp = idesc->id_dirp;
        struct inoinfo *inp;
        int n, entrysize, ret = 0;
        union lfs_dinode *dp;
        const char *errmsg;
-       struct lfs_direct proto;
+       struct lfs_dirheader proto;
        char namebuf[MAXPATHLEN + 1];
        char pathbuf[MAXPATHLEN + 1];
 
@@ -293,7 +293,7 @@
                lfs_dir_setreclen(fs, dirp, n);
                idesc->id_entryno++;
                lncntp[lfs_dir_getino(fs, dirp)]--;
-               dirp = (struct lfs_direct *) ((char *) (dirp) + n);
+               dirp = (struct lfs_dirheader *) ((char *) (dirp) + n);
                memset(dirp, 0, lfs_dir_getreclen(fs, &proto));
                lfs_dir_setreclen(fs, dirp, lfs_dir_getreclen(fs, &proto));
        }
diff -r 79dfbeaddbb9 -r 98842e55e1ca sbin/newfs_lfs/make_lfs.c
--- a/sbin/newfs_lfs/make_lfs.c Tue Sep 15 15:02:01 2015 +0000
+++ b/sbin/newfs_lfs/make_lfs.c Tue Sep 15 15:02:25 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make_lfs.c,v 1.53 2015/09/15 15:02:01 dholland Exp $   */
+/*     $NetBSD: make_lfs.c,v 1.54 2015/09/15 15:02:25 dholland Exp $   */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 #if 0
 static char sccsid[] = "@(#)lfs.c      8.5 (Berkeley) 5/24/95";
 #else
-__RCSID("$NetBSD: make_lfs.c,v 1.53 2015/09/15 15:02:01 dholland Exp $");
+__RCSID("$NetBSD: make_lfs.c,v 1.54 2015/09/15 15:02:25 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -357,7 +357,7 @@
 make_dir(struct lfs *fs, void *bufp,
     const struct dirproto *protodir, unsigned numentries)
 {
-       struct lfs_direct *ep;
+       struct lfs_dirheader *ep;
        unsigned spaceleft;
        unsigned namlen, reclen;
        unsigned i;
diff -r 79dfbeaddbb9 -r 98842e55e1ca sys/ufs/lfs/lfs_accessors.h
--- a/sys/ufs/lfs/lfs_accessors.h       Tue Sep 15 15:02:01 2015 +0000
+++ b/sys/ufs/lfs/lfs_accessors.h       Tue Sep 15 15:02:25 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_accessors.h,v 1.26 2015/09/15 15:02:01 dholland Exp $      */
+/*     $NetBSD: lfs_accessors.h,v 1.27 2015/09/15 15:02:25 dholland Exp $      */
 
 /*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
@@ -223,7 +223,7 @@
  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  */
 #define        LFS_DIRECTSIZ(namlen) \
-       ((sizeof(struct lfs_direct) - (LFS_MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3))
+       (sizeof(struct lfs_dirheader) + (((namlen)+1 + 3) &~ 3))
 
 #if (BYTE_ORDER == LITTLE_ENDIAN)
 #define LFS_OLDDIRSIZ(oldfmt, dp, needswap)    \
@@ -242,75 +242,75 @@
 #define LFS_NEWDIRFMT  0
 
 #define LFS_NEXTDIR(fs, dp) \
-       ((struct lfs_direct *)((char *)(dp) + lfs_dir_getreclen(fs, dp)))
+       ((struct lfs_dirheader *)((char *)(dp) + lfs_dir_getreclen(fs, dp)))
 
 static __unused inline char *
-lfs_dir_nameptr(const STRUCT_LFS *fs, struct lfs_direct *dp)
+lfs_dir_nameptr(const STRUCT_LFS *fs, struct lfs_dirheader *dh)
 {
-       return (char *)(&dp->d_header + 1);
+       return (char *)(dh + 1);
 }
 
 static __unused inline uint32_t
-lfs_dir_getino(const STRUCT_LFS *fs, const struct lfs_direct *dp)
+lfs_dir_getino(const STRUCT_LFS *fs, const struct lfs_dirheader *dh)
 {
-       return LFS_SWAP_uint32_t(fs, dp->d_header.dh_ino);
+       return LFS_SWAP_uint32_t(fs, dh->dh_ino);
 }
 
 static __unused inline uint16_t
-lfs_dir_getreclen(const STRUCT_LFS *fs, const struct lfs_direct *dp)
+lfs_dir_getreclen(const STRUCT_LFS *fs, const struct lfs_dirheader *dh)
 {
-       return LFS_SWAP_uint16_t(fs, dp->d_header.dh_reclen);
+       return LFS_SWAP_uint16_t(fs, dh->dh_reclen);
 }
 
 static __unused inline uint8_t
-lfs_dir_gettype(const STRUCT_LFS *fs, const struct lfs_direct *dp)
+lfs_dir_gettype(const STRUCT_LFS *fs, const struct lfs_dirheader *dh)
 {
        if (fs->lfs_hasolddirfmt) {
                return LFS_DT_UNKNOWN;
        }
-       return dp->d_header.dh_type;



Home | Main Index | Thread Index | Old Index