# HG changeset patch
# User ewan@xxxxxxxxxxxxx
# Node ID c75716820107876aaf3d619c90647d8796fdee60
# Parent 9e0b024a169624507452130244e940fa3fd6000d
Import libxen-src-0.4.3-2.tar.bz2.
Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
tools/libxen/COPYING | 510 +++++
tools/libxen/Makefile | 37
tools/libxen/README | 54
tools/libxen/include/xen_boot_type.h | 87
tools/libxen/include/xen_boot_type_internal.h | 37
tools/libxen/include/xen_common.h | 145 +
tools/libxen/include/xen_cpu_feature.h | 382 ++++
tools/libxen/include/xen_cpu_feature_internal.h | 37
tools/libxen/include/xen_driver_type.h | 77
tools/libxen/include/xen_driver_type_internal.h | 37
tools/libxen/include/xen_host.h | 276 ++
tools/libxen/include/xen_host_cpu.h | 208 ++
tools/libxen/include/xen_host_cpu_decl.h | 30
tools/libxen/include/xen_host_decl.h | 30
tools/libxen/include/xen_int_float_map.h | 53
tools/libxen/include/xen_internal.h | 192 ++
tools/libxen/include/xen_network.h | 287 +++
tools/libxen/include/xen_network_decl.h | 30
tools/libxen/include/xen_on_crash_behaviour.h | 97 +
tools/libxen/include/xen_on_crash_behaviour_internal.h | 38
tools/libxen/include/xen_on_normal_exit.h | 77
tools/libxen/include/xen_on_normal_exit_internal.h | 37
tools/libxen/include/xen_sr.h | 275 ++
tools/libxen/include/xen_sr_decl.h | 30
tools/libxen/include/xen_string_string_map.h | 53
tools/libxen/include/xen_user.h | 197 ++
tools/libxen/include/xen_user_decl.h | 30
tools/libxen/include/xen_vbd.h | 269 ++
tools/libxen/include/xen_vbd_decl.h | 30
tools/libxen/include/xen_vbd_mode.h | 77
tools/libxen/include/xen_vbd_mode_internal.h | 37
tools/libxen/include/xen_vdi.h | 330 +++
tools/libxen/include/xen_vdi_decl.h | 30
tools/libxen/include/xen_vdi_type.h | 82
tools/libxen/include/xen_vdi_type_internal.h | 37
tools/libxen/include/xen_vif.h | 314 +++
tools/libxen/include/xen_vif_decl.h | 30
tools/libxen/include/xen_vm.h | 809 ++++++++
tools/libxen/include/xen_vm_decl.h | 30
tools/libxen/include/xen_vm_power_state.h | 97 +
tools/libxen/include/xen_vm_power_state_internal.h | 37
tools/libxen/src/xen_boot_type.c | 83
tools/libxen/src/xen_common.c | 1329 ++++++++++++++
tools/libxen/src/xen_cpu_feature.c | 142 +
tools/libxen/src/xen_driver_type.c | 81
tools/libxen/src/xen_host.c | 350 +++
tools/libxen/src/xen_host_cpu.c | 208 ++
tools/libxen/src/xen_int_float_map.c | 37
tools/libxen/src/xen_network.c | 398 ++++
tools/libxen/src/xen_on_crash_behaviour.c | 85
tools/libxen/src/xen_on_normal_exit.c | 81
tools/libxen/src/xen_sr.c | 370 +++
tools/libxen/src/xen_string_string_map.c | 49
tools/libxen/src/xen_user.c | 183 +
tools/libxen/src/xen_vbd.c | 350 +++
tools/libxen/src/xen_vbd_mode.c | 81
tools/libxen/src/xen_vdi.c | 499 +++++
tools/libxen/src/xen_vdi_type.c | 82
tools/libxen/src/xen_vif.c | 460 ++++
tools/libxen/src/xen_vm.c | 1594 +++++++++++++++++
tools/libxen/src/xen_vm_power_state.c | 85
tools/libxen/test/test_bindings.c | 417 ++++
62 files changed, 12516 insertions(+)
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/COPYING
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/COPYING Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,510 @@
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard. To achieve this, non-free programs must
+be allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at least
+ three years, to give the same user the materials specified in
+ Subsection 6a, above, for a charge no more than the cost of
+ performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License
+may add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms
+of the ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library.
+It is safest to attach them to the start of each source file to most
+effectively convey the exclusion of warranty; and each file should
+have at least the "copyright" line and a pointer to where the full
+notice is found.
+
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or
+your school, if any, to sign a "copyright disclaimer" for the library,
+if necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James
+ Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/Makefile Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2006, XenSource Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+CFLAGS = -Iinclude \
+ $(shell xml2-config --cflags) \
+ $(shell curl-config --cflags) \
+ -W -Wall -Werror -std=c99 -O2 -fPIC
+
+LDFLAGS = $(shell xml2-config --libs) \
+ $(shell curl-config --libs)
+
+test/test_bindings: test/test_bindings.o src/libxen.so
+ $(CC) $(LDFLAGS) -o $@ $< -L src -lxen
+
+src/libxen.so: $(patsubst %.c, %.o, $(wildcard src/*.c))
+ $(CC) -shared -o $@ $^
+
+.PHONY: clean
+clean:
+ rm -f `find -name *.o`
+ rm -f src/libxen.so
+ rm -f test/test_bindings
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/README Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,54 @@
+Xen API C Bindings
+==================
+
+This distribution is the source code to the proposed Xen API C bindings.
+
+The Xen API project will define an XML-RPC protocol for remote and local
+management of Xen-based systems, and a set of bindings for these XML-RPC calls
+into a number of languages (this package contains those to the C language).
+
+The intention is to standardise these XML-RPC calls, and then the Xen project
+will guarantee that that wire protocol will be supported for the long term.
+The bindings will also be supported in the Xen tree, giving a stable
+foundation for Xen management tools and middlewares, in particular the Xen CIM
+providers and libvirt.
+
+THIS IS A WORK IN PROGRESS. The API and bindings are under active design and
+development, and this is a snapshot release for developers only. Both the API
+and the C bindings are scheduled to be stabilised by the Xen 3.0.4 release
+i.e. October 2006 at the earliest.
+
+These bindings are open-source (LGPL), and will be committed as libraries to
+the Xen trees for all to use after the Xen 3.0.3 release.
+
+We welcome any discussion about this library and the API in general. Please
+join the Xen-API mailing list if you are interested in this project. I (Ewan
+Mellor) will collate all the feedback from that list and push out new versions
+of the document and the bindings as and when.
+
+
+URLs
+----
+
+Xen-API wiki page:
+http://wiki.xensource.com/xenwiki/XenApi
+
+Xen-API mailing list:
+ http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
+
+
+Usage
+-----
+
+The bindings depend upon libxml2, the XML toolkit from the GNOME project; the
+test program depends upon libcurl3 also. On Debian, you need the packages
+libxml2-dev and libcurl3-dev.
+
+To compile, type make.
+
+To run the test, do
+
+LD_LIBRARY_PATH=src ./test/test_bindings <url> <username> <password>
+
+where <url> is the fragment of the server URL that follows the http://, for
+example "localhost:8005/RPC2".
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_boot_type.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_boot_type.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_BOOT_TYPE_H
+#define XEN_BOOT_TYPE_H
+
+
+#include "xen_common.h"
+
+
+enum xen_boot_type
+{
+ /**
+ * boot an HVM guest using an emulated BIOS
+ */
+ XEN_BOOT_TYPE_BIOS,
+
+ /**
+ * boot from inside the machine using grub
+ */
+ XEN_BOOT_TYPE_GRUB,
+
+ /**
+ * boot from an external kernel
+ */
+ XEN_BOOT_TYPE_KERNEL_EXTERNAL,
+
+ /**
+ * boot from a kernel inside the guest filesystem
+ */
+ XEN_BOOT_TYPE_KERNEL_INTERNAL
+};
+
+
+typedef struct xen_boot_type_set
+{
+ size_t size;
+ enum xen_boot_type contents[];
+} xen_boot_type_set;
+
+/**
+ * Allocate a xen_boot_type_set of the given size.
+ */
+extern xen_boot_type_set *
+xen_boot_type_set_alloc(size_t size);
+
+/**
+ * Free the given xen_boot_type_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_boot_type_set_free(xen_boot_type_set *set);
+
+
+/**
+ * Return the name corresponding to the given code. This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_boot_type_to_string(enum xen_boot_type val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_boot_type
+xen_boot_type_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_boot_type_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_boot_type_internal.h Sat Oct 07 18:22:09
2006 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/*
+ * Declarations of the abstract types used during demarshalling of enum
+ * xen_boot_type. Internal to this library -- do not use from outside.
+ */
+
+
+#ifndef XEN_BOOT_TYPE_INTERNAL_H
+#define XEN_BOOT_TYPE_INTERNAL_H
+
+
+#include "xen_internal.h"
+
+
+extern const abstract_type xen_boot_type_abstract_type_;
+extern const abstract_type xen_boot_type_set_abstract_type_;
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_common.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_common.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,145 @@
+/*
+ Copyright (c) 2006 XenSource, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef XEN_COMMON_H
+#define XEN_COMMON_H
+
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <time.h>
+
+#include "xen_host_decl.h"
+
+
+typedef bool (*xen_result_func)(const void *data, size_t len,
+ void *result_handle);
+
+
+/**
+ * len does not include a terminating \0.
+ */
+typedef int (*xen_call_func)(const void *, size_t len, void *user_handle,
+ void *result_handle,
+ xen_result_func result_func);
+
+
+typedef struct
+{
+ xen_call_func call_func;
+ void *handle;
+ const char *session_id;
+ bool ok;
+ char **error_description;
+ int error_description_count;
+} xen_session;
+
+
+struct xen_task_;
+typedef struct xen_task_ * xen_task_id;
+
+
+typedef struct
+{
+ int progress;
+ long eta;
+ /* !!! RESULT */
+} xen_task_status;
+
+
+typedef struct
+{
+ int major;
+ int minor;
+ int patch;
+ char *extraversion;
+} xen_version;
+
+
+/**
+ * Free the given xen_version, and all referenced values.
+ */
+extern void xen_version_free(xen_version *version);
+
+
+/**
+ * Return the version of this client-side library. This will be the major,
+ * minor, and extraversion of the Xen release with which it was released,
+ * plus the library's own version as the patch.
+ */
+extern xen_version *xen_get_client_side_version();
+
+
+extern bool
+xen_uuid_string_to_bytes(char *uuid, char **bytes);
+
+
+extern bool
+xen_uuid_bytes_to_string(char *bytes, char **uuid);
+
+
+extern void
+xen_uuid_free(char *uuid);
+
+
+extern void
+xen_uuid_bytes_free(char *bytes);
+
+
+/**
+ * Initialise this library. Call this before starting to use this library.
+ * Note that since this library depends upon libxml2, you should also call
+ * xmlInitParser as appropriate for your program.
+ */
+extern
+void xen_init(void);
+
+
+/**
+ * Clear up this library. Call when you have finished using this library.
+ * Note that since this library depends upon libxml2, you should also call
+ * xmlCleanupParser as appropriate for your program.
+ */
+extern
+void xen_fini(void);
+
+
+/**
+ * Log in at the server, and allocate a xen_session to represent this session.
+ */
+extern xen_session *
+xen_session_login_with_password(xen_call_func call_func, void *handle,
+ const char *uname, const char *pwd);
+
+
+/**
+ * Log out at the server, and free the xen_session.
+ */
+extern void
+xen_session_logout(xen_session *session);
+
+
+/**
+ * Set *result to be a handle to the host to which this session is connected.
+ */
+extern int
+xen_session_get_this_host(xen_session *session, xen_host *result);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_cpu_feature.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_cpu_feature.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_CPU_FEATURE_H
+#define XEN_CPU_FEATURE_H
+
+
+#include "xen_common.h"
+
+
+enum xen_cpu_feature
+{
+ /**
+ * Onboard FPU
+ */
+ XEN_CPU_FEATURE_FPU,
+
+ /**
+ * Virtual Mode Extensions
+ */
+ XEN_CPU_FEATURE_VME,
+
+ /**
+ * Debugging Extensions
+ */
+ XEN_CPU_FEATURE_DE,
+
+ /**
+ * Page Size Extensions
+ */
+ XEN_CPU_FEATURE_PSE,
+
+ /**
+ * Time Stamp Counter
+ */
+ XEN_CPU_FEATURE_TSC,
+
+ /**
+ * Model-Specific Registers, RDMSR, WRMSR
+ */
+ XEN_CPU_FEATURE_MSR,
+
+ /**
+ * Physical Address Extensions
+ */
+ XEN_CPU_FEATURE_PAE,
+
+ /**
+ * Machine Check Architecture
+ */
+ XEN_CPU_FEATURE_MCE,
+
+ /**
+ * CMPXCHG8 instruction
+ */
+ XEN_CPU_FEATURE_CX8,
+
+ /**
+ * Onboard APIC
+ */
+ XEN_CPU_FEATURE_APIC,
+
+ /**
+ * SYSENTER/SYSEXIT
+ */
+ XEN_CPU_FEATURE_SEP,
+
+ /**
+ * Memory Type Range Registers
+ */
+ XEN_CPU_FEATURE_MTRR,
+
+ /**
+ * Page Global Enable
+ */
+ XEN_CPU_FEATURE_PGE,
+
+ /**
+ * Machine Check Architecture
+ */
+ XEN_CPU_FEATURE_MCA,
+
+ /**
+ * CMOV instruction (FCMOVCC and FCOMI too if FPU present)
+ */
+ XEN_CPU_FEATURE_CMOV,
+
+ /**
+ * Page Attribute Table
+ */
+ XEN_CPU_FEATURE_PAT,
+
+ /**
+ * 36-bit PSEs
+ */
+ XEN_CPU_FEATURE_PSE36,
+
+ /**
+ * Processor serial number
+ */
+ XEN_CPU_FEATURE_PN,
+
+ /**
+ * Supports the CLFLUSH instruction
+ */
+ XEN_CPU_FEATURE_CLFLSH,
+
+ /**
+ * Debug Trace Store
+ */
+ XEN_CPU_FEATURE_DTES,
+
+ /**
+ * ACPI via MSR
+ */
+ XEN_CPU_FEATURE_ACPI,
+
+ /**
+ * Multimedia Extensions
+ */
+ XEN_CPU_FEATURE_MMX,
+
+ /**
+ * FXSAVE and FXRSTOR instructions (fast save and restore
+ */
+ XEN_CPU_FEATURE_FXSR,
+
+ /**
+ * Streaming SIMD Extensions
+ */
+ XEN_CPU_FEATURE_XMM,
+
+ /**
+ * Streaming SIMD Extensions-2
+ */
+ XEN_CPU_FEATURE_XMM2,
+
+ /**
+ * CPU self snoop
+ */
+ XEN_CPU_FEATURE_SELFSNOOP,
+
+ /**
+ * Hyper-Threading
+ */
+ XEN_CPU_FEATURE_HT,
+
+ /**
+ * Automatic clock control
+ */
+ XEN_CPU_FEATURE_ACC,
+
+ /**
+ * IA-64 processor
+ */
+ XEN_CPU_FEATURE_IA64,
+
+ /**
+ * SYSCALL/SYSRET
+ */
+ XEN_CPU_FEATURE_SYSCALL,
+
+ /**
+ * MP Capable.
+ */
+ XEN_CPU_FEATURE_MP,
+
+ /**
+ * Execute Disable
+ */
+ XEN_CPU_FEATURE_NX,
+
+ /**
+ * AMD MMX extensions
+ */
+ XEN_CPU_FEATURE_MMXEXT,
+
+ /**
+ * Long Mode (x86-64)
+ */
+ XEN_CPU_FEATURE_LM,
+
+ /**
+ * AMD 3DNow! extensions
+ */
+ XEN_CPU_FEATURE_3DNOWEXT,
+
+ /**
+ * 3DNow!
+ */
+ XEN_CPU_FEATURE_3DNOW,
+
+ /**
+ * CPU in recovery mode
+ */
+ XEN_CPU_FEATURE_RECOVERY,
+
+ /**
+ * Longrun power control
+ */
+ XEN_CPU_FEATURE_LONGRUN,
+
+ /**
+ * LongRun table interface
+ */
+ XEN_CPU_FEATURE_LRTI,
+
+ /**
+ * Cyrix MMX extensions
+ */
+ XEN_CPU_FEATURE_CXMMX,
+
+ /**
+ * AMD K6 nonstandard MTRRs
+ */
+ XEN_CPU_FEATURE_K6_MTRR,
+
+ /**
+ * Cyrix ARRs (= MTRRs)
+ */
+ XEN_CPU_FEATURE_CYRIX_ARR,
+
+ /**
+ * Centaur MCRs (= MTRRs)
+ */
+ XEN_CPU_FEATURE_CENTAUR_MCR,
+
+ /**
+ * Opteron, Athlon64
+ */
+ XEN_CPU_FEATURE_K8,
+
+ /**
+ * Athlon
+ */
+ XEN_CPU_FEATURE_K7,
+
+ /**
+ * P3
+ */
+ XEN_CPU_FEATURE_P3,
+
+ /**
+ * P4
+ */
+ XEN_CPU_FEATURE_P4,
+
+ /**
+ * TSC ticks at a constant rate
+ */
+ XEN_CPU_FEATURE_CONSTANT_TSC,
+
+ /**
+ * FXSAVE leaks FOP/FIP/FOP
+ */
+ XEN_CPU_FEATURE_FXSAVE_LEAK,
+
+ /**
+ * Streaming SIMD Extensions-3
+ */
+ XEN_CPU_FEATURE_XMM3,
+
+ /**
+ * Monitor/Mwait support
+ */
+ XEN_CPU_FEATURE_MWAIT,
+
+ /**
+ * CPL Qualified Debug Store
+ */
+ XEN_CPU_FEATURE_DSCPL,
+
+ /**
+ * Enhanced SpeedStep
+ */
+ XEN_CPU_FEATURE_EST,
+
+ /**
+ * Thermal Monitor 2
+ */
+ XEN_CPU_FEATURE_TM2,
+
+ /**
+ * Context ID
+ */
+ XEN_CPU_FEATURE_CID,
+
+ /**
+ * CMPXCHG16B
+ */
+ XEN_CPU_FEATURE_CX16,
+
+ /**
+ * Send Task Priority Messages
+ */
+ XEN_CPU_FEATURE_XTPR,
+
+ /**
+ * on-CPU RNG present (xstore insn)
+ */
+ XEN_CPU_FEATURE_XSTORE,
+
+ /**
+ * on-CPU RNG enabled
+ */
+ XEN_CPU_FEATURE_XSTORE_EN,
+
+ /**
+ * on-CPU crypto (xcrypt insn)
+ */
+ XEN_CPU_FEATURE_XCRYPT,
+
+ /**
+ * on-CPU crypto enabled
+ */
+ XEN_CPU_FEATURE_XCRYPT_EN,
+
+ /**
+ * LAHF/SAHF in long mode
+ */
+ XEN_CPU_FEATURE_LAHF_LM,
+
+ /**
+ * If yes HyperThreading not valid
+ */
+ XEN_CPU_FEATURE_CMP_LEGACY
+};
+
+
+typedef struct xen_cpu_feature_set
+{
+ size_t size;
+ enum xen_cpu_feature contents[];
+} xen_cpu_feature_set;
+
+/**
+ * Allocate a xen_cpu_feature_set of the given size.
+ */
+extern xen_cpu_feature_set *
+xen_cpu_feature_set_alloc(size_t size);
+
+/**
+ * Free the given xen_cpu_feature_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_cpu_feature_set_free(xen_cpu_feature_set *set);
+
+
+/**
+ * Return the name corresponding to the given code. This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_cpu_feature_to_string(enum xen_cpu_feature val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_cpu_feature
+xen_cpu_feature_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_cpu_feature_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_cpu_feature_internal.h Sat Oct 07 18:22:09
2006 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/*
+ * Declarations of the abstract types used during demarshalling of enum
+ * xen_cpu_feature. Internal to this library -- do not use from outside.
+ */
+
+
+#ifndef XEN_CPU_FEATURE_INTERNAL_H
+#define XEN_CPU_FEATURE_INTERNAL_H
+
+
+#include "xen_internal.h"
+
+
+extern const abstract_type xen_cpu_feature_abstract_type_;
+extern const abstract_type xen_cpu_feature_set_abstract_type_;
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_driver_type.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_driver_type.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_DRIVER_TYPE_H
+#define XEN_DRIVER_TYPE_H
+
+
+#include "xen_common.h"
+
+
+enum xen_driver_type
+{
+ /**
+ * use hardware emulation
+ */
+ XEN_DRIVER_TYPE_IOEMU,
+
+ /**
+ * use paravirtualised driver
+ */
+ XEN_DRIVER_TYPE_PARAVIRTUALISED
+};
+
+
+typedef struct xen_driver_type_set
+{
+ size_t size;
+ enum xen_driver_type contents[];
+} xen_driver_type_set;
+
+/**
+ * Allocate a xen_driver_type_set of the given size.
+ */
+extern xen_driver_type_set *
+xen_driver_type_set_alloc(size_t size);
+
+/**
+ * Free the given xen_driver_type_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_driver_type_set_free(xen_driver_type_set *set);
+
+
+/**
+ * Return the name corresponding to the given code. This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_driver_type_to_string(enum xen_driver_type val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_driver_type
+xen_driver_type_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_driver_type_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_driver_type_internal.h Sat Oct 07 18:22:09
2006 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/*
+ * Declarations of the abstract types used during demarshalling of enum
+ * xen_driver_type. Internal to this library -- do not use from outside.
+ */
+
+
+#ifndef XEN_DRIVER_TYPE_INTERNAL_H
+#define XEN_DRIVER_TYPE_INTERNAL_H
+
+
+#include "xen_internal.h"
+
+
+extern const abstract_type xen_driver_type_abstract_type_;
+extern const abstract_type xen_driver_type_set_abstract_type_;
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_host.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_host.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_HOST_H
+#define XEN_HOST_H
+
+#include "xen_common.h"
+#include "xen_host_cpu_decl.h"
+#include "xen_host_decl.h"
+#include "xen_string_string_map.h"
+#include "xen_vm_decl.h"
+
+
+/*
+ * The host class.
+ *
+ * A physical host.
+ */
+
+
+/**
+ * Free the given xen_host. The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_host_free(xen_host host);
+
+
+typedef struct xen_host_set
+{
+ size_t size;
+ xen_host *contents[];
+} xen_host_set;
+
+/**
+ * Allocate a xen_host_set of the given size.
+ */
+extern xen_host_set *
+xen_host_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_set. The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_host_set_free(xen_host_set *set);
+
+
+typedef struct xen_host_record
+{
+ xen_host handle;
+ char *uuid;
+ char *name_label;
+ char *name_description;
+ xen_string_string_map *software_version;
+ struct xen_vm_record_opt_set *resident_vms;
+ struct xen_host_cpu_record_opt_set *host_cpus;
+} xen_host_record;
+
+/**
+ * Allocate a xen_host_record.
+ */
+extern xen_host_record *
+xen_host_record_alloc(void);
+
+/**
+ * Free the given xen_host_record, and all referenced values. The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_host_record_free(xen_host_record *record);
+
+
+typedef struct xen_host_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_host handle;
+ xen_host_record *record;
+ } u;
+} xen_host_record_opt;
+
+/**
+ * Allocate a xen_host_record_opt.
+ */
+extern xen_host_record_opt *
+xen_host_record_opt_alloc(void);
+
+/**
+ * Free the given xen_host_record_opt, and all referenced values. The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_host_record_opt_free(xen_host_record_opt *record_opt);
+
+
+typedef struct xen_host_record_set
+{
+ size_t size;
+ xen_host_record *contents[];
+} xen_host_record_set;
+
+/**
+ * Allocate a xen_host_record_set of the given size.
+ */
+extern xen_host_record_set *
+xen_host_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_record_set, and all referenced values. The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_host_record_set_free(xen_host_record_set *set);
+
+
+
+typedef struct xen_host_record_opt_set
+{
+ size_t size;
+ xen_host_record_opt *contents[];
+} xen_host_record_opt_set;
+
+/**
+ * Allocate a xen_host_record_opt_set of the given size.
+ */
+extern xen_host_record_opt_set *
+xen_host_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_record_opt_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_host_record_opt_set_free(xen_host_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given host. !!!
+ */
+extern bool
+xen_host_get_record(xen_session *session, xen_host_record **result, xen_host
host);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid);
+
+
+/**
+ * Create a new host instance, and return its handle.
+ */
+extern bool
+xen_host_create(xen_session *session, xen_host *result, xen_host_record
*record);
+
+
+/**
+ * Get a reference to the object with the specified label.
+ */
+extern bool
+xen_host_get_by_name_label(xen_session *session, xen_host *result, char
*label);
+
+
+/**
+ * Get the uuid field of the given host.
+ */
+extern bool
+xen_host_get_uuid(xen_session *session, char **result, xen_host host);
+
+
+/**
+ * Get the name/label field of the given host.
+ */
+extern bool
+xen_host_get_name_label(xen_session *session, char **result, xen_host host);
+
+
+/**
+ * Get the name/description field of the given host.
+ */
+extern bool
+xen_host_get_name_description(xen_session *session, char **result, xen_host
host);
+
+
+/**
+ * Get the software_version field of the given host.
+ */
+extern bool
+xen_host_get_software_version(xen_session *session, xen_string_string_map
**result, xen_host host);
+
+
+/**
+ * Get the resident_VMs field of the given host.
+ */
+extern bool
+xen_host_get_resident_vms(xen_session *session, xen_vm *result, xen_host host);
+
+
+/**
+ * Get the host_CPUs field of the given host.
+ */
+extern bool
+xen_host_get_host_cpus(xen_session *session, xen_host_cpu *result, xen_host
host);
+
+
+/**
+ * Set the name/label field of the given host.
+ */
+extern bool
+xen_host_set_name_label(xen_session *session, xen_host xen_host, char *label);
+
+
+/**
+ * Set the name/description field of the given host.
+ */
+extern bool
+xen_host_set_name_description(xen_session *session, xen_host xen_host, char
*description);
+
+
+/**
+ * Puts the host into a state in which no new VMs can be started.
+ * Currently active VMs on the host continue to execute.
+ */
+extern bool
+xen_host_disable(xen_session *session, xen_host host);
+
+
+/**
+ * Puts the host into a state in which new VMs can be started.
+ */
+extern bool
+xen_host_enable(xen_session *session, xen_host host);
+
+
+/**
+ * Shutdown the host. (This function can only be called if there are no
+ * currently running VMs on the host and it is disabled.)
+ */
+extern bool
+xen_host_shutdown(xen_session *session, xen_host host);
+
+
+/**
+ * Reboot the host. (This function can only be called if there are no
+ * currently running VMs on the host and it is disabled.)
+ */
+extern bool
+xen_host_reboot(xen_session *session, xen_host host);
+
+
+/**
+ * Return a list of all the hosts known to the system
+ */
+extern bool
+xen_host_get_all(xen_session *session, xen_host *result);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_host_cpu.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_host_cpu.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_HOST_CPU_H
+#define XEN_HOST_CPU_H
+
+#include "xen_common.h"
+#include "xen_cpu_feature.h"
+#include "xen_host_cpu_decl.h"
+#include "xen_host_decl.h"
+
+
+/*
+ * The host_cpu class.
+ *
+ * A physical CPU.
+ */
+
+
+/**
+ * Free the given xen_host_cpu. The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_host_cpu_free(xen_host_cpu host_cpu);
+
+
+typedef struct xen_host_cpu_set
+{
+ size_t size;
+ xen_host_cpu *contents[];
+} xen_host_cpu_set;
+
+/**
+ * Allocate a xen_host_cpu_set of the given size.
+ */
+extern xen_host_cpu_set *
+xen_host_cpu_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_cpu_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_host_cpu_set_free(xen_host_cpu_set *set);
+
+
+typedef struct xen_host_cpu_record
+{
+ xen_host_cpu handle;
+ char *uuid;
+ struct xen_host_record_opt *host;
+ uint64_t number;
+ struct xen_cpu_feature_set *features;
+ double utilisation;
+} xen_host_cpu_record;
+
+/**
+ * Allocate a xen_host_cpu_record.
+ */
+extern xen_host_cpu_record *
+xen_host_cpu_record_alloc(void);
+
+/**
+ * Free the given xen_host_cpu_record, and all referenced values. The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_host_cpu_record_free(xen_host_cpu_record *record);
+
+
+typedef struct xen_host_cpu_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_host_cpu handle;
+ xen_host_cpu_record *record;
+ } u;
+} xen_host_cpu_record_opt;
+
+/**
+ * Allocate a xen_host_cpu_record_opt.
+ */
+extern xen_host_cpu_record_opt *
+xen_host_cpu_record_opt_alloc(void);
+
+/**
+ * Free the given xen_host_cpu_record_opt, and all referenced values.
+ * The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_host_cpu_record_opt_free(xen_host_cpu_record_opt *record_opt);
+
+
+typedef struct xen_host_cpu_record_set
+{
+ size_t size;
+ xen_host_cpu_record *contents[];
+} xen_host_cpu_record_set;
+
+/**
+ * Allocate a xen_host_cpu_record_set of the given size.
+ */
+extern xen_host_cpu_record_set *
+xen_host_cpu_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_cpu_record_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_host_cpu_record_set_free(xen_host_cpu_record_set *set);
+
+
+
+typedef struct xen_host_cpu_record_opt_set
+{
+ size_t size;
+ xen_host_cpu_record_opt *contents[];
+} xen_host_cpu_record_opt_set;
+
+/**
+ * Allocate a xen_host_cpu_record_opt_set of the given size.
+ */
+extern xen_host_cpu_record_opt_set *
+xen_host_cpu_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_host_cpu_record_opt_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_host_cpu_record_opt_set_free(xen_host_cpu_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given host_cpu. !!!
+ */
+extern bool
+xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result,
xen_host_cpu host_cpu);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char
*uuid);
+
+
+/**
+ * Create a new host_cpu instance, and return its handle.
+ */
+extern bool
+xen_host_cpu_create(xen_session *session, xen_host_cpu *result,
xen_host_cpu_record *record);
+
+
+/**
+ * Get the uuid field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu
host_cpu);
+
+
+/**
+ * Get the host field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu
host_cpu);
+
+
+/**
+ * Get the number field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_number(xen_session *session, uint64_t *result, xen_host_cpu
host_cpu);
+
+
+/**
+ * Get the features field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_features(xen_session *session, struct xen_cpu_feature_set
**result, xen_host_cpu host_cpu);
+
+
+/**
+ * Get the utilisation field of the given host_cpu.
+ */
+extern bool
+xen_host_cpu_get_utilisation(xen_session *session, double *result,
xen_host_cpu host_cpu);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_host_cpu_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_host_cpu_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_HOST_CPU_DECL_H
+#define XEN_HOST_CPU_DECL_H
+
+typedef void *xen_host_cpu;
+
+struct xen_host_cpu_set;
+struct xen_host_cpu_record;
+struct xen_host_cpu_record_set;
+struct xen_host_cpu_record_opt;
+struct xen_host_cpu_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_host_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_host_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_HOST_DECL_H
+#define XEN_HOST_DECL_H
+
+typedef void *xen_host;
+
+struct xen_host_set;
+struct xen_host_record;
+struct xen_host_record_set;
+struct xen_host_record_opt;
+struct xen_host_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_int_float_map.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_int_float_map.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_INT_FLOAT_MAP_H
+#define XEN_INT_FLOAT_MAP_H
+
+
+#include "xen_common.h"
+
+
+typedef struct xen_int_float_map_contents
+{
+ uint64_t key;
+ double val;
+} xen_int_float_map_contents;
+
+
+typedef struct xen_int_float_map
+{
+ size_t size;
+ xen_int_float_map_contents contents[];
+} xen_int_float_map;
+
+/**
+ * Allocate a xen_int_float_map of the given size.
+ */
+extern xen_int_float_map *
+xen_int_float_map_alloc(size_t size);
+
+/**
+ * Free the given xen_int_float_map, and all referenced values. The
+ * given map must have been allocated by this library.
+ */
+extern void
+xen_int_float_map_free(xen_int_float_map *map);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_internal.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,192 @@
+/*
+ Copyright (c) 2006 XenSource, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef XEN_INTERNAL_H
+#define XEN_INTERNAL_H
+
+
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+
+
+enum abstract_typename
+{
+ VOID,
+ STRING,
+ INT,
+ FLOAT,
+ BOOL,
+ DATETIME,
+ SET,
+ MAP,
+ STRUCT,
+ REF,
+ ENUM,
+ ENUMSET
+};
+
+
+typedef struct
+{
+ size_t size;
+ void *contents[];
+} arbitrary_set;
+
+
+typedef struct struct_member struct_member;
+
+
+typedef struct abstract_type
+{
+ enum abstract_typename typename;
+ const struct abstract_type *child;
+ const char * (*enum_marshaller)(int);
+ int (*enum_demarshaller)(xen_session *, const char *);
+ size_t struct_size;
+ size_t member_count;
+ const struct_member *members;
+} abstract_type;
+
+
+struct struct_member
+{
+ const char *key;
+ const struct abstract_type *type;
+ int offset;
+};
+
+
+extern const abstract_type abstract_type_string;
+extern const abstract_type abstract_type_int;
+extern const abstract_type abstract_type_float;
+extern const abstract_type abstract_type_bool;
+extern const abstract_type abstract_type_datetime;
+extern const abstract_type abstract_type_ref;
+
+extern const abstract_type abstract_type_string_set;
+extern const abstract_type abstract_type_ref_set;
+
+extern const abstract_type abstract_type_string_string_map;
+extern const abstract_type abstract_type_int_float_map;
+
+
+typedef struct abstract_value
+{
+ const abstract_type *type;
+ union
+ {
+ const char *string_val;
+ uint64_t int_val;
+ int enum_val;
+ double double_val;
+ bool bool_val;
+ arbitrary_set *set_val;
+ void *struct_val;
+ } u;
+} abstract_value;
+
+
+extern void
+xen_call_(xen_session *s, const char *method_name, abstract_value params[],
+ int param_count, const abstract_type *result_type, void *value);
+
+
+#define XEN_CALL_(method_name__) \
+ xen_call_(session, method_name__, param_values, \
+ sizeof(param_values) / sizeof(param_values[0]), \
+ &result_type, result) \
+
+
+extern char *
+xen_strdup_(const char *in);
+
+
+extern int
+xen_enum_lookup_(xen_session *session, const char *str,
+ const char **lookup_table, int n);
+
+#define ENUM_LOOKUP(session__, str__, lookup_table__) \
+ xen_enum_lookup_(session__, str__, lookup_table__, \
+ sizeof(lookup_table__) / \
+ sizeof(lookup_table__[0])) \
+ \
+
+#define XEN_ALLOC(type__) \
+type__ * \
+type__ ## _alloc() \
+{ \
+ return calloc(1, sizeof(type__)); \
+} \
+
+
+#define XEN_FREE(type__) \
+void \
+type__ ## _free(type__ handle) \
+{ \
+ free(handle); \
+} \
+
+
+#define XEN_SET_ALLOC_FREE(type__) \
+type__ ## _set * \
+type__ ## _set_alloc(size_t size) \
+{ \
+ return calloc(1, sizeof(type__ ## _set) + size * sizeof(type__)); \
+} \
+ \
+void \
+type__ ## _set_free(type__ ## _set *set) \
+{ \
+ if (set == NULL) \
+ { \
+ return; \
+ } \
+ size_t n = set->size; \
+ for (size_t i = 0; i < n; i++) \
+ { \
+ type__ ## _free(set->contents[i]); \
+ } \
+ \
+ free(set); \
+} \
+
+
+#define XEN_RECORD_OPT_FREE(type__) \
+void \
+type__ ## _record_opt_free(type__ ## _record_opt *opt) \
+{ \
+ if (opt == NULL) \
+ { \
+ return; \
+ } \
+ if (opt->is_record) \
+ { \
+ type__ ## _record_free(opt->u.record); \
+ } \
+ else \
+ { \
+ type__ ## _free(opt->u.handle); \
+ } \
+ free(opt); \
+} \
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_network.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_network.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_NETWORK_H
+#define XEN_NETWORK_H
+
+#include "xen_common.h"
+#include "xen_network_decl.h"
+#include "xen_vif_decl.h"
+
+
+/*
+ * The network class.
+ *
+ * A virtual network.
+ */
+
+
+/**
+ * Free the given xen_network. The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_network_free(xen_network network);
+
+
+typedef struct xen_network_set
+{
+ size_t size;
+ xen_network *contents[];
+} xen_network_set;
+
+/**
+ * Allocate a xen_network_set of the given size.
+ */
+extern xen_network_set *
+xen_network_set_alloc(size_t size);
+
+/**
+ * Free the given xen_network_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_network_set_free(xen_network_set *set);
+
+
+typedef struct xen_network_record
+{
+ xen_network handle;
+ char *uuid;
+ char *name_label;
+ char *name_description;
+ struct xen_vif_record_opt_set *vifs;
+ char *nic;
+ char *vlan;
+ char *default_gateway;
+ char *default_netmask;
+} xen_network_record;
+
+/**
+ * Allocate a xen_network_record.
+ */
+extern xen_network_record *
+xen_network_record_alloc(void);
+
+/**
+ * Free the given xen_network_record, and all referenced values. The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_network_record_free(xen_network_record *record);
+
+
+typedef struct xen_network_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_network handle;
+ xen_network_record *record;
+ } u;
+} xen_network_record_opt;
+
+/**
+ * Allocate a xen_network_record_opt.
+ */
+extern xen_network_record_opt *
+xen_network_record_opt_alloc(void);
+
+/**
+ * Free the given xen_network_record_opt, and all referenced values.
+ * The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_network_record_opt_free(xen_network_record_opt *record_opt);
+
+
+typedef struct xen_network_record_set
+{
+ size_t size;
+ xen_network_record *contents[];
+} xen_network_record_set;
+
+/**
+ * Allocate a xen_network_record_set of the given size.
+ */
+extern xen_network_record_set *
+xen_network_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_network_record_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_network_record_set_free(xen_network_record_set *set);
+
+
+
+typedef struct xen_network_record_opt_set
+{
+ size_t size;
+ xen_network_record_opt *contents[];
+} xen_network_record_opt_set;
+
+/**
+ * Allocate a xen_network_record_opt_set of the given size.
+ */
+extern xen_network_record_opt_set *
+xen_network_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_network_record_opt_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_network_record_opt_set_free(xen_network_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given network. !!!
+ */
+extern bool
+xen_network_get_record(xen_session *session, xen_network_record **result,
xen_network network);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_network_get_by_uuid(xen_session *session, xen_network *result, char *uuid);
+
+
+/**
+ * Create a new network instance, and return its handle.
+ */
+extern bool
+xen_network_create(xen_session *session, xen_network *result,
xen_network_record *record);
+
+
+/**
+ * Get a reference to the object with the specified label.
+ */
+extern bool
+xen_network_get_by_name_label(xen_session *session, xen_network *result, char
*label);
+
+
+/**
+ * Get the uuid field of the given network.
+ */
+extern bool
+xen_network_get_uuid(xen_session *session, char **result, xen_network network);
+
+
+/**
+ * Get the name/label field of the given network.
+ */
+extern bool
+xen_network_get_name_label(xen_session *session, char **result, xen_network
network);
+
+
+/**
+ * Get the name/description field of the given network.
+ */
+extern bool
+xen_network_get_name_description(xen_session *session, char **result,
xen_network network);
+
+
+/**
+ * Get the VIFs field of the given network.
+ */
+extern bool
+xen_network_get_vifs(xen_session *session, xen_vif *result, xen_network
network);
+
+
+/**
+ * Get the NIC field of the given network.
+ */
+extern bool
+xen_network_get_nic(xen_session *session, char **result, xen_network network);
+
+
+/**
+ * Get the VLAN field of the given network.
+ */
+extern bool
+xen_network_get_vlan(xen_session *session, char **result, xen_network network);
+
+
+/**
+ * Get the default_gateway field of the given network.
+ */
+extern bool
+xen_network_get_default_gateway(xen_session *session, char **result,
xen_network network);
+
+
+/**
+ * Get the default_netmask field of the given network.
+ */
+extern bool
+xen_network_get_default_netmask(xen_session *session, char **result,
xen_network network);
+
+
+/**
+ * Set the name/label field of the given network.
+ */
+extern bool
+xen_network_set_name_label(xen_session *session, xen_network xen_network, char
*label);
+
+
+/**
+ * Set the name/description field of the given network.
+ */
+extern bool
+xen_network_set_name_description(xen_session *session, xen_network
xen_network, char *description);
+
+
+/**
+ * Set the NIC field of the given network.
+ */
+extern bool
+xen_network_set_nic(xen_session *session, xen_network xen_network, char *nic);
+
+
+/**
+ * Set the VLAN field of the given network.
+ */
+extern bool
+xen_network_set_vlan(xen_session *session, xen_network xen_network, char
*vlan);
+
+
+/**
+ * Set the default_gateway field of the given network.
+ */
+extern bool
+xen_network_set_default_gateway(xen_session *session, xen_network xen_network,
char *default_gateway);
+
+
+/**
+ * Set the default_netmask field of the given network.
+ */
+extern bool
+xen_network_set_default_netmask(xen_session *session, xen_network xen_network,
char *default_netmask);
+
+
+/**
+ * Return a list of all the networks known to the system
+ */
+extern bool
+xen_network_get_all(xen_session *session, xen_network *result);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_network_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_network_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_NETWORK_DECL_H
+#define XEN_NETWORK_DECL_H
+
+typedef void *xen_network;
+
+struct xen_network_set;
+struct xen_network_record;
+struct xen_network_record_set;
+struct xen_network_record_opt;
+struct xen_network_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_on_crash_behaviour.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_on_crash_behaviour.h Sat Oct 07 18:22:09
2006 +0100
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_ON_CRASH_BEHAVIOUR_H
+#define XEN_ON_CRASH_BEHAVIOUR_H
+
+
+#include "xen_common.h"
+
+
+enum xen_on_crash_behaviour
+{
+ /**
+ * destroy the VM state
+ */
+ XEN_ON_CRASH_BEHAVIOUR_DESTROY,
+
+ /**
+ * record a coredump and then destroy the VM state
+ */
+ XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_DESTROY,
+
+ /**
+ * restart the VM
+ */
+ XEN_ON_CRASH_BEHAVIOUR_RESTART,
+
+ /**
+ * record a coredump and then restart the VM
+ */
+ XEN_ON_CRASH_BEHAVIOUR_COREDUMP_AND_RESTART,
+
+ /**
+ * leave the crashed VM as-is
+ */
+ XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
+
+ /**
+ * rename the crashed VM and start a new copy
+ */
+ XEN_ON_CRASH_BEHAVIOUR_RENAME_RESTART
+};
+
+
+typedef struct xen_on_crash_behaviour_set
+{
+ size_t size;
+ enum xen_on_crash_behaviour contents[];
+} xen_on_crash_behaviour_set;
+
+/**
+ * Allocate a xen_on_crash_behaviour_set of the given size.
+ */
+extern xen_on_crash_behaviour_set *
+xen_on_crash_behaviour_set_alloc(size_t size);
+
+/**
+ * Free the given xen_on_crash_behaviour_set. The given set must have
+ * been allocated by this library.
+ */
+extern void
+xen_on_crash_behaviour_set_free(xen_on_crash_behaviour_set *set);
+
+
+/**
+ * Return the name corresponding to the given code. This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_on_crash_behaviour_to_string(enum xen_on_crash_behaviour val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_on_crash_behaviour
+xen_on_crash_behaviour_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_on_crash_behaviour_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_on_crash_behaviour_internal.h Sat Oct 07
18:22:09 2006 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/*
+ * Declarations of the abstract types used during demarshalling of enum
+ * xen_on_crash_behaviour. Internal to this library -- do not use from
+ * outside.
+ */
+
+
+#ifndef XEN_ON_CRASH_BEHAVIOUR_INTERNAL_H
+#define XEN_ON_CRASH_BEHAVIOUR_INTERNAL_H
+
+
+#include "xen_internal.h"
+
+
+extern const abstract_type xen_on_crash_behaviour_abstract_type_;
+extern const abstract_type xen_on_crash_behaviour_set_abstract_type_;
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_on_normal_exit.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_on_normal_exit.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_ON_NORMAL_EXIT_H
+#define XEN_ON_NORMAL_EXIT_H
+
+
+#include "xen_common.h"
+
+
+enum xen_on_normal_exit
+{
+ /**
+ * destroy the VM state
+ */
+ XEN_ON_NORMAL_EXIT_DESTROY,
+
+ /**
+ * restart the VM
+ */
+ XEN_ON_NORMAL_EXIT_RESTART
+};
+
+
+typedef struct xen_on_normal_exit_set
+{
+ size_t size;
+ enum xen_on_normal_exit contents[];
+} xen_on_normal_exit_set;
+
+/**
+ * Allocate a xen_on_normal_exit_set of the given size.
+ */
+extern xen_on_normal_exit_set *
+xen_on_normal_exit_set_alloc(size_t size);
+
+/**
+ * Free the given xen_on_normal_exit_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_on_normal_exit_set_free(xen_on_normal_exit_set *set);
+
+
+/**
+ * Return the name corresponding to the given code. This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_on_normal_exit_to_string(enum xen_on_normal_exit val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_on_normal_exit
+xen_on_normal_exit_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_on_normal_exit_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_on_normal_exit_internal.h Sat Oct 07
18:22:09 2006 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/*
+ * Declarations of the abstract types used during demarshalling of enum
+ * xen_on_normal_exit. Internal to this library -- do not use from outside.
+ */
+
+
+#ifndef XEN_ON_NORMAL_EXIT_INTERNAL_H
+#define XEN_ON_NORMAL_EXIT_INTERNAL_H
+
+
+#include "xen_internal.h"
+
+
+extern const abstract_type xen_on_normal_exit_abstract_type_;
+extern const abstract_type xen_on_normal_exit_set_abstract_type_;
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_sr.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_sr.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_SR_H
+#define XEN_SR_H
+
+#include "xen_common.h"
+#include "xen_sr_decl.h"
+#include "xen_vdi_decl.h"
+
+
+/*
+ * The SR class.
+ *
+ * A storage repository.
+ */
+
+
+/**
+ * Free the given xen_sr. The given handle must have been allocated by
+ * this library.
+ */
+extern void
+xen_sr_free(xen_sr sr);
+
+
+typedef struct xen_sr_set
+{
+ size_t size;
+ xen_sr *contents[];
+} xen_sr_set;
+
+/**
+ * Allocate a xen_sr_set of the given size.
+ */
+extern xen_sr_set *
+xen_sr_set_alloc(size_t size);
+
+/**
+ * Free the given xen_sr_set. The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_sr_set_free(xen_sr_set *set);
+
+
+typedef struct xen_sr_record
+{
+ xen_sr handle;
+ char *uuid;
+ char *name_label;
+ char *name_description;
+ struct xen_vdi_record_opt_set *vdis;
+ uint64_t virtual_allocation;
+ uint64_t physical_utilisation;
+ uint64_t physical_size;
+ char *type;
+ char *location;
+} xen_sr_record;
+
+/**
+ * Allocate a xen_sr_record.
+ */
+extern xen_sr_record *
+xen_sr_record_alloc(void);
+
+/**
+ * Free the given xen_sr_record, and all referenced values. The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_sr_record_free(xen_sr_record *record);
+
+
+typedef struct xen_sr_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_sr handle;
+ xen_sr_record *record;
+ } u;
+} xen_sr_record_opt;
+
+/**
+ * Allocate a xen_sr_record_opt.
+ */
+extern xen_sr_record_opt *
+xen_sr_record_opt_alloc(void);
+
+/**
+ * Free the given xen_sr_record_opt, and all referenced values. The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_sr_record_opt_free(xen_sr_record_opt *record_opt);
+
+
+typedef struct xen_sr_record_set
+{
+ size_t size;
+ xen_sr_record *contents[];
+} xen_sr_record_set;
+
+/**
+ * Allocate a xen_sr_record_set of the given size.
+ */
+extern xen_sr_record_set *
+xen_sr_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_sr_record_set, and all referenced values. The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_sr_record_set_free(xen_sr_record_set *set);
+
+
+
+typedef struct xen_sr_record_opt_set
+{
+ size_t size;
+ xen_sr_record_opt *contents[];
+} xen_sr_record_opt_set;
+
+/**
+ * Allocate a xen_sr_record_opt_set of the given size.
+ */
+extern xen_sr_record_opt_set *
+xen_sr_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_sr_record_opt_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_sr_record_opt_set_free(xen_sr_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given SR. !!!
+ */
+extern bool
+xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_sr_get_by_uuid(xen_session *session, xen_sr *result, char *uuid);
+
+
+/**
+ * Create a new SR instance, and return its handle.
+ */
+extern bool
+xen_sr_create(xen_session *session, xen_sr *result, xen_sr_record *record);
+
+
+/**
+ * Get a reference to the object with the specified label.
+ */
+extern bool
+xen_sr_get_by_name_label(xen_session *session, xen_sr *result, char *label);
+
+
+/**
+ * Get the uuid field of the given SR.
+ */
+extern bool
+xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Get the name/label field of the given SR.
+ */
+extern bool
+xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Get the name/description field of the given SR.
+ */
+extern bool
+xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Get the VDIs field of the given SR.
+ */
+extern bool
+xen_sr_get_vdis(xen_session *session, xen_vdi *result, xen_sr sr);
+
+
+/**
+ * Get the virtual_allocation field of the given SR.
+ */
+extern bool
+xen_sr_get_virtual_allocation(xen_session *session, uint64_t *result, xen_sr
sr);
+
+
+/**
+ * Get the physical_utilisation field of the given SR.
+ */
+extern bool
+xen_sr_get_physical_utilisation(xen_session *session, uint64_t *result, xen_sr
sr);
+
+
+/**
+ * Get the physical_size field of the given SR.
+ */
+extern bool
+xen_sr_get_physical_size(xen_session *session, uint64_t *result, xen_sr sr);
+
+
+/**
+ * Get the type field of the given SR.
+ */
+extern bool
+xen_sr_get_type(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Get the location field of the given SR.
+ */
+extern bool
+xen_sr_get_location(xen_session *session, char **result, xen_sr sr);
+
+
+/**
+ * Set the name/label field of the given SR.
+ */
+extern bool
+xen_sr_set_name_label(xen_session *session, xen_sr xen_sr, char *label);
+
+
+/**
+ * Set the name/description field of the given SR.
+ */
+extern bool
+xen_sr_set_name_description(xen_session *session, xen_sr xen_sr, char
*description);
+
+
+/**
+ * Take an exact copy of the Storage Repository;
+ * the cloned storage repository has the same type as its parent
+ */
+extern bool
+xen_sr_clone(xen_session *session, xen_sr *result, xen_sr sr, char *loc, char
*name);
+
+
+/**
+ * Return a list of all the Storage Repositories known to the system
+ */
+extern bool
+xen_sr_get_all(xen_session *session, xen_sr *result);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_sr_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_sr_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_SR_DECL_H
+#define XEN_SR_DECL_H
+
+typedef void *xen_sr;
+
+struct xen_sr_set;
+struct xen_sr_record;
+struct xen_sr_record_set;
+struct xen_sr_record_opt;
+struct xen_sr_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_string_string_map.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_string_string_map.h Sat Oct 07 18:22:09
2006 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_STRING_STRING_MAP_H
+#define XEN_STRING_STRING_MAP_H
+
+
+#include "xen_common.h"
+
+
+typedef struct xen_string_string_map_contents
+{
+ char *key;
+ char *val;
+} xen_string_string_map_contents;
+
+
+typedef struct xen_string_string_map
+{
+ size_t size;
+ xen_string_string_map_contents contents[];
+} xen_string_string_map;
+
+/**
+ * Allocate a xen_string_string_map of the given size.
+ */
+extern xen_string_string_map *
+xen_string_string_map_alloc(size_t size);
+
+/**
+ * Free the given xen_string_string_map, and all referenced values.
+ * The given map must have been allocated by this library.
+ */
+extern void
+xen_string_string_map_free(xen_string_string_map *map);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_user.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_user.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_USER_H
+#define XEN_USER_H
+
+#include "xen_common.h"
+#include "xen_user_decl.h"
+
+
+/*
+ * The user class.
+ *
+ * A user of the system.
+ */
+
+
+/**
+ * Free the given xen_user. The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_user_free(xen_user user);
+
+
+typedef struct xen_user_set
+{
+ size_t size;
+ xen_user *contents[];
+} xen_user_set;
+
+/**
+ * Allocate a xen_user_set of the given size.
+ */
+extern xen_user_set *
+xen_user_set_alloc(size_t size);
+
+/**
+ * Free the given xen_user_set. The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_user_set_free(xen_user_set *set);
+
+
+typedef struct xen_user_record
+{
+ xen_user handle;
+ char *uuid;
+ char *short_name;
+ char *fullname;
+} xen_user_record;
+
+/**
+ * Allocate a xen_user_record.
+ */
+extern xen_user_record *
+xen_user_record_alloc(void);
+
+/**
+ * Free the given xen_user_record, and all referenced values. The
+ * given record must have been allocated by this library.
+ */
+extern void
+xen_user_record_free(xen_user_record *record);
+
+
+typedef struct xen_user_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_user handle;
+ xen_user_record *record;
+ } u;
+} xen_user_record_opt;
+
+/**
+ * Allocate a xen_user_record_opt.
+ */
+extern xen_user_record_opt *
+xen_user_record_opt_alloc(void);
+
+/**
+ * Free the given xen_user_record_opt, and all referenced values. The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_user_record_opt_free(xen_user_record_opt *record_opt);
+
+
+typedef struct xen_user_record_set
+{
+ size_t size;
+ xen_user_record *contents[];
+} xen_user_record_set;
+
+/**
+ * Allocate a xen_user_record_set of the given size.
+ */
+extern xen_user_record_set *
+xen_user_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_user_record_set, and all referenced values. The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_user_record_set_free(xen_user_record_set *set);
+
+
+
+typedef struct xen_user_record_opt_set
+{
+ size_t size;
+ xen_user_record_opt *contents[];
+} xen_user_record_opt_set;
+
+/**
+ * Allocate a xen_user_record_opt_set of the given size.
+ */
+extern xen_user_record_opt_set *
+xen_user_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_user_record_opt_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_user_record_opt_set_free(xen_user_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given user. !!!
+ */
+extern bool
+xen_user_get_record(xen_session *session, xen_user_record **result, xen_user
user);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_user_get_by_uuid(xen_session *session, xen_user *result, char *uuid);
+
+
+/**
+ * Create a new user instance, and return its handle.
+ */
+extern bool
+xen_user_create(xen_session *session, xen_user *result, xen_user_record
*record);
+
+
+/**
+ * Get the uuid field of the given user.
+ */
+extern bool
+xen_user_get_uuid(xen_session *session, char **result, xen_user user);
+
+
+/**
+ * Get the short_name field of the given user.
+ */
+extern bool
+xen_user_get_short_name(xen_session *session, char **result, xen_user user);
+
+
+/**
+ * Get the fullname field of the given user.
+ */
+extern bool
+xen_user_get_fullname(xen_session *session, char **result, xen_user user);
+
+
+/**
+ * Set the fullname field of the given user.
+ */
+extern bool
+xen_user_set_fullname(xen_session *session, xen_user xen_user, char *fullname);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_user_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_user_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_USER_DECL_H
+#define XEN_USER_DECL_H
+
+typedef void *xen_user;
+
+struct xen_user_set;
+struct xen_user_record;
+struct xen_user_record_set;
+struct xen_user_record_opt;
+struct xen_user_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vbd.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vbd.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VBD_H
+#define XEN_VBD_H
+
+#include "xen_common.h"
+#include "xen_driver_type.h"
+#include "xen_vbd_decl.h"
+#include "xen_vbd_mode.h"
+#include "xen_vdi_decl.h"
+#include "xen_vm_decl.h"
+
+
+/*
+ * The VBD class.
+ *
+ * A virtual block device.
+ */
+
+
+/**
+ * Free the given xen_vbd. The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_vbd_free(xen_vbd vbd);
+
+
+typedef struct xen_vbd_set
+{
+ size_t size;
+ xen_vbd *contents[];
+} xen_vbd_set;
+
+/**
+ * Allocate a xen_vbd_set of the given size.
+ */
+extern xen_vbd_set *
+xen_vbd_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_set. The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vbd_set_free(xen_vbd_set *set);
+
+
+typedef struct xen_vbd_record
+{
+ xen_vbd handle;
+ char *uuid;
+ struct xen_vm_record_opt *vm;
+ struct xen_vdi_record_opt *vdi;
+ char *device;
+ enum xen_vbd_mode mode;
+ enum xen_driver_type driver;
+ double io_bandwidth_incoming_kbs;
+ double io_bandwidth_outgoing_kbs;
+} xen_vbd_record;
+
+/**
+ * Allocate a xen_vbd_record.
+ */
+extern xen_vbd_record *
+xen_vbd_record_alloc(void);
+
+/**
+ * Free the given xen_vbd_record, and all referenced values. The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_vbd_record_free(xen_vbd_record *record);
+
+
+typedef struct xen_vbd_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_vbd handle;
+ xen_vbd_record *record;
+ } u;
+} xen_vbd_record_opt;
+
+/**
+ * Allocate a xen_vbd_record_opt.
+ */
+extern xen_vbd_record_opt *
+xen_vbd_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vbd_record_opt, and all referenced values. The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vbd_record_opt_free(xen_vbd_record_opt *record_opt);
+
+
+typedef struct xen_vbd_record_set
+{
+ size_t size;
+ xen_vbd_record *contents[];
+} xen_vbd_record_set;
+
+/**
+ * Allocate a xen_vbd_record_set of the given size.
+ */
+extern xen_vbd_record_set *
+xen_vbd_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_record_set, and all referenced values. The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vbd_record_set_free(xen_vbd_record_set *set);
+
+
+
+typedef struct xen_vbd_record_opt_set
+{
+ size_t size;
+ xen_vbd_record_opt *contents[];
+} xen_vbd_record_opt_set;
+
+/**
+ * Allocate a xen_vbd_record_opt_set of the given size.
+ */
+extern xen_vbd_record_opt_set *
+xen_vbd_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_record_opt_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vbd_record_opt_set_free(xen_vbd_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given VBD. !!!
+ */
+extern bool
+xen_vbd_get_record(xen_session *session, xen_vbd_record **result, xen_vbd vbd);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_vbd_get_by_uuid(xen_session *session, xen_vbd *result, char *uuid);
+
+
+/**
+ * Create a new VBD instance, and return its handle.
+ */
+extern bool
+xen_vbd_create(xen_session *session, xen_vbd *result, xen_vbd_record *record);
+
+
+/**
+ * Get the uuid field of the given VBD.
+ */
+extern bool
+xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd);
+
+
+/**
+ * Get the VM field of the given VBD.
+ */
+extern bool
+xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd);
+
+
+/**
+ * Get the VDI field of the given VBD.
+ */
+extern bool
+xen_vbd_get_vdi(xen_session *session, xen_vdi *result, xen_vbd vbd);
+
+
+/**
+ * Get the device field of the given VBD.
+ */
+extern bool
+xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd);
+
+
+/**
+ * Get the mode field of the given VBD.
+ */
+extern bool
+xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd);
+
+
+/**
+ * Get the driver field of the given VBD.
+ */
+extern bool
+xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd
vbd);
+
+
+/**
+ * Get the IO_bandwidth/incoming_kbs field of the given VBD.
+ */
+extern bool
+xen_vbd_get_io_bandwidth_incoming_kbs(xen_session *session, double *result,
xen_vbd vbd);
+
+
+/**
+ * Get the IO_bandwidth/outgoing_kbs field of the given VBD.
+ */
+extern bool
+xen_vbd_get_io_bandwidth_outgoing_kbs(xen_session *session, double *result,
xen_vbd vbd);
+
+
+/**
+ * Set the VM field of the given VBD.
+ */
+extern bool
+xen_vbd_set_vm(xen_session *session, xen_vbd xen_vbd, xen_vm vm);
+
+
+/**
+ * Set the VDI field of the given VBD.
+ */
+extern bool
+xen_vbd_set_vdi(xen_session *session, xen_vbd xen_vbd, xen_vdi vdi);
+
+
+/**
+ * Set the device field of the given VBD.
+ */
+extern bool
+xen_vbd_set_device(xen_session *session, xen_vbd xen_vbd, char *device);
+
+
+/**
+ * Set the mode field of the given VBD.
+ */
+extern bool
+xen_vbd_set_mode(xen_session *session, xen_vbd xen_vbd, enum xen_vbd_mode
mode);
+
+
+/**
+ * Set the driver field of the given VBD.
+ */
+extern bool
+xen_vbd_set_driver(xen_session *session, xen_vbd xen_vbd, enum xen_driver_type
driver);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vbd_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vbd_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VBD_DECL_H
+#define XEN_VBD_DECL_H
+
+typedef void *xen_vbd;
+
+struct xen_vbd_set;
+struct xen_vbd_record;
+struct xen_vbd_record_set;
+struct xen_vbd_record_opt;
+struct xen_vbd_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vbd_mode.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vbd_mode.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VBD_MODE_H
+#define XEN_VBD_MODE_H
+
+
+#include "xen_common.h"
+
+
+enum xen_vbd_mode
+{
+ /**
+ * disk is mounted read-only
+ */
+ XEN_VBD_MODE_RO,
+
+ /**
+ * disk is mounted read-write
+ */
+ XEN_VBD_MODE_RW
+};
+
+
+typedef struct xen_vbd_mode_set
+{
+ size_t size;
+ enum xen_vbd_mode contents[];
+} xen_vbd_mode_set;
+
+/**
+ * Allocate a xen_vbd_mode_set of the given size.
+ */
+extern xen_vbd_mode_set *
+xen_vbd_mode_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vbd_mode_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vbd_mode_set_free(xen_vbd_mode_set *set);
+
+
+/**
+ * Return the name corresponding to the given code. This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_vbd_mode_to_string(enum xen_vbd_mode val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_vbd_mode
+xen_vbd_mode_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_vbd_mode_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vbd_mode_internal.h Sat Oct 07 18:22:09
2006 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/*
+ * Declarations of the abstract types used during demarshalling of enum
+ * xen_vbd_mode. Internal to this library -- do not use from outside.
+ */
+
+
+#ifndef XEN_VBD_MODE_INTERNAL_H
+#define XEN_VBD_MODE_INTERNAL_H
+
+
+#include "xen_internal.h"
+
+
+extern const abstract_type xen_vbd_mode_abstract_type_;
+extern const abstract_type xen_vbd_mode_set_abstract_type_;
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vdi.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vdi.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VDI_H
+#define XEN_VDI_H
+
+#include "xen_common.h"
+#include "xen_sr_decl.h"
+#include "xen_vbd_decl.h"
+#include "xen_vdi_decl.h"
+#include "xen_vdi_type.h"
+
+
+/*
+ * The VDI class.
+ *
+ * A virtual disk image.
+ */
+
+
+/**
+ * Free the given xen_vdi. The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_vdi_free(xen_vdi vdi);
+
+
+typedef struct xen_vdi_set
+{
+ size_t size;
+ xen_vdi *contents[];
+} xen_vdi_set;
+
+/**
+ * Allocate a xen_vdi_set of the given size.
+ */
+extern xen_vdi_set *
+xen_vdi_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vdi_set. The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vdi_set_free(xen_vdi_set *set);
+
+
+typedef struct xen_vdi_record
+{
+ xen_vdi handle;
+ char *uuid;
+ char *name_label;
+ char *name_description;
+ struct xen_sr_record_opt *sr;
+ struct xen_vbd_record_opt_set *vbds;
+ uint64_t virtual_size;
+ uint64_t physical_utilisation;
+ uint64_t sector_size;
+ enum xen_vdi_type type;
+ struct xen_vdi_record_opt *parent;
+ struct xen_vdi_record_opt_set *children;
+ bool sharable;
+ bool read_only;
+} xen_vdi_record;
+
+/**
+ * Allocate a xen_vdi_record.
+ */
+extern xen_vdi_record *
+xen_vdi_record_alloc(void);
+
+/**
+ * Free the given xen_vdi_record, and all referenced values. The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_vdi_record_free(xen_vdi_record *record);
+
+
+typedef struct xen_vdi_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_vdi handle;
+ xen_vdi_record *record;
+ } u;
+} xen_vdi_record_opt;
+
+/**
+ * Allocate a xen_vdi_record_opt.
+ */
+extern xen_vdi_record_opt *
+xen_vdi_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vdi_record_opt, and all referenced values. The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vdi_record_opt_free(xen_vdi_record_opt *record_opt);
+
+
+typedef struct xen_vdi_record_set
+{
+ size_t size;
+ xen_vdi_record *contents[];
+} xen_vdi_record_set;
+
+/**
+ * Allocate a xen_vdi_record_set of the given size.
+ */
+extern xen_vdi_record_set *
+xen_vdi_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vdi_record_set, and all referenced values. The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vdi_record_set_free(xen_vdi_record_set *set);
+
+
+
+typedef struct xen_vdi_record_opt_set
+{
+ size_t size;
+ xen_vdi_record_opt *contents[];
+} xen_vdi_record_opt_set;
+
+/**
+ * Allocate a xen_vdi_record_opt_set of the given size.
+ */
+extern xen_vdi_record_opt_set *
+xen_vdi_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vdi_record_opt_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vdi_record_opt_set_free(xen_vdi_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given VDI. !!!
+ */
+extern bool
+xen_vdi_get_record(xen_session *session, xen_vdi_record **result, xen_vdi vdi);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_vdi_get_by_uuid(xen_session *session, xen_vdi *result, char *uuid);
+
+
+/**
+ * Create a new VDI instance, and return its handle.
+ */
+extern bool
+xen_vdi_create(xen_session *session, xen_vdi *result, xen_vdi_record *record);
+
+
+/**
+ * Get a reference to the object with the specified label.
+ */
+extern bool
+xen_vdi_get_by_name_label(xen_session *session, xen_vdi *result, char *label);
+
+
+/**
+ * Get the uuid field of the given VDI.
+ */
+extern bool
+xen_vdi_get_uuid(xen_session *session, char **result, xen_vdi vdi);
+
+
+/**
+ * Get the name/label field of the given VDI.
+ */
+extern bool
+xen_vdi_get_name_label(xen_session *session, char **result, xen_vdi vdi);
+
+
+/**
+ * Get the name/description field of the given VDI.
+ */
+extern bool
+xen_vdi_get_name_description(xen_session *session, char **result, xen_vdi vdi);
+
+
+/**
+ * Get the SR field of the given VDI.
+ */
+extern bool
+xen_vdi_get_sr(xen_session *session, xen_sr *result, xen_vdi vdi);
+
+
+/**
+ * Get the VBDs field of the given VDI.
+ */
+extern bool
+xen_vdi_get_vbds(xen_session *session, xen_vbd *result, xen_vdi vdi);
+
+
+/**
+ * Get the virtual_size field of the given VDI.
+ */
+extern bool
+xen_vdi_get_virtual_size(xen_session *session, uint64_t *result, xen_vdi vdi);
+
+
+/**
+ * Get the physical_utilisation field of the given VDI.
+ */
+extern bool
+xen_vdi_get_physical_utilisation(xen_session *session, uint64_t *result,
xen_vdi vdi);
+
+
+/**
+ * Get the sector_size field of the given VDI.
+ */
+extern bool
+xen_vdi_get_sector_size(xen_session *session, uint64_t *result, xen_vdi vdi);
+
+
+/**
+ * Get the type field of the given VDI.
+ */
+extern bool
+xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi);
+
+
+/**
+ * Get the parent field of the given VDI.
+ */
+extern bool
+xen_vdi_get_parent(xen_session *session, xen_vdi *result, xen_vdi vdi);
+
+
+/**
+ * Get the children field of the given VDI.
+ */
+extern bool
+xen_vdi_get_children(xen_session *session, xen_vdi *result, xen_vdi vdi);
+
+
+/**
+ * Get the sharable field of the given VDI.
+ */
+extern bool
+xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi);
+
+
+/**
+ * Get the read_only field of the given VDI.
+ */
+extern bool
+xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi);
+
+
+/**
+ * Set the name/label field of the given VDI.
+ */
+extern bool
+xen_vdi_set_name_label(xen_session *session, xen_vdi xen_vdi, char *label);
+
+
+/**
+ * Set the name/description field of the given VDI.
+ */
+extern bool
+xen_vdi_set_name_description(xen_session *session, xen_vdi xen_vdi, char
*description);
+
+
+/**
+ * Set the SR field of the given VDI.
+ */
+extern bool
+xen_vdi_set_sr(xen_session *session, xen_vdi xen_vdi, xen_sr sr);
+
+
+/**
+ * Set the virtual_size field of the given VDI.
+ */
+extern bool
+xen_vdi_set_virtual_size(xen_session *session, xen_vdi xen_vdi, uint64_t
virtual_size);
+
+
+/**
+ * Set the sharable field of the given VDI.
+ */
+extern bool
+xen_vdi_set_sharable(xen_session *session, xen_vdi xen_vdi, bool sharable);
+
+
+/**
+ * Set the read_only field of the given VDI.
+ */
+extern bool
+xen_vdi_set_read_only(xen_session *session, xen_vdi xen_vdi, bool read_only);
+
+
+/**
+ * Take an exact copy of the VDI; the snapshot lives in the same
+ * Storage Repository as its parent.
+ */
+extern bool
+xen_vdi_snapshot(xen_session *session, xen_vdi *result, xen_vdi vdi);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vdi_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vdi_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VDI_DECL_H
+#define XEN_VDI_DECL_H
+
+typedef void *xen_vdi;
+
+struct xen_vdi_set;
+struct xen_vdi_record;
+struct xen_vdi_record_set;
+struct xen_vdi_record_opt;
+struct xen_vdi_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vdi_type.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vdi_type.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VDI_TYPE_H
+#define XEN_VDI_TYPE_H
+
+
+#include "xen_common.h"
+
+
+enum xen_vdi_type
+{
+ /**
+ * a disk that may be replaced on upgrade
+ */
+ XEN_VDI_TYPE_SYSTEM,
+
+ /**
+ * a disk that is always preserved on upgrade
+ */
+ XEN_VDI_TYPE_USER,
+
+ /**
+ * a disk that may be reformatted on upgrade
+ */
+ XEN_VDI_TYPE_EPHEMERAL
+};
+
+
+typedef struct xen_vdi_type_set
+{
+ size_t size;
+ enum xen_vdi_type contents[];
+} xen_vdi_type_set;
+
+/**
+ * Allocate a xen_vdi_type_set of the given size.
+ */
+extern xen_vdi_type_set *
+xen_vdi_type_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vdi_type_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vdi_type_set_free(xen_vdi_type_set *set);
+
+
+/**
+ * Return the name corresponding to the given code. This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_vdi_type_to_string(enum xen_vdi_type val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_vdi_type
+xen_vdi_type_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_vdi_type_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vdi_type_internal.h Sat Oct 07 18:22:09
2006 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/*
+ * Declarations of the abstract types used during demarshalling of enum
+ * xen_vdi_type. Internal to this library -- do not use from outside.
+ */
+
+
+#ifndef XEN_VDI_TYPE_INTERNAL_H
+#define XEN_VDI_TYPE_INTERNAL_H
+
+
+#include "xen_internal.h"
+
+
+extern const abstract_type xen_vdi_type_abstract_type_;
+extern const abstract_type xen_vdi_type_set_abstract_type_;
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vif.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vif.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VIF_H
+#define XEN_VIF_H
+
+#include "xen_common.h"
+#include "xen_driver_type.h"
+#include "xen_network_decl.h"
+#include "xen_vif_decl.h"
+#include "xen_vm_decl.h"
+
+
+/*
+ * The VIF class.
+ *
+ * A virtual network interface.
+ */
+
+
+/**
+ * Free the given xen_vif. The given handle must have been allocated
+ * by this library.
+ */
+extern void
+xen_vif_free(xen_vif vif);
+
+
+typedef struct xen_vif_set
+{
+ size_t size;
+ xen_vif *contents[];
+} xen_vif_set;
+
+/**
+ * Allocate a xen_vif_set of the given size.
+ */
+extern xen_vif_set *
+xen_vif_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_set. The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vif_set_free(xen_vif_set *set);
+
+
+typedef struct xen_vif_record
+{
+ xen_vif handle;
+ char *uuid;
+ char *name;
+ enum xen_driver_type type;
+ char *device;
+ struct xen_network_record_opt *network;
+ struct xen_vm_record_opt *vm;
+ char *mac;
+ uint64_t mtu;
+ double network_read_kbs;
+ double network_write_kbs;
+ double io_bandwidth_incoming_kbs;
+ double io_bandwidth_outgoing_kbs;
+} xen_vif_record;
+
+/**
+ * Allocate a xen_vif_record.
+ */
+extern xen_vif_record *
+xen_vif_record_alloc(void);
+
+/**
+ * Free the given xen_vif_record, and all referenced values. The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_vif_record_free(xen_vif_record *record);
+
+
+typedef struct xen_vif_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_vif handle;
+ xen_vif_record *record;
+ } u;
+} xen_vif_record_opt;
+
+/**
+ * Allocate a xen_vif_record_opt.
+ */
+extern xen_vif_record_opt *
+xen_vif_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vif_record_opt, and all referenced values. The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vif_record_opt_free(xen_vif_record_opt *record_opt);
+
+
+typedef struct xen_vif_record_set
+{
+ size_t size;
+ xen_vif_record *contents[];
+} xen_vif_record_set;
+
+/**
+ * Allocate a xen_vif_record_set of the given size.
+ */
+extern xen_vif_record_set *
+xen_vif_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_record_set, and all referenced values. The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vif_record_set_free(xen_vif_record_set *set);
+
+
+
+typedef struct xen_vif_record_opt_set
+{
+ size_t size;
+ xen_vif_record_opt *contents[];
+} xen_vif_record_opt_set;
+
+/**
+ * Allocate a xen_vif_record_opt_set of the given size.
+ */
+extern xen_vif_record_opt_set *
+xen_vif_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vif_record_opt_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vif_record_opt_set_free(xen_vif_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given VIF. !!!
+ */
+extern bool
+xen_vif_get_record(xen_session *session, xen_vif_record **result, xen_vif vif);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_vif_get_by_uuid(xen_session *session, xen_vif *result, char *uuid);
+
+
+/**
+ * Create a new VIF instance, and return its handle.
+ */
+extern bool
+xen_vif_create(xen_session *session, xen_vif *result, xen_vif_record *record);
+
+
+/**
+ * Get the uuid field of the given VIF.
+ */
+extern bool
+xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the name field of the given VIF.
+ */
+extern bool
+xen_vif_get_name(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the type field of the given VIF.
+ */
+extern bool
+xen_vif_get_type(xen_session *session, enum xen_driver_type *result, xen_vif
vif);
+
+
+/**
+ * Get the device field of the given VIF.
+ */
+extern bool
+xen_vif_get_device(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the network field of the given VIF.
+ */
+extern bool
+xen_vif_get_network(xen_session *session, xen_network *result, xen_vif vif);
+
+
+/**
+ * Get the VM field of the given VIF.
+ */
+extern bool
+xen_vif_get_vm(xen_session *session, xen_vm *result, xen_vif vif);
+
+
+/**
+ * Get the MAC field of the given VIF.
+ */
+extern bool
+xen_vif_get_mac(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the MTU field of the given VIF.
+ */
+extern bool
+xen_vif_get_mtu(xen_session *session, uint64_t *result, xen_vif vif);
+
+
+/**
+ * Get the network_read_kbs field of the given VIF.
+ */
+extern bool
+xen_vif_get_network_read_kbs(xen_session *session, double *result, xen_vif
vif);
+
+
+/**
+ * Get the network_write_kbs field of the given VIF.
+ */
+extern bool
+xen_vif_get_network_write_kbs(xen_session *session, double *result, xen_vif
vif);
+
+
+/**
+ * Get the IO_bandwidth/incoming_kbs field of the given VIF.
+ */
+extern bool
+xen_vif_get_io_bandwidth_incoming_kbs(xen_session *session, double *result,
xen_vif vif);
+
+
+/**
+ * Get the IO_bandwidth/outgoing_kbs field of the given VIF.
+ */
+extern bool
+xen_vif_get_io_bandwidth_outgoing_kbs(xen_session *session, double *result,
xen_vif vif);
+
+
+/**
+ * Set the name field of the given VIF.
+ */
+extern bool
+xen_vif_set_name(xen_session *session, xen_vif xen_vif, char *name);
+
+
+/**
+ * Set the type field of the given VIF.
+ */
+extern bool
+xen_vif_set_type(xen_session *session, xen_vif xen_vif, enum xen_driver_type
type);
+
+
+/**
+ * Set the device field of the given VIF.
+ */
+extern bool
+xen_vif_set_device(xen_session *session, xen_vif xen_vif, char *device);
+
+
+/**
+ * Set the network field of the given VIF.
+ */
+extern bool
+xen_vif_set_network(xen_session *session, xen_vif xen_vif, xen_network
network);
+
+
+/**
+ * Set the VM field of the given VIF.
+ */
+extern bool
+xen_vif_set_vm(xen_session *session, xen_vif xen_vif, xen_vm vm);
+
+
+/**
+ * Set the MAC field of the given VIF.
+ */
+extern bool
+xen_vif_set_mac(xen_session *session, xen_vif xen_vif, char *mac);
+
+
+/**
+ * Set the MTU field of the given VIF.
+ */
+extern bool
+xen_vif_set_mtu(xen_session *session, xen_vif xen_vif, uint64_t mtu);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vif_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vif_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VIF_DECL_H
+#define XEN_VIF_DECL_H
+
+typedef void *xen_vif;
+
+struct xen_vif_set;
+struct xen_vif_record;
+struct xen_vif_record_set;
+struct xen_vif_record_opt;
+struct xen_vif_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vm.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vm.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,809 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VM_H
+#define XEN_VM_H
+
+#include "xen_boot_type.h"
+#include "xen_common.h"
+#include "xen_cpu_feature.h"
+#include "xen_host_decl.h"
+#include "xen_int_float_map.h"
+#include "xen_on_crash_behaviour.h"
+#include "xen_on_normal_exit.h"
+#include "xen_string_string_map.h"
+#include "xen_vbd_decl.h"
+#include "xen_vif_decl.h"
+#include "xen_vm_decl.h"
+#include "xen_vm_power_state.h"
+
+
+/*
+ * The VM class.
+ *
+ * A virtual machine (or 'guest').
+ */
+
+
+/**
+ * Free the given xen_vm. The given handle must have been allocated by
+ * this library.
+ */
+extern void
+xen_vm_free(xen_vm vm);
+
+
+typedef struct xen_vm_set
+{
+ size_t size;
+ xen_vm *contents[];
+} xen_vm_set;
+
+/**
+ * Allocate a xen_vm_set of the given size.
+ */
+extern xen_vm_set *
+xen_vm_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_set. The given set must have been allocated
+ * by this library.
+ */
+extern void
+xen_vm_set_free(xen_vm_set *set);
+
+
+typedef struct xen_vm_record
+{
+ xen_vm handle;
+ char *uuid;
+ enum xen_vm_power_state power_state;
+ char *name_label;
+ char *name_description;
+ uint64_t user_version;
+ bool is_a_template;
+ struct xen_host_record_opt *resident_on;
+ uint64_t memory_static_max;
+ uint64_t memory_dynamic_max;
+ uint64_t memory_actual;
+ uint64_t memory_dynamic_min;
+ uint64_t memory_static_min;
+ char *vcpus_policy;
+ char *vcpus_params;
+ uint64_t vcpus_number;
+ xen_int_float_map *vcpus_utilisation;
+ struct xen_cpu_feature_set *vcpus_features_required;
+ struct xen_cpu_feature_set *vcpus_features_can_use;
+ struct xen_cpu_feature_set *vcpus_features_force_on;
+ struct xen_cpu_feature_set *vcpus_features_force_off;
+ enum xen_on_normal_exit actions_after_shutdown;
+ enum xen_on_normal_exit actions_after_reboot;
+ enum xen_on_normal_exit actions_after_suspend;
+ enum xen_on_crash_behaviour actions_after_crash;
+ struct xen_vif_record_opt_set *vifs;
+ struct xen_vbd_record_opt_set *vbds;
+ uint64_t tpm_instance;
+ uint64_t tpm_backend;
+ char *bios_boot;
+ bool platform_std_vga;
+ char *platform_serial;
+ bool platform_localtime;
+ bool platform_clock_offset;
+ bool platform_enable_audio;
+ char *builder;
+ enum xen_boot_type boot_method;
+ char *kernel_kernel;
+ char *kernel_initrd;
+ char *kernel_args;
+ char *grub_cmdline;
+ char *pci_bus;
+ xen_string_string_map *tools_version;
+ xen_string_string_map *otherconfig;
+} xen_vm_record;
+
+/**
+ * Allocate a xen_vm_record.
+ */
+extern xen_vm_record *
+xen_vm_record_alloc(void);
+
+/**
+ * Free the given xen_vm_record, and all referenced values. The given
+ * record must have been allocated by this library.
+ */
+extern void
+xen_vm_record_free(xen_vm_record *record);
+
+
+typedef struct xen_vm_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_vm handle;
+ xen_vm_record *record;
+ } u;
+} xen_vm_record_opt;
+
+/**
+ * Allocate a xen_vm_record_opt.
+ */
+extern xen_vm_record_opt *
+xen_vm_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vm_record_opt, and all referenced values. The
+ * given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vm_record_opt_free(xen_vm_record_opt *record_opt);
+
+
+typedef struct xen_vm_record_set
+{
+ size_t size;
+ xen_vm_record *contents[];
+} xen_vm_record_set;
+
+/**
+ * Allocate a xen_vm_record_set of the given size.
+ */
+extern xen_vm_record_set *
+xen_vm_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_record_set, and all referenced values. The
+ * given set must have been allocated by this library.
+ */
+extern void
+xen_vm_record_set_free(xen_vm_record_set *set);
+
+
+
+typedef struct xen_vm_record_opt_set
+{
+ size_t size;
+ xen_vm_record_opt *contents[];
+} xen_vm_record_opt_set;
+
+/**
+ * Allocate a xen_vm_record_opt_set of the given size.
+ */
+extern xen_vm_record_opt_set *
+xen_vm_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_record_opt_set, and all referenced values.
+ * The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_record_opt_set_free(xen_vm_record_opt_set *set);
+
+
+/**
+ * Get the current state of the given VM. !!!
+ */
+extern bool
+xen_vm_get_record(xen_session *session, xen_vm_record **result, xen_vm vm);
+
+
+/**
+ * Get a reference to the object with the specified UUID. !!!
+ */
+extern bool
+xen_vm_get_by_uuid(xen_session *session, xen_vm *result, char *uuid);
+
+
+/**
+ * Create a new VM instance, and return its handle.
+ */
+extern bool
+xen_vm_create(xen_session *session, xen_vm *result, xen_vm_record *record);
+
+
+/**
+ * Get a reference to the object with the specified label.
+ */
+extern bool
+xen_vm_get_by_name_label(xen_session *session, xen_vm *result, char *label);
+
+
+/**
+ * Get the uuid field of the given VM.
+ */
+extern bool
+xen_vm_get_uuid(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the power_state field of the given VM.
+ */
+extern bool
+xen_vm_get_power_state(xen_session *session, enum xen_vm_power_state *result,
xen_vm vm);
+
+
+/**
+ * Get the name/label field of the given VM.
+ */
+extern bool
+xen_vm_get_name_label(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the name/description field of the given VM.
+ */
+extern bool
+xen_vm_get_name_description(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the user_version field of the given VM.
+ */
+extern bool
+xen_vm_get_user_version(xen_session *session, uint64_t *result, xen_vm vm);
+
+
+/**
+ * Get the is_a_template field of the given VM.
+ */
+extern bool
+xen_vm_get_is_a_template(xen_session *session, bool *result, xen_vm vm);
+
+
+/**
+ * Get the resident_on field of the given VM.
+ */
+extern bool
+xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm);
+
+
+/**
+ * Get the memory/static_max field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_static_max(xen_session *session, uint64_t *result, xen_vm
vm);
+
+
+/**
+ * Get the memory/dynamic_max field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_dynamic_max(xen_session *session, uint64_t *result, xen_vm
vm);
+
+
+/**
+ * Get the memory/actual field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_actual(xen_session *session, uint64_t *result, xen_vm vm);
+
+
+/**
+ * Get the memory/dynamic_min field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_dynamic_min(xen_session *session, uint64_t *result, xen_vm
vm);
+
+
+/**
+ * Get the memory/static_min field of the given VM.
+ */
+extern bool
+xen_vm_get_memory_static_min(xen_session *session, uint64_t *result, xen_vm
vm);
+
+
+/**
+ * Get the VCPUs/policy field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_policy(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/params field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_params(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/number field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_number(xen_session *session, uint64_t *result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/utilisation field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result,
xen_vm vm);
+
+
+/**
+ * Get the VCPUs/features/required field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_features_required(xen_session *session, struct
xen_cpu_feature_set **result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/features/can_use field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_features_can_use(xen_session *session, struct
xen_cpu_feature_set **result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/features/force_on field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_features_force_on(xen_session *session, struct
xen_cpu_feature_set **result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/features/force_off field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_features_force_off(xen_session *session, struct
xen_cpu_feature_set **result, xen_vm vm);
+
+
+/**
+ * Get the actions/after_shutdown field of the given VM.
+ */
+extern bool
+xen_vm_get_actions_after_shutdown(xen_session *session, enum
xen_on_normal_exit *result, xen_vm vm);
+
+
+/**
+ * Get the actions/after_reboot field of the given VM.
+ */
+extern bool
+xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit
*result, xen_vm vm);
+
+
+/**
+ * Get the actions/after_suspend field of the given VM.
+ */
+extern bool
+xen_vm_get_actions_after_suspend(xen_session *session, enum xen_on_normal_exit
*result, xen_vm vm);
+
+
+/**
+ * Get the actions/after_crash field of the given VM.
+ */
+extern bool
+xen_vm_get_actions_after_crash(xen_session *session, enum
xen_on_crash_behaviour *result, xen_vm vm);
+
+
+/**
+ * Get the VIFs field of the given VM.
+ */
+extern bool
+xen_vm_get_vifs(xen_session *session, xen_vif *result, xen_vm vm);
+
+
+/**
+ * Get the VBDs field of the given VM.
+ */
+extern bool
+xen_vm_get_vbds(xen_session *session, xen_vbd *result, xen_vm vm);
+
+
+/**
+ * Get the TPM/instance field of the given VM.
+ */
+extern bool
+xen_vm_get_tpm_instance(xen_session *session, uint64_t *result, xen_vm vm);
+
+
+/**
+ * Get the TPM/backend field of the given VM.
+ */
+extern bool
+xen_vm_get_tpm_backend(xen_session *session, uint64_t *result, xen_vm vm);
+
+
+/**
+ * Get the bios/boot field of the given VM.
+ */
+extern bool
+xen_vm_get_bios_boot(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the platform/std_VGA field of the given VM.
+ */
+extern bool
+xen_vm_get_platform_std_vga(xen_session *session, bool *result, xen_vm vm);
+
+
+/**
+ * Get the platform/serial field of the given VM.
+ */
+extern bool
+xen_vm_get_platform_serial(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the platform/localtime field of the given VM.
+ */
+extern bool
+xen_vm_get_platform_localtime(xen_session *session, bool *result, xen_vm vm);
+
+
+/**
+ * Get the platform/clock_offset field of the given VM.
+ */
+extern bool
+xen_vm_get_platform_clock_offset(xen_session *session, bool *result, xen_vm
vm);
+
+
+/**
+ * Get the platform/enable_audio field of the given VM.
+ */
+extern bool
+xen_vm_get_platform_enable_audio(xen_session *session, bool *result, xen_vm
vm);
+
+
+/**
+ * Get the builder field of the given VM.
+ */
+extern bool
+xen_vm_get_builder(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the boot_method field of the given VM.
+ */
+extern bool
+xen_vm_get_boot_method(xen_session *session, enum xen_boot_type *result,
xen_vm vm);
+
+
+/**
+ * Get the kernel/kernel field of the given VM.
+ */
+extern bool
+xen_vm_get_kernel_kernel(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the kernel/initrd field of the given VM.
+ */
+extern bool
+xen_vm_get_kernel_initrd(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the kernel/args field of the given VM.
+ */
+extern bool
+xen_vm_get_kernel_args(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the grub/cmdline field of the given VM.
+ */
+extern bool
+xen_vm_get_grub_cmdline(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the PCI_bus field of the given VM.
+ */
+extern bool
+xen_vm_get_pci_bus(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the tools_version field of the given VM.
+ */
+extern bool
+xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result,
xen_vm vm);
+
+
+/**
+ * Get the otherConfig field of the given VM.
+ */
+extern bool
+xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result,
xen_vm vm);
+
+
+/**
+ * Set the name/label field of the given VM.
+ */
+extern bool
+xen_vm_set_name_label(xen_session *session, xen_vm xen_vm, char *label);
+
+
+/**
+ * Set the name/description field of the given VM.
+ */
+extern bool
+xen_vm_set_name_description(xen_session *session, xen_vm xen_vm, char
*description);
+
+
+/**
+ * Set the user_version field of the given VM.
+ */
+extern bool
+xen_vm_set_user_version(xen_session *session, xen_vm xen_vm, uint64_t
user_version);
+
+
+/**
+ * Set the is_a_template field of the given VM.
+ */
+extern bool
+xen_vm_set_is_a_template(xen_session *session, xen_vm xen_vm, bool
is_a_template);
+
+
+/**
+ * Set the memory/dynamic_max field of the given VM.
+ */
+extern bool
+xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm xen_vm, uint64_t
dynamic_max);
+
+
+/**
+ * Set the memory/dynamic_min field of the given VM.
+ */
+extern bool
+xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm xen_vm, uint64_t
dynamic_min);
+
+
+/**
+ * Set the VCPUs/policy field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_policy(xen_session *session, xen_vm xen_vm, char *policy);
+
+
+/**
+ * Set the VCPUs/params field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_params(xen_session *session, xen_vm xen_vm, char *params);
+
+
+/**
+ * Set the VCPUs/features/force_on field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_features_force_on(xen_session *session, xen_vm xen_vm, struct
xen_cpu_feature_set *force_on);
+
+
+/**
+ * Set the VCPUs/features/force_off field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_features_force_off(xen_session *session, xen_vm xen_vm,
struct xen_cpu_feature_set *force_off);
+
+
+/**
+ * Set the actions/after_shutdown field of the given VM.
+ */
+extern bool
+xen_vm_set_actions_after_shutdown(xen_session *session, xen_vm xen_vm, enum
xen_on_normal_exit after_shutdown);
+
+
+/**
+ * Set the actions/after_reboot field of the given VM.
+ */
+extern bool
+xen_vm_set_actions_after_reboot(xen_session *session, xen_vm xen_vm, enum
xen_on_normal_exit after_reboot);
+
+
+/**
+ * Set the actions/after_suspend field of the given VM.
+ */
+extern bool
+xen_vm_set_actions_after_suspend(xen_session *session, xen_vm xen_vm, enum
xen_on_normal_exit after_suspend);
+
+
+/**
+ * Set the actions/after_crash field of the given VM.
+ */
+extern bool
+xen_vm_set_actions_after_crash(xen_session *session, xen_vm xen_vm, enum
xen_on_crash_behaviour after_crash);
+
+
+/**
+ * Set the bios/boot field of the given VM.
+ */
+extern bool
+xen_vm_set_bios_boot(xen_session *session, xen_vm xen_vm, char *boot);
+
+
+/**
+ * Set the platform/std_VGA field of the given VM.
+ */
+extern bool
+xen_vm_set_platform_std_vga(xen_session *session, xen_vm xen_vm, bool std_vga);
+
+
+/**
+ * Set the platform/serial field of the given VM.
+ */
+extern bool
+xen_vm_set_platform_serial(xen_session *session, xen_vm xen_vm, char *serial);
+
+
+/**
+ * Set the platform/localtime field of the given VM.
+ */
+extern bool
+xen_vm_set_platform_localtime(xen_session *session, xen_vm xen_vm, bool
localtime);
+
+
+/**
+ * Set the platform/clock_offset field of the given VM.
+ */
+extern bool
+xen_vm_set_platform_clock_offset(xen_session *session, xen_vm xen_vm, bool
clock_offset);
+
+
+/**
+ * Set the platform/enable_audio field of the given VM.
+ */
+extern bool
+xen_vm_set_platform_enable_audio(xen_session *session, xen_vm xen_vm, bool
enable_audio);
+
+
+/**
+ * Set the builder field of the given VM.
+ */
+extern bool
+xen_vm_set_builder(xen_session *session, xen_vm xen_vm, char *builder);
+
+
+/**
+ * Set the boot_method field of the given VM.
+ */
+extern bool
+xen_vm_set_boot_method(xen_session *session, xen_vm xen_vm, enum xen_boot_type
boot_method);
+
+
+/**
+ * Set the kernel/kernel field of the given VM.
+ */
+extern bool
+xen_vm_set_kernel_kernel(xen_session *session, xen_vm xen_vm, char *kernel);
+
+
+/**
+ * Set the kernel/initrd field of the given VM.
+ */
+extern bool
+xen_vm_set_kernel_initrd(xen_session *session, xen_vm xen_vm, char *initrd);
+
+
+/**
+ * Set the kernel/args field of the given VM.
+ */
+extern bool
+xen_vm_set_kernel_args(xen_session *session, xen_vm xen_vm, char *args);
+
+
+/**
+ * Set the grub/cmdline field of the given VM.
+ */
+extern bool
+xen_vm_set_grub_cmdline(xen_session *session, xen_vm xen_vm, char *cmdline);
+
+
+/**
+ * Set the otherConfig field of the given VM.
+ */
+extern bool
+xen_vm_set_otherconfig(xen_session *session, xen_vm xen_vm,
xen_string_string_map *otherconfig);
+
+
+/**
+ * Clones the specified VM, making a new VM. Clone automatically
+ * exploits the capabilities of the underlying storage repository in which the
+ * VM's disk images are stored (e.g. Copy on Write). This function can only
+ * be called when the VM is in the Halted State.
+ */
+extern bool
+xen_vm_clone(xen_session *session, xen_vm *result, xen_vm vm, char *new_name);
+
+
+/**
+ * Start the specified VM. This function can only be called with the
+ * VM is in the Halted State.
+ */
+extern bool
+xen_vm_start(xen_session *session, xen_vm vm, bool start_paused);
+
+
+/**
+ * Pause the specified VM. This can only be called when the specified
+ * VM is in the Running state.
+ */
+extern bool
+xen_vm_pause(xen_session *session, xen_vm vm);
+
+
+/**
+ * Resume the specified VM. This can only be called when the specified
+ * VM is in the Paused state.
+ */
+extern bool
+xen_vm_unpause(xen_session *session, xen_vm vm);
+
+
+/**
+ * Attempt to cleanly shutdown the specified VM. (Note: this may not be
+ * supported---e.g. if a guest agent is not installed).
+ *
+ * Once shutdown has been completed perform poweroff action specified in guest
+ * configuration.
+ */
+extern bool
+xen_vm_clean_shutdown(xen_session *session, xen_vm vm);
+
+
+/**
+ * Attempt to cleanly shutdown the specified VM (Note: this may not be
+ * supported---e.g. if a guest agent is not installed).
+ *
+ * Once shutdown has been completed perform reboot action specified in guest
+ * configuration.
+ */
+extern bool
+xen_vm_clean_reboot(xen_session *session, xen_vm vm);
+
+
+/**
+ * Stop executing the specified VM without attempting a clean shutdown.
+ * Then perform poweroff action specified in VM configuration.
+ */
+extern bool
+xen_vm_hard_shutdown(xen_session *session, xen_vm vm);
+
+
+/**
+ * Stop executing the specified VM without attempting a clean shutdown.
+ * Then perform reboot action specified in VM configuration
+ */
+extern bool
+xen_vm_hard_reboot(xen_session *session, xen_vm vm);
+
+
+/**
+ * Suspend the specified VM to disk.
+ */
+extern bool
+xen_vm_suspend(xen_session *session, xen_vm vm);
+
+
+/**
+ * Awaken the specified VM and resume it.
+ */
+extern bool
+xen_vm_resume(xen_session *session, xen_vm vm, bool start_paused);
+
+
+/**
+ * Return a list of all the VMs known to the system.
+ */
+extern bool
+xen_vm_get_all(xen_session *session, xen_vm *result);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vm_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vm_decl.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VM_DECL_H
+#define XEN_VM_DECL_H
+
+typedef void *xen_vm;
+
+struct xen_vm_set;
+struct xen_vm_record;
+struct xen_vm_record_set;
+struct xen_vm_record_opt;
+struct xen_vm_record_opt_set;
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/include/xen_vm_power_state.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vm_power_state.h Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VM_POWER_STATE_H
+#define XEN_VM_POWER_STATE_H
+
+
+#include "xen_common.h"
+
+
+enum xen_vm_power_state
+{
+ /**
+ * Halted
+ */
+ XEN_VM_POWER_STATE_HALTED,
+
+ /**
+ * Paused
+ */
+ XEN_VM_POWER_STATE_PAUSED,
+
+ /**
+ * Running
+ */
+ XEN_VM_POWER_STATE_RUNNING,
+
+ /**
+ * Suspended
+ */
+ XEN_VM_POWER_STATE_SUSPENDED,
+
+ /**
+ * Shutting Down
+ */
+ XEN_VM_POWER_STATE_SHUTTINGDOWN,
+
+ /**
+ * Some other unknown state
+ */
+ XEN_VM_POWER_STATE_UNKNOWN
+};
+
+
+typedef struct xen_vm_power_state_set
+{
+ size_t size;
+ enum xen_vm_power_state contents[];
+} xen_vm_power_state_set;
+
+/**
+ * Allocate a xen_vm_power_state_set of the given size.
+ */
+extern xen_vm_power_state_set *
+xen_vm_power_state_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_power_state_set. The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vm_power_state_set_free(xen_vm_power_state_set *set);
+
+
+/**
+ * Return the name corresponding to the given code. This string must
+ * not be modified or freed.
+ */
+extern const char *
+xen_vm_power_state_to_string(enum xen_vm_power_state val);
+
+
+/**
+ * Return the correct code for the given string, or set the session
+ * object to failure and return an undefined value if the given string does
+ * not match a known code.
+ */
+extern enum xen_vm_power_state
+xen_vm_power_state_from_string(xen_session *session, const char *str);
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107
tools/libxen/include/xen_vm_power_state_internal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vm_power_state_internal.h Sat Oct 07
18:22:09 2006 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/*
+ * Declarations of the abstract types used during demarshalling of enum
+ * xen_vm_power_state. Internal to this library -- do not use from outside.
+ */
+
+
+#ifndef XEN_VM_POWER_STATE_INTERNAL_H
+#define XEN_VM_POWER_STATE_INTERNAL_H
+
+
+#include "xen_internal.h"
+
+
+extern const abstract_type xen_vm_power_state_abstract_type_;
+extern const abstract_type xen_vm_power_state_set_abstract_type_;
+
+
+#endif
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_boot_type.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_boot_type.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <string.h>
+
+#include "xen_internal.h"
+#include "xen_boot_type.h"
+#include "xen_boot_type_internal.h"
+
+
+/*
+ * Maintain this in the same order as the enum declaration!
+ */
+static const char *lookup_table[] =
+{
+ "bios",
+ "grub",
+ "kernel_external",
+ "kernel_internal"
+};
+
+
+extern xen_boot_type_set *
+xen_boot_type_set_alloc(size_t size)
+{
+ return calloc(1, sizeof(xen_boot_type_set) +
+ size * sizeof(enum xen_boot_type));
+}
+
+
+extern void
+xen_boot_type_set_free(xen_boot_type_set *set)
+{
+ free(set);
+}
+
+
+const char *
+xen_boot_type_to_string(enum xen_boot_type val)
+{
+ return lookup_table[val];
+}
+
+
+extern enum xen_boot_type
+xen_boot_type_from_string(xen_session *session, const char *str)
+{
+ return ENUM_LOOKUP(session, str, lookup_table);
+}
+
+
+const abstract_type xen_boot_type_abstract_type_ =
+ {
+ .typename = ENUM,
+ .enum_marshaller =
+ (const char *(*)(int))&xen_boot_type_to_string,
+ .enum_demarshaller =
+ (int (*)(xen_session *, const char *))&xen_boot_type_from_string
+ };
+
+
+const abstract_type xen_boot_type_set_abstract_type_ =
+ {
+ .typename = SET,
+ .child = &xen_boot_type_abstract_type_
+ };
+
+
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_common.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_common.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,1329 @@
+/*
+ Copyright (c) 2006 XenSource, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <assert.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlsave.h>
+#include <libxml/xmlstring.h>
+#include <libxml/xpath.h>
+
+#include "xen_common.h"
+#include "xen_internal.h"
+#include "xen_int_float_map.h"
+#include "xen_string_string_map.h"
+
+
+static xmlXPathCompExprPtr responsePath = NULL;
+static xmlXPathCompExprPtr faultPath = NULL;
+
+
+typedef struct
+{
+ size_t size;
+ void *contents[];
+} arbitrary_map;
+
+
+typedef struct
+{
+ bool is_record;
+ union
+ {
+ char *handle;
+ void *record;
+ } u;
+} arbitrary_record_opt;
+
+
+static char *
+make_body(const char *, abstract_value [], int);
+
+static void
+parse_result(xen_session *, const char *, const abstract_type *, void *);
+
+static void
+add_value(xmlNode *, const char *, const char *);
+static void
+add_param(xmlNode *, const char *, const char *);
+
+static xmlNode *
+add_param_struct(xmlNode *);
+static xmlNode *
+add_struct_array(xmlNode *, const char *);
+static void
+add_struct_member(xmlNode *, const char *, const char *, const char *);
+static void
+add_unnamed_value(xmlNode *, const char *, const char *, const char *);
+
+static void
+add_struct_value(const struct abstract_type *, void *,
+ void (*)(xmlNode *, const char *, const char *,
+ const char *),
+ const char *, xmlNode *);
+
+static void
+call_raw(xen_session *, const char *, abstract_value [], int,
+ const abstract_type *, void *);
+
+static void
+parse_structmap_value(xen_session *, xmlNode *, const abstract_type *,
+ void *);
+
+static size_t size_of_member(const abstract_type *);
+
+
+void
+xen_init(void)
+{
+ responsePath =
+ xmlXPathCompile(
+ BAD_CAST(
+ "/methodResponse/params/param/value/struct/member/value"));
+ faultPath =
+ xmlXPathCompile(
+ BAD_CAST("/methodResponse/fault/value/struct/member/value"));
+}
+
+
+void
+xen_fini(void)
+{
+ xmlXPathFreeCompExpr(responsePath);
+ xmlXPathFreeCompExpr(faultPath);
+ responsePath = NULL;
+ faultPath = NULL;
+}
+
+
+xen_session *
+xen_session_login_with_password(xen_call_func call_func, void *handle,
+ const char *uname, const char *pwd)
+{
+ abstract_value params[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uname },
+ { .type = &abstract_type_string,
+ .u.string_val = pwd }
+ };
+
+ xen_session *session = malloc(sizeof(xen_session));
+ session->call_func = call_func;
+ session->handle = handle;
+ session->session_id = NULL;
+ session->ok = true;
+ session->error_description = NULL;
+ session->error_description_count = 0;
+
+ call_raw(session, "Session.login_with_password", params, 2,
+ &abstract_type_string, &session->session_id);
+
+ return session;
+}
+
+
+void
+xen_session_logout(xen_session *session)
+{
+ abstract_value params[] =
+ {
+ };
+ xen_call_(session, "Session.logout", params, 0, NULL, NULL);
+
+ if (session->error_description != NULL)
+ {
+ for (int i = 0; i < session->error_description_count; i++)
+ {
+ free(session->error_description[i]);
+ }
+ free(session->error_description);
+ }
+
+ free((char *)session->session_id);
+ free(session);
+}
+
+
+int
+xen_session_get_this_host(xen_session *session, xen_host *result)
+{
+ abstract_value params[] =
+ {
+ };
+
+ xen_call_(session, "Session.get_this_host", params, 0,
+ &abstract_type_string, result);
+ return session->ok;
+}
+
+
+#define X "%02x"
+#define UUID_FORMAT X X X X "-" X X "-" X X "-" X X "-" X X X X X X
+
+
+bool
+xen_uuid_string_to_bytes(char *uuid, char **bytes)
+{
+ unsigned int buf[16];
+
+ *bytes = NULL;
+
+ if (strlen(uuid) != 36)
+ return false;
+
+ if (16 != sscanf(uuid, UUID_FORMAT,
+ buf + 0, buf + 1, buf + 2, buf + 3,
+ buf + 4, buf + 5,
+ buf + 6, buf + 7,
+ buf + 8, buf + 9,
+ buf + 10, buf + 11, buf + 12, buf + 13, buf + 14,
+ buf + 15))
+ {
+ return false;
+ }
+
+ *bytes = malloc(16);
+ if (*bytes == NULL)
+ return false;
+
+ for (int i = 0; i < 16; i++) {
+ (*bytes)[i] = (char)buf[i];
+ }
+
+ return true;
+}
+
+
+bool
+xen_uuid_bytes_to_string(char *bytes, char **uuid)
+{
+ *uuid = malloc(37);
+ if (*uuid == NULL)
+ return false;
+
+ sprintf(*uuid, UUID_FORMAT,
+ bytes[0], bytes[1], bytes[2], bytes[3],
+ bytes[4], bytes[5],
+ bytes[6], bytes[7],
+ bytes[8], bytes[9],
+ bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]);
+
+ return true;
+}
+
+
+#undef UUID_FORMAT
+#undef X
+
+
+void
+xen_uuid_free(char *uuid)
+{
+ free(uuid);
+}
+
+
+void
+xen_uuid_bytes_free(char *bytes)
+{
+ free(bytes);
+}
+
+
+/**
+ * @param value A pointer to the correct location as per the given
+ * result_type. Will be populated if the call succeeds. In that case, and if
+ * value is a char **, the char * itself must be freed by the caller.
+ */
+void
+xen_call_(xen_session *s, const char *method_name,
+ abstract_value params[], int param_count,
+ const abstract_type *result_type, void *value)
+{
+ if (!s->ok)
+ {
+ return;
+ }
+
+ abstract_value *full_params =
+ malloc(sizeof(abstract_value) * (param_count + 1));
+
+ full_params[0].type = &abstract_type_string;
+ full_params[0].u.string_val = s->session_id;
+
+ memcpy(full_params + 1, params, param_count * sizeof(abstract_value));
+
+ call_raw(s, method_name, full_params, param_count + 1, result_type,
+ value);
+
+ free(full_params);
+}
+
+
+static bool
+bufferAdd(const void *data, size_t len, void *buffer)
+{
+ return 0 == xmlBufferAdd((xmlBufferPtr)buffer, data, len);
+}
+
+
+static void
+call_raw(xen_session *s, const char *method_name,
+ abstract_value params[], int param_count,
+ const abstract_type *result_type, void *value)
+{
+ xmlBufferPtr buffer = xmlBufferCreate();
+ char *body = make_body(method_name, params, param_count);
+ int error_code =
+ s->call_func(body, strlen(body), s->handle, buffer, &bufferAdd);
+ free(body);
+ if (error_code)
+ {
+ char **strings = malloc(2 * sizeof(char *));
+
+ strings[0] = xen_strdup_("TRANSPORT_FAULT");
+ strings[1] = malloc(20);
+ snprintf(strings[1], 20, "%d", error_code);
+
+ s->ok = false;
+ s->error_description = strings;
+ s->error_description_count = 2;
+ }
+ else
+ {
+ parse_result(s, (char *)xmlBufferContent(buffer), result_type, value);
+ }
+ xmlBufferFree(buffer);
+}
+
+
+static void server_error(xen_session *session, const char *error_string)
+{
+ if (!session->ok)
+ {
+ /* Don't wipe out the earlier error message with this one. */
+ return;
+ }
+
+ char **strings = malloc(2 * sizeof(char *));
+
+ strings[0] = xen_strdup_("SERVER_FAULT");
+ strings[1] = xen_strdup_(error_string);
+
+ session->ok = false;
+ session->error_description = strings;
+ session->error_description_count = 2;
+}
+
+
+static void server_error_2(xen_session *session, const char *error_string,
+ const char *param)
+{
+ if (!session->ok)
+ {
+ /* Don't wipe out the earlier error message with this one. */
+ return;
+ }
+
+ char **strings = malloc(3 * sizeof(char *));
+
+ strings[0] = xen_strdup_("SERVER_FAULT_2");
+ strings[1] = xen_strdup_(error_string);
+ strings[2] = xen_strdup_(param);
+
+ session->ok = false;
+ session->error_description = strings;
+ session->error_description_count = 3;
+}
+
+
+static bool is_container_node(xmlNode *n, char *type)
+{
+ return
+ n->type == XML_ELEMENT_NODE &&
+ 0 == strcmp((char *)n->name, type) &&
+ n->children != NULL &&
+ n->children == n->last &&
+ n->children->type == XML_ELEMENT_NODE;
+}
+
+
+/**
+ * @return The contents of the given value, or NULL if this is not a node with
+ * the given type. If not NULL, the result must be freed with xmlFree().
+ */
+static xmlChar *string_from_value(xmlNode *n, char *type)
+{
+ return
+ is_container_node(n, "value") &&
+ 0 == strcmp((char *)n->children->name, type) ?
+ (n->children->children == NULL ?
+ xmlStrdup(BAD_CAST("")) :
+ xmlNodeGetContent(n->children->children)) :
+ NULL;
+}
+
+
+/**
+ * Find the name node that is a child of the given one, and return its
+ * contents, or NULL if this has no such node. If not NULL, the result must
+ * be freed with xmlFree().
+ */
+static xmlChar *string_from_name(xmlNode *n)
+{
+ xmlNode *cur = n->children;
+
+ while (cur != NULL)
+ {
+ if (0 == strcmp((char *)cur->name, "name"))
+ {
+ return xmlNodeGetContent(cur);
+ }
+ cur = cur->next;
+ }
+
+ return NULL;
+}
+
+
+static int count_children(xmlNode *n, const char *name)
+{
+ int result = 0;
+ xmlNode *cur = n->children;
+
+ while (cur != NULL)
+ {
+ if (0 == strcmp((char *)cur->name, name))
+ {
+ result++;
+ }
+ cur = cur->next;
+ }
+
+ return result;
+}
+
+
+static void destring(xen_session *s, xmlChar *name, const abstract_type *type,
+ void *value)
+{
+ switch (type->typename)
+ {
+ case STRING:
+ *((char **)value) = xen_strdup_((const char *)name);
+ break;
+
+ case INT:
+ *((uint64_t *)value) = atoll((const char *)name);
+ break;
+
+ case FLOAT:
+ *((double *)value) = atof((const char *)name);
+ break;
+
+ default:
+ server_error(s, "Invalid Map key type");
+ }
+}
+
+
+static void parse_into(xen_session *s, xmlNode *value_node,
+ const abstract_type *result_type, void *value,
+ int slot)
+{
+ if (result_type == NULL)
+ {
+ xmlChar *string = string_from_value(value_node, "string");
+ if (string == NULL || strcmp((char *)string, ""))
+ {
+ server_error(s,
+ "Expected Void from the server, but didn't get it");
+ }
+ else
+ {
+ free(string);
+ }
+
+ return;
+ }
+
+ switch (result_type->typename)
+ {
+ case STRING:
+ {
+ xmlChar *string = string_from_value(value_node, "string");
+ if (string == NULL)
+ {
+ server_error(
+ s, "Expected a String from the server, but didn't get one");
+ }
+ else
+ {
+ ((char **)value)[slot] = xen_strdup_((const char *)string);
+ free(string);
+ }
+ }
+ break;
+
+ case ENUM:
+ {
+ xmlChar *string = string_from_value(value_node, "string");
+ if (string == NULL)
+ {
+ server_error(
+ s, "Expected an Enum from the server, but didn't get one");
+ }
+ else
+ {
+ ((int *)value)[slot] =
+ result_type->enum_demarshaller(s, (const char *)string);
+ free(string);
+ }
+ }
+ break;
+
+ case INT:
+ {
+ xmlChar *string = string_from_value(value_node, "string");
+ if (string == NULL)
+ {
+ server_error(
+ s, "Expected an Int from the server, but didn't get one");
+ }
+ else
+ {
+ ((uint64_t *)value)[slot] = (uint64_t)atoll((char *)string);
+ free(string);
+ }
+ }
+ break;
+
+ case FLOAT:
+ {
+ xmlChar *string = string_from_value(value_node, "double");
+ if (string == NULL)
+ {
+ server_error(
+ s, "Expected a Float from the server, but didn't get one");
+ }
+ else
+ {
+ ((double *)value)[slot] = atof((char *)string);
+ free(string);
+ }
+ }
+ break;
+
+ case BOOL:
+ {
+ xmlChar *string = string_from_value(value_node, "boolean");
+ if (string == NULL)
+ {
+ server_error(
+ s, "Expected a Bool from the server, but didn't get one");
+ }
+ else
+ {
+ ((bool *)value)[slot] = (0 == strcmp((char *)string, "1"));
+ free(string);
+ }
+ }
+ break;
+
+ case SET:
+ {
+ if (!is_container_node(value_node, "value") ||
+ !is_container_node(value_node->children, "array"))
+ {
+ server_error(s,
+ "Expected Set from the server, but didn't get it");
+ }
+ else
+ {
+ xmlNode *data_node = value_node->children->children;
+ int n = count_children(data_node, "value");
+
+ const abstract_type *member_type = result_type->child;
+ size_t member_size = size_of_member(member_type);
+
+ arbitrary_set *set =
+ calloc(1, sizeof(arbitrary_set) + member_size * n);
+ set->size = n;
+ int i = 0;
+ xmlNode *cur = data_node->children;
+
+ while (cur != NULL)
+ {
+ if (0 == strcmp((char *)cur->name, "value"))
+ {
+ parse_into(s, cur, member_type, set->contents, i);
+ i++;
+ }
+ cur = cur->next;
+ }
+
+ ((arbitrary_set **)value)[slot] = set;
+ }
+ }
+ break;
+
+ case MAP:
+ {
+ if (!is_container_node(value_node, "value") ||
+ value_node->children->type != XML_ELEMENT_NODE ||
+ 0 != strcmp((char *)value_node->children->name, "struct") ||
+ value_node->children->children == NULL)
+ {
+ server_error(s,
+ "Expected Map from the server, but didn't get it");
+ }
+ else
+ {
+ xmlNode *struct_node = value_node->children;
+ int n = count_children(struct_node, "member");
+
+ size_t struct_size = result_type->struct_size;
+
+ const struct struct_member *key_member = result_type->members;
+ const struct struct_member *val_member = result_type->members + 1;
+
+ arbitrary_map *map =
+ calloc(1, sizeof(arbitrary_map) + struct_size * n);
+ map->size = n;
+ int i = 0;
+ xmlNode *cur = struct_node->children;
+
+ while (cur != NULL)
+ {
+ if (0 == strcmp((char *)cur->name, "member"))
+ {
+ if (cur->children == NULL || cur->last == cur->children)
+ {
+ server_error(s, "Malformed Map");
+ free(map);
+ return;
+ }
+
+ xmlChar *name = string_from_name(cur);
+ if (name == NULL)
+ {
+ server_error(s, "Malformed Map");
+ free(map);
+ return;
+ }
+
+ destring(s, name, key_member->type,
+ ((void *)(map + 1)) +
+ (i * struct_size) +
+ key_member->offset);
+ xmlFree(name);
+ if (!s->ok)
+ {
+ free(map);
+ return;
+ }
+
+ parse_structmap_value(s, cur, val_member->type,
+ ((void *)(map + 1)) +
+ (i * struct_size) +
+ val_member->offset);
+ if (!s->ok)
+ {
+ free(map);
+ return;
+ }
+ i++;
+ }
+ cur = cur->next;
+ }
+
+ ((arbitrary_map **)value)[slot] = map;
+ }
+ }
+ break;
+
+ case STRUCT:
+ {
+ if (!is_container_node(value_node, "value") ||
+ value_node->children->type != XML_ELEMENT_NODE ||
+ 0 != strcmp((char *)value_node->children->name, "struct") ||
+ value_node->children->children == NULL)
+ {
+ server_error(s,
+ "Expected Map from the server, but didn't get it");
+ }
+ else
+ {
+ xmlNode *struct_node = value_node->children;
+
+ void *result = calloc(1, result_type->struct_size);
+ xmlNode *cur = struct_node->children;
+
+ size_t member_count = result_type->member_count;
+
+ const struct_member **checklist =
+ malloc(sizeof(const struct_member *) * member_count);
+ int seen_count = 0;
+
+ while (cur != NULL)
+ {
+ if (0 == strcmp((char *)cur->name, "member"))
+ {
+ if (cur->children == NULL || cur->last == cur->children)
+ {
+ server_error(s, "Malformed Struct");
+ free(result);
+ free(checklist);
+ return;
+ }
+
+ xmlChar *name = string_from_name(cur);
+ if (name == NULL)
+ {
+ server_error(s, "Malformed Struct");
+ free(result);
+ free(checklist);
+ return;
+ }
+
+ for (size_t i = 0; i < member_count; i++)
+ {
+ const struct_member *mem = result_type->members + i;
+
+ if (0 == strcmp((char *)name, mem->key))
+ {
+ parse_structmap_value(s, cur, mem->type,
+ result + mem->offset);
+ checklist[seen_count] = mem;
+ seen_count++;
+ break;
+ }
+ }
+
+ /* Note that we're skipping unknown fields implicitly.
+ This means that we'll be forward compatible with
+ new servers. */
+
+ xmlFree(name);
+
+ if (!s->ok)
+ {
+ free(result);
+ free(checklist);
+ return;
+ }
+ }
+ cur = cur->next;
+ }
+
+ /* Check that we've filled all fields. */
+ for (size_t i = 0; i < member_count; i++)
+ {
+ const struct_member *mem = result_type->members + i;
+ int j;
+
+ for (j = 0; j < seen_count; j++)
+ {
+ if (checklist[j] == mem)
+ {
+ break;
+ }
+ }
+
+ if (j == seen_count)
+ {
+ server_error_2(s,
+ "Struct did not contain expected field",
+ mem->key);
+ free(result);
+ free(checklist);
+ return;
+ }
+ }
+
+ free(checklist);
+ ((void **)value)[slot] = result;
+ }
+ }
+ break;
+
+ case REF:
+ {
+ arbitrary_record_opt *record_opt =
+ calloc(1, sizeof(arbitrary_record_opt));
+
+ record_opt->is_record = false;
+ parse_into(s, value_node, &abstract_type_string,
+ &(record_opt->u.handle), 0);
+
+ ((arbitrary_record_opt **)value)[slot] = record_opt;
+ }
+ break;
+
+ default:
+ assert(false);
+ }
+}
+
+
+static size_t size_of_member(const abstract_type *type)
+{
+ switch (type->typename)
+ {
+ case STRING:
+ return sizeof(char *);
+
+/*
+ case INT:
+ return sizeof(uint64_t);
+
+ case FLOAT:
+ return sizeof(double);
+
+ case BOOL:
+ return sizeof(bool);
+*/
+ case ENUM:
+ return sizeof(int);
+
+ case REF:
+ return sizeof(arbitrary_record_opt);
+
+ default:
+ assert(false);
+ }
+}
+
+
+static void parse_structmap_value(xen_session *s, xmlNode *n,
+ const abstract_type *type, void *value)
+{
+ xmlNode *cur = n->children;
+
+ while (cur != NULL)
+ {
+ if (0 == strcmp((char *)cur->name, "value"))
+ {
+ parse_into(s, cur, type, value, 0);
+ return;
+ }
+ cur = cur->next;
+ }
+
+ server_error(s, "Missing value in Map/Struct");
+}
+
+
+static void parse_fault(xen_session *session, xmlXPathContextPtr xpathCtx)
+{
+ xmlXPathObjectPtr xpathObj = xmlXPathCompiledEval(faultPath, xpathCtx);
+ if (xpathObj == NULL)
+ {
+ server_error(session, "Method response is neither result nor fault");
+ return;
+ }
+
+ if (xpathObj->type != XPATH_NODESET ||
+ xpathObj->nodesetval->nodeNr != 2)
+ {
+ xmlXPathFreeObject(xpathObj);
+ server_error(session, "Method response is neither result nor fault");
+ return;
+ }
+
+ xmlNode *fault_node0 = xpathObj->nodesetval->nodeTab[0];
+ xmlNode *fault_node1 = xpathObj->nodesetval->nodeTab[1];
+
+ xmlChar *fault_code_str = string_from_value(fault_node0, "int");
+ if (fault_code_str == NULL)
+ {
+ fault_code_str = string_from_value(fault_node0, "i4");
+ }
+ if (fault_code_str == NULL)
+ {
+ xmlXPathFreeObject(xpathObj);
+ server_error(session, "Fault code is malformed");
+ return;
+ }
+
+ xmlChar *fault_string_str = string_from_value(fault_node1, "string");
+ if (fault_string_str == NULL)
+ {
+ xmlFree(fault_code_str);
+ xmlXPathFreeObject(xpathObj);
+ server_error(session, "Fault string is malformed");
+ return;
+ }
+
+ char **strings = malloc(3 * sizeof(char *));
+
+ strings[0] = xen_strdup_("FAULT");
+ strings[1] = xen_strdup_((char *)fault_code_str);
+ strings[2] = xen_strdup_((char *)fault_string_str);
+
+ session->ok = false;
+ session->error_description = strings;
+ session->error_description_count = 3;
+
+ xmlFree(fault_code_str);
+ xmlFree(fault_string_str);
+ xmlXPathFreeObject(xpathObj);
+}
+
+
+static void parse_failure(xen_session *session, xmlNode *node)
+{
+ abstract_type error_description_type =
+ { .typename = SET,
+ .child = &abstract_type_string };
+ arbitrary_set *error_descriptions;
+
+ parse_into(session, node, &error_description_type, &error_descriptions,
+ 0);
+
+ if (session->ok)
+ {
+ session->ok = false;
+
+ char **c = (char **)error_descriptions->contents;
+ int n = error_descriptions->size;
+
+ char **strings = malloc(3 * sizeof(char *));
+ for (int i = 0; i < n; i++)
+ {
+ strings[i] = xen_strdup_(c[i]);
+ }
+
+ session->error_description_count = n;
+ session->error_description = strings;
+ }
+
+ free(error_descriptions);
+}
+
+
+/**
+ * Parameters as for xen_call_() above.
+ */
+static void parse_result(xen_session *session, const char *result,
+ const abstract_type *result_type, void *value)
+{
+ xmlDocPtr doc =
+ xmlReadMemory(result, strlen(result), "", NULL, XML_PARSE_NONET);
+
+ if (doc == NULL)
+ {
+ server_error(session, "Couldn't parse the server response");
+ return;
+ }
+
+ xmlXPathContextPtr xpathCtx = xmlXPathNewContext(doc);
+ if (xpathCtx == NULL)
+ {
+ xmlFreeDoc(doc);
+ server_error(session, "Couldn't create XPath context");
+ return;
+ }
+
+ xmlXPathObjectPtr xpathObj =
+ xmlXPathCompiledEval(responsePath, xpathCtx);
+ if (xpathObj == NULL)
+ {
+ parse_fault(session, xpathCtx);
+
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+ return;
+ }
+
+ if (xpathObj->type != XPATH_NODESET ||
+ xpathObj->nodesetval->nodeNr != 2)
+ {
+ parse_fault(session, xpathCtx);
+
+ xmlXPathFreeObject(xpathObj);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+ return;
+ }
+
+ xmlNode *node0 = xpathObj->nodesetval->nodeTab[0];
+ xmlNode *node1 = xpathObj->nodesetval->nodeTab[1];
+
+ xmlChar *status_code = string_from_value(node0, "string");
+ if (status_code == NULL)
+ {
+ xmlXPathFreeObject(xpathObj);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+ server_error(session, "Server response does not have a Status");
+ return;
+ }
+
+ if (strcmp((char *)status_code, "Success"))
+ {
+ parse_failure(session, node1);
+
+ xmlFree(status_code);
+ xmlXPathFreeObject(xpathObj);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+ return;
+ }
+
+ parse_into(session, node1, result_type, value, 0);
+
+ xmlFree(status_code);
+ xmlXPathFreeObject(xpathObj);
+ xmlXPathFreeContext(xpathCtx);
+ xmlFreeDoc(doc);
+}
+
+
+static char *
+make_body(const char *method_name, abstract_value params[], int param_count)
+{
+ char buf[20];
+
+ xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
+ xmlNode *methodCall = xmlNewNode(NULL, BAD_CAST "methodCall");
+ xmlDocSetRootElement(doc, methodCall);
+
+ xmlNewChild(methodCall, NULL, BAD_CAST "methodName",
+ BAD_CAST method_name);
+
+ xmlNode *params_node =
+ xmlNewChild(methodCall, NULL, BAD_CAST "params", NULL);
+
+ for (int p = 0; p < param_count; p++)
+ {
+ abstract_value *v = params + p;
+ switch (v->type->typename)
+ {
+ case STRING:
+ add_param(params_node, "string", v->u.string_val);
+ break;
+
+ case INT:
+ snprintf(buf, sizeof(buf), "%"PRId64, v->u.int_val);
+ add_param(params_node, "string", buf);
+ break;
+
+ case FLOAT:
+ snprintf(buf, sizeof(buf), "%lf", v->u.double_val);
+ add_param(params_node, "double", buf);
+ break;
+
+ case BOOL:
+ add_param(params_node, "boolean", v->u.bool_val ? "1" : "0");
+ break;
+
+ case VOID:
+ add_param(params_node, "string", "");
+ break;
+
+ case ENUM:
+ add_param(params_node, "string",
+ v->type->enum_marshaller(v->u.enum_val));
+ break;
+
+ case STRUCT:
+ {
+ size_t member_count = v->type->member_count;
+
+ xmlNode *struct_node = add_param_struct(params_node);
+
+ for (size_t i = 0; i < member_count; i++)
+ {
+ const struct struct_member *mem = v->type->members + i;
+ const char *key = mem->key;
+ void *struct_value = v->u.struct_val;
+
+ add_struct_value(mem->type, struct_value + mem->offset,
+ add_struct_member, key, struct_node);
+ }
+ }
+ break;
+
+ default:
+ assert(false);
+ }
+ }
+
+ xmlBufferPtr buffer = xmlBufferCreate();
+ xmlSaveCtxtPtr save_ctxt =
+ xmlSaveToBuffer(buffer, NULL, XML_SAVE_NO_XHTML);
+
+ if (xmlSaveDoc(save_ctxt, doc) == -1)
+ {
+ return NULL;
+ }
+
+ xmlFreeDoc(doc);
+ xmlSaveClose(save_ctxt);
+ xmlChar *content = xmlStrdup(xmlBufferContent(buffer));
+ xmlBufferFree(buffer);
+ return (char *)content;
+}
+
+
+static void
+add_struct_value(const struct abstract_type *type, void *value,
+ void (*adder)(xmlNode *node, const char *key,
+ const char *type, const char *val),
+ const char *key, xmlNode *node)
+{
+ char buf[20];
+
+ switch (type->typename)
+ {
+ case REF:
+ case STRING:
+ {
+ char *val = *(char **)value;
+ if (val != NULL)
+ {
+ adder(node, key, "string", val);
+ }
+ }
+ break;
+
+ case INT:
+ {
+ uint64_t val = *(uint64_t *)value;
+ snprintf(buf, sizeof(buf), "%"PRId64, val);
+ adder(node, key, "string", buf);
+ }
+ break;
+
+ case FLOAT:
+ {
+ double val = *(double *)value;
+ snprintf(buf, sizeof(buf), "%lf", val);
+ adder(node, key, "double", buf);
+ }
+ break;
+
+ case BOOL:
+ {
+ bool val = *(bool *)value;
+ adder(node, key, "boolean", val ? "1" : "0");
+ }
+ break;
+
+ case ENUM:
+ {
+ int val = *(int *)value;
+ adder(node, key, "string", type->enum_marshaller(val));
+ }
+ break;
+
+ case SET:
+ {
+ const struct abstract_type *member_type = type->child;
+ size_t member_size = size_of_member(member_type);
+ arbitrary_set *set_val = *(arbitrary_set **)value;
+
+ if (set_val != NULL)
+ {
+ xmlNode *data_node = add_struct_array(node, key);
+
+ for (size_t i = 0; i < set_val->size; i++)
+ {
+ void *member_value = set_val->contents + (i * member_size);
+ add_struct_value(member_type, member_value,
+ add_unnamed_value, NULL, data_node);
+ }
+ }
+ }
+ break;
+
+ case STRUCT:
+ case MAP:
+ {
+ /* XXX Nested structures aren't supported yet, but
+ fortunately we don't need them, because we don't have
+ any "deep create" calls. This will need to be
+ fixed. We don't need maps either. */
+ }
+ break;
+
+ default:
+ assert(false);
+ }
+}
+
+
+static xmlNode *
+add_container(xmlNode *parent, const char *name)
+{
+ return xmlNewChild(parent, NULL, BAD_CAST name, NULL);
+}
+
+
+static void
+add_param(xmlNode *params_node, const char *type, const char *value)
+{
+ xmlNode *param_node = add_container(params_node, "param");
+ add_value(param_node, type, value);
+}
+
+
+static void
+add_value(xmlNode *parent, const char *type, const char *value)
+{
+ xmlNode *value_node = add_container(parent, "value");
+ xmlNewChild(value_node, NULL, BAD_CAST type, BAD_CAST value);
+}
+
+
+static void
+add_unnamed_value(xmlNode *parent, const char *name, const char *type,
+ const char *value)
+{
+ (void)name;
+ add_value(parent, type, value);
+}
+
+
+static xmlNode *
+add_param_struct(xmlNode *params_node)
+{
+ xmlNode *param_node = add_container(params_node, "param");
+ xmlNode *value_node = add_container(param_node, "value");
+
+ return xmlNewChild(value_node, NULL, BAD_CAST "struct", NULL);
+}
+
+
+static void
+add_struct_member(xmlNode *struct_node, const char *name, const char *type,
+ const char *value)
+{
+ xmlNode *member_node = add_container(struct_node, "member");
+
+ xmlNewChild(member_node, NULL, BAD_CAST "name", BAD_CAST name);
+
+ add_value(member_node, type, value);
+}
+
+
+static xmlNode *
+add_struct_array(xmlNode *struct_node, const char *name)
+{
+ xmlNode *member_node = add_container(struct_node, "member");
+
+ xmlNewChild(member_node, NULL, BAD_CAST "name", BAD_CAST name);
+
+ xmlNode *value_node = add_container(member_node, "value");
+ xmlNode *array_node = add_container(value_node, "array");
+
+ return add_container(array_node, "data");
+
+}
+
+
+int xen_enum_lookup_(xen_session *session, const char *str,
+ const char **lookup_table, int n)
+{
+ if (str != NULL)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ if (0 == strcmp(str, lookup_table[i]))
+ {
+ return i;
+ }
+ }
+ }
+
+ server_error_2(session, "Bad enum string", str);
+ return 0;
+}
+
+
+char *
+xen_strdup_(const char *in)
+{
+ char *result = malloc(strlen(in) + 1);
+ strcpy(result, in);
+ return result;
+}
+
+
+const abstract_type abstract_type_string = { .typename = STRING };
+const abstract_type abstract_type_int = { .typename = INT };
+const abstract_type abstract_type_float = { .typename = FLOAT };
+const abstract_type abstract_type_bool = { .typename = BOOL };
+const abstract_type abstract_type_datetime = { .typename = DATETIME };
+const abstract_type abstract_type_ref = { .typename = REF };
+
+const abstract_type abstract_type_string_set =
+ {
+ .typename = SET,
+ .child = &abstract_type_string
+ };
+
+const abstract_type abstract_type_ref_set =
+ {
+ .typename = SET,
+ .child = &abstract_type_ref
+ };
+
+static const struct struct_member string_string_members[] =
+{
+ {
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_string_string_map_contents, key)
+ },
+ {
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_string_string_map_contents, val)
+ }
+};
+const abstract_type abstract_type_string_string_map =
+ {
+ .typename = MAP,
+ .struct_size = sizeof(xen_string_string_map_contents),
+ .members = string_string_members
+ };
+
+static struct struct_member int_float_members[] =
+{
+ {
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_int_float_map_contents, key)
+ },
+ {
+ .type = &abstract_type_float,
+ .offset = offsetof(xen_int_float_map_contents, val)
+ }
+};
+const abstract_type abstract_type_int_float_map =
+ {
+ .typename = MAP,
+ .struct_size = sizeof(xen_int_float_map_contents),
+ .members = int_float_members
+ };
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_cpu_feature.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_cpu_feature.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <string.h>
+
+#include "xen_internal.h"
+#include "xen_cpu_feature.h"
+#include "xen_cpu_feature_internal.h"
+
+
+/*
+ * Maintain this in the same order as the enum declaration!
+ */
+static const char *lookup_table[] =
+{
+ "FPU",
+ "VME",
+ "DE",
+ "PSE",
+ "TSC",
+ "MSR",
+ "PAE",
+ "MCE",
+ "CX8",
+ "APIC",
+ "SEP",
+ "MTRR",
+ "PGE",
+ "MCA",
+ "CMOV",
+ "PAT",
+ "PSE36",
+ "PN",
+ "CLFLSH",
+ "DTES",
+ "ACPI",
+ "MMX",
+ "FXSR",
+ "XMM",
+ "XMM2",
+ "SELFSNOOP",
+ "HT",
+ "ACC",
+ "IA64",
+ "SYSCALL",
+ "MP",
+ "NX",
+ "MMXEXT",
+ "LM",
+ "3DNOWEXT",
+ "3DNOW",
+ "RECOVERY",
+ "LONGRUN",
+ "LRTI",
+ "CXMMX",
+ "K6_MTRR",
+ "CYRIX_ARR",
+ "CENTAUR_MCR",
+ "K8",
+ "K7",
+ "P3",
+ "P4",
+ "CONSTANT_TSC",
+ "FXSAVE_LEAK",
+ "XMM3",
+ "MWAIT",
+ "DSCPL",
+ "EST",
+ "TM2",
+ "CID",
+ "CX16",
+ "XTPR",
+ "XSTORE",
+ "XSTORE_EN",
+ "XCRYPT",
+ "XCRYPT_EN",
+ "LAHF_LM",
+ "CMP_LEGACY"
+};
+
+
+extern xen_cpu_feature_set *
+xen_cpu_feature_set_alloc(size_t size)
+{
+ return calloc(1, sizeof(xen_cpu_feature_set) +
+ size * sizeof(enum xen_cpu_feature));
+}
+
+
+extern void
+xen_cpu_feature_set_free(xen_cpu_feature_set *set)
+{
+ free(set);
+}
+
+
+const char *
+xen_cpu_feature_to_string(enum xen_cpu_feature val)
+{
+ return lookup_table[val];
+}
+
+
+extern enum xen_cpu_feature
+xen_cpu_feature_from_string(xen_session *session, const char *str)
+{
+ return ENUM_LOOKUP(session, str, lookup_table);
+}
+
+
+const abstract_type xen_cpu_feature_abstract_type_ =
+ {
+ .typename = ENUM,
+ .enum_marshaller =
+ (const char *(*)(int))&xen_cpu_feature_to_string,
+ .enum_demarshaller =
+ (int (*)(xen_session *, const char *))&xen_cpu_feature_from_string
+ };
+
+
+const abstract_type xen_cpu_feature_set_abstract_type_ =
+ {
+ .typename = SET,
+ .child = &xen_cpu_feature_abstract_type_
+ };
+
+
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_driver_type.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_driver_type.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <string.h>
+
+#include "xen_internal.h"
+#include "xen_driver_type.h"
+#include "xen_driver_type_internal.h"
+
+
+/*
+ * Maintain this in the same order as the enum declaration!
+ */
+static const char *lookup_table[] =
+{
+ "ioemu",
+ "paravirtualised"
+};
+
+
+extern xen_driver_type_set *
+xen_driver_type_set_alloc(size_t size)
+{
+ return calloc(1, sizeof(xen_driver_type_set) +
+ size * sizeof(enum xen_driver_type));
+}
+
+
+extern void
+xen_driver_type_set_free(xen_driver_type_set *set)
+{
+ free(set);
+}
+
+
+const char *
+xen_driver_type_to_string(enum xen_driver_type val)
+{
+ return lookup_table[val];
+}
+
+
+extern enum xen_driver_type
+xen_driver_type_from_string(xen_session *session, const char *str)
+{
+ return ENUM_LOOKUP(session, str, lookup_table);
+}
+
+
+const abstract_type xen_driver_type_abstract_type_ =
+ {
+ .typename = ENUM,
+ .enum_marshaller =
+ (const char *(*)(int))&xen_driver_type_to_string,
+ .enum_demarshaller =
+ (int (*)(xen_session *, const char *))&xen_driver_type_from_string
+ };
+
+
+const abstract_type xen_driver_type_set_abstract_type_ =
+ {
+ .typename = SET,
+ .child = &xen_driver_type_abstract_type_
+ };
+
+
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_host.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_host.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,350 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_host.h"
+#include "xen_host_cpu.h"
+#include "xen_internal.h"
+#include "xen_string_string_map.h"
+#include "xen_vm.h"
+
+
+XEN_FREE(xen_host)
+XEN_SET_ALLOC_FREE(xen_host)
+XEN_ALLOC(xen_host_record)
+XEN_SET_ALLOC_FREE(xen_host_record)
+XEN_ALLOC(xen_host_record_opt)
+XEN_RECORD_OPT_FREE(xen_host)
+XEN_SET_ALLOC_FREE(xen_host_record_opt)
+
+
+static const struct_member xen_host_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_host_record, uuid) },
+ { .key = "name_label",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_host_record, name_label) },
+ { .key = "name_description",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_host_record, name_description) },
+ { .key = "software_version",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_host_record, software_version) },
+ { .key = "resident_vms",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_host_record, resident_vms) },
+ { .key = "host_cpus",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_host_record, host_cpus) }
+ };
+
+const abstract_type xen_host_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_host_record),
+ .member_count =
+ sizeof(xen_host_record_struct_members) / sizeof(struct_member),
+ .members = xen_host_record_struct_members
+ };
+
+
+void
+xen_host_record_free(xen_host_record *record)
+{
+ free(record->handle);
+ free(record->uuid);
+ free(record->name_label);
+ free(record->name_description);
+ xen_string_string_map_free(record->software_version);
+ xen_vm_record_opt_set_free(record->resident_vms);
+ xen_host_cpu_record_opt_set_free(record->host_cpus);
+ free(record);
+}
+
+
+bool
+xen_host_get_record(xen_session *session, xen_host_record **result, xen_host
host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = xen_host_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("host.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_host_create(xen_session *session, xen_host *result, xen_host_record
*record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_host_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host.create");
+ return session->ok;
+}
+
+
+bool
+xen_host_get_by_name_label(xen_session *session, xen_host *result, char *label)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = label }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host.get_by_name_label");
+ return session->ok;
+}
+
+
+bool
+xen_host_get_name_label(xen_session *session, char **result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host.get_name_label");
+ return session->ok;
+}
+
+
+bool
+xen_host_get_name_description(xen_session *session, char **result, xen_host
host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host.get_name_description");
+ return session->ok;
+}
+
+
+bool
+xen_host_get_software_version(xen_session *session, xen_string_string_map
**result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("host.get_software_version");
+ return session->ok;
+}
+
+
+bool
+xen_host_get_resident_vms(xen_session *session, xen_vm *result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("host.get_resident_vms");
+ return session->ok;
+}
+
+
+bool
+xen_host_get_host_cpus(xen_session *session, xen_host_cpu *result, xen_host
host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("host.get_host_cpus");
+ return session->ok;
+}
+
+
+bool
+xen_host_set_name_label(xen_session *session, xen_host xen_host, char *label)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_host },
+ { .type = &abstract_type_string,
+ .u.string_val = label }
+ };
+
+ xen_call_(session, "host.set_name_label", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_set_name_description(xen_session *session, xen_host xen_host, char
*description)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_host },
+ { .type = &abstract_type_string,
+ .u.string_val = description }
+ };
+
+ xen_call_(session, "host.set_name_description", param_values, 2, NULL,
NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_disable(xen_session *session, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ xen_call_(session, "host.disable", param_values, 1, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_enable(xen_session *session, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ xen_call_(session, "host.enable", param_values, 1, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_shutdown(xen_session *session, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ xen_call_(session, "host.shutdown", param_values, 1, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_reboot(xen_session *session, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ xen_call_(session, "host.reboot", param_values, 1, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_host_get_all(xen_session *session, xen_host *result)
+{
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ xen_call_(session, "host.get_all", NULL, 0, &result_type, result);
+ return session->ok;
+}
+
+
+bool
+xen_host_get_uuid(xen_session *session, char **result, xen_host host)
+{
+ *result = session->ok ? xen_strdup_((char *)host) : NULL;
+ return session->ok;
+}
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_host_cpu.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_host_cpu.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_cpu_feature.h"
+#include "xen_cpu_feature_internal.h"
+#include "xen_host.h"
+#include "xen_host_cpu.h"
+#include "xen_internal.h"
+
+
+XEN_FREE(xen_host_cpu)
+XEN_SET_ALLOC_FREE(xen_host_cpu)
+XEN_ALLOC(xen_host_cpu_record)
+XEN_SET_ALLOC_FREE(xen_host_cpu_record)
+XEN_ALLOC(xen_host_cpu_record_opt)
+XEN_RECORD_OPT_FREE(xen_host_cpu)
+XEN_SET_ALLOC_FREE(xen_host_cpu_record_opt)
+
+
+static const struct_member xen_host_cpu_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_host_cpu_record, uuid) },
+ { .key = "host",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_host_cpu_record, host) },
+ { .key = "number",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_host_cpu_record, number) },
+ { .key = "features",
+ .type = &xen_cpu_feature_set_abstract_type_,
+ .offset = offsetof(xen_host_cpu_record, features) },
+ { .key = "utilisation",
+ .type = &abstract_type_float,
+ .offset = offsetof(xen_host_cpu_record, utilisation) }
+ };
+
+const abstract_type xen_host_cpu_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_host_cpu_record),
+ .member_count =
+ sizeof(xen_host_cpu_record_struct_members) / sizeof(struct_member),
+ .members = xen_host_cpu_record_struct_members
+ };
+
+
+void
+xen_host_cpu_record_free(xen_host_cpu_record *record)
+{
+ free(record->handle);
+ free(record->uuid);
+ xen_host_record_opt_free(record->host);
+ xen_cpu_feature_set_free(record->features);
+ free(record);
+}
+
+
+bool
+xen_host_cpu_get_record(xen_session *session, xen_host_cpu_record **result,
xen_host_cpu host_cpu)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_cpu }
+ };
+
+ abstract_type result_type = xen_host_cpu_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("host_cpu.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char
*uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host_cpu.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_host_cpu_create(xen_session *session, xen_host_cpu *result,
xen_host_cpu_record *record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_host_cpu_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host_cpu.create");
+ return session->ok;
+}
+
+
+bool
+xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu
host_cpu)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_cpu }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("host_cpu.get_host");
+ return session->ok;
+}
+
+
+bool
+xen_host_cpu_get_number(xen_session *session, uint64_t *result, xen_host_cpu
host_cpu)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_cpu }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("host_cpu.get_number");
+ return session->ok;
+}
+
+
+bool
+xen_host_cpu_get_features(xen_session *session, struct xen_cpu_feature_set
**result, xen_host_cpu host_cpu)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_cpu }
+ };
+
+ abstract_type result_type = xen_cpu_feature_set_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("host_cpu.get_features");
+ return session->ok;
+}
+
+
+bool
+xen_host_cpu_get_utilisation(xen_session *session, double *result,
xen_host_cpu host_cpu)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host_cpu }
+ };
+
+ abstract_type result_type = abstract_type_float;
+
+ XEN_CALL_("host_cpu.get_utilisation");
+ return session->ok;
+}
+
+
+bool
+xen_host_cpu_get_uuid(xen_session *session, char **result, xen_host_cpu
host_cpu)
+{
+ *result = session->ok ? xen_strdup_((char *)host_cpu) : NULL;
+ return session->ok;
+}
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_int_float_map.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_int_float_map.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "xen_common.h"
+#include "xen_int_float_map.h"
+#include "xen_internal.h"
+
+
+xen_int_float_map *
+xen_int_float_map_alloc(size_t size)
+{
+ return calloc(1, sizeof(xen_int_float_map) +
+ size * sizeof(struct xen_int_float_map_contents));
+}
+
+
+void
+xen_int_float_map_free(xen_int_float_map *map)
+{
+ free(map);
+}
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_network.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_network.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,398 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_internal.h"
+#include "xen_network.h"
+#include "xen_vif.h"
+
+
+XEN_FREE(xen_network)
+XEN_SET_ALLOC_FREE(xen_network)
+XEN_ALLOC(xen_network_record)
+XEN_SET_ALLOC_FREE(xen_network_record)
+XEN_ALLOC(xen_network_record_opt)
+XEN_RECORD_OPT_FREE(xen_network)
+XEN_SET_ALLOC_FREE(xen_network_record_opt)
+
+
+static const struct_member xen_network_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_network_record, uuid) },
+ { .key = "name_label",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_network_record, name_label) },
+ { .key = "name_description",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_network_record, name_description) },
+ { .key = "vifs",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_network_record, vifs) },
+ { .key = "nic",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_network_record, nic) },
+ { .key = "vlan",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_network_record, vlan) },
+ { .key = "default_gateway",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_network_record, default_gateway) },
+ { .key = "default_netmask",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_network_record, default_netmask) }
+ };
+
+const abstract_type xen_network_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_network_record),
+ .member_count =
+ sizeof(xen_network_record_struct_members) / sizeof(struct_member),
+ .members = xen_network_record_struct_members
+ };
+
+
+void
+xen_network_record_free(xen_network_record *record)
+{
+ free(record->handle);
+ free(record->uuid);
+ free(record->name_label);
+ free(record->name_description);
+ xen_vif_record_opt_set_free(record->vifs);
+ free(record->nic);
+ free(record->vlan);
+ free(record->default_gateway);
+ free(record->default_netmask);
+ free(record);
+}
+
+
+bool
+xen_network_get_record(xen_session *session, xen_network_record **result,
xen_network network)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = network }
+ };
+
+ abstract_type result_type = xen_network_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("network.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_network_get_by_uuid(xen_session *session, xen_network *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_network_create(xen_session *session, xen_network *result,
xen_network_record *record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_network_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.create");
+ return session->ok;
+}
+
+
+bool
+xen_network_get_by_name_label(xen_session *session, xen_network *result, char
*label)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = label }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.get_by_name_label");
+ return session->ok;
+}
+
+
+bool
+xen_network_get_name_label(xen_session *session, char **result, xen_network
network)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = network }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.get_name_label");
+ return session->ok;
+}
+
+
+bool
+xen_network_get_name_description(xen_session *session, char **result,
xen_network network)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = network }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.get_name_description");
+ return session->ok;
+}
+
+
+bool
+xen_network_get_vifs(xen_session *session, xen_vif *result, xen_network
network)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = network }
+ };
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("network.get_vifs");
+ return session->ok;
+}
+
+
+bool
+xen_network_get_nic(xen_session *session, char **result, xen_network network)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = network }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.get_nic");
+ return session->ok;
+}
+
+
+bool
+xen_network_get_vlan(xen_session *session, char **result, xen_network network)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = network }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.get_vlan");
+ return session->ok;
+}
+
+
+bool
+xen_network_get_default_gateway(xen_session *session, char **result,
xen_network network)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = network }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.get_default_gateway");
+ return session->ok;
+}
+
+
+bool
+xen_network_get_default_netmask(xen_session *session, char **result,
xen_network network)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = network }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("network.get_default_netmask");
+ return session->ok;
+}
+
+
+bool
+xen_network_set_name_label(xen_session *session, xen_network xen_network, char
*label)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_network },
+ { .type = &abstract_type_string,
+ .u.string_val = label }
+ };
+
+ xen_call_(session, "network.set_name_label", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_network_set_name_description(xen_session *session, xen_network
xen_network, char *description)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_network },
+ { .type = &abstract_type_string,
+ .u.string_val = description }
+ };
+
+ xen_call_(session, "network.set_name_description", param_values, 2, NULL,
NULL);
+ return session->ok;
+}
+
+
+bool
+xen_network_set_nic(xen_session *session, xen_network xen_network, char *nic)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_network },
+ { .type = &abstract_type_string,
+ .u.string_val = nic }
+ };
+
+ xen_call_(session, "network.set_nic", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_network_set_vlan(xen_session *session, xen_network xen_network, char *vlan)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_network },
+ { .type = &abstract_type_string,
+ .u.string_val = vlan }
+ };
+
+ xen_call_(session, "network.set_vlan", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_network_set_default_gateway(xen_session *session, xen_network xen_network,
char *default_gateway)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_network },
+ { .type = &abstract_type_string,
+ .u.string_val = default_gateway }
+ };
+
+ xen_call_(session, "network.set_default_gateway", param_values, 2, NULL,
NULL);
+ return session->ok;
+}
+
+
+bool
+xen_network_set_default_netmask(xen_session *session, xen_network xen_network,
char *default_netmask)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_network },
+ { .type = &abstract_type_string,
+ .u.string_val = default_netmask }
+ };
+
+ xen_call_(session, "network.set_default_netmask", param_values, 2, NULL,
NULL);
+ return session->ok;
+}
+
+
+bool
+xen_network_get_all(xen_session *session, xen_network *result)
+{
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ xen_call_(session, "network.get_all", NULL, 0, &result_type, result);
+ return session->ok;
+}
+
+
+bool
+xen_network_get_uuid(xen_session *session, char **result, xen_network network)
+{
+ *result = session->ok ? xen_strdup_((char *)network) : NULL;
+ return session->ok;
+}
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_on_crash_behaviour.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_on_crash_behaviour.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <string.h>
+
+#include "xen_internal.h"
+#include "xen_on_crash_behaviour.h"
+#include "xen_on_crash_behaviour_internal.h"
+
+
+/*
+ * Maintain this in the same order as the enum declaration!
+ */
+static const char *lookup_table[] =
+{
+ "destroy",
+ "coredump_and_destroy",
+ "restart",
+ "coredump_and_restart",
+ "preserve",
+ "rename_restart"
+};
+
+
+extern xen_on_crash_behaviour_set *
+xen_on_crash_behaviour_set_alloc(size_t size)
+{
+ return calloc(1, sizeof(xen_on_crash_behaviour_set) +
+ size * sizeof(enum xen_on_crash_behaviour));
+}
+
+
+extern void
+xen_on_crash_behaviour_set_free(xen_on_crash_behaviour_set *set)
+{
+ free(set);
+}
+
+
+const char *
+xen_on_crash_behaviour_to_string(enum xen_on_crash_behaviour val)
+{
+ return lookup_table[val];
+}
+
+
+extern enum xen_on_crash_behaviour
+xen_on_crash_behaviour_from_string(xen_session *session, const char *str)
+{
+ return ENUM_LOOKUP(session, str, lookup_table);
+}
+
+
+const abstract_type xen_on_crash_behaviour_abstract_type_ =
+ {
+ .typename = ENUM,
+ .enum_marshaller =
+ (const char *(*)(int))&xen_on_crash_behaviour_to_string,
+ .enum_demarshaller =
+ (int (*)(xen_session *, const char
*))&xen_on_crash_behaviour_from_string
+ };
+
+
+const abstract_type xen_on_crash_behaviour_set_abstract_type_ =
+ {
+ .typename = SET,
+ .child = &xen_on_crash_behaviour_abstract_type_
+ };
+
+
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_on_normal_exit.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_on_normal_exit.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <string.h>
+
+#include "xen_internal.h"
+#include "xen_on_normal_exit.h"
+#include "xen_on_normal_exit_internal.h"
+
+
+/*
+ * Maintain this in the same order as the enum declaration!
+ */
+static const char *lookup_table[] =
+{
+ "destroy",
+ "restart"
+};
+
+
+extern xen_on_normal_exit_set *
+xen_on_normal_exit_set_alloc(size_t size)
+{
+ return calloc(1, sizeof(xen_on_normal_exit_set) +
+ size * sizeof(enum xen_on_normal_exit));
+}
+
+
+extern void
+xen_on_normal_exit_set_free(xen_on_normal_exit_set *set)
+{
+ free(set);
+}
+
+
+const char *
+xen_on_normal_exit_to_string(enum xen_on_normal_exit val)
+{
+ return lookup_table[val];
+}
+
+
+extern enum xen_on_normal_exit
+xen_on_normal_exit_from_string(xen_session *session, const char *str)
+{
+ return ENUM_LOOKUP(session, str, lookup_table);
+}
+
+
+const abstract_type xen_on_normal_exit_abstract_type_ =
+ {
+ .typename = ENUM,
+ .enum_marshaller =
+ (const char *(*)(int))&xen_on_normal_exit_to_string,
+ .enum_demarshaller =
+ (int (*)(xen_session *, const char
*))&xen_on_normal_exit_from_string
+ };
+
+
+const abstract_type xen_on_normal_exit_set_abstract_type_ =
+ {
+ .typename = SET,
+ .child = &xen_on_normal_exit_abstract_type_
+ };
+
+
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_sr.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_sr.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_internal.h"
+#include "xen_sr.h"
+#include "xen_vdi.h"
+
+
+XEN_FREE(xen_sr)
+XEN_SET_ALLOC_FREE(xen_sr)
+XEN_ALLOC(xen_sr_record)
+XEN_SET_ALLOC_FREE(xen_sr_record)
+XEN_ALLOC(xen_sr_record_opt)
+XEN_RECORD_OPT_FREE(xen_sr)
+XEN_SET_ALLOC_FREE(xen_sr_record_opt)
+
+
+static const struct_member xen_sr_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_sr_record, uuid) },
+ { .key = "name_label",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_sr_record, name_label) },
+ { .key = "name_description",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_sr_record, name_description) },
+ { .key = "vdis",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_sr_record, vdis) },
+ { .key = "virtual_allocation",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_sr_record, virtual_allocation) },
+ { .key = "physical_utilisation",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_sr_record, physical_utilisation) },
+ { .key = "physical_size",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_sr_record, physical_size) },
+ { .key = "type",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_sr_record, type) },
+ { .key = "location",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_sr_record, location) }
+ };
+
+const abstract_type xen_sr_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_sr_record),
+ .member_count =
+ sizeof(xen_sr_record_struct_members) / sizeof(struct_member),
+ .members = xen_sr_record_struct_members
+ };
+
+
+void
+xen_sr_record_free(xen_sr_record *record)
+{
+ free(record->handle);
+ free(record->uuid);
+ free(record->name_label);
+ free(record->name_description);
+ xen_vdi_record_opt_set_free(record->vdis);
+ free(record->type);
+ free(record->location);
+ free(record);
+}
+
+
+bool
+xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = xen_sr_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("SR.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_by_uuid(xen_session *session, xen_sr *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("SR.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_sr_create(xen_session *session, xen_sr *result, xen_sr_record *record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_sr_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("SR.create");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_by_name_label(xen_session *session, xen_sr *result, char *label)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = label }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("SR.get_by_name_label");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("SR.get_name_label");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("SR.get_name_description");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_vdis(xen_session *session, xen_vdi *result, xen_sr sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("SR.get_vdis");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_virtual_allocation(xen_session *session, uint64_t *result, xen_sr
sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("SR.get_virtual_allocation");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_physical_utilisation(xen_session *session, uint64_t *result, xen_sr
sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("SR.get_physical_utilisation");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_physical_size(xen_session *session, uint64_t *result, xen_sr sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("SR.get_physical_size");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_type(xen_session *session, char **result, xen_sr sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("SR.get_type");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_location(xen_session *session, char **result, xen_sr sr)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("SR.get_location");
+ return session->ok;
+}
+
+
+bool
+xen_sr_set_name_label(xen_session *session, xen_sr xen_sr, char *label)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_sr },
+ { .type = &abstract_type_string,
+ .u.string_val = label }
+ };
+
+ xen_call_(session, "SR.set_name_label", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_sr_set_name_description(xen_session *session, xen_sr xen_sr, char
*description)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_sr },
+ { .type = &abstract_type_string,
+ .u.string_val = description }
+ };
+
+ xen_call_(session, "SR.set_name_description", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_sr_clone(xen_session *session, xen_sr *result, xen_sr sr, char *loc, char
*name)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = sr },
+ { .type = &abstract_type_string,
+ .u.string_val = loc },
+ { .type = &abstract_type_string,
+ .u.string_val = name }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("SR.clone");
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_all(xen_session *session, xen_sr *result)
+{
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ xen_call_(session, "SR.get_all", NULL, 0, &result_type, result);
+ return session->ok;
+}
+
+
+bool
+xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr)
+{
+ *result = session->ok ? xen_strdup_((char *)sr) : NULL;
+ return session->ok;
+}
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_string_string_map.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_string_string_map.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "xen_common.h"
+#include "xen_internal.h"
+#include "xen_string_string_map.h"
+
+
+xen_string_string_map *
+xen_string_string_map_alloc(size_t size)
+{
+ return calloc(1, sizeof(xen_string_string_map) +
+ size * sizeof(struct xen_string_string_map_contents));
+}
+
+
+void
+xen_string_string_map_free(xen_string_string_map *map)
+{
+ if (map == NULL)
+ {
+ return;
+ }
+
+ size_t n = map->size;
+ for (size_t i = 0; i < n; i++)
+ {
+ free(map->contents[i].key);
+ free(map->contents[i].val);
+ }
+
+ free(map);
+}
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_user.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_user.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_internal.h"
+#include "xen_user.h"
+
+
+XEN_FREE(xen_user)
+XEN_SET_ALLOC_FREE(xen_user)
+XEN_ALLOC(xen_user_record)
+XEN_SET_ALLOC_FREE(xen_user_record)
+XEN_ALLOC(xen_user_record_opt)
+XEN_RECORD_OPT_FREE(xen_user)
+XEN_SET_ALLOC_FREE(xen_user_record_opt)
+
+
+static const struct_member xen_user_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_user_record, uuid) },
+ { .key = "short_name",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_user_record, short_name) },
+ { .key = "fullname",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_user_record, fullname) }
+ };
+
+const abstract_type xen_user_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_user_record),
+ .member_count =
+ sizeof(xen_user_record_struct_members) / sizeof(struct_member),
+ .members = xen_user_record_struct_members
+ };
+
+
+void
+xen_user_record_free(xen_user_record *record)
+{
+ free(record->handle);
+ free(record->uuid);
+ free(record->short_name);
+ free(record->fullname);
+ free(record);
+}
+
+
+bool
+xen_user_get_record(xen_session *session, xen_user_record **result, xen_user
user)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = user }
+ };
+
+ abstract_type result_type = xen_user_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("user.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_user_get_by_uuid(xen_session *session, xen_user *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("user.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_user_create(xen_session *session, xen_user *result, xen_user_record
*record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_user_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("user.create");
+ return session->ok;
+}
+
+
+bool
+xen_user_get_short_name(xen_session *session, char **result, xen_user user)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = user }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("user.get_short_name");
+ return session->ok;
+}
+
+
+bool
+xen_user_get_fullname(xen_session *session, char **result, xen_user user)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = user }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("user.get_fullname");
+ return session->ok;
+}
+
+
+bool
+xen_user_set_fullname(xen_session *session, xen_user xen_user, char *fullname)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_user },
+ { .type = &abstract_type_string,
+ .u.string_val = fullname }
+ };
+
+ xen_call_(session, "user.set_fullname", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_user_get_uuid(xen_session *session, char **result, xen_user user)
+{
+ *result = session->ok ? xen_strdup_((char *)user) : NULL;
+ return session->ok;
+}
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_vbd.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_vbd.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,350 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_driver_type_internal.h"
+#include "xen_internal.h"
+#include "xen_vbd.h"
+#include "xen_vbd_mode_internal.h"
+#include "xen_vdi.h"
+#include "xen_vm.h"
+
+
+XEN_FREE(xen_vbd)
+XEN_SET_ALLOC_FREE(xen_vbd)
+XEN_ALLOC(xen_vbd_record)
+XEN_SET_ALLOC_FREE(xen_vbd_record)
+XEN_ALLOC(xen_vbd_record_opt)
+XEN_RECORD_OPT_FREE(xen_vbd)
+XEN_SET_ALLOC_FREE(xen_vbd_record_opt)
+
+
+static const struct_member xen_vbd_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vbd_record, uuid) },
+ { .key = "vm",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vbd_record, vm) },
+ { .key = "vdi",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vbd_record, vdi) },
+ { .key = "device",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vbd_record, device) },
+ { .key = "mode",
+ .type = &xen_vbd_mode_abstract_type_,
+ .offset = offsetof(xen_vbd_record, mode) },
+ { .key = "driver",
+ .type = &xen_driver_type_abstract_type_,
+ .offset = offsetof(xen_vbd_record, driver) },
+ { .key = "io_bandwidth_incoming_kbs",
+ .type = &abstract_type_float,
+ .offset = offsetof(xen_vbd_record, io_bandwidth_incoming_kbs) },
+ { .key = "io_bandwidth_outgoing_kbs",
+ .type = &abstract_type_float,
+ .offset = offsetof(xen_vbd_record, io_bandwidth_outgoing_kbs) }
+ };
+
+const abstract_type xen_vbd_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_vbd_record),
+ .member_count =
+ sizeof(xen_vbd_record_struct_members) / sizeof(struct_member),
+ .members = xen_vbd_record_struct_members
+ };
+
+
+void
+xen_vbd_record_free(xen_vbd_record *record)
+{
+ free(record->handle);
+ free(record->uuid);
+ xen_vm_record_opt_free(record->vm);
+ xen_vdi_record_opt_free(record->vdi);
+ free(record->device);
+ free(record);
+}
+
+
+bool
+xen_vbd_get_record(xen_session *session, xen_vbd_record **result, xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = xen_vbd_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("VBD.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_by_uuid(xen_session *session, xen_vbd *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VBD.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_vbd_create(xen_session *session, xen_vbd *result, xen_vbd_record *record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_vbd_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VBD.create");
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VBD.get_vm");
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_vdi(xen_session *session, xen_vdi *result, xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VBD.get_vdi");
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VBD.get_device");
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = xen_vbd_mode_abstract_type_;
+ char *result_str = NULL;
+ XEN_CALL_("VBD.get_mode");
+ *result = xen_vbd_mode_from_string(session, result_str);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd
vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = xen_driver_type_abstract_type_;
+ char *result_str = NULL;
+ XEN_CALL_("VBD.get_driver");
+ *result = xen_driver_type_from_string(session, result_str);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_io_bandwidth_incoming_kbs(xen_session *session, double *result,
xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = abstract_type_float;
+
+ XEN_CALL_("VBD.get_io_bandwidth_incoming_kbs");
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_io_bandwidth_outgoing_kbs(xen_session *session, double *result,
xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = abstract_type_float;
+
+ XEN_CALL_("VBD.get_io_bandwidth_outgoing_kbs");
+ return session->ok;
+}
+
+
+bool
+xen_vbd_set_vm(xen_session *session, xen_vbd xen_vbd, xen_vm vm)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_vbd },
+ { .type = &abstract_type_string,
+ .u.string_val = vm }
+ };
+
+ xen_call_(session, "VBD.set_vm", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_set_vdi(xen_session *session, xen_vbd xen_vbd, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_vbd },
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ xen_call_(session, "VBD.set_vdi", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_set_device(xen_session *session, xen_vbd xen_vbd, char *device)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_vbd },
+ { .type = &abstract_type_string,
+ .u.string_val = device }
+ };
+
+ xen_call_(session, "VBD.set_device", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_set_mode(xen_session *session, xen_vbd xen_vbd, enum xen_vbd_mode mode)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_vbd },
+ { .type = &xen_vbd_mode_abstract_type_,
+ .u.string_val = xen_vbd_mode_to_string(mode) }
+ };
+
+ xen_call_(session, "VBD.set_mode", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_set_driver(xen_session *session, xen_vbd xen_vbd, enum xen_driver_type
driver)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = xen_vbd },
+ { .type = &xen_driver_type_abstract_type_,
+ .u.string_val = xen_driver_type_to_string(driver) }
+ };
+
+ xen_call_(session, "VBD.set_driver", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd)
+{
+ *result = session->ok ? xen_strdup_((char *)vbd) : NULL;
+ return session->ok;
+}
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_vbd_mode.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_vbd_mode.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <string.h>
+
+#include "xen_internal.h"
+#include "xen_vbd_mode.h"
+#include "xen_vbd_mode_internal.h"
+
+
+/*
+ * Maintain this in the same order as the enum declaration!
+ */
+static const char *lookup_table[] =
+{
+ "RO",
+ "RW"
+};
+
+
+extern xen_vbd_mode_set *
+xen_vbd_mode_set_alloc(size_t size)
+{
+ return calloc(1, sizeof(xen_vbd_mode_set) +
+ size * sizeof(enum xen_vbd_mode));
+}
+
+
+extern void
+xen_vbd_mode_set_free(xen_vbd_mode_set *set)
+{
+ free(set);
+}
+
+
+const char *
+xen_vbd_mode_to_string(enum xen_vbd_mode val)
+{
+ return lookup_table[val];
+}
+
+
+extern enum xen_vbd_mode
+xen_vbd_mode_from_string(xen_session *session, const char *str)
+{
+ return ENUM_LOOKUP(session, str, lookup_table);
+}
+
+
+const abstract_type xen_vbd_mode_abstract_type_ =
+ {
+ .typename = ENUM,
+ .enum_marshaller =
+ (const char *(*)(int))&xen_vbd_mode_to_string,
+ .enum_demarshaller =
+ (int (*)(xen_session *, const char *))&xen_vbd_mode_from_string
+ };
+
+
+const abstract_type xen_vbd_mode_set_abstract_type_ =
+ {
+ .typename = SET,
+ .child = &xen_vbd_mode_abstract_type_
+ };
+
+
diff -r 9e0b024a1696 -r c75716820107 tools/libxen/src/xen_vdi.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_vdi.c Sat Oct 07 18:22:09 2006 +0100
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 2006, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_internal.h"
+#include "xen_sr.h"
+#include "xen_vbd.h"
+#include "xen_vdi.h"
+#include "xen_vdi_type_internal.h"
+
+
+XEN_FREE(xen_vdi)
+XEN_SET_ALLOC_FREE(xen_vdi)
+XEN_ALLOC(xen_vdi_record)
+XEN_SET_ALLOC_FREE(xen_vdi_record)
+XEN_ALLOC(xen_vdi_record_opt)
+XEN_RECORD_OPT_FREE(xen_vdi)
+XEN_SET_ALLOC_FREE(xen_vdi_record_opt)
+
+
+static const struct_member xen_vdi_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vdi_record, uuid) },
+ { .key = "name_label",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vdi_record, name_label) },
+ { .key = "name_description",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vdi_record, name_description) },
+ { .key = "sr",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vdi_record, sr) },
+ { .key = "vbds",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_vdi_record, vbds) },
+ { .key = "virtual_size",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_vdi_record, virtual_size) },
+ { .key = "physical_utilisation",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_vdi_record, physical_utilisation) },
+ { .key = "sector_size",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_vdi_record, sector_size) },
+ { .key = "type",
+ .type = &xen_vdi_type_abstract_type_,
+ .offset = offsetof(xen_vdi_record, type) },
+ { .key = "parent",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vdi_record, parent) },
+ { .key = "children",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_vdi_record, children) },
+ { .key = "sharable",
+ .type = &abstract_type_bool,
+ .offset = offsetof(xen_vdi_record, sharable) },
+ { .key = "read_only",
+ .type = &abstract_type_bool,
+ .offset = offsetof(xen_vdi_record, read_only) }
+ };
+
+const abstract_type xen_vdi_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_vdi_record),
+ .member_count =
+ sizeof(xen_vdi_record_struct_members) / sizeof(struct_member),
+ .members = xen_vdi_record_struct_members
+ };
+
+
+void
+xen_vdi_record_free(xen_vdi_record *record)
+{
+ free(record->handle);
+ free(record->uuid);
+ free(record->name_label);
+ free(record->name_description);
+ xen_sr_record_opt_free(record->sr);
+ xen_vbd_record_opt_set_free(record->vbds);
+ xen_vdi_record_opt_free(record->parent);
+ xen_vdi_record_opt_set_free(record->children);
+ free(record);
+}
+
+
+bool
+xen_vdi_get_record(xen_session *session, xen_vdi_record **result, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = xen_vdi_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("VDI.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_by_uuid(xen_session *session, xen_vdi *result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VDI.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_create(xen_session *session, xen_vdi *result, xen_vdi_record *record)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &xen_vdi_record_abstract_type_,
+ .u.struct_val = record }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VDI.create");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_by_name_label(xen_session *session, xen_vdi *result, char *label)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = label }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VDI.get_by_name_label");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_name_label(xen_session *session, char **result, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VDI.get_name_label");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_name_description(xen_session *session, char **result, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VDI.get_name_description");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_sr(xen_session *session, xen_sr *result, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VDI.get_sr");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_vbds(xen_session *session, xen_vbd *result, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("VDI.get_vbds");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_virtual_size(xen_session *session, uint64_t *result, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("VDI.get_virtual_size");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_physical_utilisation(xen_session *session, uint64_t *result,
xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("VDI.get_physical_utilisation");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_sector_size(xen_session *session, uint64_t *result, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("VDI.get_sector_size");
+ return session->ok;
+}
+
+
+bool
+xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vdi }
+ };
+
+ abstract_type result_type = xen_vdi_type_abstract_type_;
+ char *result_str = NULL;
+ XEN_CALL_("VDI.get_type");
+ *result = xen_vdi_type_from_string(session, result_str);
+ return session->ok;
+}
+
+
+bool
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|