virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("remoteReadConfigFile: %s: %s: invalid type:"
" got %s; expected %s"), filename, key,
- virConfTypeName(p->type),
- virConfTypeName(required_type));
+ virConfTypeToString(p->type),
+ virConfTypeToString(required_type));
return -1;
}
return 0;
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("remoteReadConfigFile: %s: %s: invalid type:"
" got %s; expected %s"), filename, key,
- virConfTypeName(p->type),
- virConfTypeName(required_type));
+ virConfTypeToString(p->type),
+ virConfTypeToString(required_type));
return -1;
}
return 0;
* *
************************************************************************/
+VIR_ENUM_IMPL(virConf, VIR_CONF_LAST,
+ "*unexpected*",
+ "long",
+ "string",
+ "list");
+
typedef struct _virConfEntry virConfEntry;
typedef virConfEntry *virConfEntryPtr;
#ifndef __VIR_CONF_H__
# define __VIR_CONF_H__
+# include "virutil.h"
+
/**
* virConfType:
* one of the possible type for a value from the configuration file
* TODO: we probably need a float too.
*/
typedef enum {
- VIR_CONF_NONE = 0, /* undefined */
- VIR_CONF_LONG = 1, /* a long int */
- VIR_CONF_STRING = 2, /* a string */
- VIR_CONF_LIST = 3 /* a list */
+ VIR_CONF_NONE = 0, /* undefined */
+ VIR_CONF_LONG, /* a long int */
+ VIR_CONF_STRING, /* a string */
+ VIR_CONF_LIST, /* a list */
+ VIR_CONF_LAST, /* sentinel */
} virConfType;
+VIR_ENUM_DECL(virConf)
+
typedef enum {
VIR_CONF_FLAG_VMX_FORMAT = 1, /* allow ':', '.' and '-' in names for compatibility
with VMware VMX configuration file, but restrict
to string only and don't expect quotes for values */
} virConfFlags;
-static inline const char *
-virConfTypeName (virConfType t)
-{
- switch (t) {
- case VIR_CONF_LONG:
- return "long";
- case VIR_CONF_STRING:
- return "string";
- case VIR_CONF_LIST:
- return "list";
- default:
- return "*unexpected*";
- }
-}
-
/**
* virConfValue:
* a value from the configuration file