Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
cfg.mk | 2 +-
src/qemu/qemu_driver.c | 3 ++-
src/security/security_dac.c | 10 ++++++++++
src/security/security_dac.h | 2 ++
src/security/security_manager.c | 4 +++-
src/security/security_manager.h | 4 +++-
6 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index e436434..43a591f 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -783,7 +783,7 @@ sc_prohibit_cross_inclusion:
access/ | conf/) safe="($$dir|conf|util)";; \
locking/) safe="($$dir|util|conf|rpc)";; \
cpu/| network/| node_device/| rpc/| security/| storage/) \
- safe="($$dir|util|conf|storage)";; \
+ safe="($$dir|util|conf|storage|locking)";; \
xenapi/ | xenconfig/ ) safe="($$dir|util|conf|xen)";; \
*) safe="($$dir|$(mid_dirs)|util)";; \
esac; \
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8cd5ee3..5abccb0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -435,7 +435,8 @@ qemuSecurityInit(virQEMUDriverPtr driver)
cfg->user,
cfg->group,
flags,
- qemuSecurityChownCallback)))
+ qemuSecurityChownCallback,
+ driver->lockManager)))
goto error;
if (!stack) {
if (!(stack = virSecurityManagerNewStack(mgr)))
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 6c4e351..463b459 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -57,6 +57,7 @@ struct _virSecurityDACData {
bool dynamicOwnership;
char *baselabel;
virSecurityManagerDACChownCallback chownCallback;
+ virLockManagerPluginPtr lockPlugin;
};
typedef struct _virSecurityDACCallbackData virSecurityDACCallbackData;
@@ -101,6 +102,15 @@ virSecurityDACSetChownCallback(virSecurityManagerPtr mgr,
priv->chownCallback = chownCallback;
}
+void
+virSecurityDACSetLockingPlugin(virSecurityManagerPtr mgr,
+ virLockManagerPluginPtr lockPlugin)
+{
+ virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
+ priv->lockPlugin = lockPlugin;
+}
+
+
/* returns 1 if label isn't found, 0 on success, -1 on error */
static int
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
diff --git a/src/security/security_dac.h b/src/security/security_dac.h
index 846cefb..aefc262 100644
--- a/src/security/security_dac.h
+++ b/src/security/security_dac.h
@@ -35,4 +35,6 @@ void virSecurityDACSetDynamicOwnership(virSecurityManagerPtr mgr,
void virSecurityDACSetChownCallback(virSecurityManagerPtr mgr,
virSecurityManagerDACChownCallback chownCallback);
+void virSecurityDACSetLockingPlugin(virSecurityManagerPtr mgr,
+ virLockManagerPluginPtr lockPlugin);
#endif /* __VIR_SECURITY_DAC */
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 5b05a47..e41e761 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -141,7 +141,8 @@ virSecurityManagerNewDAC(const char *virtDriver,
uid_t user,
gid_t group,
unsigned int flags,
- virSecurityManagerDACChownCallback chownCallback)
+ virSecurityManagerDACChownCallback chownCallback,
+ virLockManagerPluginPtr lockPlugin)
{
virSecurityManagerPtr mgr;
@@ -162,6 +163,7 @@ virSecurityManagerNewDAC(const char *virtDriver,
virSecurityDACSetDynamicOwnership(mgr, flags &
VIR_SECURITY_MANAGER_DYNAMIC_OWNERSHIP);
virSecurityDACSetChownCallback(mgr, chownCallback);
+ virSecurityDACSetLockingPlugin(mgr, lockPlugin);
return mgr;
}
diff --git a/src/security/security_manager.h b/src/security/security_manager.h
index e534e31..96f7053 100644
--- a/src/security/security_manager.h
+++ b/src/security/security_manager.h
@@ -26,6 +26,7 @@
# include "domain_conf.h"
# include "vircommand.h"
# include "virstoragefile.h"
+# include "locking/lock_manager.h"
typedef struct _virSecurityManager virSecurityManager;
typedef virSecurityManager *virSecurityManagerPtr;
@@ -71,7 +72,8 @@ virSecurityManagerPtr virSecurityManagerNewDAC(const char *virtDriver,
uid_t user,
gid_t group,
unsigned int flags,
- virSecurityManagerDACChownCallback
chownCallback);
+ virSecurityManagerDACChownCallback
chownCallback,
+ virLockManagerPluginPtr lockPlugin);
int virSecurityManagerPreFork(virSecurityManagerPtr mgr);
void virSecurityManagerPostFork(virSecurityManagerPtr mgr);
--
2.4.9