[libvirt] [PATCH v3 2/3] virfile: Introduce internal API for managing ACL

Daniel P. Berrange berrange at redhat.com
Tue Mar 12 12:28:07 UTC 2013


On Mon, Mar 11, 2013 at 05:13:28PM +0100, Michal Privoznik wrote:
> diff --git a/m4/virt-acl.m4 b/m4/virt-acl.m4
> new file mode 100644
> index 0000000..7f16dca
> --- /dev/null
> +++ b/m4/virt-acl.m4
> @@ -0,0 +1,9 @@
> +dnl The libacl.so library
> +
> +AC_DEFUN([LIBVIRT_CHECK_ACL],[
> +  LIBVIRT_CHECK_LIB([ACL], [acl], [acl_init], [sys/acl.h])
> +])

Given your arg here of 'ACL' the conditional provided
will be WITH_ACL, not HAVE_LIBACL

> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index aae7101..e868e09 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -42,6 +42,12 @@
>  # include <sys/types.h>
>  #endif
>  
> +#ifdef HAVE_LIBACL

s/HAVE_LIBACL/WITH_ACL

> +# include <acl/libacl.h>
> +# include <sys/acl.h>

Not required, libacl.h includes it already

> +# include <sys/types.h>

Never required anywhere.

> @@ -750,3 +756,181 @@ virFileRemoveAttr(const char *file ATTRIBUTE_UNUSED,
>      return -1;
>  }
>  #endif /* HAVE_LIBATTR */
> +
> +#ifdef HAVE_LIBACL

s/HAVE_LIBACL/WITH_ACL/

> +#else /* HAVE_LIBACL */

s/HAVE_LIBACL/WITH_ACL/

> +#endif /* HAVE_LIBACL */

s/HAVE_LIBACL/WITH_ACL/

> diff --git a/src/util/virfile.h b/src/util/virfile.h
> index 3b4d672..fe46a7d 100644
> --- a/src/util/virfile.h
> +++ b/src/util/virfile.h
> @@ -120,4 +120,15 @@ int virFileGetAttr(const char *file,
>  int virFileRemoveAttr(const char *file,
>                        const char *name);
>  
> +int virFileSetACL(const char *file,
> +                  uid_t user,
> +                  mode_t perms);

ATTRIBUTE_NONNULL(1) here and for the other 2 functions

> +
> +int virFileGetACL(const char *file,
> +                  uid_t user,
> +                  mode_t *perms);

Perhaps add ATTRIBUTE_NONNULL(3) ?

> +
> +int virFileRemoveACL(const char *file,
> +                     uid_t user);
> +
>  #endif /* __VIR_FILES_H */

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list