diff mbox series

[23/30] security: dac: break out SetImageLabelRelative

Message ID 06d363e9487fc7e7417d1305917c9b20989c4237.1570482718.git.crobinso@redhat.com
State Accepted
Commit aa736c098e47a57a45c1b977bb9acfd998840a41
Headers show
Series storagefile, security: qcow2 data_file support | expand

Commit Message

Cole Robinson Oct. 7, 2019, 9:49 p.m. UTC
This will be used for recursing into externalDataStore

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/security/security_dac.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

-- 
2.23.0

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

Comments

Daniel Henrique Barboza Oct. 10, 2019, 3:58 p.m. UTC | #1
On 10/7/19 6:49 PM, Cole Robinson wrote:
> This will be used for recursing into externalDataStore

>

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---


Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>


>   src/security/security_dac.c | 19 ++++++++++++++-----

>   1 file changed, 14 insertions(+), 5 deletions(-)

>

> diff --git a/src/security/security_dac.c b/src/security/security_dac.c

> index befa388791..326b9b1a3c 100644

> --- a/src/security/security_dac.c

> +++ b/src/security/security_dac.c

> @@ -934,15 +934,16 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr,

>   

>   

>   static int

> -virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,

> -                            virDomainDefPtr def,

> -                            virStorageSourcePtr src,

> -                            virSecurityDomainImageLabelFlags flags)

> +virSecurityDACSetImageLabelRelative(virSecurityManagerPtr mgr,

> +                                    virDomainDefPtr def,

> +                                    virStorageSourcePtr src,

> +                                    virStorageSourcePtr parent,

> +                                    virSecurityDomainImageLabelFlags flags)

>   {

>       virStorageSourcePtr n;

>   

>       for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {

> -        if (virSecurityDACSetImageLabelInternal(mgr, def, n, src) < 0)

> +        if (virSecurityDACSetImageLabelInternal(mgr, def, n, parent) < 0)

>               return -1;

>   

>           if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN))

> @@ -952,6 +953,14 @@ virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,

>       return 0;

>   }

>   

> +static int

> +virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,

> +                            virDomainDefPtr def,

> +                            virStorageSourcePtr src,

> +                            virSecurityDomainImageLabelFlags flags)

> +{

> +    return virSecurityDACSetImageLabelRelative(mgr, def, src, src, flags);

> +}

>   

>   static int

>   virSecurityDACRestoreImageLabelSingle(virSecurityManagerPtr mgr,


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

Patch

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index befa388791..326b9b1a3c 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -934,15 +934,16 @@  virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr,
 
 
 static int
-virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,
-                            virDomainDefPtr def,
-                            virStorageSourcePtr src,
-                            virSecurityDomainImageLabelFlags flags)
+virSecurityDACSetImageLabelRelative(virSecurityManagerPtr mgr,
+                                    virDomainDefPtr def,
+                                    virStorageSourcePtr src,
+                                    virStorageSourcePtr parent,
+                                    virSecurityDomainImageLabelFlags flags)
 {
     virStorageSourcePtr n;
 
     for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
-        if (virSecurityDACSetImageLabelInternal(mgr, def, n, src) < 0)
+        if (virSecurityDACSetImageLabelInternal(mgr, def, n, parent) < 0)
             return -1;
 
         if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN))
@@ -952,6 +953,14 @@  virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,
     return 0;
 }
 
+static int
+virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,
+                            virDomainDefPtr def,
+                            virStorageSourcePtr src,
+                            virSecurityDomainImageLabelFlags flags)
+{
+    return virSecurityDACSetImageLabelRelative(mgr, def, src, src, flags);
+}
 
 static int
 virSecurityDACRestoreImageLabelSingle(virSecurityManagerPtr mgr,