|
|
7a3408 |
From 51b7b21a435d66f4c33cbe0c29cc7e5ee7d498ae Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <51b7b21a435d66f4c33cbe0c29cc7e5ee7d498ae@dist-git>
|
|
|
7a3408 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
7a3408 |
Date: Tue, 15 Sep 2015 11:51:22 +0200
|
|
|
7a3408 |
Subject: [PATCH] security_selinux: Replace SELinuxSCSICallbackData with proper
|
|
|
7a3408 |
struct
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1124841
|
|
|
7a3408 |
|
|
|
7a3408 |
We have plenty of callbacks in the driver. Some of these
|
|
|
7a3408 |
callbacks require more than one argument to be passed. For that
|
|
|
7a3408 |
we currently have a data type (struct) per each callback. Well,
|
|
|
7a3408 |
so far for only one - SELinuxSCSICallbackData. But lets turn it
|
|
|
7a3408 |
into more general name so it can be reused in other callbacks too
|
|
|
7a3408 |
instead of each one introducing a new, duplicate data type.
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit 276c409163fb94b0c325900d6e2581eaa3e3ada6)
|
|
|
7a3408 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/security/security_selinux.c | 15 +++++++++------
|
|
|
7a3408 |
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
|
|
|
7a3408 |
index 46080bf..c6da6b0 100644
|
|
|
7a3408 |
--- a/src/security/security_selinux.c
|
|
|
7a3408 |
+++ b/src/security/security_selinux.c
|
|
|
7a3408 |
@@ -68,15 +68,18 @@ struct _virSecuritySELinuxData {
|
|
|
7a3408 |
#endif
|
|
|
7a3408 |
};
|
|
|
7a3408 |
|
|
|
7a3408 |
-#define SECURITY_SELINUX_VOID_DOI "0"
|
|
|
7a3408 |
-#define SECURITY_SELINUX_NAME "selinux"
|
|
|
7a3408 |
+/* Data structure to pass to various callbacks so we have everything we need */
|
|
|
7a3408 |
+typedef struct _virSecuritySELinuxCallbackData virSecuritySELinuxCallbackData;
|
|
|
7a3408 |
+typedef virSecuritySELinuxCallbackData *virSecuritySELinuxCallbackDataPtr;
|
|
|
7a3408 |
|
|
|
7a3408 |
-/* Data structure to pass to *FileIterate so we have everything we need */
|
|
|
7a3408 |
-struct SELinuxSCSICallbackData {
|
|
|
7a3408 |
+struct _virSecuritySELinuxCallbackData {
|
|
|
7a3408 |
virSecurityManagerPtr mgr;
|
|
|
7a3408 |
virDomainDefPtr def;
|
|
|
7a3408 |
};
|
|
|
7a3408 |
|
|
|
7a3408 |
+#define SECURITY_SELINUX_VOID_DOI "0"
|
|
|
7a3408 |
+#define SECURITY_SELINUX_NAME "selinux"
|
|
|
7a3408 |
+
|
|
|
7a3408 |
static int
|
|
|
7a3408 |
virSecuritySELinuxRestoreSecurityTPMFileLabelInt(virSecurityManagerPtr mgr,
|
|
|
7a3408 |
virDomainDefPtr def,
|
|
|
7a3408 |
@@ -1319,7 +1322,7 @@ virSecuritySELinuxSetSecuritySCSILabel(virSCSIDevicePtr dev,
|
|
|
7a3408 |
const char *file, void *opaque)
|
|
|
7a3408 |
{
|
|
|
7a3408 |
virSecurityLabelDefPtr secdef;
|
|
|
7a3408 |
- struct SELinuxSCSICallbackData *ptr = opaque;
|
|
|
7a3408 |
+ virSecuritySELinuxCallbackDataPtr ptr = opaque;
|
|
|
7a3408 |
virSecurityManagerPtr mgr = ptr->mgr;
|
|
|
7a3408 |
virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr);
|
|
|
7a3408 |
|
|
|
7a3408 |
@@ -1400,7 +1403,7 @@ virSecuritySELinuxSetSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr,
|
|
|
7a3408 |
|
|
|
7a3408 |
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
|
|
|
7a3408 |
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
|
|
7a3408 |
- struct SELinuxSCSICallbackData data = {.mgr = mgr, .def = def};
|
|
|
7a3408 |
+ virSecuritySELinuxCallbackData data = {.mgr = mgr, .def = def};
|
|
|
7a3408 |
|
|
|
7a3408 |
virSCSIDevicePtr scsi =
|
|
|
7a3408 |
virSCSIDeviceNew(NULL,
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.3
|
|
|
7a3408 |
|