[PATCH] xml: Clean up schemas to use shared data types instead of local

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The schema files contained duplicate data types that can be shared from
the basictypes.rng file.
---
 docs/schemas/capability.rng |   43 +++++----------------------------
 docs/schemas/interface.rng  |   16 ++++--------
 docs/schemas/nodedev.rng    |   54 +++++++++++++++---------------------------
 docs/schemas/nwfilter.rng   |   28 +---------------------
 4 files changed, 32 insertions(+), 109 deletions(-)

diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index 3af95e9..06ff685 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -1,6 +1,7 @@
 <!-- A Relax NG schema for the libvirt capabilities XML format -->
 <grammar xmlns="http://relaxng.org/ns/structure/1.0";
     datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes";>
+  <include href='basictypes.rng'/>
   <start>
     <ref name='capabilities'/>
   </start>
@@ -157,7 +158,7 @@
     <element name='topology'>
       <element name='cells'>
         <attribute name='num'>
-          <ref name='uint'/>
+          <ref name='unsignedInt'/>
         </attribute>
         <oneOrMore>
           <ref name='cell'/>
@@ -169,13 +170,13 @@
   <define name='cell'>
     <element name='cell'>
       <attribute name='id'>
-        <ref name='uint'/>
+        <ref name='unsignedInt'/>
       </attribute>

       <optional>
         <element name='cpus'>
           <attribute name='num'>
-            <ref name='uint'/>
+            <ref name='unsignedInt'/>
           </attribute>
           <oneOrMore>
             <ref name='cpu'/>
@@ -188,7 +189,7 @@
   <define name='cpu'>
     <element name='cpu'>
       <attribute name='id'>
-        <ref name='uint'/>
+        <ref name='unsignedInt'/>
       </attribute>
     </element>
   </define>
@@ -238,13 +239,13 @@

   <define name='emulator'>
     <element name='emulator'>
-      <ref name='path'/>
+      <ref name='absFilePath'/>
     </element>
   </define>

   <define name='loader'>
     <element name='loader'>
-      <ref name='path'/>
+      <ref name='absFilePath'/>
     </element>
   </define>

@@ -367,39 +368,9 @@
     </choice>
   </define>

-
-  <define name='positiveInteger'>
-    <data type='positiveInteger'>
-      <param name="pattern">[0-9]+</param>
-    </data>
-  </define>
-
-  <define name='uint'>
-    <data type='unsignedInt'>
-      <param name="pattern">[0-9]+</param>
-    </data>
-  </define>
-
-  <define name='path'>
-    <data type='string'>
-      <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
-    </data>
-  </define>
-
   <define name='featureName'>
     <data type='string'>
       <param name='pattern'>[a-zA-Z0-9\-_]+</param>
     </data>
   </define>
-
-  <define name="UUID">
-    <choice>
-      <data type="string">
-        <param name="pattern">[a-fA-F0-9]{32}</param>
-      </data>
-      <data type="string">
-        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
-      </data>
-    </choice>
-  </define>
 </grammar>
diff --git a/docs/schemas/interface.rng b/docs/schemas/interface.rng
index 53fa18a..3984b63 100644
--- a/docs/schemas/interface.rng
+++ b/docs/schemas/interface.rng
@@ -183,12 +183,12 @@
         <choice>
           <element name="miimon">
             <!-- miimon frequency in ms -->
-            <attribute name="freq"><ref name="uint"/></attribute>
+            <attribute name="freq"><ref name="unsignedInt"/></attribute>
             <optional>
-              <attribute name="downdelay"><ref name="uint"/></attribute>
+              <attribute name="downdelay"><ref name="unsignedInt"/></attribute>
             </optional>
             <optional>
-              <attribute name="updelay"><ref name="uint"/></attribute>
+              <attribute name="updelay"><ref name="unsignedInt"/></attribute>
             </optional>
             <optional>
               <!-- use_carrier -->
@@ -203,7 +203,7 @@
             </optional>
           </element>
           <element name="arpmon">
-            <attribute name="interval"><ref name="uint"/></attribute>
+            <attribute name="interval"><ref name="unsignedInt"/></attribute>
             <attribute name="target"><ref name="ipv4Addr"/></attribute>
             <optional>
               <attribute name="validate">
@@ -252,7 +252,7 @@
   <define name="mtu">
     <optional>
       <element name="mtu">
-        <attribute name="size"><ref name="uint"/></attribute>
+        <attribute name="size"><ref name="unsignedInt"/></attribute>
       </element>
     </optional>
   </define>
@@ -407,12 +407,6 @@

   <!-- Type library -->

-  <define name='uint'>
-    <data type='unsignedInt'>
-      <param name="pattern">[0-9]+</param>
-    </data>
-  </define>
-
   <define name="timeval">
     <data type="double">
       <param name="minInclusive">0</param>
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index 1b9a2d1..a73c2e5 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -1,6 +1,7 @@
 <!-- A Relax NG schema for the libvirt node device XML format -->
 <grammar xmlns="http://relaxng.org/ns/structure/1.0";
     datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes";>
+  <include href='basictypes.rng'/>
   <start>
     <ref name='device'/>
   </start>
@@ -56,7 +57,7 @@
       </optional>

       <element name='uuid'>
-        <ref name='uuid'/>
+        <ref name='UUID'/>
       </element>
     </element>

@@ -80,16 +81,16 @@
     </attribute>

     <element name='domain'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='bus'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='slot'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='function'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>

     <element name='product'>
@@ -122,10 +123,10 @@
     </attribute>

     <element name='bus'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='device'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>

     <element name='product'>
@@ -157,16 +158,16 @@
     </attribute>

     <element name='number'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='class'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='subclass'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='protocol'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>

     <optional>
@@ -252,7 +253,7 @@
     </attribute>

     <element name='host'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>

     <optional>
@@ -273,16 +274,16 @@
     </attribute>

     <element name='host'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='bus'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='target'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
     <element name='lun'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>

     <element name='type'>
@@ -352,7 +353,7 @@
       </element>

       <element name='media_size'>
-        <ref name='uint'/>
+        <ref name='unsignedLong'/>
       </element>
       <optional>
         <element name='media_label'>
@@ -364,27 +365,10 @@

   <define name='capstoragefixed'>
     <element name='size'>
-      <ref name='uint'/>
+      <ref name='unsignedLong'/>
     </element>
   </define>

-  <define name='uuid'>
-    <choice>
-      <data type='string'>
-        <param name="pattern">[a-fA-F0-9]{32}</param>
-      </data>
-      <data type='string'>
-        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
-      </data>
-    </choice>
-  </define>
-
-  <define name='uint'>
-    <data type='string'>
-      <param name="pattern">[0-9]+</param>
-    </data>
-  </define>
-
   <define name='hexuint'>
     <data type='string'>
       <param name="pattern">(0x)?[0-9a-f]+</param>
diff --git a/docs/schemas/nwfilter.rng b/docs/schemas/nwfilter.rng
index bce3d3b..13fd9b9 100644
--- a/docs/schemas/nwfilter.rng
+++ b/docs/schemas/nwfilter.rng
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"; datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes";>
+  <include href='basictypes.rng'/>
   <start>
     <ref name="filter"/>
   </start>
@@ -799,18 +800,6 @@

   <!-- ################  type library ################ -->

-  <define name="UUID">
-    <choice>
-      <data type="string">
-        <param name="pattern">[a-fA-F0-9]{32}</param>
-      </data>
-
-      <data type="string">
-        <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
-      </data>
-    </choice>
-  </define>
-
   <define name="variable-name-type">
     <data type="string">
       <param name="pattern">$[a-zA-Z0-9_]+(\[[ ]*[@]?[0-9]+[ ]*\])?</param>
@@ -930,21 +919,6 @@
     </choice>
   </define>

-  <define name="uint8range">
-    <choice>
-      <ref name="variable-name-type"/>
-
-      <data type="string">
-        <param name="pattern">0x[0-9a-fA-F]{1,2}</param>
-      </data>
-
-      <data type="int">
-        <param name="minInclusive">0</param>
-        <param name="maxInclusive">255</param>
-      </data>
-    </choice>
-  </define>
-
   <define name="uint16range">
     <choice>
       <ref name="variable-name-type"/>
-- 
1.7.3.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]