Date: Sun, 27 Jul 2008 19:20:35 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 146060 for review Message-ID: <200807271920.m6RJKZxd054696@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=146060 Change 146060 by trasz@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807271920.m6RJKZxd054696>