diff --git a/libisofs/aaip-os-dummy.c b/libisofs/aaip-os-dummy.c index 7490577..ba92977 100644 --- a/libisofs/aaip-os-dummy.c +++ b/libisofs/aaip-os-dummy.c @@ -11,7 +11,7 @@ To be included by aaip_0_2.c - Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2+ + Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+ */ @@ -28,6 +28,29 @@ #include +/* ------------------------------ Inquiry --------------------------------- */ + +/* See also API iso_local_attr_support(). + @param flag + Bitfield for control purposes + bit0= inquire availability of ACL + bit1= inquire availability of xattr + bit2 - bit7= Reserved for future types. + It is permissibile to set them to 1 already now. + bit8 and higher: reserved, submit 0 + @return + Bitfield corresponding to flag. If bits are set, th + bit0= ACL adapter is enabled + bit1= xattr adapter is enabled + bit2 - bit7= Reserved for future types. + bit8 and higher: reserved, do not interpret these +*/ +int aaip_local_attr_support(int flag) +{ + return(0); +} + + /* ------------------------------ Getters --------------------------------- */ /* Obtain the ACL of the given file in long text form. diff --git a/libisofs/aaip-os-freebsd.c b/libisofs/aaip-os-freebsd.c index 58071b1..1d7770e 100644 --- a/libisofs/aaip-os-freebsd.c +++ b/libisofs/aaip-os-freebsd.c @@ -7,7 +7,7 @@ To be included by aaip_0_2.c - Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2 + Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+ */ @@ -34,6 +34,36 @@ #endif +/* ------------------------------ Inquiry --------------------------------- */ + +/* See also API iso_local_attr_support(). + @param flag + Bitfield for control purposes + bit0= inquire availability of ACL + bit1= inquire availability of xattr + bit2 - bit7= Reserved for future types. + It is permissibile to set them to 1 already now. + bit8 and higher: reserved, submit 0 + @return + Bitfield corresponding to flag. If bits are set, th + bit0= ACL adapter is enabled + bit1= xattr adapter is enabled + bit2 - bit7= Reserved for future types. + bit8 and higher: reserved, do not interpret these +*/ +int aaip_local_attr_support(int flag) +{ + int ret= 0; + +#ifdef Libisofs_with_aaip_acL + if(flag & 1) + ret|= 1; +#endif + + return(ret); +} + +, /* ------------------------------ Getters --------------------------------- */ /* Obtain the ACL of the given file in long text form. diff --git a/libisofs/aaip-os-linux.c b/libisofs/aaip-os-linux.c index f0d199a..96b8b7b 100644 --- a/libisofs/aaip-os-linux.c +++ b/libisofs/aaip-os-linux.c @@ -7,7 +7,7 @@ To be included by aaip_0_2.c - Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2+ + Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+ */ @@ -34,6 +34,40 @@ #endif +/* ------------------------------ Inquiry --------------------------------- */ + +/* See also API iso_local_attr_support(). + @param flag + Bitfield for control purposes + bit0= inquire availability of ACL + bit1= inquire availability of xattr + bit2 - bit7= Reserved for future types. + It is permissibile to set them to 1 already now. + bit8 and higher: reserved, submit 0 + @return + Bitfield corresponding to flag. If bits are set, th + bit0= ACL adapter is enabled + bit1= xattr adapter is enabled + bit2 - bit7= Reserved for future types. + bit8 and higher: reserved, do not interpret these +*/ +int aaip_local_attr_support(int flag) +{ + int ret= 0; + +#ifdef Libisofs_with_aaip_acL + if(flag & 1) + ret|= 1; +#endif +#ifdef Libisofs_with_aaip_xattR + if(flag & 2) + ret|= 2; +#endif + + return(ret); +} + + /* ------------------------------ Getters --------------------------------- */ /* Obtain the ACL of the given file in long text form. diff --git a/libisofs/aaip_0_2.h b/libisofs/aaip_0_2.h index b4f5dc0..3b6b574 100644 --- a/libisofs/aaip_0_2.h +++ b/libisofs/aaip_0_2.h @@ -145,6 +145,24 @@ int aaip_add_acl_st_mode(char *acl_text, mode_t st_mode, int flag); /* ------ OS interface ------ */ +/* See also API iso_local_attr_support(). + @param flag + Bitfield for control purposes + bit0= inquire availability of ACL + bit1= inquire availability of xattr + bit2 - bit7= Reserved for future types. + It is permissibile to set them to 1 already now. + bit8 and higher: reserved, submit 0 + @return + Bitfield corresponding to flag. If bits are set, th + bit0= ACL adapter is enabled + bit1= xattr adapter is enabled + bit2 - bit7= Reserved for future types. + bit8 and higher: reserved, do not interpret these +*/ +int aaip_local_attr_support(int flag); + + /* Obtain the ACL of the given file in long text form. @param path Path to the file @param text Will hold the result. This is a managed object which diff --git a/libisofs/fs_local.c b/libisofs/fs_local.c index 5e28a5b..7dc370b 100644 --- a/libisofs/fs_local.c +++ b/libisofs/fs_local.c @@ -819,6 +819,15 @@ int iso_local_filesystem_new(IsoFilesystem **fs) } +int iso_local_attr_support(int flag) +{ + int ret; + + ret= aaip_local_attr_support(flag & 255); + return ret; +} + + int iso_local_get_acl_text(char *disk_path, char **text, int flag) { int ret; diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 4a8229b..291b340 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -5791,6 +5791,30 @@ int iso_node_set_attrs(IsoNode *node, size_t num_attrs, char **names, * from local files. */ +/** + * Inquire whether local filesystem operations with ACL or xattr are enabled + * inside libisofs. They may be disabled because of compile time decisions. + * E.g. because the operating system does not support these features or + * because libisofs has not yet an adapter to use them. + * + * @param flag + * Bitfield for control purposes + * bit0= inquire availability of ACL + * bit1= inquire availability of xattr + * bit2 - bit7= Reserved for future types. + * It is permissibile to set them to 1 already now. + * bit8 and higher: reserved, submit 0 + * @return + * Bitfield corresponding to flag. If bits are set, th + * bit0= ACL adapter is enabled + * bit1= xattr adapter is enabled + * bit2 - bit7= Reserved for future types. + * bit8 and higher: reserved, do not interpret these + * + * @since 1.1.6 + */ +int iso_local_attr_support(int flag); + /** * Get an ACL of the given file in the local filesystem in long text form. * diff --git a/libisofs/libisofs.ver b/libisofs/libisofs.ver index e3798d1..a6b6363 100644 --- a/libisofs/libisofs.ver +++ b/libisofs/libisofs.ver @@ -125,6 +125,7 @@ iso_init; iso_init_with_flag; iso_lib_is_compatible; iso_lib_version; +iso_local_attr_support; iso_local_get_acl_text; iso_local_get_attrs; iso_local_get_perms_wo_acl;