Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Aug 2008 12:04:36 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 147525 for review
Message-ID:  <200808161204.m7GC4aKA098600@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147525

Change 147525 by trasz@trasz_traszkan on 2008/08/16 12:04:10

	Cosmetic fixes and little change in parameter list of one of the
	functions.  No functional changes.

Affected files ...

.. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_nfs4.c#26 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/sys/acl.h#22 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/ufs/ufs/ufs_vnops.c#14 edit

Differences ...

==== //depot/projects/soc2008/trasz_nfs4acl/sys/kern/subr_acl_nfs4.c#26 (text+ko) ====

@@ -99,7 +99,8 @@
 		*denied_explicitly = 0;
 
 	KASSERT(aclp->acl_cnt > 0, ("aclp->acl_cnt > 0"));
-	KASSERT(aclp->acl_cnt <= ACL_MAX_ENTRIES, ("aclp->acl_cnt <= ACL_MAX_ENTRIES"));
+	KASSERT(aclp->acl_cnt <= ACL_MAX_ENTRIES,
+	    ("aclp->acl_cnt <= ACL_MAX_ENTRIES"));
 
 	for (i = 0; i < aclp->acl_cnt; i++) {
 		entry = &(aclp->acl_entry[i]);
@@ -330,6 +331,9 @@
 	struct acl_entry *entry, *copy, *previous,
 	    *a1, *a2, *a3, *a4, *a5, *a6;
 	mode_t amode;
+	const int READ = 04;
+	const int WRITE = 02;
+	const int EXEC = 01;
 
 	/*
 	 * NFSv4 Minor Version 1, draft-ietf-nfsv4-minorversion1-03.txt
@@ -493,28 +497,28 @@
 			amode = amode >> 3;
 
 		if (entry->ae_perm & ACL_READ_DATA) {
-			if (amode & ACL_READ)
+			if (amode & READ)
 				previous->ae_perm &= ~ACL_READ_DATA;
 			else
 				previous->ae_perm |= ACL_READ_DATA;
 		}
 
 		if (entry->ae_perm & ACL_WRITE_DATA) {
-			if (amode & ACL_WRITE)
+			if (amode & WRITE)
 				previous->ae_perm &= ~ACL_WRITE_DATA;
 			else
 				previous->ae_perm |= ACL_WRITE_DATA;
 		}
 
 		if (entry->ae_perm & ACL_APPEND_DATA) {
-			if (amode & ACL_WRITE)
+			if (amode & WRITE)
 				previous->ae_perm &= ~ACL_APPEND_DATA;
 			else
 				previous->ae_perm |= ACL_APPEND_DATA;
 		}
 
 		if (entry->ae_perm & ACL_EXECUTE) {
-			if (amode & ACL_EXECUTE)
+			if (amode & EXEC)
 				previous->ae_perm &= ~ACL_EXECUTE;
 			else
 				previous->ae_perm |= ACL_EXECUTE;
@@ -537,25 +541,22 @@
 			extramode &= ~ownermode;
 
 			if (extramode) {
-				CTASSERT(ACL_READ == 04);
-				CTASSERT(ACL_WRITE == 02);
-				if (extramode & ACL_READ) {
+				if (extramode & READ) {
 					entry->ae_perm &= ~ACL_READ_DATA;
 					previous->ae_perm &= ~ACL_READ_DATA;
 				}
 
-				if (extramode & ACL_WRITE) {
+				if (extramode & WRITE) {
 					entry->ae_perm &=
 					    ~(ACL_WRITE_DATA | ACL_APPEND_DATA);
 					previous->ae_perm &=
 					    ~(ACL_WRITE_DATA | ACL_APPEND_DATA);
 				}
-			}
 
-			CTASSERT(ACL_EXECUTE == 01);
-			if (extramode & ACL_EXECUTE) {
-				entry->ae_perm &= ~ACL_EXECUTE;
-				previous->ae_perm &= ~ACL_EXECUTE;
+				if (extramode & EXEC) {
+					entry->ae_perm &= ~ACL_EXECUTE;
+					previous->ae_perm &= ~ACL_EXECUTE;
+				}
 			}
 		}
 	}
@@ -800,8 +801,8 @@
 }
 
 int		
-acl_nfs4_compute_inherited_acl(struct acl *child_aclp,
-    const struct acl *parent_aclp, mode_t mode, int file_owner_id,
+acl_nfs4_compute_inherited_acl(const struct acl *parent_aclp,
+    struct acl *child_aclp, mode_t mode, int file_owner_id,
     int is_directory)
 {
 	int i, error, flags;

==== //depot/projects/soc2008/trasz_nfs4acl/sys/sys/acl.h#22 (text+ko) ====

@@ -270,13 +270,19 @@
 mode_t			acl_posix1e_newfilemode(mode_t cmode,
 			    struct acl *dacl);
 
-int			acl_nfs4_sync_acl_from_mode(struct acl *aclp, mode_t mode, int file_owner_id);
-void			acl_nfs4_sync_mode_from_acl(mode_t *mode, const struct acl *aclp);
+int			acl_nfs4_sync_acl_from_mode(struct acl *aclp,
+			    mode_t mode, int file_owner_id);
+void			acl_nfs4_sync_mode_from_acl(mode_t *mode,
+			    const struct acl *aclp);
 int			acl_nfs4_is_trivial(const struct acl *aclp);
-int			acl_nfs4_compute_inherited_acl(struct acl *child_aclp, const struct acl *parent_aclp,
-			    mode_t mode, int file_owner_id, int is_directory);
-int			acl_copy_oldacl_into_acl(const struct oldacl *source, struct acl *dest);
-int			acl_copy_acl_into_oldacl(const struct acl *source, struct oldacl *dest);
+int			acl_nfs4_compute_inherited_acl(
+			    const struct acl *parent_aclp,
+			    struct acl *child_aclp, mode_t mode,
+			    int file_owner_id, int is_directory);
+int			acl_copy_oldacl_into_acl(const struct oldacl *source,
+			    struct acl *dest);
+int			acl_copy_acl_into_oldacl(const struct acl *source,
+			    struct oldacl *dest);
 
 /*
  * File system independent syntax check for a POSIX.1e ACL.

==== //depot/projects/soc2008/trasz_nfs4acl/sys/ufs/ufs/ufs_vnops.c#14 (text+ko) ====

@@ -1422,8 +1422,8 @@
 
 #ifdef UFS_ACL
 static int
-ufs_do_nfs4_acl_inheritance(struct vnode *parentvp, struct vnode *childvp, mode_t child_mode,
-    int file_owner_id, int is_directory, struct ucred *cred, struct thread *td)
+ufs_do_nfs4_acl_inheritance(struct vnode *dvp, struct vnode *tvp,
+    mode_t child_mode, struct ucred *cred, struct thread *td)
 {
 	int error;
 	struct acl *parent_aclp, *child_aclp;
@@ -1431,16 +1431,16 @@
 	parent_aclp = acl_alloc();
 	child_aclp = acl_alloc();
 
-	error = VOP_GETACL(parentvp, ACL_TYPE_NFS4, parent_aclp, cred, td);
+	error = VOP_GETACL(dvp, ACL_TYPE_NFS4, parent_aclp, cred, td);
 	if (error)
 		goto out;
 
-	error = acl_nfs4_compute_inherited_acl(child_aclp, parent_aclp,
-	    child_mode, file_owner_id, is_directory);
+	error = acl_nfs4_compute_inherited_acl(parent_aclp, child_aclp,
+	    child_mode, VTOI(tvp)->i_uid, tvp->v_type == VDIR);
 	if (error)
 		goto out;
 
-	error = VOP_SETACL(childvp, ACL_TYPE_NFS4, child_aclp, cred, td);
+	error = VOP_SETACL(tvp, ACL_TYPE_NFS4, child_aclp, cred, td);
 	if (error)
 		goto out;
 
@@ -1686,7 +1686,7 @@
 
 	if (dvp->v_mount->mnt_flag & MNT_NFS4ACLS) {
 		error = ufs_do_nfs4_acl_inheritance(dvp, tvp, dmode,
-		    ip->i_uid, 1, cnp->cn_cred, cnp->cn_thread);
+		    cnp->cn_cred, cnp->cn_thread);
 		if (error)
 			goto bad;
 	}
@@ -2517,7 +2517,7 @@
 
 	if (dvp->v_mount->mnt_flag & MNT_NFS4ACLS) {
 		error = ufs_do_nfs4_acl_inheritance(dvp, tvp, mode,
-		    ip->i_uid, 0, cnp->cn_cred, cnp->cn_thread);
+		    cnp->cn_cred, cnp->cn_thread);
 		if (error)
 			goto bad;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808161204.m7GC4aKA098600>