security_selinux: Replace SELinuxSCSICallbackData with proper struct

We have plenty of callbacks in the driver. Some of these
callbacks require more than one argument to be passed. For that
we currently have a data type (struct) per each callback. Well,
so far for only one - SELinuxSCSICallbackData. But lets turn it
into more general name so it can be reused in other callbacks too
instead of each one introducing a new, duplicate data type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 276c409163)
This commit is contained in:
Michal Privoznik 2015-09-10 13:49:18 +02:00 committed by Cole Robinson
parent ee89fc6e7a
commit 9a7a699896

View File

@ -68,15 +68,18 @@ struct _virSecuritySELinuxData {
#endif #endif
}; };
#define SECURITY_SELINUX_VOID_DOI "0" /* Data structure to pass to various callbacks so we have everything we need */
#define SECURITY_SELINUX_NAME "selinux" typedef struct _virSecuritySELinuxCallbackData virSecuritySELinuxCallbackData;
typedef virSecuritySELinuxCallbackData *virSecuritySELinuxCallbackDataPtr;
/* Data structure to pass to *FileIterate so we have everything we need */ struct _virSecuritySELinuxCallbackData {
struct SELinuxSCSICallbackData {
virSecurityManagerPtr mgr; virSecurityManagerPtr mgr;
virDomainDefPtr def; virDomainDefPtr def;
}; };
#define SECURITY_SELINUX_VOID_DOI "0"
#define SECURITY_SELINUX_NAME "selinux"
static int static int
virSecuritySELinuxRestoreSecurityTPMFileLabelInt(virSecurityManagerPtr mgr, virSecuritySELinuxRestoreSecurityTPMFileLabelInt(virSecurityManagerPtr mgr,
virDomainDefPtr def, virDomainDefPtr def,
@ -1319,7 +1322,7 @@ virSecuritySELinuxSetSecuritySCSILabel(virSCSIDevicePtr dev,
const char *file, void *opaque) const char *file, void *opaque)
{ {
virSecurityLabelDefPtr secdef; virSecurityLabelDefPtr secdef;
struct SELinuxSCSICallbackData *ptr = opaque; virSecuritySELinuxCallbackDataPtr ptr = opaque;
virSecurityManagerPtr mgr = ptr->mgr; virSecurityManagerPtr mgr = ptr->mgr;
virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr); virSecuritySELinuxDataPtr data = virSecurityManagerGetPrivateData(mgr);
@ -1400,7 +1403,7 @@ virSecuritySELinuxSetSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
struct SELinuxSCSICallbackData data = {.mgr = mgr, .def = def}; virSecuritySELinuxCallbackData data = {.mgr = mgr, .def = def};
virSCSIDevicePtr scsi = virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL, virSCSIDeviceNew(NULL,