From 5a420c1b9afb18e77342aae013d5dc0e17ea681b Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 9 Jun 2013 17:57:08 +0000 Subject: [PATCH] Stick UFS_ in front of these symbols: DIRBLKSIZ DIRECTSIZ DIRSIZ OLDDIRFMT NEWDIRFMT Part of PR 47909. --- sbin/fsck_ext2fs/dir.c | 10 +++++----- sbin/fsck_ffs/dir.c | 20 ++++++++++---------- sbin/fsck_ffs/pass2.c | 10 +++++----- sbin/fsck_ffs/setup.c | 6 +++--- sbin/fsdb/fsdb.c | 6 +++--- sbin/restore/dirs.c | 18 +++++++++--------- sys/lib/libsa/ufs.c | 4 ++-- sys/ufs/ffs/ffs_vfsops.c | 8 ++++---- sys/ufs/ufs/dir.h | 36 ++++++++++++++++++------------------ sys/ufs/ufs/dirhash.h | 4 ++-- sys/ufs/ufs/ufs_dirhash.c | 28 ++++++++++++++-------------- sys/ufs/ufs/ufs_extattr.c | 16 ++++++++-------- sys/ufs/ufs/ufs_lookup.c | 22 +++++++++++----------- sys/ufs/ufs/ufs_rename.c | 8 ++++---- sys/ufs/ufs/ufs_vnops.c | 8 ++++---- usr.sbin/makefs/ffs.c | 26 +++++++++++++------------- 16 files changed, 115 insertions(+), 115 deletions(-) diff --git a/sbin/fsck_ext2fs/dir.c b/sbin/fsck_ext2fs/dir.c index e3e59017403e..f8f8e4d80cae 100644 --- a/sbin/fsck_ext2fs/dir.c +++ b/sbin/fsck_ext2fs/dir.c @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.26 2013/01/22 09:39:11 dholland Exp $ */ +/* $NetBSD: dir.c,v 1.27 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -58,7 +58,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94"; #else -__RCSID("$NetBSD: dir.c,v 1.26 2013/01/22 09:39:11 dholland Exp $"); +__RCSID("$NetBSD: dir.c,v 1.27 2013/06/09 17:57:09 dholland Exp $"); #endif #endif /* not lint */ @@ -84,7 +84,7 @@ const char *lfname = "lost+found"; int lfmode = 01700; struct ext2fs_dirtemplate emptydir = { .dot_ino = 0, - .dot_reclen = DIRBLKSIZ, + .dot_reclen = UFS_DIRBLKSIZ, }; struct ext2fs_dirtemplate dirhead = { .dot_ino = 0, @@ -93,12 +93,12 @@ struct ext2fs_dirtemplate dirhead = { .dot_type = EXT2_FT_DIR, .dot_name = ".", .dotdot_ino = 0, - .dotdot_reclen = DIRBLKSIZ - 12, + .dotdot_reclen = UFS_DIRBLKSIZ - 12, .dotdot_namlen = 2, .dotdot_type = EXT2_FT_DIR, .dotdot_name = "..", }; -#undef DIRBLKSIZ +#undef UFS_DIRBLKSIZ static int expanddir(struct ext2fs_dinode *, char *); static void freedir(ino_t, ino_t); diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 2f9cdf5e1d0f..e07e9091ad77 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.54 2013/01/22 09:39:11 dholland Exp $ */ +/* $NetBSD: dir.c,v 1.55 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: dir.c,v 1.54 2013/01/22 09:39:11 dholland Exp $"); +__RCSID("$NetBSD: dir.c,v 1.55 2013/06/09 17:57:09 dholland Exp $"); #endif #endif /* not lint */ @@ -59,7 +59,7 @@ int lfmode = 01700; ino_t lfdir; struct dirtemplate emptydir = { .dot_ino = 0, - .dot_reclen = DIRBLKSIZ, + .dot_reclen = UFS_DIRBLKSIZ, }; struct dirtemplate dirhead = { .dot_ino = 0, @@ -68,7 +68,7 @@ struct dirtemplate dirhead = { .dot_namlen = 1, .dot_name = ".", .dotdot_ino = 0, - .dotdot_reclen = DIRBLKSIZ - 12, + .dotdot_reclen = UFS_DIRBLKSIZ - 12, .dotdot_type = DT_DIR, .dotdot_namlen = 2, .dotdot_name = "..", @@ -79,7 +79,7 @@ struct odirtemplate odirhead = { .dot_namlen = 1, .dot_name = ".", .dotdot_ino = 0, - .dotdot_reclen = DIRBLKSIZ - 12, + .dotdot_reclen = UFS_DIRBLKSIZ - 12, .dotdot_namlen = 2, .dotdot_name = "..", }; @@ -154,8 +154,8 @@ dirscan(struct inodesc *idesc) struct bufarea *bp; int dsize, n; long blksiz; -#if DIRBLKSIZ > APPLEUFS_DIRBLKSIZ - char dbuf[DIRBLKSIZ]; +#if UFS_DIRBLKSIZ > APPLEUFS_DIRBLKSIZ + char dbuf[UFS_DIRBLKSIZ]; #else char dbuf[APPLEUFS_DIRBLKSIZ]; #endif @@ -324,7 +324,7 @@ dircheck(struct inodesc *idesc, struct direct *dp) return (0); if (dp->d_ino == 0) return (1); - size = DIRSIZ(!newinofmt, dp, needswap); + size = UFS_DIRSIZ(!newinofmt, dp, needswap); # if (BYTE_ORDER == LITTLE_ENDIAN) if (!newinofmt && !needswap) { # else @@ -450,9 +450,9 @@ mkentry(struct inodesc *idesc) int newlen, oldlen; newent.d_namlen = strlen(idesc->id_name); - newlen = DIRSIZ(0, &newent, 0); + newlen = UFS_DIRSIZ(0, &newent, 0); if (dirp->d_ino != 0) - oldlen = DIRSIZ(0, dirp, 0); + oldlen = UFS_DIRSIZ(0, dirp, 0); else oldlen = 0; if (iswap16(dirp->d_reclen) - oldlen < newlen) diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c index f30d69979510..e5c7d2479d50 100644 --- a/sbin/fsck_ffs/pass2.c +++ b/sbin/fsck_ffs/pass2.c @@ -1,4 +1,4 @@ -/* $NetBSD: pass2.c,v 1.49 2013/01/22 09:39:12 dholland Exp $ */ +/* $NetBSD: pass2.c,v 1.50 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: pass2.c,v 1.49 2013/01/22 09:39:12 dholland Exp $"); +__RCSID("$NetBSD: pass2.c,v 1.50 2013/06/09 17:57:09 dholland Exp $"); #endif #endif /* not lint */ @@ -382,7 +382,7 @@ pass2check(struct inodesc *idesc) proto.d_type = proto.d_namlen; proto.d_namlen = tmp; } - entrysize = DIRSIZ(0, &proto, 0); + entrysize = UFS_DIRSIZ(0, &proto, 0); if (dirp->d_ino != 0 && strcmp(dirp->d_name, "..") != 0) { pfatal("CANNOT FIX, FIRST ENTRY IN DIRECTORY CONTAINS %s\n", dirp->d_name); @@ -433,9 +433,9 @@ chk1: proto.d_type = proto.d_namlen; proto.d_namlen = tmp; } - entrysize = DIRSIZ(0, &proto, 0); + entrysize = UFS_DIRSIZ(0, &proto, 0); if (idesc->id_entryno == 0) { - n = DIRSIZ(0, dirp, 0); + n = UFS_DIRSIZ(0, dirp, 0); if (iswap16(dirp->d_reclen) < n + entrysize) goto chk2; proto.d_reclen = iswap16(iswap16(dirp->d_reclen) - n); diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 7a872f875e98..f3cb8c573fc9 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.96 2013/01/22 09:39:12 dholland Exp $ */ +/* $NetBSD: setup.c,v 1.97 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: setup.c,v 1.96 2013/01/22 09:39:12 dholland Exp $"); +__RCSID("$NetBSD: setup.c,v 1.97 2013/06/09 17:57:09 dholland Exp $"); #endif #endif /* not lint */ @@ -534,7 +534,7 @@ setup(const char *dev, const char *origdev) if (readappleufs()) isappleufs = 1; - dirblksiz = DIRBLKSIZ; + dirblksiz = UFS_DIRBLKSIZ; if (isappleufs) dirblksiz = APPLEUFS_DIRBLKSIZ; diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index bfbf699ba310..345b20ac2075 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -1,4 +1,4 @@ -/* $NetBSD: fsdb.c,v 1.45 2013/01/22 09:39:12 dholland Exp $ */ +/* $NetBSD: fsdb.c,v 1.46 2013/06/09 17:57:09 dholland Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fsdb.c,v 1.45 2013/01/22 09:39:12 dholland Exp $"); +__RCSID("$NetBSD: fsdb.c,v 1.46 2013/06/09 17:57:09 dholland Exp $"); #endif /* not lint */ #include @@ -990,7 +990,7 @@ chnamefunc(struct inodesc *idesc) if (slotcount++ == desired) { /* will name fit? */ testdir.d_namlen = strlen(idesc->id_name); - if (DIRSIZ(NEWDIRFMT, &testdir, 0) <= iswap16(dirp->d_reclen)) { + if (UFS_DIRSIZ(UFS_NEWDIRFMT, &testdir, 0) <= iswap16(dirp->d_reclen)) { dirp->d_namlen = testdir.d_namlen; strlcpy(dirp->d_name, idesc->id_name, sizeof(dirp->d_name)); diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c index 31a8fd324f95..5127c2e75d78 100644 --- a/sbin/restore/dirs.c +++ b/sbin/restore/dirs.c @@ -1,4 +1,4 @@ -/* $NetBSD: dirs.c,v 1.49 2013/01/22 09:39:13 dholland Exp $ */ +/* $NetBSD: dirs.c,v 1.50 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 1983, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)dirs.c 8.7 (Berkeley) 5/1/95"; #else -__RCSID("$NetBSD: dirs.c,v 1.49 2013/01/22 09:39:13 dholland Exp $"); +__RCSID("$NetBSD: dirs.c,v 1.50 2013/06/09 17:57:09 dholland Exp $"); #endif #endif /* not lint */ @@ -184,7 +184,7 @@ extractdirs(int genmode) nulldir.d_type = DT_DIR; nulldir.d_namlen = 1; (void) strcpy(nulldir.d_name, "/"); - nulldir.d_reclen = DIRSIZ(0, &nulldir, 0); + nulldir.d_reclen = UFS_DIRSIZ(0, &nulldir, 0); for (;;) { curfile.name = ""; curfile.action = USING; @@ -372,16 +372,16 @@ putdir(char *buf, long size) i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1)); if ((dp->d_reclen & 0x3) != 0 || dp->d_reclen > i || - dp->d_reclen < DIRSIZ(0, dp, 0) /* || + dp->d_reclen < UFS_DIRSIZ(0, dp, 0) /* || dp->d_namlen > NAME_MAX */) { vprintf(stdout, "Mangled directory: "); if ((dp->d_reclen & 0x3) != 0) vprintf(stdout, "reclen not multiple of 4 "); - if (dp->d_reclen < DIRSIZ(0, dp, 0)) + if (dp->d_reclen < UFS_DIRSIZ(0, dp, 0)) vprintf(stdout, - "reclen less than DIRSIZ (%d < %lu) ", - dp->d_reclen, (u_long)DIRSIZ(0, dp, 0)); + "reclen less than UFS_DIRSIZ (%d < %lu) ", + dp->d_reclen, (u_long)UFS_DIRSIZ(0, dp, 0)); #if 0 /* dp->d_namlen is a uint8_t, always < NAME_MAX */ if (dp->d_namlen > NAME_MAX) vprintf(stdout, @@ -413,7 +413,7 @@ long prev = 0; static void putent(struct direct *dp) { - dp->d_reclen = DIRSIZ(0, dp, 0); + dp->d_reclen = UFS_DIRSIZ(0, dp, 0); if (dirloc + dp->d_reclen > DIRBLKSIZ) { ((struct direct *)(dirbuf + prev))->d_reclen = DIRBLKSIZ - prev; @@ -449,7 +449,7 @@ dcvt(struct odirect *odp, struct direct *ndp) ndp->d_type = DT_UNKNOWN; (void) strncpy(ndp->d_name, odp->d_name, ODIRSIZ); ndp->d_namlen = strlen(ndp->d_name); - ndp->d_reclen = DIRSIZ(0, ndp, 0); + ndp->d_reclen = UFS_DIRSIZ(0, ndp, 0); } /* diff --git a/sys/lib/libsa/ufs.c b/sys/lib/libsa/ufs.c index 7caf2205a1db..42cfe3f7455c 100644 --- a/sys/lib/libsa/ufs.c +++ b/sys/lib/libsa/ufs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs.c,v 1.59 2013/01/22 09:39:14 dholland Exp $ */ +/* $NetBSD: ufs.c,v 1.60 2013/06/09 17:57:08 dholland Exp $ */ /*- * Copyright (c) 1993 @@ -895,7 +895,7 @@ ufs_ls(struct open_file *f, const char *pattern) if (rc) goto out; /* some firmware might use block size larger than DEV_BSIZE */ - if (buf_size < DIRBLKSIZ) + if (buf_size < UFS_DIRBLKSIZ) goto out; dp = (struct direct *)buf; diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 856f8cc5a1c7..41e0aee95149 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.282 2013/01/22 09:39:16 dholland Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.283 2013/06/09 17:57:08 dholland Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.282 2013/01/22 09:39:16 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.283 2013/06/09 17:57:08 dholland Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -753,7 +753,7 @@ ffs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l) mp->mnt_iflag |= IMNT_DTYPE; } else { ump->um_maxsymlinklen = fs->fs_maxsymlinklen; - ump->um_dirblksiz = DIRBLKSIZ; + ump->um_dirblksiz = UFS_DIRBLKSIZ; if (ump->um_maxsymlinklen > 0) mp->mnt_iflag |= IMNT_DTYPE; else @@ -1234,7 +1234,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l) mp->mnt_iflag |= IMNT_DTYPE; } else { ump->um_maxsymlinklen = fs->fs_maxsymlinklen; - ump->um_dirblksiz = DIRBLKSIZ; + ump->um_dirblksiz = UFS_DIRBLKSIZ; if (ump->um_maxsymlinklen > 0) mp->mnt_iflag |= IMNT_DTYPE; else diff --git a/sys/ufs/ufs/dir.h b/sys/ufs/ufs/dir.h index 88c2d13b8f7c..9de68bce3da0 100644 --- a/sys/ufs/ufs/dir.h +++ b/sys/ufs/ufs/dir.h @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.22 2013/06/07 23:37:53 dholland Exp $ */ +/* $NetBSD: dir.h,v 1.23 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -48,11 +48,11 @@ #define MAXDIRSIZE (0x7fffffff) /* - * A directory consists of some number of blocks of DIRBLKSIZ - * bytes, where DIRBLKSIZ is chosen such that it can be transferred + * A directory consists of some number of blocks of UFS_DIRBLKSIZ + * bytes, where UFS_DIRBLKSIZ is chosen such that it can be transferred * to disk in a single atomic operation (e.g. 512 bytes on most machines). * - * Each DIRBLKSIZ byte block contains some number of directory entry + * Each UFS_DIRBLKSIZ byte block contains some number of directory entry * structures, which are of variable length. Each directory entry has * a struct direct at the front of it, containing its inode number, * the length of the entry, and the length of the name contained in @@ -60,9 +60,9 @@ * All names are guaranteed null terminated. * The maximum length of a name in a directory is FFS_MAXNAMLEN. * - * The macro DIRSIZ(fmt, dp) gives the amount of space required to represent + * The macro UFS_DIRSIZ(fmt, dp) gives the amount of space required to represent * a directory entry. Free space in a directory is represented by - * entries which have dp->d_reclen > DIRSIZ(fmt, dp). All DIRBLKSIZ bytes + * entries which have dp->d_reclen > DIRSIZ(fmt, dp). All UFS_DIRBLKSIZ bytes * in a directory block are claimed by the directory entries. This * usually results in the last entry in a directory having a large * dp->d_reclen. When entries are deleted from a directory, the @@ -72,8 +72,8 @@ * Entries other than the first in a directory do not normally have * dp->d_ino set to 0. */ -#undef DIRBLKSIZ -#define DIRBLKSIZ DEV_BSIZE +#undef UFS_DIRBLKSIZ +#define UFS_DIRBLKSIZ DEV_BSIZE #define FFS_MAXNAMLEN 255 #define APPLEUFS_DIRBLKSIZ 1024 @@ -106,26 +106,26 @@ struct direct { #define DTTOIF(dirtype) ((dirtype) << 12) /* - * The DIRSIZ macro gives the minimum record length which will hold + * The UFS_DIRSIZ macro gives the minimum record length which will hold * the directory entry. This requires the amount of space in struct direct * without the d_name field, plus enough space for the name with a terminating * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. */ -#define DIRECTSIZ(namlen) \ +#define UFS_DIRECTSIZ(namlen) \ ((sizeof(struct direct) - (FFS_MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3)) #if (BYTE_ORDER == LITTLE_ENDIAN) -#define DIRSIZ(oldfmt, dp, needswap) \ - (((oldfmt) && !(needswap)) ? \ - DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen)) +#define UFS_DIRSIZ(oldfmt, dp, needswap) \ + (((oldfmt) && !(needswap)) ? \ + UFS_DIRECTSIZ((dp)->d_type) : UFS_DIRECTSIZ((dp)->d_namlen)) #else -#define DIRSIZ(oldfmt, dp, needswap) \ - (((oldfmt) && (needswap)) ? \ - DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen)) +#define UFS_DIRSIZ(oldfmt, dp, needswap) \ + (((oldfmt) && (needswap)) ? \ + UFS_DIRECTSIZ((dp)->d_type) : UFS_DIRECTSIZ((dp)->d_namlen)) #endif -#define OLDDIRFMT 1 -#define NEWDIRFMT 0 +#define UFS_OLDDIRFMT 1 +#define UFS_NEWDIRFMT 0 /* * Template for manipulating directories. Should use struct direct's, diff --git a/sys/ufs/ufs/dirhash.h b/sys/ufs/ufs/dirhash.h index 914eeca8d2fa..b13302648348 100644 --- a/sys/ufs/ufs/dirhash.h +++ b/sys/ufs/ufs/dirhash.h @@ -1,4 +1,4 @@ -/* $NetBSD: dirhash.h,v 1.6 2008/06/04 11:33:19 ad Exp $ */ +/* $NetBSD: dirhash.h,v 1.7 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 2001 Ian Dowse. All rights reserved. @@ -47,7 +47,7 @@ #define DIRHASH_DEL (-2) /* deleted entry; may be part of chain */ #define DIRALIGN 4 -#define DH_NFSTATS (DIRECTSIZ(FFS_MAXNAMLEN + 1) / DIRALIGN) +#define DH_NFSTATS (UFS_DIRECTSIZ(FFS_MAXNAMLEN + 1) / DIRALIGN) /* max DIRALIGN words in a directory entry */ /* diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index e893a93f04e1..f0a6a1490a63 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_dirhash.c,v 1.34 2009/10/05 23:48:08 rmind Exp $ */ +/* $NetBSD: ufs_dirhash.c,v 1.35 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 2001, 2002 Ian Dowse. All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.34 2009/10/05 23:48:08 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_dirhash.c,v 1.35 2013/06/09 17:57:09 dholland Exp $"); /* * This implements a hash-based lookup scheme for UFS directories. @@ -146,7 +146,7 @@ ufsdirhash_build(struct inode *ip) vp = ip->i_vnode; /* Allocate 50% more entries than this dir size could ever need. */ KASSERT(ip->i_size >= dirblksiz); - nslots = ip->i_size / DIRECTSIZ(1); + nslots = ip->i_size / UFS_DIRECTSIZ(1); nslots = (nslots * 3 + 1) / 2; narrays = howmany(nslots, DH_NBLKOFF); nslots = narrays * DH_NBLKOFF; @@ -239,7 +239,7 @@ ufsdirhash_build(struct inode *ip) slot = WRAPINCR(slot, dh->dh_hlen); dh->dh_hused++; DH_ENTRY(dh, slot) = pos; - ufsdirhash_adjfree(dh, pos, -DIRSIZ(0, ep, needswap), + ufsdirhash_adjfree(dh, pos, -UFS_DIRSIZ(0, ep, needswap), dirblksiz); } pos += ep->d_reclen; @@ -316,7 +316,7 @@ ufsdirhash_free(struct inode *ip) * If successful, the directory offset is stored in *offp, and a * pointer to a struct buf containing the entry is stored in *bpp. If * prevoffp is non-NULL, the offset of the previous entry within - * the DIRBLKSIZ-sized block is stored in *prevoffp (if the entry + * the UFS_DIRBLKSIZ-sized block is stored in *prevoffp (if the entry * is the first in a block, the start of the block is used). */ int @@ -448,7 +448,7 @@ restart: /* Check for sequential access, and update offset. */ if (dh->dh_seqopt == 0 && dh->dh_seqoff == offset) dh->dh_seqopt = 1; - dh->dh_seqoff = offset + DIRSIZ(0, dp, needswap); + dh->dh_seqoff = offset + UFS_DIRSIZ(0, dp, needswap); DIRHASH_UNLOCK(dh); *bpp = bp; @@ -483,7 +483,7 @@ restart: * the offset of the directory entry that begins the free space. * This will either be the offset of an existing entry that has free * space at the end, or the offset of an entry with d_ino == 0 at - * the start of a DIRBLKSIZ block. + * the start of a UFS_DIRBLKSIZ block. * * To use the space, the caller may need to compact existing entries in * the directory. The total number of bytes in all of the entries involved @@ -540,7 +540,7 @@ ufsdirhash_findfree(struct inode *ip, int slotneeded, int *slotsize) brelse(bp, 0); return (-1); } - if (dp->d_ino == 0 || dp->d_reclen > DIRSIZ(0, dp, needswap)) + if (dp->d_ino == 0 || dp->d_reclen > UFS_DIRSIZ(0, dp, needswap)) break; i += dp->d_reclen; dp = (struct direct *)((char *)dp + dp->d_reclen); @@ -557,7 +557,7 @@ ufsdirhash_findfree(struct inode *ip, int slotneeded, int *slotsize) while (i < dirblksiz && freebytes < slotneeded) { freebytes += dp->d_reclen; if (dp->d_ino != 0) - freebytes -= DIRSIZ(0, dp, needswap); + freebytes -= UFS_DIRSIZ(0, dp, needswap); if (dp->d_reclen == 0) { DIRHASH_UNLOCK(dh); brelse(bp, 0); @@ -655,7 +655,7 @@ ufsdirhash_add(struct inode *ip, struct direct *dirp, doff_t offset) DH_ENTRY(dh, slot) = offset; /* Update the per-block summary info. */ - ufsdirhash_adjfree(dh, offset, -DIRSIZ(0, dirp, needswap), dirblksiz); + ufsdirhash_adjfree(dh, offset, -UFS_DIRSIZ(0, dirp, needswap), dirblksiz); DIRHASH_UNLOCK(dh); } @@ -690,7 +690,7 @@ ufsdirhash_remove(struct inode *ip, struct direct *dirp, doff_t offset) ufsdirhash_delslot(dh, slot); /* Update the per-block summary info. */ - ufsdirhash_adjfree(dh, offset, DIRSIZ(0, dirp, needswap), dirblksiz); + ufsdirhash_adjfree(dh, offset, UFS_DIRSIZ(0, dirp, needswap), dirblksiz); DIRHASH_UNLOCK(dh); } @@ -724,7 +724,7 @@ ufsdirhash_move(struct inode *ip, struct direct *dirp, doff_t oldoff, /* * Inform dirhash that the directory has grown by one block that - * begins at offset (i.e. the new length is offset + DIRBLKSIZ). + * begins at offset (i.e. the new length is offset + UFS_DIRBLKSIZ). */ void ufsdirhash_newblk(struct inode *ip, doff_t offset) @@ -868,7 +868,7 @@ ufsdirhash_checkblock(struct inode *ip, char *sbuf, doff_t offset) /* Check that the entry exists (will panic if it doesn't). */ ufsdirhash_findslot(dh, dp->d_name, dp->d_namlen, offset + i); - nfree += dp->d_reclen - DIRSIZ(0, dp, needswap); + nfree += dp->d_reclen - UFS_DIRSIZ(0, dp, needswap); } if (i != dirblksiz) panic("ufsdirhash_checkblock: bad dir end"); @@ -1000,7 +1000,7 @@ ufsdirhash_delslot(struct dirhash *dh, int slot) /* * Given a directory entry and its offset, find the offset of the - * previous entry in the same DIRBLKSIZ-sized block. Returns an + * previous entry in the same UFS_DIRBLKSIZ-sized block. Returns an * offset, or -1 if there is no previous entry in the block or some * other problem occurred. */ diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c index 81193027a6f1..b11df5a09097 100644 --- a/sys/ufs/ufs/ufs_extattr.c +++ b/sys/ufs/ufs/ufs_extattr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_extattr.c,v 1.41 2012/12/08 13:42:36 manu Exp $ */ +/* $NetBSD: ufs_extattr.c,v 1.42 2013/06/09 17:57:09 dholland Exp $ */ /*- * Copyright (c) 1999-2002 Robert N. M. Watson @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.41 2012/12/08 13:42:36 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_extattr.c,v 1.42 2013/06/09 17:57:09 dholland Exp $"); #ifdef _KERNEL_OPT #include "opt_ffs.h" @@ -545,7 +545,7 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp, if (dvp->v_type != VDIR) return (ENOTDIR); - dirbuf = kmem_alloc(DIRBLKSIZ, KM_SLEEP); + dirbuf = kmem_alloc(UFS_DIRBLKSIZ, KM_SLEEP); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; @@ -562,9 +562,9 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp, vargs.a_cookies = NULL; while (!eofflag) { - auio.uio_resid = DIRBLKSIZ; + auio.uio_resid = UFS_DIRBLKSIZ; aiov.iov_base = dirbuf; - aiov.iov_len = DIRBLKSIZ; + aiov.iov_len = UFS_DIRBLKSIZ; error = ufs_readdir(&vargs); if (error) { printf("ufs_extattr_iterate_directory: ufs_readdir " @@ -573,12 +573,12 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp, } /* - * XXXRW: While in UFS, we always get DIRBLKSIZ returns from + * XXXRW: While in UFS, we always get UFS_DIRBLKSIZ returns from * the directory code on success, on other file systems this * may not be the case. For portability, we should check the * read length on return from ufs_readdir(). */ - edp = (struct dirent *)&dirbuf[DIRBLKSIZ]; + edp = (struct dirent *)&dirbuf[UFS_DIRBLKSIZ]; for (dp = (struct dirent *)dirbuf; dp < edp; ) { if (dp->d_reclen == 0) break; @@ -617,7 +617,7 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp, break; } } - kmem_free(dirbuf, DIRBLKSIZ); + kmem_free(dirbuf, UFS_DIRBLKSIZ); return (0); } diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index 882873cb53bf..c399c812aa21 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_lookup.c,v 1.122 2013/01/22 09:39:18 dholland Exp $ */ +/* $NetBSD: ufs_lookup.c,v 1.123 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.122 2013/01/22 09:39:18 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.123 2013/06/09 17:57:09 dholland Exp $"); #ifdef _KERNEL_OPT #include "opt_ffs.h" @@ -220,7 +220,7 @@ ufs_lookup(void *v) slotfreespace = slotsize = slotneeded = 0; if ((nameiop == CREATE || nameiop == RENAME) && (flags & ISLASTCN)) { slotstatus = NONE; - slotneeded = DIRECTSIZ(cnp->cn_namelen); + slotneeded = UFS_DIRECTSIZ(cnp->cn_namelen); } /* @@ -348,7 +348,7 @@ searchloop: int size = ufs_rw16(ep->d_reclen, needswap); if (ep->d_ino != 0) - size -= DIRSIZ(FSFMT(vdp), ep, needswap); + size -= UFS_DIRSIZ(FSFMT(vdp), ep, needswap); if (size > 0) { if (size >= slotneeded) { slotstatus = FOUND; @@ -528,10 +528,10 @@ found: * Check that directory length properly reflects presence * of this entry. */ - if (results->ulr_offset + DIRSIZ(FSFMT(vdp), ep, needswap) > dp->i_size) { + if (results->ulr_offset + UFS_DIRSIZ(FSFMT(vdp), ep, needswap) > dp->i_size) { ufs_dirbad(dp, results->ulr_offset, "i_size too small"); dp->i_size = - results->ulr_offset + DIRSIZ(FSFMT(vdp), ep, needswap); + results->ulr_offset + UFS_DIRSIZ(FSFMT(vdp), ep, needswap); DIP_ASSIGN(dp, size, dp->i_size); dp->i_flag |= IN_CHANGE | IN_UPDATE; UFS_WAPBL_UPDATE(vdp, NULL, NULL, UPDATE_DIROP); @@ -733,13 +733,13 @@ ufs_dirbadentry(struct vnode *dp, struct direct *ep, int entryoffsetinblock) ufs_rw16(ep->d_reclen, needswap) > dirblksiz - (entryoffsetinblock & (dirblksiz - 1)) || ufs_rw16(ep->d_reclen, needswap) < - DIRSIZ(FSFMT(dp), ep, needswap) || + UFS_DIRSIZ(FSFMT(dp), ep, needswap) || namlen > FFS_MAXNAMLEN) { /*return (1); */ printf("First bad, reclen=%#x, DIRSIZ=%lu, namlen=%d, " "flags=%#x, entryoffsetinblock=%d, dirblksiz = %d\n", ufs_rw16(ep->d_reclen, needswap), - (u_long)DIRSIZ(FSFMT(dp), ep, needswap), + (u_long)UFS_DIRSIZ(FSFMT(dp), ep, needswap), namlen, dp->v_mount->mnt_flag, entryoffsetinblock, dirblksiz); goto bad; @@ -833,7 +833,7 @@ ufs_direnter(struct vnode *dvp, const struct ufs_lookup_results *ulr, l = curlwp; dp = VTOI(dvp); - newentrysize = DIRSIZ(0, dirp, 0); + newentrysize = UFS_DIRSIZ(0, dirp, 0); if (ulr->ulr_count == 0) { /* @@ -923,7 +923,7 @@ ufs_direnter(struct vnode *dvp, const struct ufs_lookup_results *ulr, * ulr_offset + ulr_count would yield the space. */ ep = (struct direct *)dirbuf; - dsize = (ep->d_ino != 0) ? DIRSIZ(FSFMT(dvp), ep, needswap) : 0; + dsize = (ep->d_ino != 0) ? UFS_DIRSIZ(FSFMT(dvp), ep, needswap) : 0; spacefree = ufs_rw16(ep->d_reclen, needswap) - dsize; for (loc = ufs_rw16(ep->d_reclen, needswap); loc < ulr->ulr_count; ) { uint16_t reclen; @@ -950,7 +950,7 @@ ufs_direnter(struct vnode *dvp, const struct ufs_lookup_results *ulr, dsize = 0; continue; } - dsize = DIRSIZ(FSFMT(dvp), nep, needswap); + dsize = UFS_DIRSIZ(FSFMT(dvp), nep, needswap); spacefree += reclen - dsize; #ifdef UFS_DIRHASH if (dp->i_dirhash != NULL) diff --git a/sys/ufs/ufs/ufs_rename.c b/sys/ufs/ufs/ufs_rename.c index 67fad139a7cd..9f21c4ac4924 100644 --- a/sys/ufs/ufs/ufs_rename.c +++ b/sys/ufs/ufs/ufs_rename.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_rename.c,v 1.6 2013/01/22 09:39:18 dholland Exp $ */ +/* $NetBSD: ufs_rename.c,v 1.7 2013/06/09 17:57:09 dholland Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_rename.c,v 1.6 2013/01/22 09:39:18 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_rename.c,v 1.7 2013/06/09 17:57:09 dholland Exp $"); #include #include @@ -271,8 +271,8 @@ ufs_gro_remove_check_permitted(struct mount *mp, kauth_cred_t cred, * XXX Copypasta from ufs_vnops.c. Kill! */ static const struct dirtemplate mastertemplate = { - 0, 12, DT_DIR, 1, ".", - 0, DIRBLKSIZ - 12, DT_DIR, 2, ".." + 0, 12, DT_DIR, 1, ".", + 0, UFS_DIRBLKSIZ - 12, DT_DIR, 2, ".." }; /* diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 3a7f44677898..d2daf45547df 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_vnops.c,v 1.213 2013/06/08 05:47:02 kardel Exp $ */ +/* $NetBSD: ufs_vnops.c,v 1.214 2013/06/09 17:57:09 dholland Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.213 2013/06/08 05:47:02 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.214 2013/06/09 17:57:09 dholland Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -124,8 +124,8 @@ static int ufs_chown(struct vnode *, uid_t, gid_t, kauth_cred_t, * A virgin directory (no blushing please). */ static const struct dirtemplate mastertemplate = { - 0, 12, DT_DIR, 1, ".", - 0, DIRBLKSIZ - 12, DT_DIR, 2, ".." + 0, 12, DT_DIR, 1, ".", + 0, UFS_DIRBLKSIZ - 12, DT_DIR, 2, ".." }; /* diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index 7fd44cb974a3..8d12d000dfb3 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.c,v 1.60 2013/02/03 03:21:21 christos Exp $ */ +/* $NetBSD: ffs.c,v 1.61 2013/06/09 17:57:09 dholland Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -71,7 +71,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs.c,v 1.60 2013/02/03 03:21:21 christos Exp $"); +__RCSID("$NetBSD: ffs.c,v 1.61 2013/06/09 17:57:09 dholland Exp $"); #endif /* !__lint */ #include @@ -575,12 +575,12 @@ ffs_size_dir(fsnode *root, fsinfo_t *fsopts) #define ADDDIRENT(e) do { \ tmpdir.d_namlen = strlen((e)); \ - this = DIRSIZ(0, &tmpdir, 0); \ + this = UFS_DIRSIZ(0, &tmpdir, 0); \ if (debug & DEBUG_FS_SIZE_DIR_ADD_DIRENT) \ printf("ADDDIRENT: was: %s (%d) this %d cur %d\n", \ e, tmpdir.d_namlen, this, curdirsize); \ - if (this + curdirsize > roundup(curdirsize, DIRBLKSIZ)) \ - curdirsize = roundup(curdirsize, DIRBLKSIZ); \ + if (this + curdirsize > roundup(curdirsize, UFS_DIRBLKSIZ)) \ + curdirsize = roundup(curdirsize, UFS_DIRBLKSIZ); \ curdirsize += this; \ if (debug & DEBUG_FS_SIZE_DIR_ADD_DIRENT) \ printf("ADDDIRENT: now: %s (%d) this %d cur %d\n", \ @@ -1006,13 +1006,13 @@ ffs_make_dirbuf(dirbuf_t *dbuf, const char *name, fsnode *node, int needswap) de.d_type = IFTODT(node->type); de.d_namlen = (uint8_t)strlen(name); strcpy(de.d_name, name); - reclen = DIRSIZ(0, &de, needswap); + reclen = UFS_DIRSIZ(0, &de, needswap); de.d_reclen = ufs_rw16(reclen, needswap); dp = (struct direct *)(dbuf->buf + dbuf->cur); llen = 0; if (dp != NULL) - llen = DIRSIZ(0, dp, needswap); + llen = UFS_DIRSIZ(0, dp, needswap); if (debug & DEBUG_FS_MAKE_DIRBUF) printf( @@ -1022,15 +1022,15 @@ ffs_make_dirbuf(dirbuf_t *dbuf, const char *name, fsnode *node, int needswap) ufs_rw32(de.d_fileno, needswap), de.d_type, reclen, de.d_namlen, de.d_name); - if (reclen + dbuf->cur + llen > roundup(dbuf->size, DIRBLKSIZ)) { + if (reclen + dbuf->cur + llen > roundup(dbuf->size, UFS_DIRBLKSIZ)) { if (debug & DEBUG_FS_MAKE_DIRBUF) printf("ffs_make_dirbuf: growing buf to %d\n", - dbuf->size + DIRBLKSIZ); - newbuf = erealloc(dbuf->buf, dbuf->size + DIRBLKSIZ); + dbuf->size + UFS_DIRBLKSIZ); + newbuf = erealloc(dbuf->buf, dbuf->size + UFS_DIRBLKSIZ); dbuf->buf = newbuf; - dbuf->size += DIRBLKSIZ; - memset(dbuf->buf + dbuf->size - DIRBLKSIZ, 0, DIRBLKSIZ); - dbuf->cur = dbuf->size - DIRBLKSIZ; + dbuf->size += UFS_DIRBLKSIZ; + memset(dbuf->buf + dbuf->size - UFS_DIRBLKSIZ, 0, UFS_DIRBLKSIZ); + dbuf->cur = dbuf->size - UFS_DIRBLKSIZ; } else if (dp) { /* shrink end of previous */ dp->d_reclen = ufs_rw16(llen,needswap); dbuf->cur += llen;