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:
parent
5f81c29f8a
commit
d21c7f090e
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user