Simplify calculation of DIRECTSIZ. No functional change intended.
Suggested by: kib MFC after: 1 week
This commit is contained in:
parent
bc79b41c40
commit
ab2214d400
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347064
@ -108,13 +108,11 @@ struct direct {
|
|||||||
* The DIRSIZ macro gives the minimum record length which will hold
|
* The DIRSIZ macro gives the minimum record length which will hold
|
||||||
* the directory entry. This requires the amount of space in struct direct
|
* 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
|
* 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.
|
* null byte (dp->d_namlen + 1), rounded up to a 4 byte boundary.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#define DIRECTSIZ(namlen) \
|
#define DIR_ROUNDUP 4 /* Directory name roundup size */
|
||||||
((__offsetof(struct direct, d_name) + \
|
#define DIRECTSIZ(namlen) \
|
||||||
((namlen)+1)*sizeof(((struct direct *)0)->d_name[0]) + 3) & ~3)
|
(roundup2(__offsetof(struct direct, d_name) + (namlen) + 1, DIR_ROUNDUP))
|
||||||
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
#if (BYTE_ORDER == LITTLE_ENDIAN)
|
||||||
#define DIRSIZ(oldfmt, dp) \
|
#define DIRSIZ(oldfmt, dp) \
|
||||||
((oldfmt) ? DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen))
|
((oldfmt) ? DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen))
|
||||||
|
Loading…
Reference in New Issue
Block a user