[libvirt] [PATCH 04/11] qemu_security: Kill code duplication

Peter Krempa pkrempa at redhat.com
Wed Feb 8 14:09:03 UTC 2017


On Wed, Feb 08, 2017 at 14:59:13 +0100, Martin Kletzander wrote:
> On Wed, Feb 08, 2017 at 02:37:48PM +0100, Michal Privoznik wrote:
> > On 02/08/2017 01:43 PM, Peter Krempa wrote:

[...]

> 
> How about simply:
> 
> int
> qemuNamespaceMountTransactionStart(virDomainObjPtr vm,
>                                   virSecurityManagerPtr secMgr)
> {
>    if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT) &&
>        virSecurityManagerTransactionStart(secMgr) < 0)
>        return -1;
> 
>    return 0;
> }
> 
> int
> qemuNamespaceMountTransactionCommit(virDomainObjPtr vm,
>                                    virSecurityManagerPtr secMgr)
> {
>    if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT) &&
>        virSecurityManagerTransactionCommit(secMgr, vm->pid) < 0)
>        return -1;
> 
>    return 0;
> }
> 
> void
> qemuNamespaceMountTransactionAbort(virSecurityManagerPtr secMgr)
> {
>    virSecurityManagerTransactionAbort(secMgr);
> }
> 
> or anything similar with the naming being done by someone else than me.
> 
> You can also extract the securityManager out of the vm pointer if you
> want to make it even shorter.

Yes, this is exactly what I wanted to say in the parallel reply :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170208/133c17bc/attachment-0001.sig>


More information about the libvir-list mailing list