[libvirt] [PATCH v1 01/10] locking: Allow seclabel remembering
Daniel P. Berrange
berrange at redhat.com
Fri Sep 19 15:35:56 UTC 2014
On Wed, Sep 10, 2014 at 03:26:07PM +0200, Michal Privoznik wrote:
> To keep original seclabel for files libvirt is touching we need a
> single point where the original seclabels can be stored. Instead
> of inventing a new one we can misuse virtlockd which already has
> nearly all the infrastructure we need. As nice feature, it keeps
> its internal state between virtlockd restarts. Again, it's
> something we are going to need, as we don't want to lose the
> original labels on the lock daemon restart.
>
> In this commit two functions are introduced:
>
> virLockManagerRememberSeclabel that takes three arguments:
>
> path, model and seclabel
>
> where @path is unique identifier for the file we are about to
> label, @model and @seclabel then represents original seclabel.
>
> virLockManagerRecallSeclabel then takes:
>
> path, model, *seclabel
>
> and returns number of references held on @path. If the return
> value is zero, *seclabel contains the original label stored by
> first call of RememberSeclabel(). If a positive value is
> returned, other domains are still using the @path and the
> original label shall not be restored.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> src/libvirt_private.syms | 2 ++
> src/locking/lock_driver.h | 41 +++++++++++++++++++++++++++++++++++++++++
> src/locking/lock_manager.c | 26 ++++++++++++++++++++++++++
> src/locking/lock_manager.h | 9 +++++++++
> 4 files changed, 78 insertions(+)
> diff --git a/src/locking/lock_manager.h b/src/locking/lock_manager.h
> index 4189759..3fd5b9a 100644
> --- a/src/locking/lock_manager.h
> +++ b/src/locking/lock_manager.h
> @@ -67,4 +67,13 @@ int virLockManagerInquire(virLockManagerPtr manager,
>
> int virLockManagerFree(virLockManagerPtr manager);
>
> +int virLockManagerRememberSeclabel(virLockManagerPtr lock,
> + const char *path,
> + const char *model,
> + const char *seclabel);
> +int virLockManagerRecallSeclabel(virLockManagerPtr lock,
> + const char *path,
> + const char *model,
> + char **seclabel);
Can add ATTRIBUTE_NONNULL for all of the args in these methods.
ACK if that's changed.
Regards,
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