From 0c97dc415945896c30adbfecd1ac38fa4b90d677 Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Sun, 26 Jun 2011 05:13:10 -0400 Subject: [PATCH] xml: create an RNG file for common types and move some definitions there domain.rng, network.rng, and interface.rng already use a few of the same types (or in some cases *should* but don't), and an upcoming code change will have them sharing even more. To prepare for that, this patch takes those common data type definitions and moves them into basictypes.rng. This may break some rule about the need to RNG files to be autonomous or something, but I saw that storageencryption.rng is used in this way, so I figured it must not be completely against the law... --- docs/schemas/Makefile.am | 1 + docs/schemas/basictypes.rng | 130 ++++++++++++++++++++++++++++++++++++ docs/schemas/domain.rng | 86 ++---------------------- docs/schemas/interface.rng | 71 ++++---------------- docs/schemas/network.rng | 79 ++++++---------------- libvirt.spec.in | 1 + mingw32-libvirt.spec.in | 1 + 7 files changed, 169 insertions(+), 200 deletions(-) create mode 100644 docs/schemas/basictypes.rng diff --git a/docs/schemas/Makefile.am b/docs/schemas/Makefile.am index 36b9aebe1c..5ef77372f9 100644 --- a/docs/schemas/Makefile.am +++ b/docs/schemas/Makefile.am @@ -2,6 +2,7 @@ schemadir = $(pkgdatadir)/schemas schema_DATA = \ + basictypes.rng \ capability.rng \ domain.rng \ domainsnapshot.rng \ diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng new file mode 100644 index 0000000000..b3267f53b6 --- /dev/null +++ b/docs/schemas/basictypes.rng @@ -0,0 +1,130 @@ + + + + + + + + [0-9]+ + + + + + + [0-9]+ + + + + + + + 0x[0-9a-fA-F]{1,2} + + + 0 + 255 + + + + + + + 0x[0-9a-fA-F]{1,6} + + + 0 + 16777215 + + + + + + + + [a-fA-F0-9]{32} + + + [a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12} + + + + + + + + ([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2} + + + + + + + (((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])) + + + + + + + +(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(([0-9A-Fa-f]{1,4}:){0,5}:(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(::([0-9A-Fa-f]{1,4}:){0,5}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:) + + + + + + + + + + + + + 32 + + + + + + 128 + + + + + + + + + + + + + [a-zA-Z0-9\.\-]+ + + + + + + [a-zA-Z0-9_\.\-\\:/]+ + + + + + + [a-zA-Z0-9_\.\+\-\\&"'<>/%]+ + + + + + + /[a-zA-Z0-9_\.\+\-\\&"'<>/%]+ + + + + + + /[a-zA-Z0-9_\.\+\-\\&"'<>/%]* + + + + diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index fb1497b2a4..3c8414eef0 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -5,6 +5,7 @@ + - - - [0-9]+ - - - - - [0-9]+ - - ([0-9]+(-[0-9]+)?|\^[0-9]+)(,([0-9]+(-[0-9]+)?|\^[0-9]+))* @@ -2381,11 +2370,6 @@ [0-9]+ - - - [a-zA-Z0-9\.\-]+ - - -1 @@ -2419,51 +2403,11 @@ [a-zA-Z0-9_\+\-]+ - - - - [a-fA-F0-9]{32} - - - [a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12} - - - - - - [a-zA-Z0-9_\.\+\-\\&"'<>/%]+ - - - - - /[a-zA-Z0-9_\.\+\-\\&"'<>/%]+ - - - - - /[a-zA-Z0-9_\.\+\-\\&"'<>/%]* - - - - - [a-zA-Z0-9_\.\-\\:/]+ - - (vepa|bridge|private|passthrough) - - - ([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2} - - - - - ([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9] - - (([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9])|(([0-9a-fA-F]+|:)+[0-9a-fA-F]+)|([a-zA-Z0-9_\.\+\-]*) @@ -2539,28 +2483,6 @@ [a-zA-Z0-9_\.:]+ - - - - 0x[0-9a-fA-F]{1,2} - - - 0 - 255 - - - - - - - 0x[0-9a-fA-F]{1,6} - - - 0 - 16777215 - - - 39 diff --git a/docs/schemas/interface.rng b/docs/schemas/interface.rng index 4dd1bb489e..53fa18a00f 100644 --- a/docs/schemas/interface.rng +++ b/docs/schemas/interface.rng @@ -1,3 +1,4 @@ + + - + @@ -75,7 +77,7 @@ - + @@ -202,7 +204,7 @@ - + @@ -244,7 +246,7 @@ - + @@ -303,14 +305,14 @@ - + - + - + @@ -331,15 +333,15 @@ - + - + - + @@ -417,55 +419,6 @@ - - - [a-zA-Z0-9_\.\-:/]+ - - - - - - - [a-fA-F0-9]{32} - - - [a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12} - - - - - - - ([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2} - - - - - - (((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])) - - - - - - 32 - - - - - - - - (([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))))|(([0-9A-Fa-f]{1,4}:){0,5}:((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))))|(::([0-9A-Fa-f]{1,4}:){0,5}((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:) - - - - - - 128 - - - 4096 diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 05f45e5489..6d9f06b930 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -1,3 +1,4 @@ + @@ -5,6 +6,8 @@ + + @@ -18,7 +21,7 @@ - + @@ -28,7 +31,7 @@ - + @@ -53,7 +56,7 @@ - + @@ -65,7 +68,7 @@ - + @@ -83,7 +86,7 @@ - + @@ -93,15 +96,15 @@ - + - + - + @@ -114,12 +117,12 @@ local to the host. --> - + - - + + @@ -136,22 +139,22 @@ - - + + - + - + - + - + @@ -163,52 +166,10 @@ - - - - (((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])) - - - - - - - - (([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(([0-9A-Fa-f]{1,4}:){0,5}:(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(::([0-9A-Fa-f]{1,4}:){0,5}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:) - - - - - - - - - - - - - 128 - - - (ipv4)|(ipv6) - - - - ([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2} - - - - - - - ([a-zA-Z\-]+) - - - diff --git a/libvirt.spec.in b/libvirt.spec.in index feca5ad014..bf220f3aa3 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1065,6 +1065,7 @@ fi %{_datadir}/libvirt/schemas/secret.rng %{_datadir}/libvirt/schemas/storageencryption.rng %{_datadir}/libvirt/schemas/nwfilter.rng +%{_datadir}/libvirt/schemas/basictypes.rng %{_datadir}/libvirt/cpu_map.xml diff --git a/mingw32-libvirt.spec.in b/mingw32-libvirt.spec.in index d9c9f61015..a8a39dade8 100644 --- a/mingw32-libvirt.spec.in +++ b/mingw32-libvirt.spec.in @@ -108,6 +108,7 @@ rm -rf $RPM_BUILD_ROOT %{_mingw32_datadir}/libvirt/schemas/nwfilter.rng %{_mingw32_datadir}/libvirt/schemas/secret.rng %{_mingw32_datadir}/libvirt/schemas/storageencryption.rng +%{_mingw32_datadir}/libvirt/schemas/basictypes.rng %{_mingw32_datadir}/libvirt/cpu_map.xml