PERFORCE change 144723 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Sat Jul 5 16:54:05 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=144723
Change 144723 by trasz at trasz_traszkan on 2008/07/05 16:53:46
Change the "flag" part of the API to be compatible with Darwin.
Affected files ...
.. //depot/projects/soc2008/trasz_nfs4acl/TODO#3 edit
.. //depot/projects/soc2008/trasz_nfs4acl/bin/setfacl/merge.c#4 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/Makefile.inc#4 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/Symbol.map#4 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_flag.c#1 add
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_from_text_nfs4.c#2 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_get.c#4 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_set.c#4 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_to_text_nfs4.c#2 edit
.. //depot/projects/soc2008/trasz_nfs4acl/sys/sys/acl.h#8 edit
Differences ...
==== //depot/projects/soc2008/trasz_nfs4acl/TODO#3 (text+ko) ====
@@ -4,15 +4,6 @@
- Add the ability to add ACE at a given position in ACL to setfacl(1),
-- Change acl_{get,set}_flags_np into Darwin-compatible calls:
-
- int acl_add_flag_np(acl_flagset_t flagset_d, acl_flag_t flag);
- int acl_clear_flags_np(acl_flagset_t flagset_d);
- int acl_delete_flag_np(acl_flagset_t flagset_d, acl_flag_t flag);
- int acl_get_flag_np(acl_flagset_t flagset_d, acl_flag_t flag);
- int acl_get_flagset_np(void *obj_p, acl_flagset_t *flagset_p);
- int acl_set_flagset_np(void *obj_p, acl_flagset_t flagset_d);
-
- Find out what to do with chmod(1). Right now, "chmod 600" on file
which already has mode 0600 does not call chmod(2) at all - and it
should, as it might cause ACL recomputation.
==== //depot/projects/soc2008/trasz_nfs4acl/bin/setfacl/merge.c#4 (text+ko) ====
@@ -43,7 +43,7 @@
{
acl_permset_t permset;
acl_extended_t extended;
- acl_flag_t flags;
+ acl_flagset_t flagset;
int have_entry;
uid_t *id, *id_new;
@@ -67,10 +67,10 @@
err(1, "acl_get_extended_np() failed");
if (acl_set_extended_np(*entry_new, extended))
err(1, "acl_set_extended_np() failed");
- if (acl_get_flags_np(*entry, &flags))
- err(1, "acl_get_flags_np() failed");
- if (acl_set_flags_np(*entry_new, flags))
- err(1, "acl_set_flags_np() failed");
+ if (acl_get_flagset_np(*entry, &flagset))
+ err(1, "acl_get_flagset_np() failed");
+ if (acl_set_flagset_np(*entry_new, flagset))
+ err(1, "acl_set_flagset_np() failed");
}
have_entry = 1;
@@ -92,7 +92,7 @@
acl_t acl_new;
acl_tag_t tag, tag_new;
acl_extended_t extended, extended_new;
- acl_flag_t flags;
+ acl_flagset_t flagset;
int entry_id, entry_id_new, have_entry;
if (acl_type == ACL_TYPE_ACCESS || acl_type == ACL_TYPE_NFS4)
@@ -163,10 +163,10 @@
err(1, "acl_get_extended_np() failed");
if (acl_set_extended_np(entry_new, extended))
err(1, "acl_set_extended_np() failed");
- if (acl_get_flags_np(entry, &flags))
- err(1, "acl_get_flags_np() failed");
- if (acl_set_flags_np(entry_new, flags))
- err(1, "acl_set_flags_np() failed");
+ if (acl_get_flagset_np(entry, &flagset))
+ err(1, "acl_get_flagset_np() failed");
+ if (acl_set_flagset_np(entry_new, flagset))
+ err(1, "acl_set_flagset_np() failed");
}
have_entry = 1;
break;
==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/Makefile.inc#4 (text+ko) ====
@@ -8,6 +8,7 @@
acl_delete.c \
acl_delete_entry.c \
acl_entry.c \
+ acl_flag.c \
acl_flags_nfs4.c \
acl_free.c \
acl_from_text.c \
==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/Symbol.map#4 (text) ====
@@ -22,24 +22,28 @@
acl_get_file;
acl_get_link_np;
acl_get_extended_np;
- acl_get_flags_np;
acl_get_fd;
acl_get_fd_np;
+ acl_get_flag_np;
acl_get_perm_np;
+ acl_get_flagset_np;
acl_get_permset;
acl_get_qualifier;
acl_get_tag_type;
acl_init;
acl_dup;
+ acl_add_flag_np;
acl_add_perm;
+ acl_clear_flags_np;
acl_clear_perms;
+ acl_delete_flag_np;
acl_delete_perm;
acl_set_extended_np;
- acl_set_flags_np;
acl_set_file;
acl_set_link_np;
acl_set_fd;
acl_set_fd_np;
+ acl_set_flagset_np;
acl_set_permset;
acl_set_qualifier;
acl_set_tag_type;
==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_from_text_nfs4.c#2 (text+ko) ====
@@ -154,7 +154,7 @@
return (error);
}
- error = acl_set_flags_np(entry, flags);
+ error = acl_set_flagset_np(entry, &flags);
return (error);
}
==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_get.c#4 (text+ko) ====
@@ -243,21 +243,3 @@
return (0);
}
-int
-acl_get_flags_np(acl_entry_t entry_d, acl_flag_t *flags_p)
-{
- if (entry_d == NULL || flags_p == NULL) {
- errno = EINVAL;
- return (-1);
- }
-
- if (!_entry_is_nfs4(entry_d)) {
- errno = EINVAL;
- return (-1);
- }
-
- *flags_p = entry_d->ae_flags;
-
- return (0);
-}
-
==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_set.c#4 (text+ko) ====
@@ -271,25 +271,3 @@
return (-1);
}
-int
-acl_set_flags_np(acl_entry_t entry_d, acl_flag_t flags)
-{
- if (entry_d == NULL) {
- errno = EINVAL;
- return (-1);
- }
-
- if ((flags & ACL_FLAGS_BITS) != flags) {
- errno = EINVAL;
- return (-1);
- }
-
- if (!_entry_must_be_nfs4(entry_d)) {
- errno = EINVAL;
- return (-1);
- }
-
- entry_d->ae_flags = flags;
- return (0);
-}
-
==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_to_text_nfs4.c#2 (text+ko) ====
@@ -135,18 +135,26 @@
format_entry_compact(char *str, size_t size, const acl_entry_t entry)
{
size_t off = 0, maximum_who_field_length = 18;
+ acl_permset_t permset;
+ acl_flagset_t flagset;
assert(_entry_is_nfs4(entry));
+ if (acl_get_flagset_np(entry, &flagset))
+ return (0);
+
+ if (acl_get_permset(entry, &permset))
+ return (0);
+
off += format_who(str + off, size - off, entry);
if (off < maximum_who_field_length)
off += add_padding(str, size - off, maximum_who_field_length - off);
off += snprintf(str + off, size - off, ":");
- off += _nfs4_format_access_mask(str + off, size - off, entry->ae_perm, 0);
+ off += _nfs4_format_access_mask(str + off, size - off, *permset, 0);
off += snprintf(str + off, size - off, ":");
- off += _nfs4_format_flags(str + off, size - off, entry->ae_flags, 0);
+ off += _nfs4_format_flags(str + off, size - off, *flagset, 0);
off += snprintf(str + off, size - off, ":");
off += format_extended(str + off, size - off, entry);
==== //depot/projects/soc2008/trasz_nfs4acl/sys/sys/acl.h#8 (text+ko) ====
@@ -80,6 +80,7 @@
typedef int acl_extended_t;
typedef int acl_type_t;
typedef int *acl_permset_t;
+typedef int *acl_flagset_t;
struct acl_entry {
acl_tag_t ae_tag;
@@ -297,8 +298,10 @@
* filesystems (i.e., AFS).
*/
__BEGIN_DECLS
+int acl_add_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);
int acl_add_perm(acl_permset_t _permset_d, acl_perm_t _perm);
int acl_calc_mask(acl_t *_acl_p);
+int acl_clear_flags_np(acl_flagset_t _flagset_d);
int acl_clear_perms(acl_permset_t _permset_d);
int acl_copy_entry(acl_entry_t _dest_d, acl_entry_t _src_d);
ssize_t acl_copy_ext(void *_buf_p, acl_t _acl, ssize_t _size);
@@ -312,6 +315,7 @@
int acl_delete_link_np(const char *_path_p, acl_type_t _type);
int acl_delete_def_file(const char *_path_p);
int acl_delete_def_link_np(const char *_path_p);
+int acl_delete_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);
int acl_delete_perm(acl_permset_t _permset_d, acl_perm_t _perm);
acl_t acl_dup(acl_t _acl);
int acl_free(void *_obj_p);
@@ -320,20 +324,21 @@
acl_t acl_get_fd(int _fd);
acl_t acl_get_fd_np(int fd, acl_type_t _type);
acl_t acl_get_file(const char *_path_p, acl_type_t _type);
-int acl_get_flags_np(acl_entry_t _entry_d, acl_flag_t *_flags_p);
int acl_get_extended_np(acl_entry_t _entry_d, acl_extended_t *_extended_p);
acl_t acl_get_link_np(const char *_path_p, acl_type_t _type);
void *acl_get_qualifier(acl_entry_t _entry_d);
+int acl_get_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);
int acl_get_perm_np(acl_permset_t _permset_d, acl_perm_t _perm);
+int acl_get_flagset_np(acl_entry_t _entry_d, acl_flagset_t *_flagset_p);
int acl_get_permset(acl_entry_t _entry_d, acl_permset_t *_permset_p);
int acl_get_tag_type(acl_entry_t _entry_d, acl_tag_t *_tag_type_p);
acl_t acl_init(int _count);
int acl_set_fd(int _fd, acl_t _acl);
int acl_set_fd_np(int _fd, acl_t _acl, acl_type_t _type);
int acl_set_file(const char *_path_p, acl_type_t _type, acl_t _acl);
-int acl_set_flags_np(acl_entry_t _entry_d, acl_flag_t _flags);
int acl_set_extended_np(acl_entry_t _entry_d, acl_extended_t _extended);
int acl_set_link_np(const char *_path_p, acl_type_t _type, acl_t _acl);
+int acl_set_flagset_np(acl_entry_t _entry_d, acl_flagset_t _flagset_d);
int acl_set_permset(acl_entry_t _entry_d, acl_permset_t _permset_d);
int acl_set_qualifier(acl_entry_t _entry_d, const void *_tag_qualifier_p);
int acl_set_tag_type(acl_entry_t _entry_d, acl_tag_t _tag_type);
More information about the p4-projects
mailing list