mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxl: add is_default checkers for string and timer_mode types
Those types are missing a helper to check whether a definition of the type holds the default value. This will be required by a later patch that will implement deprecation of fields inside of a libxl type. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
1 parent
71b7b4e0f5
commit
bfbc4b64af
3 files changed
+14
-2
No files matched your search
+2
-1
@@ -302,7 +302,8 @@ string = Builtin("char *", namespace = None, copy_fn = "libxl_string_copy", disp
|
||||
json_gen_fn = "libxl__string_gen_json",
|
||||
json_parse_type = "JSON_STRING | JSON_NULL",
|
||||
json_parse_fn = "libxl__string_parse_json",
|
||||
autogenerate_json = False)
|
||||
autogenerate_json = False,
|
||||
check_default_fn="libxl__string_is_default")
|
||||
|
||||
class Array(Type):
|
||||
"""An array of the same type"""
|
||||
|
||||
@@ -4359,6 +4359,16 @@ void* libxl__device_list(libxl__gc *gc, const struct libxl_device_type *dt,
|
||||
uint32_t domid, int *num);
|
||||
void libxl__device_list_free(const struct libxl_device_type *dt,
|
||||
void *list, int num);
|
||||
|
||||
static inline bool libxl__timer_mode_is_default(libxl_timer_mode *tm)
|
||||
{
|
||||
return *tm == LIBXL_TIMER_MODE_DEFAULT;
|
||||
}
|
||||
|
||||
static inline bool libxl__string_is_default(char **s)
|
||||
{
|
||||
return *s == NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -173,7 +173,8 @@ libxl_timer_mode = Enumeration("timer_mode", [
|
||||
(1, "no_delay_for_missed_ticks"),
|
||||
(2, "no_missed_ticks_pending"),
|
||||
(3, "one_missed_tick_pending"),
|
||||
], init_val = "LIBXL_TIMER_MODE_DEFAULT")
|
||||
], init_val = "LIBXL_TIMER_MODE_DEFAULT",
|
||||
check_default_fn = "libxl__timer_mode_is_default")
|
||||
|
||||
libxl_bios_type = Enumeration("bios_type", [
|
||||
(0, "unknown"),
|
||||
|
||||