We make small modifications to the rng files to allow the relaxng-to-proto script to infer XML attribute types better. 1. Make iobase and irq refs so we can override their types in the script. 2. Replace deviceName with absFilePath so that vdpa devices get fuzzed correctly with file paths. 3. The relaxng-to-proto script does not handle regexes, so convert some of them to <choice> containing <value>. Signed-off-by: Rayhan Faizel <rayhan.faizel@xxxxxxxxx> --- src/conf/schemas/basictypes.rng | 20 ++++++++++++++------ src/conf/schemas/domaincommon.rng | 11 +++++++---- src/conf/schemas/networkcommon.rng | 14 ++++++++------ 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/conf/schemas/basictypes.rng b/src/conf/schemas/basictypes.rng index 2931e316b7..db05c085fe 100644 --- a/src/conf/schemas/basictypes.rng +++ b/src/conf/schemas/basictypes.rng @@ -555,19 +555,27 @@ </element> </define> + <define name="iobase"> + <data type="string"> + <param name="pattern">0x[a-fA-F0-9]{1,4}</param> + </data> + </define> + + <define name="irq"> + <data type="string"> + <param name="pattern">0x[a-fA-F0-9]</param> + </data> + </define> + <define name="isaaddress"> <optional> <attribute name="iobase"> - <data type="string"> - <param name="pattern">0x[a-fA-F0-9]{1,4}</param> - </data> + <ref name="iobase"/> </attribute> </optional> <optional> <attribute name="irq"> - <data type="string"> - <param name="pattern">0x[a-fA-F0-9]</param> - </data> + <ref name="irq"/> </attribute> </optional> </define> diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index 05ba697924..d635d2b179 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -3670,7 +3670,7 @@ <interleave> <element name="source"> <attribute name="dev"> - <ref name="deviceName"/> + <ref name="absFilePath"/> </attribute> </element> <ref name="interface-options"/> @@ -8495,9 +8495,12 @@ </data> </define> <define name="bridgeMode"> - <data type="string"> - <param name="pattern">(vepa|bridge|private|passthrough)</param> - </data> + <choice> + <value>vepa</value> + <value>bridge</value> + <value>private</value> + <value>passthrough</value> + </choice> </define> <define name="addrIPorName"> <choice> diff --git a/src/conf/schemas/networkcommon.rng b/src/conf/schemas/networkcommon.rng index 6df6d43f54..0254bac693 100644 --- a/src/conf/schemas/networkcommon.rng +++ b/src/conf/schemas/networkcommon.rng @@ -199,14 +199,16 @@ </data> </define> <define name="protocol"> - <data type="string"> - <param name="pattern">(tcp)|(udp)</param> - </data> + <choice> + <value>tcp</value> + <value>udp</value> + </choice> </define> <define name="addr-family"> - <data type="string"> - <param name="pattern">(ipv4)|(ipv6)</param> - </data> + <choice> + <value>ipv4</value> + <value>ipv6</value> + </choice> </define> <define name="vlan"> -- 2.34.1