diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c72c2f9d4c..bb34cbaa57 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1021,6 +1021,7 @@ virSecurityDriverLookup; # security/security_manager.h virSecurityManagerCheckAllLabel; virSecurityManagerClearSocketLabel; +virSecurityManagerDomainSetDirLabel; virSecurityManagerGenLabel; virSecurityManagerGetBaseLabel; virSecurityManagerGetDOI; diff --git a/src/security/security_driver.h b/src/security/security_driver.h index f0dca09177..784b0dee65 100644 --- a/src/security/security_driver.h +++ b/src/security/security_driver.h @@ -118,6 +118,9 @@ typedef int (*virSecurityDomainSetImageLabel) (virSecurityManagerPtr mgr, typedef int (*virSecurityDomainRestoreImageLabel) (virSecurityManagerPtr mgr, virDomainDefPtr def, virStorageSourcePtr src); +typedef int (*virSecurityDomainSetDirLabel) (virSecurityManagerPtr mgr, + virDomainDefPtr def, + const char *path); struct _virSecurityDriver { @@ -168,6 +171,8 @@ struct _virSecurityDriver { virSecurityDomainSetHugepages domainSetSecurityHugepages; virSecurityDriverGetBaseLabel getBaseLabel; + + virSecurityDomainSetDirLabel domainSetDirLabel; }; virSecurityDriverPtr virSecurityDriverLookup(const char *name, diff --git a/src/security/security_manager.c b/src/security/security_manager.c index f533571e39..28d7dfd0c0 100644 --- a/src/security/security_manager.c +++ b/src/security/security_manager.c @@ -1006,3 +1006,20 @@ virSecurityManagerSetHugepages(virSecurityManagerPtr mgr, return 0; } + + +int +virSecurityManagerDomainSetDirLabel(virSecurityManagerPtr mgr, + virDomainDefPtr vm, + const char *path) +{ + if (mgr->drv->domainSetDirLabel) { + int ret; + virObjectLock(mgr); + ret = mgr->drv->domainSetDirLabel(mgr, vm, path); + virObjectUnlock(mgr); + return ret; + } + + return 0; +} diff --git a/src/security/security_manager.h b/src/security/security_manager.h index 2b4353e56d..53e56f684a 100644 --- a/src/security/security_manager.h +++ b/src/security/security_manager.h @@ -153,4 +153,8 @@ int virSecurityManagerRestoreImageLabel(virSecurityManagerPtr mgr, virDomainDefPtr vm, virStorageSourcePtr src); +int virSecurityManagerDomainSetDirLabel(virSecurityManagerPtr mgr, + virDomainDefPtr vm, + const char *path); + #endif /* VIR_SECURITY_MANAGER_H__ */