Pino Toscano <ptoscano(a)redhat.com> [2018-05-25, 01:05PM +0200]:
On Thursday, 24 May 2018 14:24:33 CEST Xiao Feng Ren wrote:
> diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
> index 1a18cd31b1..8050a3ebc4 100644
> --- a/docs/schemas/basictypes.rng
> +++ b/docs/schemas/basictypes.rng
> @@ -111,6 +111,34 @@
> </attribute>
> </optional>
> </define>
> + <define name="zpciaddress">
> + <optional>
> + <attribute name="uid">
> + <choice>
> + <data type="string">
> + <param
name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
> + </data>
> + <data type="unsignedInt">
> + <param name="minInclusive">1</param>
> + <param name="maxInclusive">65535</param>
> + </data>
> + </choice>
> + </attribute>
This seems to be the "uint16" type already.
uint16 has '0' inclusive which we do not technically allow, although we
couldn't come up with a nice enough regex to also exlude it there.
> + </optional>
> + <optional>
> + <attribute name="fid">
> + <choice>
> + <data type="string">
> + <param
name="pattern">(0x)?[0-9a-fA-F]{1,8}</param>
> + </data>
> + <data type="unsignedLong">
> + <param name="minInclusive">0</param>
> + <param name="maxInclusive">4294967295</param>
> + </data>
> + </choice>
> + </attribute>
This could be a new "uint32" type, changing the 0x prefix as
non-optional (otherwise the value "10" can be both valid as decimal
and hexadeciaml).
Here it would be fine.
> @@ -57,6 +125,8 @@ void
> virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
> {
> VIR_FREE(info->alias);
> + if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
> + VIR_FREE(info->addr.pci.zpci);
VIR_FREE should be safe to use on a NULL pointer, so just call it
directly without checking the type.
But if the union info->addr is not of type PCI then the pointer could
hold arbitrary value, right? Which is not the case currently, because
the zpci field is far enough in the structure to be always 0 set, but we
shouldn't rely on this IMHO.
--
IBM Systems
Linux on Z & Virtualization Development
------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819
------------------------------------------------------------------------
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294