Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ufs Add more comments to explain what we are doing.



details:   https://anonhg.NetBSD.org/src/rev/b00e41ccd33b
branches:  trunk
changeset: 451077:b00e41ccd33b
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 05 15:07:12 2019 +0000

description:
Add more comments to explain what we are doing.

diffstat:

 sys/ufs/ufs/dir.h        |  6 ++++--
 sys/ufs/ufs/ufs_lookup.c |  6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r 1564f84ae54f -r b00e41ccd33b sys/ufs/ufs/dir.h
--- a/sys/ufs/ufs/dir.h Sun May 05 15:05:22 2019 +0000
+++ b/sys/ufs/ufs/dir.h Sun May 05 15:07:12 2019 +0000
@@ -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 @@
  * 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))
diff -r 1564f84ae54f -r b00e41ccd33b sys/ufs/ufs/ufs_lookup.c
--- a/sys/ufs/ufs/ufs_lookup.c  Sun May 05 15:05:22 2019 +0000
+++ b/sys/ufs/ufs/ufs_lookup.c  Sun May 05 15:07:12 2019 +0000
@@ -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 @@
        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)))



Home | Main Index | Thread Index | Old Index