All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	boris.ostrovsky@oracle.com,
	Roger Pau Monne <roger.pau@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH v2 01/21] libxl: add is_default checkers for string and timer_mode types
Date: Thu, 7 Sep 2017 11:16:22 +0100	[thread overview]
Message-ID: <20170907101642.15782-2-roger.pau@citrix.com> (raw)
In-Reply-To: <20170907101642.15782-1-roger.pau@citrix.com>

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>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v1:
 - New in this version.
---
 tools/libxl/idl.py           |  3 ++-
 tools/libxl/libxl_internal.h | 10 ++++++++++
 tools/libxl/libxl_types.idl  |  3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/idl.py b/tools/libxl/idl.py
index 437049ebb9..a4a084e1ce 100644
--- a/tools/libxl/idl.py
+++ b/tools/libxl/idl.py
@@ -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"""
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 724750967c..06d3b25418 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -4350,6 +4350,16 @@ static inline bool libxl__acpi_defbool_val(const libxl_domain_build_info *b_info
     return libxl_defbool_val(b_info->acpi) &&
            libxl_defbool_val(b_info->u.hvm.acpi);
 }
+
+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
 
 /*
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 173d70acec..267c4f3804 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -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"),
-- 
2.11.0 (Apple Git-81)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-09-07 10:17 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07 10:16 [PATCH v2 00/21] libxl/xl: add PVH guest type Roger Pau Monne
2017-09-07 10:16 ` Roger Pau Monne [this message]
2017-09-19 14:48   ` [PATCH v2 01/21] libxl: add is_default checkers for string and timer_mode types Ian Jackson
2017-09-20 16:12   ` Wei Liu
2017-09-07 10:16 ` [PATCH v2 02/21] libxl: introduce a way to mark fields as deprecated in the idl Roger Pau Monne
2017-09-20 15:46   ` Ian Jackson
2017-09-20 16:39     ` Wei Liu
2017-09-21 10:32       ` Ian Jackson
2017-09-22 16:02     ` Roger Pau Monné
2017-09-22 16:09       ` Ian Jackson
2017-09-07 10:16 ` [PATCH v2 03/21] libxl/xl: use the new domain_build_info fields position Roger Pau Monne
2017-09-20 14:48   ` Ian Jackson
2017-09-07 10:16 ` [PATCH v2 04/21] xl: introduce a domain type option Roger Pau Monne
2017-09-20 14:50   ` Ian Jackson
2017-09-21 17:16     ` Roger Pau Monné
2017-09-21 17:22       ` Ian Jackson
2017-09-07 10:16 ` [PATCH v2 05/21] xl: introduce a firmware option Roger Pau Monne
2017-09-20 14:53   ` Ian Jackson
2017-09-07 10:16 ` [PATCH v2 06/21] libxl: introduce a PVH guest type Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 07/21] libxl: allow PVH guests to use a bootloader Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 08/21] libxl: set PVH guests to use the PV console Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 09/21] libxl: add PVH support to domain creation Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 10/21] libxl: remove device model "none" support from disk related functions Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 11/21] libxl: set device model for PVH guests Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 12/21] libxl: add PVH support to domain building Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 13/21] libxl: add PVH support to domain save/suspend Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 14/21] libxl: add PVH support to vpcu hotplug, domain destruction/pause and domain configuration Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 15/21] libxl: add PVH support to memory functions Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 16/21] libxl: PVH guests use PV nics Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 17/21] libxl: remove device model "none" support from stream functions Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 18/21] libxl: add PVH support to USB Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 19/21] libxl: add PVH support to x86 functions Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 20/21] xl: add PVH as a guest type Roger Pau Monne
2017-09-07 10:16 ` [PATCH v2 21/21] libxl: remove device model "none" from IDL Roger Pau Monne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170907101642.15782-2-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.