]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
syntax-check: Fix and rename virSecurity rule
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Mar 2021 07:29:42 +0000 (08:29 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 15 Mar 2021 08:37:15 +0000 (09:37 +0100)
The aim of virSecurity rule is to discourage from using plain
virSecurityManager*() APIs within QEMU driver in favor of their
qemuSecurity*() counterparts. The reason is simple: namespaces;
virSecurityManager*() needs additional
virSecurityManagerTransactionCommit() call to enter given
namespace and do its work from there. And that's exactly what
those qemuSecurity*() wrappers do.

To help us ensure correctness (from this POV), we have a
syntax-check rule that forbids any occurrence of
"virSecurityManager" string under src/qemu/ (except for
qemu_security of course).

But with if we want to remove virSecurityManagerPtr type, then we
have to allow "virSecurityManager *". Therefore, change the rule
so that no call of a function with "virSecurityManager" prefix is
allowed. And also change the name to better reflect what is going
on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
build-aux/syntax-check.mk

index 794ec326e44440e8aca72a1728abfe6f5e3549d3..249e43fa528db2f42b8b6de9262273c614670e60 100644 (file)
@@ -1049,10 +1049,10 @@ sc_prohibit_sysconf_pagesize:
        halt='use virGetSystemPageSize[KB] instead of sysconf(_SC_PAGESIZE)' \
          $(_sc_search_regexp)
 
-sc_prohibit_virSecurity:
+sc_prohibit_virSecurityManager:
        @$(VC_LIST_EXCEPT) | $(GREP) 'src/qemu/' | \
                $(GREP) -v 'src/qemu/qemu_security' | \
-               xargs $(GREP) -Pn 'virSecurityManager(?!Ptr)' /dev/null && \
+               xargs $(GREP) -Pn 'virSecurityManager\S*\(' /dev/null && \
                { echo '$(ME): prefer qemuSecurity wrappers' 1>&2; exit 1; } || :
 
 sc_prohibit_pthread_create: