mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
conf: Rename virDomainCapsFeature to virDomainProcessCapsFeature
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
2ac56edbf8
commit
d95eded4bb
@ -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]));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -217,7 +217,6 @@ virDomainBlockedReasonTypeToString;
|
||||
virDomainBootTypeFromString;
|
||||
virDomainBootTypeToString;
|
||||
virDomainCapabilitiesPolicyTypeToString;
|
||||
virDomainCapsFeatureTypeToString;
|
||||
virDomainChrConsoleTargetTypeFromString;
|
||||
virDomainChrConsoleTargetTypeToString;
|
||||
virDomainChrDefForeach;
|
||||
@ -543,6 +542,7 @@ virDomainPausedReasonTypeFromString;
|
||||
virDomainPausedReasonTypeToString;
|
||||
virDomainPMSuspendedReasonTypeFromString;
|
||||
virDomainPMSuspendedReasonTypeToString;
|
||||
virDomainProcessCapsFeatureTypeToString;
|
||||
virDomainRedirdevBusTypeFromString;
|
||||
virDomainRedirdevBusTypeToString;
|
||||
virDomainRedirdevDefFind;
|
||||
|
@ -305,7 +305,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[] = {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user