Date: Thu, 9 Feb 2017 17:47:01 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313475 - in head: lib/libstand sbin/fsck_ffs sys/ufs/ufs Message-ID: <201702091747.v19Hl1Hx079792@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Thu Feb 9 17:47:01 2017 New Revision: 313475 URL: https://svnweb.freebsd.org/changeset/base/313475 Log: ufs: Use UFS_MAXNAMLEN constant (like NFS, EXT2FS, SVR4, IBCS2) instead of redefining the MAXNAMLEN constant. No functional change. Reviewed by: kib@, markj@ Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D9500 Modified: head/lib/libstand/ufs.c head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/pass3.c head/sys/ufs/ufs/dir.h head/sys/ufs/ufs/dirhash.h head/sys/ufs/ufs/ufs_lookup.c Modified: head/lib/libstand/ufs.c ============================================================================== --- head/lib/libstand/ufs.c Thu Feb 9 15:16:08 2017 (r313474) +++ head/lib/libstand/ufs.c Thu Feb 9 17:47:01 2017 (r313475) @@ -586,7 +586,7 @@ ufs_open(upath, f) ncp = cp; while ((c = *cp) != '\0' && c != '/') { - if (++len > MAXNAMLEN) { + if (++len > UFS_MAXNAMLEN) { rc = ENOENT; goto out; } Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Thu Feb 9 15:16:08 2017 (r313474) +++ head/sbin/fsck_ffs/fsutil.c Thu Feb 9 17:47:01 2017 (r313475) @@ -889,7 +889,7 @@ getpathname(char *namebuf, ino_t curdir, cp -= len; memmove(cp, namebuf, (size_t)len); *--cp = '/'; - if (cp < &namebuf[MAXNAMLEN]) + if (cp < &namebuf[UFS_MAXNAMLEN]) break; ino = idesc.id_number; } Modified: head/sbin/fsck_ffs/pass3.c ============================================================================== --- head/sbin/fsck_ffs/pass3.c Thu Feb 9 15:16:08 2017 (r313474) +++ head/sbin/fsck_ffs/pass3.c Thu Feb 9 17:47:01 2017 (r313475) @@ -52,7 +52,7 @@ pass3(void) int loopcnt, inpindex, state; ino_t orphan; struct inodesc idesc; - char namebuf[MAXNAMLEN+1]; + char namebuf[UFS_MAXNAMLEN+1]; for (inpindex = inplast - 1; inpindex >= 0; inpindex--) { if (got_siginfo) { Modified: head/sys/ufs/ufs/dir.h ============================================================================== --- head/sys/ufs/ufs/dir.h Thu Feb 9 15:16:08 2017 (r313474) +++ head/sys/ufs/ufs/dir.h Thu Feb 9 17:47:01 2017 (r313475) @@ -57,7 +57,7 @@ * the length of the entry, and the length of the name contained in * the entry. These are followed by the name padded to a 4 byte boundary * with null bytes. All names are guaranteed null terminated. - * The maximum length of a name in a directory is MAXNAMLEN. + * The maximum length of a name in a directory is UFS_MAXNAMLEN. * * The macro DIRSIZ(fmt, dp) gives the amount of space required to represent * a directory entry. Free space in a directory is represented by @@ -72,14 +72,15 @@ * dp->d_ino set to 0. */ #define DIRBLKSIZ DEV_BSIZE -#define MAXNAMLEN 255 +#define UFS_MAXNAMLEN 255 struct direct { u_int32_t d_ino; /* inode number of entry */ u_int16_t d_reclen; /* length of this record */ u_int8_t d_type; /* file type, see below */ u_int8_t d_namlen; /* length of string in d_name */ - char d_name[MAXNAMLEN + 1];/* name with length <= MAXNAMLEN */ + char d_name[UFS_MAXNAMLEN + 1]; + /* name with length <= UFS_MAXNAMLEN */ }; /* @@ -124,7 +125,7 @@ struct direct { /* * Template for manipulating directories. Should use struct direct's, - * but the name field is MAXNAMLEN - 1, and this just won't do. + * but the name field is UFS_MAXNAMLEN - 1, and this just won't do. */ struct dirtemplate { u_int32_t dot_ino; Modified: head/sys/ufs/ufs/dirhash.h ============================================================================== --- head/sys/ufs/ufs/dirhash.h Thu Feb 9 15:16:08 2017 (r313474) +++ head/sys/ufs/ufs/dirhash.h Thu Feb 9 17:47:01 2017 (r313475) @@ -48,7 +48,7 @@ #define DIRHASH_DEL (-2) /* deleted entry; may be part of chain */ #define DIRALIGN 4 -#define DH_NFSTATS (DIRECTSIZ(MAXNAMLEN + 1) / DIRALIGN) +#define DH_NFSTATS (DIRECTSIZ(UFS_MAXNAMLEN + 1) / DIRALIGN) /* max DIRALIGN words in a directory entry */ /* Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Thu Feb 9 15:16:08 2017 (r313474) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Feb 9 17:47:01 2017 (r313475) @@ -771,7 +771,7 @@ ufs_dirbad(ip, offset, how) * record length must be multiple of 4 * entry must fit in rest of its DIRBLKSIZ block * record must be large enough to contain entry - * name is not longer than MAXNAMLEN + * name is not longer than UFS_MAXNAMLEN * name must be as long as advertised, and null terminated */ int @@ -792,7 +792,7 @@ ufs_dirbadentry(dp, ep, entryoffsetinblo # endif if ((ep->d_reclen & 0x3) != 0 || ep->d_reclen > DIRBLKSIZ - (entryoffsetinblock & (DIRBLKSIZ - 1)) || - ep->d_reclen < DIRSIZ(OFSFMT(dp), ep) || namlen > MAXNAMLEN) { + ep->d_reclen < DIRSIZ(OFSFMT(dp), ep) || namlen > UFS_MAXNAMLEN) { /*return (1); */ printf("First bad\n"); goto bad;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702091747.v19Hl1Hx079792>