svn commit: r363753 - in head/sys: kern sys

Mateusz Guzik mjg at FreeBSD.org
Sat Aug 1 06:33:12 UTC 2020


Author: mjg
Date: Sat Aug  1 06:33:11 2020
New Revision: 363753
URL: https://svnweb.freebsd.org/changeset/base/363753

Log:
  vfs: convert ni_rigthsneeded to a pointer
  
  Shaves 8 bytes of struct nameidata on 64-bit platforms.

Modified:
  head/sys/kern/vfs_lookup.c
  head/sys/sys/namei.h

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c	Sat Aug  1 06:32:25 2020	(r363752)
+++ head/sys/kern/vfs_lookup.c	Sat Aug  1 06:33:11 2020	(r363753)
@@ -347,7 +347,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp,
 			*dpp = pwd->pwd_cdir;
 			vrefact(*dpp);
 		} else {
-			rights = ndp->ni_rightsneeded;
+			rights = *ndp->ni_rightsneeded;
 			cap_rights_set_one(&rights, CAP_LOOKUP);
 
 			if (cnp->cn_flags & AUDITVNODE1)
@@ -403,7 +403,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp,
 			ndp->ni_beneath_latch = pwd->pwd_cdir;
 			vrefact(ndp->ni_beneath_latch);
 		} else {
-			rights = ndp->ni_rightsneeded;
+			rights = *ndp->ni_rightsneeded;
 			cap_rights_set_one(&rights, CAP_LOOKUP);
 			error = fgetvp_rights(td, ndp->ni_dirfd, &rights,
 			    &dirfd_caps, &ndp->ni_beneath_latch);
@@ -1381,7 +1381,7 @@ NDINIT_ALL(struct nameidata *ndp, u_long op, u_long fl
 	ndp->ni_resflags = 0;
 	filecaps_init(&ndp->ni_filecaps);
 	ndp->ni_cnd.cn_thread = td;
-	ndp->ni_rightsneeded = *rightsp;
+	ndp->ni_rightsneeded = rightsp;
 }
 
 /*

Modified: head/sys/sys/namei.h
==============================================================================
--- head/sys/sys/namei.h	Sat Aug  1 06:32:25 2020	(r363752)
+++ head/sys/sys/namei.h	Sat Aug  1 06:33:11 2020	(r363753)
@@ -69,7 +69,7 @@ struct nameidata {
 	 */
 	const	char *ni_dirp;		/* pathname pointer */
 	enum	uio_seg ni_segflg;	/* location of pathname */
-	cap_rights_t ni_rightsneeded;	/* rights required to look up vnode */
+	cap_rights_t *ni_rightsneeded;	/* rights required to look up vnode */
 	/*
 	 * Arguments to lookup.
 	 */


More information about the svn-src-all mailing list