Date: Mon, 25 May 2009 19:06:10 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 162734 for review Message-ID: <200905251906.n4PJ6A9R006997@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=162734 Change 162734 by trasz@trasz_victim on 2009/05/25 19:05:42 Whitespace fixes. Affected files ... .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/Symbol.map#10 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_branding.c#10 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_calc_mask.c#5 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_delete_entry.c#9 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_flag.c#5 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_from_text_nfs4.c#11 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_get.c#11 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_set.c#8 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_strip.c#8 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_support.c#8 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_support_nfs4.c#12 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_to_text.c#7 edit .. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_to_text_nfs4.c#14 edit Differences ... ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/Symbol.map#10 (text) ==== @@ -84,4 +84,3 @@ acl_strip_np; acl_to_text_np; }; - ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_branding.c#10 (text+ko) ==== @@ -62,12 +62,14 @@ int _acl_brand(const acl_t acl) { + return (acl->ats_brand); } int _entry_brand(const acl_entry_t entry) { + return (_acl_brand(entry2acl(entry))); } @@ -77,6 +79,7 @@ int _acl_brand_may_be(const acl_t acl, int brand) { + if (_acl_brand(acl) == ACL_BRAND_UNKNOWN) return (1); @@ -89,6 +92,7 @@ int _entry_brand_may_be(const acl_entry_t entry, int brand) { + return (_acl_brand_may_be(entry2acl(entry), brand)); } @@ -98,6 +102,7 @@ void _acl_brand_as(acl_t acl, int brand) { + assert(_acl_brand_may_be(acl, brand)); acl->ats_brand = brand; @@ -106,23 +111,23 @@ void _entry_brand_as(const acl_entry_t entry, int brand) { + _acl_brand_as(entry2acl(entry), brand); } int _acl_type_not_valid_for_acl(const acl_t acl, acl_type_t type) { + switch (_acl_brand(acl)) { case ACL_BRAND_NFS4: if (type == ACL_TYPE_NFS4) return (0); - break; case ACL_BRAND_POSIX: if (type == ACL_TYPE_ACCESS || type == ACL_TYPE_DEFAULT) return (0); - break; } @@ -132,16 +137,15 @@ void _acl_brand_from_type(acl_t acl, acl_type_t type) { + switch (type) { case ACL_TYPE_NFS4: _acl_brand_as(acl, ACL_BRAND_NFS4); break; - case ACL_TYPE_ACCESS: case ACL_TYPE_DEFAULT: _acl_brand_as(acl, ACL_BRAND_POSIX); break; - default: /* XXX: What to do here? */ break; @@ -151,13 +155,12 @@ int acl_get_brand_np(acl_t acl, int *brand_p) { + if (acl == NULL || brand_p == NULL) { errno = EINVAL; return (-1); } - *brand_p = _acl_brand(acl); return (0); } - ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_calc_mask.c#5 (text+ko) ==== @@ -54,7 +54,6 @@ errno = EINVAL; return (-1); } - _acl_brand_as(*acl_p, ACL_BRAND_POSIX); /* ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_delete_entry.c#9 (text+ko) ==== ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_flag.c#5 (text+ko) ==== @@ -30,11 +30,13 @@ #include <stdio.h> #include <errno.h> #include <sys/acl.h> + #include "acl_support.h" static int _flag_is_invalid(acl_flag_t flag) { + if ((flag & ACL_FLAGS_BITS) == flag) return (0); @@ -46,6 +48,7 @@ int acl_add_flag_np(acl_flagset_t flagset_d, acl_flag_t flag) { + if (flagset_d == NULL) { errno = EINVAL; return (-1); @@ -62,6 +65,7 @@ int acl_clear_flags_np(acl_flagset_t flagset_d) { + if (flagset_d == NULL) { errno = EINVAL; return (-1); @@ -75,6 +79,7 @@ int acl_delete_flag_np(acl_flagset_t flagset_d, acl_flag_t flag) { + if (flagset_d == NULL) { errno = EINVAL; return (-1); @@ -91,6 +96,7 @@ int acl_get_flag_np(acl_flagset_t flagset_d, acl_flag_t flag) { + if (flagset_d == NULL) { errno = EINVAL; return (-1); @@ -108,6 +114,7 @@ int acl_get_flagset_np(acl_entry_t entry_d, acl_flagset_t *flagset_p) { + if (entry_d == NULL || flagset_p == NULL) { errno = EINVAL; return (-1); @@ -126,6 +133,7 @@ int acl_set_flagset_np(acl_entry_t entry_d, acl_flagset_t flagset_d) { + if (entry_d == NULL) { errno = EINVAL; return (-1); @@ -145,4 +153,3 @@ return (0); } - ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_from_text_nfs4.c#11 (text+ko) ==== @@ -53,15 +53,14 @@ static int parse_tag(const char *str, acl_entry_t entry, int *need_qualifier) { + assert(need_qualifier != NULL); *need_qualifier = 0; if (strcmp(str, "owner@") == 0) return (acl_set_tag_type(entry, ACL_USER_OBJ)); - if (strcmp(str, "group@") == 0) return (acl_set_tag_type(entry, ACL_GROUP_OBJ)); - if (strcmp(str, "everyone@") == 0) return (acl_set_tag_type(entry, ACL_EVERYONE)); @@ -69,7 +68,6 @@ if (strcmp(str, "user") == 0 || strcmp(str, "u") == 0) return (acl_set_tag_type(entry, ACL_USER)); - if (strcmp(str, "group") == 0 || strcmp(str, "g") == 0) return (acl_set_tag_type(entry, ACL_GROUP)); @@ -176,15 +174,13 @@ static int parse_entry_type(const char *str, acl_entry_t entry) { + if (strcmp(str, "allow") == 0) return (acl_set_entry_type_np(entry, ACL_ENTRY_TYPE_ALLOW)); - if (strcmp(str, "deny") == 0) return (acl_set_entry_type_np(entry, ACL_ENTRY_TYPE_DENY)); - if (strcmp(str, "audit") == 0) return (acl_set_entry_type_np(entry, ACL_ENTRY_TYPE_AUDIT)); - if (strcmp(str, "alarm") == 0) return (acl_set_entry_type_np(entry, ACL_ENTRY_TYPE_ALARM)); @@ -314,4 +310,3 @@ errno = EINVAL; return (-1); } - ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_get.c#11 (text+ko) ==== @@ -222,6 +222,7 @@ int acl_get_entry_type_np(acl_entry_t entry_d, acl_entry_type_t *entry_type_p) { + if (entry_d == NULL || entry_type_p == NULL) { errno = EINVAL; return (-1); @@ -236,4 +237,3 @@ return (0); } - ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_set.c#8 (text+ko) ==== @@ -107,6 +107,7 @@ int acl_set_fd(int fd, acl_t acl) { + if (fpathconf(fd, _PC_EXTENDED_SECURITY_NP)) return (acl_set_fd_np(fd, acl, ACL_TYPE_NFS4)); @@ -154,17 +155,14 @@ } if ((*permset_d & ACL_POSIX1E_BITS) != *permset_d) { - if ((*permset_d & ACL_NFS4_PERM_BITS) != *permset_d) { errno = EINVAL; return (-1); } - if (!_entry_brand_may_be(entry_d, ACL_BRAND_NFS4)) { errno = EINVAL; return (-1); } - _entry_brand_as(entry_d, ACL_BRAND_NFS4); } @@ -180,11 +178,11 @@ int acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p) { + if (!entry_d || !tag_qualifier_p) { errno = EINVAL; return (-1); } - switch(entry_d->ae_tag) { case ACL_USER: case ACL_GROUP: @@ -218,16 +216,13 @@ errno = EINVAL; return (-1); } - _entry_brand_as(entry_d, ACL_BRAND_POSIX); break; - case ACL_EVERYONE: if (!_entry_brand_may_be(entry_d, ACL_BRAND_NFS4)) { errno = EINVAL; return (-1); } - _entry_brand_as(entry_d, ACL_BRAND_NFS4); break; } @@ -251,16 +246,15 @@ int acl_set_entry_type_np(acl_entry_t entry_d, acl_entry_type_t entry_type) { + if (entry_d == NULL) { errno = EINVAL; return (-1); } - if (!_entry_brand_may_be(entry_d, ACL_BRAND_NFS4)) { errno = EINVAL; return (-1); } - _entry_brand_as(entry_d, ACL_BRAND_NFS4); switch (entry_type) { @@ -268,7 +262,6 @@ case ACL_ENTRY_TYPE_DENY: case ACL_ENTRY_TYPE_AUDIT: case ACL_ENTRY_TYPE_ALARM: - entry_d->ae_entry_type = entry_type; return (0); } @@ -276,4 +269,3 @@ errno = EINVAL; return (-1); } - ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_strip.c#8 (text+ko) ==== @@ -198,4 +198,3 @@ return (-1); } } - ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_support.c#8 (text+ko) ==== @@ -92,6 +92,7 @@ static int _posix1e_acl_entry_compare(struct acl_entry *a, struct acl_entry *b) { + assert(_entry_brand(a) == ACL_BRAND_POSIX); assert(_entry_brand(b) == ACL_BRAND_POSIX); @@ -151,6 +152,7 @@ int _posix1e_acl(acl_t acl, acl_type_t type) { + if (_acl_brand(acl) != ACL_BRAND_POSIX) return (0); @@ -431,13 +433,12 @@ int _acl_type_unold(acl_type_t type) { + switch (type) { case ACL_TYPE_ACCESS_OLD: return (ACL_TYPE_ACCESS); - case ACL_TYPE_DEFAULT_OLD: return (ACL_TYPE_DEFAULT); - default: return (type); } @@ -447,9 +448,9 @@ string_skip_whitespace(char *string) { - while (*string && ((*string == ' ') || (*string == '\t'))) { + while (*string && ((*string == ' ') || (*string == '\t'))) string++; - } + return (string); } ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_support_nfs4.c#12 (text+ko) ==== @@ -75,6 +75,7 @@ static const char * format_flag(uint32_t *var, const struct flagnames_struct *flags) { + for (; flags->name != 0; flags++) { if ((flags->flag & *var) == 0) continue; @@ -205,6 +206,7 @@ int _nfs4_format_flags(char *str, size_t size, acl_flag_t var, int verbose) { + if (verbose) return (format_flags_verbose(str, size, var, a_flags)); @@ -214,6 +216,7 @@ int _nfs4_format_access_mask(char *str, size_t size, acl_perm_t var, int verbose) { + if (verbose) return (format_flags_verbose(str, size, var, a_access_masks)); ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_to_text.c#7 (text+ko) ==== @@ -242,13 +242,12 @@ char * acl_to_text_np(acl_t acl, ssize_t *len_p, int flags) { + switch (_acl_brand(acl)) { case ACL_BRAND_POSIX: return (_posix1e_acl_to_text(acl, len_p, flags)); - case ACL_BRAND_NFS4: return (_nfs4_acl_to_text_np(acl, len_p, flags)); - default: errno = EINVAL; return (NULL); @@ -258,6 +257,6 @@ char * acl_to_text(acl_t acl, ssize_t *len_p) { + return (acl_to_text_np(acl, len_p, 0)); } - ==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_to_text_nfs4.c#14 (text+ko) ==== @@ -120,19 +120,15 @@ case ACL_ENTRY_TYPE_ALLOW: snprintf(str, size, "allow"); break; - case ACL_ENTRY_TYPE_DENY: snprintf(str, size, "deny"); break; - case ACL_ENTRY_TYPE_AUDIT: snprintf(str, size, "audit"); break; - case ACL_ENTRY_TYPE_ALARM: snprintf(str, size, "alarm"); break; - default: return (-1); } @@ -268,4 +264,3 @@ return (str); } -
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905251906.n4PJ6A9R006997>