[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] security: Switch to C99-style struct initialization



---
 src/security/security_apparmor.c |   50 ++++++++++++++++++------------------
 src/security/security_dac.c      |   53 ++++++++++++++++++-------------------
 src/security/security_nop.c      |   52 ++++++++++++++++++------------------
 src/security/security_selinux.c  |   52 ++++++++++++++++++------------------
 src/security/security_stack.c    |   52 ++++++++++++++++++------------------
 5 files changed, 129 insertions(+), 130 deletions(-)

diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 2d05fd0..62af3c6 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -809,39 +809,39 @@ AppArmorSetImageFDLabel(virSecurityManagerPtr mgr,
 }
 
 virSecurityDriver virAppArmorSecurityDriver = {
-    0,
-    SECURITY_APPARMOR_NAME,
-    AppArmorSecurityManagerProbe,
-    AppArmorSecurityManagerOpen,
-    AppArmorSecurityManagerClose,
+    .privateDataLen                     = 0,
+    .name                               = SECURITY_APPARMOR_NAME,
+    .probe                              = AppArmorSecurityManagerProbe,
+    .open                               = AppArmorSecurityManagerOpen,
+    .close                              = AppArmorSecurityManagerClose,
 
-    AppArmorSecurityManagerGetModel,
-    AppArmorSecurityManagerGetDOI,
+    .getModel                           = AppArmorSecurityManagerGetModel,
+    .getDOI                             = AppArmorSecurityManagerGetDOI,
 
-    AppArmorSecurityVerify,
+    .domainSecurityVerify               = AppArmorSecurityVerify,
 
-    AppArmorSetSecurityImageLabel,
-    AppArmorRestoreSecurityImageLabel,
+    .domainSetSecurityImageLabel        = AppArmorSetSecurityImageLabel,
+    .domainRestoreSecurityImageLabel    = AppArmorRestoreSecurityImageLabel,
 
-    AppArmorSetSecurityDaemonSocketLabel,
-    AppArmorSetSecuritySocketLabel,
-    AppArmorClearSecuritySocketLabel,
+    .domainSetSecurityDaemonSocketLabel = AppArmorSetSecurityDaemonSocketLabel,
+    .domainSetSecuritySocketLabel       = AppArmorSetSecuritySocketLabel,
+    .domainClearSecuritySocketLabel     = AppArmorClearSecuritySocketLabel,
 
-    AppArmorGenSecurityLabel,
-    AppArmorReserveSecurityLabel,
-    AppArmorReleaseSecurityLabel,
+    .domainGenSecurityLabel             = AppArmorGenSecurityLabel,
+    .domainReserveSecurityLabel         = AppArmorReserveSecurityLabel,
+    .domainReleaseSecurityLabel         = AppArmorReleaseSecurityLabel,
 
-    AppArmorGetSecurityProcessLabel,
-    AppArmorSetSecurityProcessLabel,
+    .domainGetSecurityProcessLabel      = AppArmorGetSecurityProcessLabel,
+    .domainSetSecurityProcessLabel      = AppArmorSetSecurityProcessLabel,
 
-    AppArmorSetSecurityAllLabel,
-    AppArmorRestoreSecurityAllLabel,
+    .domainSetSecurityAllLabel          = AppArmorSetSecurityAllLabel,
+    .domainRestoreSecurityAllLabel      = AppArmorRestoreSecurityAllLabel,
 
-    AppArmorSetSecurityHostdevLabel,
-    AppArmorRestoreSecurityHostdevLabel,
+    .domainSetSecurityHostdevLabel      = AppArmorSetSecurityHostdevLabel,
+    .domainRestoreSecurityHostdevLabel  = AppArmorRestoreSecurityHostdevLabel,
 
-    AppArmorSetSavedStateLabel,
-    AppArmorRestoreSavedStateLabel,
+    .domainSetSavedStateLabel           = AppArmorSetSavedStateLabel,
+    .domainRestoreSavedStateLabel       = AppArmorRestoreSavedStateLabel,
 
-    AppArmorSetImageFDLabel,
+    .domainSetSecurityImageFDLabel      = AppArmorSetImageFDLabel,
 };
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 470861d..9182b39 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -723,42 +723,41 @@ static char *virSecurityDACGetMountOptions(virSecurityManagerPtr mgr ATTRIBUTE_U
 }
 
 virSecurityDriver virSecurityDriverDAC = {
-    sizeof(virSecurityDACData),
-    "virDAC",
+    .privateDataLen                     = sizeof(virSecurityDACData),
+    .name                               = "virDAC",
+    .probe                              = virSecurityDACProbe,
+    .open                               = virSecurityDACOpen,
+    .close                              = virSecurityDACClose,
 
-    virSecurityDACProbe,
-    virSecurityDACOpen,
-    virSecurityDACClose,
+    .getModel                           = virSecurityDACGetModel,
+    .getDOI                             = virSecurityDACGetDOI,
 
-    virSecurityDACGetModel,
-    virSecurityDACGetDOI,
+    .domainSecurityVerify               = virSecurityDACVerify,
 
-    virSecurityDACVerify,
+    .domainSetSecurityImageLabel        = virSecurityDACSetSecurityImageLabel,
+    .domainRestoreSecurityImageLabel    = virSecurityDACRestoreSecurityImageLabel,
 
-    virSecurityDACSetSecurityImageLabel,
-    virSecurityDACRestoreSecurityImageLabel,
+    .domainSetSecurityDaemonSocketLabel = virSecurityDACSetDaemonSocketLabel,
+    .domainSetSecuritySocketLabel       = virSecurityDACSetSocketLabel,
+    .domainClearSecuritySocketLabel     = virSecurityDACClearSocketLabel,
 
-    virSecurityDACSetDaemonSocketLabel,
-    virSecurityDACSetSocketLabel,
-    virSecurityDACClearSocketLabel,
+    .domainGenSecurityLabel             = virSecurityDACGenLabel,
+    .domainReserveSecurityLabel         = virSecurityDACReserveLabel,
+    .domainReleaseSecurityLabel         = virSecurityDACReleaseLabel,
 
-    virSecurityDACGenLabel,
-    virSecurityDACReserveLabel,
-    virSecurityDACReleaseLabel,
+    .domainGetSecurityProcessLabel      = virSecurityDACGetProcessLabel,
+    .domainSetSecurityProcessLabel      = virSecurityDACSetProcessLabel,
 
-    virSecurityDACGetProcessLabel,
-    virSecurityDACSetProcessLabel,
+    .domainSetSecurityAllLabel          = virSecurityDACSetSecurityAllLabel,
+    .domainRestoreSecurityAllLabel      = virSecurityDACRestoreSecurityAllLabel,
 
-    virSecurityDACSetSecurityAllLabel,
-    virSecurityDACRestoreSecurityAllLabel,
+    .domainSetSecurityHostdevLabel      = virSecurityDACSetSecurityHostdevLabel,
+    .domainRestoreSecurityHostdevLabel  = virSecurityDACRestoreSecurityHostdevLabel,
 
-    virSecurityDACSetSecurityHostdevLabel,
-    virSecurityDACRestoreSecurityHostdevLabel,
+    .domainSetSavedStateLabel           = virSecurityDACSetSavedStateLabel,
+    .domainRestoreSavedStateLabel       = virSecurityDACRestoreSavedStateLabel,
 
-    virSecurityDACSetSavedStateLabel,
-    virSecurityDACRestoreSavedStateLabel,
+    .domainSetSecurityImageFDLabel      = virSecurityDACSetImageFDLabel,
 
-    virSecurityDACSetImageFDLabel,
-
-    virSecurityDACGetMountOptions,
+    .domainGetSecurityMountOptions      = virSecurityDACGetMountOptions,
 };
diff --git a/src/security/security_nop.c b/src/security/security_nop.c
index b62daf5..5f90df3 100644
--- a/src/security/security_nop.c
+++ b/src/security/security_nop.c
@@ -170,41 +170,41 @@ static char *virSecurityDomainGetMountOptionsNop(virSecurityManagerPtr mgr ATTRI
 }
 
 virSecurityDriver virSecurityDriverNop = {
-    0,
-    "none",
-    virSecurityDriverProbeNop,
-    virSecurityDriverOpenNop,
-    virSecurityDriverCloseNop,
+    .privateDataLen                     = 0,
+    .name                               = "none",
+    .probe                              = virSecurityDriverProbeNop,
+    .open                               = virSecurityDriverOpenNop,
+    .close                              = virSecurityDriverCloseNop,
 
-    virSecurityDriverGetModelNop,
-    virSecurityDriverGetDOINop,
+    .getModel                           = virSecurityDriverGetModelNop,
+    .getDOI                             = virSecurityDriverGetDOINop,
 
-    virSecurityDomainVerifyNop,
+    .domainSecurityVerify               = virSecurityDomainVerifyNop,
 
-    virSecurityDomainSetImageLabelNop,
-    virSecurityDomainRestoreImageLabelNop,
+    .domainSetSecurityImageLabel        = virSecurityDomainSetImageLabelNop,
+    .domainRestoreSecurityImageLabel    = virSecurityDomainRestoreImageLabelNop,
 
-    virSecurityDomainSetDaemonSocketLabelNop,
-    virSecurityDomainSetSocketLabelNop,
-    virSecurityDomainClearSocketLabelNop,
+    .domainSetSecurityDaemonSocketLabel = virSecurityDomainSetDaemonSocketLabelNop,
+    .domainSetSecuritySocketLabel       = virSecurityDomainSetSocketLabelNop,
+    .domainClearSecuritySocketLabel     = virSecurityDomainClearSocketLabelNop,
 
-    virSecurityDomainGenLabelNop,
-    virSecurityDomainReserveLabelNop,
-    virSecurityDomainReleaseLabelNop,
+    .domainGenSecurityLabel             = virSecurityDomainGenLabelNop,
+    .domainReserveSecurityLabel         = virSecurityDomainReserveLabelNop,
+    .domainReleaseSecurityLabel         = virSecurityDomainReleaseLabelNop,
 
-    virSecurityDomainGetProcessLabelNop,
-    virSecurityDomainSetProcessLabelNop,
+    .domainGetSecurityProcessLabel      = virSecurityDomainGetProcessLabelNop,
+    .domainSetSecurityProcessLabel      = virSecurityDomainSetProcessLabelNop,
 
-    virSecurityDomainSetAllLabelNop,
-    virSecurityDomainRestoreAllLabelNop,
+    .domainSetSecurityAllLabel          = virSecurityDomainSetAllLabelNop,
+    .domainRestoreSecurityAllLabel      = virSecurityDomainRestoreAllLabelNop,
 
-    virSecurityDomainSetHostdevLabelNop,
-    virSecurityDomainRestoreHostdevLabelNop,
+    .domainSetSecurityHostdevLabel      = virSecurityDomainSetHostdevLabelNop,
+    .domainRestoreSecurityHostdevLabel  = virSecurityDomainRestoreHostdevLabelNop,
 
-    virSecurityDomainSetSavedStateLabelNop,
-    virSecurityDomainRestoreSavedStateLabelNop,
+    .domainSetSavedStateLabel           = virSecurityDomainSetSavedStateLabelNop,
+    .domainRestoreSavedStateLabel       = virSecurityDomainRestoreSavedStateLabelNop,
 
-    virSecurityDomainSetFDLabelNop,
+    .domainSetSecurityImageFDLabel      =  virSecurityDomainSetFDLabelNop,
 
-    virSecurityDomainGetMountOptionsNop,
+    .domainGetSecurityMountOptions      = virSecurityDomainGetMountOptionsNop,
 };
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 2b8ff19..ffa65fb 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1591,41 +1591,41 @@ static char *SELinuxGetSecurityMountOptions(virSecurityManagerPtr mgr,
 }
 
 virSecurityDriver virSecurityDriverSELinux = {
-    sizeof(virSecuritySELinuxData),
-    SECURITY_SELINUX_NAME,
-    SELinuxSecurityDriverProbe,
-    SELinuxSecurityDriverOpen,
-    SELinuxSecurityDriverClose,
+    .privateDataLen                     = sizeof(virSecuritySELinuxData),
+    .name                               = SECURITY_SELINUX_NAME,
+    .probe                              = SELinuxSecurityDriverProbe,
+    .open                               = SELinuxSecurityDriverOpen,
+    .close                              = SELinuxSecurityDriverClose,
 
-    SELinuxSecurityGetModel,
-    SELinuxSecurityGetDOI,
+    .getModel                           = SELinuxSecurityGetModel,
+    .getDOI                             = SELinuxSecurityGetDOI,
 
-    SELinuxSecurityVerify,
+    .domainSecurityVerify               = SELinuxSecurityVerify,
 
-    SELinuxSetSecurityImageLabel,
-    SELinuxRestoreSecurityImageLabel,
+    .domainSetSecurityImageLabel        = SELinuxSetSecurityImageLabel,
+    .domainRestoreSecurityImageLabel    = SELinuxRestoreSecurityImageLabel,
 
-    SELinuxSetSecurityDaemonSocketLabel,
-    SELinuxSetSecuritySocketLabel,
-    SELinuxClearSecuritySocketLabel,
+    .domainSetSecurityDaemonSocketLabel = SELinuxSetSecurityDaemonSocketLabel,
+    .domainSetSecuritySocketLabel       = SELinuxSetSecuritySocketLabel,
+    .domainClearSecuritySocketLabel     = SELinuxClearSecuritySocketLabel,
 
-    SELinuxGenSecurityLabel,
-    SELinuxReserveSecurityLabel,
-    SELinuxReleaseSecurityLabel,
+    .domainGenSecurityLabel             = SELinuxGenSecurityLabel,
+    .domainReserveSecurityLabel         = SELinuxReserveSecurityLabel,
+    .domainReleaseSecurityLabel         = SELinuxReleaseSecurityLabel,
 
-    SELinuxGetSecurityProcessLabel,
-    SELinuxSetSecurityProcessLabel,
+    .domainGetSecurityProcessLabel      = SELinuxGetSecurityProcessLabel,
+    .domainSetSecurityProcessLabel      = SELinuxSetSecurityProcessLabel,
 
-    SELinuxSetSecurityAllLabel,
-    SELinuxRestoreSecurityAllLabel,
+    .domainSetSecurityAllLabel          = SELinuxSetSecurityAllLabel,
+    .domainRestoreSecurityAllLabel      = SELinuxRestoreSecurityAllLabel,
 
-    SELinuxSetSecurityHostdevLabel,
-    SELinuxRestoreSecurityHostdevLabel,
+    .domainSetSecurityHostdevLabel      = SELinuxSetSecurityHostdevLabel,
+    .domainRestoreSecurityHostdevLabel  = SELinuxRestoreSecurityHostdevLabel,
 
-    SELinuxSetSavedStateLabel,
-    SELinuxRestoreSavedStateLabel,
+    .domainSetSavedStateLabel           = SELinuxSetSavedStateLabel,
+    .domainRestoreSavedStateLabel       = SELinuxRestoreSavedStateLabel,
 
-    SELinuxSetImageFDLabel,
+    .domainSetSecurityImageFDLabel      = SELinuxSetImageFDLabel,
 
-    SELinuxGetSecurityMountOptions,
+    .domainGetSecurityMountOptions      = SELinuxGetSecurityMountOptions,
 };
diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index 6ecd099..65d30d6 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -409,41 +409,41 @@ static char *virSecurityStackGetMountOptions(virSecurityManagerPtr mgr ATTRIBUTE
 }
 
 virSecurityDriver virSecurityDriverStack = {
-    sizeof(virSecurityStackData),
-    "stack",
-    virSecurityStackProbe,
-    virSecurityStackOpen,
-    virSecurityStackClose,
+    .privateDataLen                     = sizeof(virSecurityStackData),
+    .name                               = "stack",
+    .probe                              = virSecurityStackProbe,
+    .open                               = virSecurityStackOpen,
+    .close                              = virSecurityStackClose,
 
-    virSecurityStackGetModel,
-    virSecurityStackGetDOI,
+    .getModel                           = virSecurityStackGetModel,
+    .getDOI                             = virSecurityStackGetDOI,
 
-    virSecurityStackVerify,
+    .domainSecurityVerify               = virSecurityStackVerify,
 
-    virSecurityStackSetSecurityImageLabel,
-    virSecurityStackRestoreSecurityImageLabel,
+    .domainSetSecurityImageLabel        = virSecurityStackSetSecurityImageLabel,
+    .domainRestoreSecurityImageLabel    = virSecurityStackRestoreSecurityImageLabel,
 
-    virSecurityStackSetDaemonSocketLabel,
-    virSecurityStackSetSocketLabel,
-    virSecurityStackClearSocketLabel,
+    .domainSetSecurityDaemonSocketLabel = virSecurityStackSetDaemonSocketLabel,
+    .domainSetSecuritySocketLabel       = virSecurityStackSetSocketLabel,
+    .domainClearSecuritySocketLabel     = virSecurityStackClearSocketLabel,
 
-    virSecurityStackGenLabel,
-    virSecurityStackReserveLabel,
-    virSecurityStackReleaseLabel,
+    .domainGenSecurityLabel             = virSecurityStackGenLabel,
+    .domainReserveSecurityLabel         = virSecurityStackReserveLabel,
+    .domainReleaseSecurityLabel         = virSecurityStackReleaseLabel,
 
-    virSecurityStackGetProcessLabel,
-    virSecurityStackSetProcessLabel,
+    .domainGetSecurityProcessLabel      = virSecurityStackGetProcessLabel,
+    .domainSetSecurityProcessLabel      = virSecurityStackSetProcessLabel,
 
-    virSecurityStackSetSecurityAllLabel,
-    virSecurityStackRestoreSecurityAllLabel,
+    .domainSetSecurityAllLabel          = virSecurityStackSetSecurityAllLabel,
+    .domainRestoreSecurityAllLabel      = virSecurityStackRestoreSecurityAllLabel,
 
-    virSecurityStackSetSecurityHostdevLabel,
-    virSecurityStackRestoreSecurityHostdevLabel,
+    .domainSetSecurityHostdevLabel      = virSecurityStackSetSecurityHostdevLabel,
+    .domainRestoreSecurityHostdevLabel  = virSecurityStackRestoreSecurityHostdevLabel,
 
-    virSecurityStackSetSavedStateLabel,
-    virSecurityStackRestoreSavedStateLabel,
+    .domainSetSavedStateLabel           = virSecurityStackSetSavedStateLabel,
+    .domainRestoreSavedStateLabel       = virSecurityStackRestoreSavedStateLabel,
 
-    virSecurityStackSetImageFDLabel,
+    .domainSetSecurityImageFDLabel      = virSecurityStackSetImageFDLabel,
 
-    virSecurityStackGetMountOptions,
+    .domainGetSecurityMountOptions      = virSecurityStackGetMountOptions,
 };
-- 
1.7.8.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]