[PATCH 2/3 v3] vfs_posixacl: expose acl_t <--> smb_acl_t converter functions

Simo simo at samba.org
Mon May 20 16:46:01 MDT 2013


On 05/20/2013 03:11 AM, Anand Avati wrote:
> These converters are used in vfs_glusterfs for storing posix acls
> as xattrs (where acl_set_file does not work)
>
> Signed-off-by: Anand Avati <avati at redhat.com>
> ---
>   source3/modules/vfs_posixacl.c |    7 ++-----
>   source3/modules/vfs_posixacl.h |    3 +++
>   2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c
> index 6963aae..7733832 100644
> --- a/source3/modules/vfs_posixacl.c
> +++ b/source3/modules/vfs_posixacl.c
> @@ -26,10 +26,7 @@
>   
>   static bool smb_ace_to_internal(acl_entry_t posix_ace,
>   				struct smb_acl_entry *ace);
> -static struct smb_acl_t *smb_acl_to_internal(acl_t acl, TALLOC_CTX *mem_ctx);
>   static int smb_acl_set_mode(acl_entry_t entry, SMB_ACL_PERM_T perm);
> -static acl_t smb_acl_to_posix(const struct smb_acl_t *acl);
> -
>   
>   /* public functions - the api */
>   
> @@ -213,7 +210,7 @@ static bool smb_ace_to_internal(acl_entry_t posix_ace,
>   	return True;
>   }
>   
> -static struct smb_acl_t *smb_acl_to_internal(acl_t acl, TALLOC_CTX *mem_ctx)
> +struct smb_acl_t *smb_acl_to_internal(acl_t acl, TALLOC_CTX *mem_ctx)
>   {
>   	struct smb_acl_t *result = sys_acl_init(mem_ctx);
>   	int entry_id = ACL_FIRST_ENTRY;
> @@ -270,7 +267,7 @@ static int smb_acl_set_mode(acl_entry_t entry, SMB_ACL_PERM_T perm)
>           return acl_set_permset(entry, permset);
>   }
>   
> -static acl_t smb_acl_to_posix(const struct smb_acl_t *acl)
> +acl_t smb_acl_to_posix(const struct smb_acl_t *acl)
>   {
>   	acl_t result;
>   	int i;
> diff --git a/source3/modules/vfs_posixacl.h b/source3/modules/vfs_posixacl.h
> index b0fe841..424cfe9 100644
> --- a/source3/modules/vfs_posixacl.h
> +++ b/source3/modules/vfs_posixacl.h
> @@ -44,5 +44,8 @@ int posixacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
>   
>   NTSTATUS vfs_posixacl_init(void);
>   
> +struct smb_acl_t *smb_acl_to_internal(acl_t acl, TALLOC_CTX *mem_ctx);
> +acl_t smb_acl_to_posix(const struct smb_acl_t *acl);
> +
>   #endif


Reading the module code, the reason you are making these calls public is 
to call them after you use acl_copy_int on the acl buffer.

If I understand it correctly that public function the buffer is an 
exportable representation of an API.
So maybe, instead of making these internal functions public we can add a 
new interface to the VFS that returns this public exportable buffer 
instead and let the API caller call and internal function that does 
acl_copy_int + smb_acl_to_internal , and the reverse ?

Not sure if this is too Linux specific though.

Simo.


-- 
Simo Sorce
Samba Team Member <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-technical mailing list