[PATCH 17/37] util: xml: Introduce virXMLPropLongLong

Ján Tomko jtomko at redhat.com
Mon Sep 26 14:01:35 UTC 2022


On a Monday in 2022, Peter Krempa wrote:
>Add a helper for parsing long long values from XML properties with
>semantics like virXMLPropInt.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/libvirt_private.syms |  1 +
> src/util/virxml.c        | 64 ++++++++++++++++++++++++++++++++++++++++
> src/util/virxml.h        |  9 ++++++
> 3 files changed, 74 insertions(+)
>
>diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
>index 01bb349e05..5be40dbefe 100644
>--- a/src/libvirt_private.syms
>+++ b/src/libvirt_private.syms
>@@ -3682,6 +3682,7 @@ virXMLPickShellSafeComment;
> virXMLPropEnum;
> virXMLPropEnumDefault;
> virXMLPropInt;
>+virXMLPropLongLong;
> virXMLPropString;
> virXMLPropStringRequired;
> virXMLPropTristateBool;
>diff --git a/src/util/virxml.c b/src/util/virxml.c
>index b94af9c7a3..0a91fd237e 100644
>--- a/src/util/virxml.c
>+++ b/src/util/virxml.c
>@@ -750,6 +750,70 @@ virXMLPropUInt(xmlNodePtr node,
> }
>
>
>+/**
>+ * virXMLPropLongLong:
>+ * @node: XML dom node pointer
>+ * @name: Name of the property (attribute) to get
>+ * @base: Number base, see strtol
>+ * @flags: Bitwise or of virXMLPropFlags

*Bitwise-OR

>+ * @result: The returned value
>+ * @defaultResult: default value of @result in case the property is not found

*Default value

>+ *
>+ * Convenience function to return value of a long long attribute.
>+ *
>+ * Returns 1 in case of success in which case @result is set,
>+ *         or 0 if the attribute is not present,
>+ *         or -1 and reports an error on failure.
>+ */

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano


More information about the libvir-list mailing list