PERFORCE change 27244 for review

Robert Watson rwatson at freebsd.org
Sun Mar 23 03:03:09 GMT 2003


http://perforce.freebsd.org/chv.cgi?CH=27244

Change 27244 by rwatson at rwatson_paprika on 2003/03/22 19:02:15

	More file systems updated to handle new cmask semantics for
	vop_mknod().

Affected files ...

.. //depot/projects/trustedbsd/acl/sys/coda/coda_vnops.c#4 edit
.. //depot/projects/trustedbsd/acl/sys/fs/devfs/devfs_vnops.c#4 edit
.. //depot/projects/trustedbsd/acl/sys/fs/fifofs/fifo_vnops.c#4 edit
.. //depot/projects/trustedbsd/acl/sys/fs/unionfs/union_vnops.c#4 edit
.. //depot/projects/trustedbsd/acl/sys/gnu/ext2fs/ext2_vnops.c#4 edit

Differences ...

==== //depot/projects/trustedbsd/acl/sys/coda/coda_vnops.c#4 (text+ko) ====


==== //depot/projects/trustedbsd/acl/sys/fs/devfs/devfs_vnops.c#4 (text+ko) ====

@@ -458,6 +458,7 @@
 	struct vnode **a_vpp;
 	struct componentname *a_cnp;
 	struct vattr *a_vap;
+	int a_cmask;
 };
 */
 {
@@ -729,6 +730,7 @@
 	struct devfs_dirent *de;
 	struct vattr *vap;
 	struct vnode *vp;
+	u_short mode;
 	int c, error;
 	uid_t uid;
 	gid_t gid;
@@ -746,6 +748,7 @@
 	    (vap->va_gen != VNOVAL)) {
 		return (EINVAL);
 	}
+	mode = vap->va_mode &~ ap->a_cmask;
 
 	de = vp->v_data;
 	if (vp->v_type == VDIR)
@@ -770,11 +773,11 @@
 		c = 1;
 	}
 
-	if (vap->va_mode != (mode_t)VNOVAL) {
+	if (mode != (mode_t)VNOVAL) {
 		if ((ap->a_cred->cr_uid != de->de_uid) &&
 		    (error = suser_cred(ap->a_td->td_ucred, PRISON_ROOT)))
 			return (error);
-		de->de_mode = vap->va_mode;
+		de->de_mode = mode;
 		c = 1;
 	}
 

==== //depot/projects/trustedbsd/acl/sys/fs/fifofs/fifo_vnops.c#4 (text+ko) ====


==== //depot/projects/trustedbsd/acl/sys/fs/unionfs/union_vnops.c#4 (text+ko) ====

@@ -692,6 +692,7 @@
 		struct vnode **a_vpp;
 		struct componentname *a_cnp;
 		struct vattr *a_vap;
+		int a_cmask;
 	} */ *ap;
 {
 	struct union_node *dun = VTOUNION(ap->a_dvp);

==== //depot/projects/trustedbsd/acl/sys/gnu/ext2fs/ext2_vnops.c#4 (text+ko) ====

@@ -83,7 +83,7 @@
 #include <gnu/ext2fs/ext2_extern.h>
 #include <gnu/ext2fs/ext2_fs.h>
 
-static int ext2_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *);
+static int ext2_makeinode(int mode, int cmask, struct vnode *, struct vnode **, struct componentname *);
 
 static int ext2_access(struct vop_access_args *);
 static int ext2_advlock(struct vop_advlock_args *);
@@ -283,13 +283,11 @@
 		int a_cmask;
 	} */ *ap;
 {
-	u_short mode;
 	int error;
 
-	mode = ap->a_vap->va_mode &~ ap->a_cmask;
 	error =
-	    ext2_makeinode(MAKEIMODE(ap->a_vap->va_type, mode), ap->a_dvp,
-	    ap->a_vpp, ap->a_cnp);
+	    ext2_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_mode),
+	    ap->a_cmask, ap->a_dvp, ap->a_vpp, ap->a_cnp);
 	if (error)
 		return (error);
 	return (0);
@@ -698,6 +696,7 @@
 		struct vnode **a_vpp;
 		struct componentname *a_cnp;
 		struct vattr *a_vap;
+		int a_cmask;
 	} */ *ap;
 {
 	struct vattr *vap = ap->a_vap;
@@ -707,7 +706,7 @@
 	int error;
 
 	error = ext2_makeinode(MAKEIMODE(vap->va_type, vap->va_mode),
-	    ap->a_dvp, vpp, ap->a_cnp);
+	    ap->a_cmask, ap->a_dvp, vpp, ap->a_cnp);
 	if (error)
 		return (error);
 	ip = VTOI(*vpp);
@@ -1188,6 +1187,7 @@
 		struct vnode **a_vpp;
 		struct componentname *a_cnp;
 		struct vattr *a_vap;
+		int a_cmask;
 	} */ *ap;
 {
 	struct vnode *dvp = ap->a_dvp;
@@ -1207,7 +1207,7 @@
 		error = EMLINK;
 		goto out;
 	}
-	dmode = vap->va_mode & 0777;
+	dmode = vap->va_mode & 0777 &~ ap->a_cmask;
 	dmode |= IFDIR;
 	/*
 	 * Must simulate part of ext2_makeinode here to acquire the inode,
@@ -1779,8 +1779,9 @@
  * Allocate a new inode.
  */
 static int
-ext2_makeinode(mode, dvp, vpp, cnp)
+ext2_makeinode(mode, cmask, dvp, vpp, cnp)
 	int mode;
+	int cmask;
 	struct vnode *dvp;
 	struct vnode **vpp;
 	struct componentname *cnp;
@@ -1789,6 +1790,11 @@
 	struct vnode *tvp;
 	int error;
 
+	/*
+	 * XXXACL: If and when we support ext2fs ACLs, the new object mode
+	 * will need to be calculated using the ACL_MASK entry also.
+	 */
+	mode &= ~cmask;
 	pdir = VTOI(dvp);
 #ifdef DIAGNOSTIC
 	if ((cnp->cn_flags & HASBUF) == 0)
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list