[libvirt] [PATCH v4 14/25] security: Document @restore member of transaction list

Michal Privoznik posted 25 patches 6 years, 9 months ago
[libvirt] [PATCH v4 14/25] security: Document @restore member of transaction list
Posted by Michal Privoznik 6 years, 9 months ago
Both DAC and SELinux drivers support transactions. Each item on
the transaction list consists of various variables and @restore
is one of them. Document it so that as the list of variables grow
it's easier to spot which variable does what.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
---
 src/security/security_dac.c     | 5 ++++-
 src/security/security_selinux.c | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 300c383dd5..c19421fa8f 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -79,7 +79,7 @@ struct _virSecurityDACChownItem {
     const virStorageSource *src;
     uid_t uid;
     gid_t gid;
-    bool restore;
+    bool restore; /* Whether current operation is 'set' or 'restore' */
 };
 
 typedef struct _virSecurityDACChownList virSecurityDACChownList;
@@ -155,8 +155,11 @@ virSecurityDACChownListFree(void *opaque)
  * @src: disk source to chown
  * @uid: user ID
  * @gid: group ID
+ * @restore: if current operation is set or restore
  *
  * Appends an entry onto transaction list.
+ * The @restore should be true if the operation is restoring
+ * seclabel and false otherwise.
  *
  * Returns: 1 in case of successful append
  *          0 if there is no transaction enabled
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index ff54d47e23..38f4e3afd8 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -82,7 +82,7 @@ struct _virSecuritySELinuxContextItem {
     char *path;
     char *tcon;
     bool optional;
-    bool restore;
+    bool restore; /* Whether current operation is 'set' or 'restore' */
 };
 
 typedef struct _virSecuritySELinuxContextList virSecuritySELinuxContextList;
@@ -168,8 +168,11 @@ virSecuritySELinuxContextListFree(void *opaque)
  * @path: Path to chown
  * @tcon: target context
  * @optional: true if setting @tcon is optional
+ * @restore: if current operation is set or restore
  *
  * Appends an entry onto transaction list.
+ * The @restore should be true if the operation is restoring
+ * seclabel and false otherwise.
  *
  * Returns: 1 in case of successful append
  *          0 if there is no transaction enabled
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 14/25] security: Document @restore member of transaction list
Posted by Daniel P. Berrangé 6 years, 7 months ago
On Thu, Apr 25, 2019 at 10:19:50AM +0200, Michal Privoznik wrote:
> Both DAC and SELinux drivers support transactions. Each item on
> the transaction list consists of various variables and @restore
> is one of them. Document it so that as the list of variables grow
> it's easier to spot which variable does what.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> Reviewed-by: Cole Robinson <crobinso@redhat.com>
> ---
>  src/security/security_dac.c     | 5 ++++-
>  src/security/security_selinux.c | 5 ++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list