Module Name: src
Committed By: christos
Date: Sun May 5 15:07:12 UTC 2019
Modified Files:
src/sys/ufs/ufs: dir.h ufs_lookup.c
Log Message:
Add more comments to explain what we are doing.
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/ufs/ufs/dir.h
cvs rdiff -u -r1.149 -r1.150 src/sys/ufs/ufs/ufs_lookup.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ufs/ufs/dir.h
diff -u src/sys/ufs/ufs/dir.h:1.26 src/sys/ufs/ufs/dir.h:1.27
--- src/sys/ufs/ufs/dir.h:1.26 Sat May 4 21:48:53 2019
+++ src/sys/ufs/ufs/dir.h Sun May 5 11:07:12 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.h,v 1.26 2019/05/05 01:48:53 christos Exp $ */
+/* $NetBSD: dir.h,v 1.27 2019/05/05 15:07:12 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -109,7 +109,9 @@ struct direct {
* The UFS_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.
+ * NUL byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
+ * The UFS_NAMEPAD macro gives the number bytes of padding needed including
+ * the NUL terminating byte.
*/
#define DIR_ROUNDUP 4
#define UFS_NAMEROUNDUP(namlen) (((namlen) + DIR_ROUNDUP) & ~(DIR_ROUNDUP - 1))
Index: src/sys/ufs/ufs/ufs_lookup.c
diff -u src/sys/ufs/ufs/ufs_lookup.c:1.149 src/sys/ufs/ufs/ufs_lookup.c:1.150
--- src/sys/ufs/ufs/ufs_lookup.c:1.149 Sat May 4 21:48:53 2019
+++ src/sys/ufs/ufs/ufs_lookup.c Sun May 5 11:07:12 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_lookup.c,v 1.149 2019/05/05 01:48:53 christos Exp $ */
+/* $NetBSD: ufs_lookup.c,v 1.150 2019/05/05 15:07:12 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.149 2019/05/05 01:48:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.150 2019/05/05 15:07:12 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_ffs.h"
@@ -799,7 +799,7 @@ ufs_makedirentry(struct inode *ip, struc
newdirp->d_namlen = namelen;
memcpy(newdirp->d_name, cnp->cn_nameptr, namelen);
- /* Zero out padding */
+ /* NUL terminate and zero out padding */
memset(&newdirp->d_name[namelen], 0, UFS_NAMEPAD(namelen));
if (FSFMT(ITOV(ip)))