PERFORCE change 146060 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Jul 27 19:20:36 UTC 2008


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

Change 146060 by trasz at trasz_traszkan on 2008/07/27 19:20:34

	Simplify alignment.

Affected files ...

.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_branding.c#3 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_init.c#4 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_support.h#4 edit

Differences ...

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_branding.c#3 (text+ko) ====

@@ -48,10 +48,7 @@
 {
 	acl_t aclp;
 
-	/*
-	 * XXX: This is not a proper way to strip off low order bits.
-	 */
-	aclp = (acl_t)((long)entry - ((long)entry % (long)_ACL_T_ALIGNMENT));
+	aclp = (acl_t)(((long)entry >> _ACL_T_ALIGNMENT_BITS) << _ACL_T_ALIGNMENT_BITS);
 
 	return (aclp);
 }

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_init.c#4 (text+ko) ====

@@ -57,8 +57,8 @@
 		return (NULL);
 	}
 
-	assert(_ACL_T_ALIGNMENT > sizeof(struct acl_t_struct));
-	error = posix_memalign((void *)&acl, _ACL_T_ALIGNMENT, sizeof(struct acl_t_struct));
+	assert(1 << _ACL_T_ALIGNMENT_BITS > sizeof(struct acl_t_struct));
+	error = posix_memalign((void *)&acl, 1 << _ACL_T_ALIGNMENT_BITS, sizeof(struct acl_t_struct));
 	if (error)
 		return (NULL);
 

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_support.h#4 (text+ko) ====

@@ -33,7 +33,7 @@
 #define _ACL_SUPPORT_H
 
 #define _POSIX1E_ACL_STRING_PERM_MAXSIZE 3       /* read, write, exec */
-#define _ACL_T_ALIGNMENT		(1 << 12)
+#define _ACL_T_ALIGNMENT_BITS		12
 
 int	_acl_type_unold(acl_type_t type);
 int	_acl_differs(const acl_t a, const acl_t b);


More information about the p4-projects mailing list