diff options
author | Toomas Soome <tsoome@me.com> | 2017-03-07 23:53:51 +0200 |
---|---|---|
committer | Dan McDonald <danmcd@omniti.com> | 2017-03-08 10:27:26 -0500 |
commit | 8130c4e15eb6129bd0df647bf3d86d0ec8c7ec3e (patch) | |
tree | 7976ad56c108f1504e1abbd62ac4161468f5b8da | |
parent | 0895054906a89b14eb2ea951eda263af653d17de (diff) | |
download | illumos-joyent-8130c4e15eb6129bd0df647bf3d86d0ec8c7ec3e.tar.gz |
7949 loader: Use UFS_MAXNAMLEN constant
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Reviewed by: Vitaliy Gusev <gusev.vitaliy@icloud.com>
Reviewed by: Juraj Lutter <juraj@lutter.sk>
Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r-- | usr/src/boot/include/ufs/ufs/dir.h | 10 | ||||
-rw-r--r-- | usr/src/boot/lib/libstand/ufs.c | 3 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/common/ufsread.c | 5 |
3 files changed, 8 insertions, 10 deletions
diff --git a/usr/src/boot/include/ufs/ufs/dir.h b/usr/src/boot/include/ufs/ufs/dir.h index 3d399617b6..0632bbf745 100644 --- a/usr/src/boot/include/ufs/ufs/dir.h +++ b/usr/src/boot/include/ufs/ufs/dir.h @@ -32,7 +32,6 @@ * SUCH DAMAGE. * * @(#)dir.h 8.2 (Berkeley) 1/21/94 - * $FreeBSD$ */ #ifndef _UFS_UFS_DIR_H_ @@ -57,7 +56,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,13 +71,14 @@ * 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_int16_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 */ }; /* @@ -123,7 +123,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; diff --git a/usr/src/boot/lib/libstand/ufs.c b/usr/src/boot/lib/libstand/ufs.c index 7d2ff148f4..9a16c6b6e6 100644 --- a/usr/src/boot/lib/libstand/ufs.c +++ b/usr/src/boot/lib/libstand/ufs.c @@ -68,7 +68,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); /* * Stand-alone file reading package. @@ -581,7 +580,7 @@ ufs_open(upath, f) ncp = cp; while ((c = *cp) != '\0' && c != '/') { - if (++len > MAXNAMLEN) { + if (++len > UFS_MAXNAMLEN) { rc = ENOENT; goto out; } diff --git a/usr/src/boot/sys/boot/common/ufsread.c b/usr/src/boot/sys/boot/common/ufsread.c index 1ceb533352..b063e663c4 100644 --- a/usr/src/boot/sys/boot/common/ufsread.c +++ b/usr/src/boot/sys/boot/common/ufsread.c @@ -44,7 +44,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); #include <ufs/ufs/dinode.h> #include <ufs/ufs/dir.h> @@ -133,7 +132,7 @@ fsfind(const char *name, ufs_ino_t * ino) static ufs_ino_t lookup(const char *path) { - static char name[MAXNAMLEN + 1]; + static char name[UFS_MAXNAMLEN + 1]; const char *s; ufs_ino_t ino; ssize_t n; @@ -147,7 +146,7 @@ lookup(const char *path) if (!*path) break; for (s = path; *s && *s != '/'; s++); - if ((n = s - path) > MAXNAMLEN) + if ((n = s - path) > UFS_MAXNAMLEN) return 0; ls = *path == '?' && n == 1 && !*s; memcpy(name, path, n); |