summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ufs/dir.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ufs/ufs/dir.h')
-rw-r--r--sys/ufs/ufs/dir.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/ufs/ufs/dir.h b/sys/ufs/ufs/dir.h
index 574a32f..9f79e83 100644
--- a/sys/ufs/ufs/dir.h
+++ b/sys/ufs/ufs/dir.h
@@ -105,13 +105,11 @@ struct direct {
* The DIRSIZ macro gives the minimum record length which will hold
* 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
- * 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) \
- ((__offsetof(struct direct, d_name) + \
- ((namlen)+1)*sizeof(((struct direct *)0)->d_name[0]) + 3) & ~3)
+#define DIR_ROUNDUP 4 /* Directory name roundup size */
+#define DIRECTSIZ(namlen) \
+ (roundup2(__offsetof(struct direct, d_name) + (namlen) + 1, DIR_ROUNDUP))
#if (BYTE_ORDER == LITTLE_ENDIAN)
#define DIRSIZ(oldfmt, dp) \
((oldfmt) ? DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen))
OpenPOWER on IntegriCloud