The enum name sounds too generic. It in fact describes the capabilities of the process, thus add 'Process' to the name. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/domain_conf.c | 12 +++--- src/conf/domain_conf.h | 82 ++++++++++++++++++++-------------------- src/libvirt_private.syms | 2 +- src/lxc/lxc_cgroup.c | 2 +- src/lxc/lxc_container.c | 20 +++++----- src/lxc/lxc_native.c | 4 +- 6 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d5aba7336f..3e81140430 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -211,8 +211,8 @@ VIR_ENUM_IMPL(virDomainMsrsUnknown, "fault", ); -VIR_ENUM_IMPL(virDomainCapsFeature, - VIR_DOMAIN_CAPS_FEATURE_LAST, +VIR_ENUM_IMPL(virDomainProcessCapsFeature, + VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST, "audit_control", "audit_write", "block_suspend", @@ -20616,7 +20616,7 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; for (i = 0; i < n; i++) { - int val = virDomainCapsFeatureTypeFromString((const char *)nodes[i]->name); + int val = virDomainProcessCapsFeatureTypeFromString((const char *)nodes[i]->name); if (val < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unexpected capability feature '%s'"), nodes[i]->name); @@ -20627,7 +20627,7 @@ virDomainDefParseXML(xmlDocPtr xml, if ((def->caps_features[val] = virTristateSwitchTypeFromString(tmp)) == -1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown state attribute '%s' of feature capability '%s'"), - tmp, virDomainCapsFeatureTypeToString(val)); + tmp, virDomainProcessCapsFeatureTypeToString(val)); goto error; } VIR_FREE(tmp); @@ -28295,10 +28295,10 @@ virDomainDefFormatFeatures(virBufferPtr buf, case VIR_DOMAIN_FEATURE_CAPABILITIES: virBufferSetChildIndent(&tmpChildBuf, &childBuf); - for (j = 0; j < VIR_DOMAIN_CAPS_FEATURE_LAST; j++) { + for (j = 0; j < VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST; j++) { if (def->caps_features[j] != VIR_TRISTATE_SWITCH_ABSENT) virBufferAsprintf(&tmpChildBuf, "<%s state='%s'/>\n", - virDomainCapsFeatureTypeToString(j), + virDomainProcessCapsFeatureTypeToString(j), virTristateSwitchTypeToString(def->caps_features[j])); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c69d1b7ef5..2f7a006711 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1817,45 +1817,45 @@ typedef enum { /* The capabilities are ordered alphabetically to help check for new ones */ typedef enum { - VIR_DOMAIN_CAPS_FEATURE_AUDIT_CONTROL = 0, - VIR_DOMAIN_CAPS_FEATURE_AUDIT_WRITE, - VIR_DOMAIN_CAPS_FEATURE_BLOCK_SUSPEND, - VIR_DOMAIN_CAPS_FEATURE_CHOWN, - VIR_DOMAIN_CAPS_FEATURE_DAC_OVERRIDE, - VIR_DOMAIN_CAPS_FEATURE_DAC_READ_SEARCH, - VIR_DOMAIN_CAPS_FEATURE_FOWNER, - VIR_DOMAIN_CAPS_FEATURE_FSETID, - VIR_DOMAIN_CAPS_FEATURE_IPC_LOCK, - VIR_DOMAIN_CAPS_FEATURE_IPC_OWNER, - VIR_DOMAIN_CAPS_FEATURE_KILL, - VIR_DOMAIN_CAPS_FEATURE_LEASE, - VIR_DOMAIN_CAPS_FEATURE_LINUX_IMMUTABLE, - VIR_DOMAIN_CAPS_FEATURE_MAC_ADMIN, - VIR_DOMAIN_CAPS_FEATURE_MAC_OVERRIDE, - VIR_DOMAIN_CAPS_FEATURE_MKNOD, - VIR_DOMAIN_CAPS_FEATURE_NET_ADMIN, - VIR_DOMAIN_CAPS_FEATURE_NET_BIND_SERVICE, - VIR_DOMAIN_CAPS_FEATURE_NET_BROADCAST, - VIR_DOMAIN_CAPS_FEATURE_NET_RAW, - VIR_DOMAIN_CAPS_FEATURE_SETGID, - VIR_DOMAIN_CAPS_FEATURE_SETFCAP, - VIR_DOMAIN_CAPS_FEATURE_SETPCAP, - VIR_DOMAIN_CAPS_FEATURE_SETUID, - VIR_DOMAIN_CAPS_FEATURE_SYS_ADMIN, - VIR_DOMAIN_CAPS_FEATURE_SYS_BOOT, - VIR_DOMAIN_CAPS_FEATURE_SYS_CHROOT, - VIR_DOMAIN_CAPS_FEATURE_SYS_MODULE, - VIR_DOMAIN_CAPS_FEATURE_SYS_NICE, - VIR_DOMAIN_CAPS_FEATURE_SYS_PACCT, - VIR_DOMAIN_CAPS_FEATURE_SYS_PTRACE, - VIR_DOMAIN_CAPS_FEATURE_SYS_RAWIO, - VIR_DOMAIN_CAPS_FEATURE_SYS_RESOURCE, - VIR_DOMAIN_CAPS_FEATURE_SYS_TIME, - VIR_DOMAIN_CAPS_FEATURE_SYS_TTY_CONFIG, - VIR_DOMAIN_CAPS_FEATURE_SYSLOG, - VIR_DOMAIN_CAPS_FEATURE_WAKE_ALARM, - VIR_DOMAIN_CAPS_FEATURE_LAST -} virDomainCapsFeature; + VIR_DOMAIN_PROCES_CAPS_FEATURE_AUDIT_CONTROL = 0, + VIR_DOMAIN_PROCES_CAPS_FEATURE_AUDIT_WRITE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_BLOCK_SUSPEND, + VIR_DOMAIN_PROCES_CAPS_FEATURE_CHOWN, + VIR_DOMAIN_PROCES_CAPS_FEATURE_DAC_OVERRIDE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_DAC_READ_SEARCH, + VIR_DOMAIN_PROCES_CAPS_FEATURE_FOWNER, + VIR_DOMAIN_PROCES_CAPS_FEATURE_FSETID, + VIR_DOMAIN_PROCES_CAPS_FEATURE_IPC_LOCK, + VIR_DOMAIN_PROCES_CAPS_FEATURE_IPC_OWNER, + VIR_DOMAIN_PROCES_CAPS_FEATURE_KILL, + VIR_DOMAIN_PROCES_CAPS_FEATURE_LEASE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_LINUX_IMMUTABLE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_MAC_ADMIN, + VIR_DOMAIN_PROCES_CAPS_FEATURE_MAC_OVERRIDE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_MKNOD, + VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_ADMIN, + VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_BIND_SERVICE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_BROADCAST, + VIR_DOMAIN_PROCES_CAPS_FEATURE_NET_RAW, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SETGID, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SETFCAP, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SETPCAP, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SETUID, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_ADMIN, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_BOOT, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_CHROOT, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_MODULE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_NICE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_PACCT, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_PTRACE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_RAWIO, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_RESOURCE, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_TIME, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_TTY_CONFIG, + VIR_DOMAIN_PROCES_CAPS_FEATURE_SYSLOG, + VIR_DOMAIN_PROCES_CAPS_FEATURE_WAKE_ALARM, + VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST +} virDomainProcessCapsFeature; typedef enum { VIR_DOMAIN_LOCK_FAILURE_DEFAULT, @@ -2420,7 +2420,7 @@ struct _virDomainDef { * to handle support. A few assign specific data values to the option. * See virDomainDefFeaturesCheckABIStability() for details. */ int features[VIR_DOMAIN_FEATURE_LAST]; - int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST]; + int caps_features[VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST]; int hyperv_features[VIR_DOMAIN_HYPERV_LAST]; int kvm_features[VIR_DOMAIN_KVM_LAST]; int msrs_features[VIR_DOMAIN_MSRS_LAST]; @@ -3394,7 +3394,7 @@ VIR_ENUM_DECL(virDomainVirt); VIR_ENUM_DECL(virDomainBoot); VIR_ENUM_DECL(virDomainFeature); VIR_ENUM_DECL(virDomainCapabilitiesPolicy); -VIR_ENUM_DECL(virDomainCapsFeature); +VIR_ENUM_DECL(virDomainProcessCapsFeature); VIR_ENUM_DECL(virDomainLifecycle); VIR_ENUM_DECL(virDomainLifecycleAction); VIR_ENUM_DECL(virDomainDevice); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 94509d6f43..0a5431b50b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -217,7 +217,6 @@ virDomainBlockedReasonTypeToString; virDomainBootTypeFromString; virDomainBootTypeToString; virDomainCapabilitiesPolicyTypeToString; -virDomainCapsFeatureTypeToString; virDomainChrConsoleTargetTypeFromString; virDomainChrConsoleTargetTypeToString; virDomainChrDefForeach; @@ -543,6 +542,7 @@ virDomainPausedReasonTypeFromString; virDomainPausedReasonTypeToString; virDomainPMSuspendedReasonTypeFromString; virDomainPMSuspendedReasonTypeToString; +virDomainProcessCapsFeatureTypeToString; virDomainRedirdevBusTypeFromString; virDomainRedirdevBusTypeToString; virDomainRedirdevDefFind; diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index 5efb495b56..7e8259678f 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -306,7 +306,7 @@ virLXCTeardownHostUSBDeviceCgroup(virUSBDevicePtr dev G_GNUC_UNUSED, static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, virCgroupPtr cgroup) { - int capMknod = def->caps_features[VIR_DOMAIN_CAPS_FEATURE_MKNOD]; + int capMknod = def->caps_features[VIR_DOMAIN_PROCES_CAPS_FEATURE_MKNOD]; int ret = -1; size_t i; static virLXCCgroupDevicePolicy devices[] = { diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 1fb9049c96..abad36c5aa 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1950,7 +1950,7 @@ static int lxcContainerDropCapabilities(virDomainDefPtr def, size_t i; int policy = def->features[VIR_DOMAIN_FEATURE_CAPABILITIES]; - /* Maps virDomainCapsFeature to CAPS_* */ + /* Maps virDomainProcessCapsFeature to CAPS_* */ static int capsMapping[] = {CAP_AUDIT_CONTROL, CAP_AUDIT_WRITE, CAP_BLOCK_SUSPEND, @@ -1996,7 +1996,7 @@ static int lxcContainerDropCapabilities(virDomainDefPtr def, capng_clear(CAPNG_SELECT_BOTH); /* Apply all single capabilities changes */ - for (i = 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) { + for (i = 0; i < VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST; i++) { bool toDrop = false; int state = def->caps_features[i]; @@ -2013,21 +2013,21 @@ static int lxcContainerDropCapabilities(virDomainDefPtr def, capsMapping[i])) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to add capability %s: %d"), - virDomainCapsFeatureTypeToString(i), ret); + virDomainProcessCapsFeatureTypeToString(i), ret); return -1; } break; case VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT: switch (i) { - case VIR_DOMAIN_CAPS_FEATURE_SYS_BOOT: /* No use of reboot */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_BOOT: /* No use of reboot */ toDrop = !keepReboot && (state != VIR_TRISTATE_SWITCH_ON); break; - case VIR_DOMAIN_CAPS_FEATURE_SYS_MODULE: /* No kernel module loading */ - case VIR_DOMAIN_CAPS_FEATURE_SYS_TIME: /* No changing the clock */ - case VIR_DOMAIN_CAPS_FEATURE_MKNOD: /* No creating device nodes */ - case VIR_DOMAIN_CAPS_FEATURE_AUDIT_CONTROL: /* No messing with auditing status */ - case VIR_DOMAIN_CAPS_FEATURE_MAC_ADMIN: /* No messing with LSM config */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_MODULE: /* No kernel module loading */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_SYS_TIME: /* No changing the clock */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_MKNOD: /* No creating device nodes */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_AUDIT_CONTROL: /* No messing with auditing status */ + case VIR_DOMAIN_PROCES_CAPS_FEATURE_MAC_ADMIN: /* No messing with LSM config */ toDrop = (state != VIR_TRISTATE_SWITCH_ON); break; default: /* User specified capabilities to drop */ @@ -2045,7 +2045,7 @@ static int lxcContainerDropCapabilities(virDomainDefPtr def, capsMapping[i])) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to remove capability %s: %d"), - virDomainCapsFeatureTypeToString(i), ret); + virDomainProcessCapsFeatureTypeToString(i), ret); return -1; } break; diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index fec3b4454c..5018cf115b 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -1043,8 +1043,8 @@ lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties) if (virConfGetValueString(properties, "lxc.cap.drop", &value) > 0) toDrop = virStringSplit(value, " ", 0); - for (i = 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) { - capString = virDomainCapsFeatureTypeToString(i); + for (i = 0; i < VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST; i++) { + capString = virDomainProcessCapsFeatureTypeToString(i); if (toDrop != NULL && virStringListHasString((const char **)toDrop, capString)) def->caps_features[i] = VIR_TRISTATE_SWITCH_OFF; -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list