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
This commit is contained in:
Conrad Meyer 2017-02-09 17:47:01 +00:00
parent 6053fa9683
commit 0ecf59f68f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313475
6 changed files with 11 additions and 10 deletions

View File

@ -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;
}

View File

@ -889,7 +889,7 @@ getpathname(char *namebuf, ino_t curdir, ino_t ino)
cp -= len;
memmove(cp, namebuf, (size_t)len);
*--cp = '/';
if (cp < &namebuf[MAXNAMLEN])
if (cp < &namebuf[UFS_MAXNAMLEN])
break;
ino = idesc.id_number;
}

View File

@ -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) {

View File

@ -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;

View File

@ -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 */
/*

View File

@ -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, entryoffsetinblock)
# 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;