From: Richard W.M. Jones <"Richard W.M. Jones "> Date: Wed, 16 Apr 2008 12:43:00 +0000 (+0100) Subject: Initial import from old virt-top repository. X-Git-Tag: 0.6.1.1~45 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=9b1c8e53eaa6fb79ee801e3014793618b977857d;p=ocaml-libvirt.git Initial import from old virt-top repository. --- 9b1c8e53eaa6fb79ee801e3014793618b977857d diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..f78c6f6 --- /dev/null +++ b/.hgignore @@ -0,0 +1,46 @@ +syntax: glob +META +ocaml-libvirt-*.tar.gz +ocaml-libvirt-*.exe +html +configure +config.log +config.status +config.h +config.cache +Makefile +Make.rules +*/Makefile +autom4te.cache +core +core.* +*.cmi +*.cmo +*.cmx +*.cma +*.cmxa +*.o +*.so +*.a +*.opt +*.dll +*.exe +*~ +libvirt/libvirt_version.ml +examples/list_domains +examples/node_info +mlvirsh/mlvirsh +virt-ctrl/virt-ctrl +virt-top/virt-top +virt-df/virt-df +wininstaller.nsis +*.orig +mlvirsh/mlvirsh_gettext.ml +virt-ctrl/virt_ctrl_gettext.ml +virt-df/virt_df_gettext.ml +virt-top/virt_top_gettext.ml +po/*.mo +po/*.po.bak +virt-df/virt_df_lvm2_lexer.ml +virt-df/virt_df_lvm2_parser.ml +virt-df/virt_df_lvm2_parser.mli \ No newline at end of file diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..e77696a --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, 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 or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +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 give any other recipients of the Program a copy of this License +along with the Program. + +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 Program or any portion +of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +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 Program, 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 Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) 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; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, 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 executable. However, as a +special exception, the source code 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. + +If distribution of executable or 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 counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program 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. + + 5. 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 Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program 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 to +this License. + + 7. 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 Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program 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 Program. + +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. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program 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. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 Program +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 Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, 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 + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), 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 Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. 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. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/COPYING.LIB b/COPYING.LIB new file mode 100644 index 0000000..ba2be48 --- /dev/null +++ b/COPYING.LIB @@ -0,0 +1,515 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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. +^L + 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. +^L + 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. +^L + 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. +^L + 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. +^L + 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. +^L + 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. +^L + 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 +^L + 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. + + + + Copyright (C) + + 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..c03dcd2 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,243 @@ +2008-01-20 Richard Jones + + Fix Volume.lookup_by_key and Volume.lookup_by_path + * libvirt/libvirt.mli, libvirt/libvirt.ml: These functions take + a connection object, not a pool, as first parameter. + + Version 0.4.0.2 released. + +2008-01-18 Richard Jones + + Move to autogeneration of many C bindings. + * configure.ac, libvirt/libvirt_c.c, libvirt/generator.pl: Many + C bindings can now be autogenerated using a Perl script. + Also includes preliminary support for the experimental + storage API. + +2008-01-08 Richard Jones + + Get node_info just once for each connection. + * vc_connections.ml: Get node_info just once for each connection, + which is more efficient. + * vc_connections.mli: Tidy up. + + Type Vc_domain_ops.dops_callback_fn for clarity. + * virt-ctrl/vc_domain_ops.mli, virt-ctrl/vc_domain_ops.ml, + virt-ctrl/vc_mainwindow.mli: Give a type name to the domain_ops + callback type, for extra clarity. + + Change comments virt-manager -> virt-ctrl. + * virt-ctrl/*.ml, virt-ctrl/*.mli: Change comments virt-manager -> + virt-ctrl. + + Move programming information to libvirt generated doc. + * README, libvirt/libvirt.mli: Moved programming information to + libvirt generated documentation, greatly expanded examples and + other issues. + * examples/Makefile.in, examples/node_info.ml, examples/.depend: + Added node_info example program. + * .hgignore, Makefile.in: Ignore, clean up node_info binary. + * examples/list_domains.ml: Make a read-only connection. + + Clean up *.exe files. + * Makefile.in: Clean up *.exe files. + + Version 0.4.0.1 released. + * Makefile.in: Provide a 'winupload' target. + + Rename some dialogs in virt-ctrl. + * virt-ctrl/vc_mainwindow.ml: Fix some "virtual machine manager" -> + "virt-ctrl" dialogs in main window. + + Fix bad paths in wininstaller.nsis.in. + * wininstaller.nsis.in: + * .hgignore: Ignore *.orig files. + + Fix native virt-ctrl on Windows. + * virt-ctrl/Makefile.in, virt-ctrl/mingw-gcc-wrapper.ml: Wrapper + around 'gcc' to fix native virt-ctrl builds on Windows/MinGW. + * .hgignore: Ignore *.exe files. + +2008-01-07 Richard Jones + + Updated MANIFEST. + * MANIFEST: Bring the MANIFEST file up to date. + + mlvirtmanager renamed as virt-ctrl. + * .hgignore, Makefile.in, configure.ac: Rename + mlvirtmanager as virt-ctrl to avoid any confusion with + the real virt-manager. + * mlvirtmanager/, virt-ctrl/: Subdirectory moved. + * README: Supporting documentation updated. + + Include mlvirtmanager in the Windows installer. + * wininstaller.nsis.in: Include mlvirtmanager in the Windows + installer. + * Makefile.in: Re-enable native code builds for Windows installer. + * mlvirtmanager/Makefile.in: Pass $(LDFLAGS) when building on + Windows - you need to specify the location of $GTK/lib. + + Bundle Gtk DLLs and support files in the Windows installer. + * configure.ac: Detect library paths instead of hard- + coding them. + * wininstaller.nsis (removed): This file is now autogenerated. + * wininstaller.nsis.in: Bundle Gtk DLLs and support files. + * Makefile.in: More verbose messages from NSIS. + + Include required libraries in the Windows installer. + * wininstaller.nsis: Include *.dll files. + + Windows installer. + * Makefile.in, configure.ac: Add --with-nsis[=path/to/nsis] and + call out to 'makensis.exe'. + * wininstaller.nsis, winlicense.rtf: Configuration and support + files for NSIS-based Windows installer. + * README: Update documentation to reflect. + +2008-01-05 Richard Jones + + mlvirtmanager compiles and runs on Windows (MinGW). + * configure.ac: Directories to search for optional modules were + specified incorrectly - fixed. + * mlvirtmanager/Makefile.in: Changed so can build without + ocamlfind, and checked it can build on Windows. + + mlvirsh can compile without extlib + * mlvirsh/mlvirsh.ml: mlvirsh only needed three functions from + extlib, so copy them in here to avoid the dependency. + * configure.ac: No dependency on extlib for mlvirsh. + * mlvirsh/Makefile.in: Changed so can build without ocamlfind. + * README: Updated documentation. + + Update documentation for Windows. + * README: Update documentation for Windows. + + Build libvirt and examples on Windows (MinGW). + * aclocal.m4: Add AC_CHECK_OCAML_MODULE to check for OCaml + modules directly (without ocamlfind being needed). + * configure.ac: Remove requirement for ocamlfind. + * config.guess, config.sub: Ship these files to guess host, + build and target. + * libvirt/Makefile.in, examples/Makefile.in: Change these + so they don't require ocamlfind, do the right thing on MinGW. + * Make.rules.in: Make.rules is now generated from this file. + File can use ocamlfind or direct ocaml commands as available. + * .hgignore: Ignore some generated files on Windows. + +2008-01-04 Richard Jones + + Make extlib an optional dependency. + * Makefile.in, README, configure.ac, examples/Makefile.in, + libvirt/Makefile.in, mlvirtmanager/Makefile.in: Much code + doesn't really need extlib, so make it optional. + Bail earlier in configure step if we don't have ocamlfind. + +2007-12-20 Richard Jones + + * libvirt/libvirt_c.c: Use enter/leave_blocking_section around + synchronous libvirt API calls, so that multithreaded OCaml + programs can be used. + * configure.ac: Version 0.4.0.0 for release. + * libvirt/libvirt.ml, libvirt/libvirt.mli, libvirt/libvirt_c.c: + Change the ad-hoc "foo not supported" exception into a + specific Libvirt.Not_supported "foo" exception. + * virt-top/virt_top.ml: Change virt-top to understand new + exception type. + +2007-11-20 Richard Jones + + * libvirt/libvirt.mli, libvirt/libvirt.ml: New error numbers + in base libvirt. + * libvirt/libvirt_c.c: Gracefully handle the case where libvirt + throws an error number we have not heard of before (eg. when + dynamic linking with newer libvirt). + * configure.ac: Check exists. + * configure.ac: Version 0.3.3.4. + * virt-top/virt-top.pod: Fixed ocaml libvirt website URI in manpage. + +2007-11-19 Richard Jones + + * virt-top/virt-top.pod: Example connection URIs in virt-top manpage + (bug 390691). + +2007-11-14 Richard Jones + + * libvirt/libvirt.mli: Added filename = string type to clarify + some function signatures which take a filename. Added lots + of function documentation. + * libvirt/libvirt.ml: Added VIR_FROM_OPENVZ. + * configure.ac: Version 0.3.3.3 for release. + +2007-11-14 Richard Jones + + * Makefile.in: New rules for releasing and uploading. + +2007-11-14 Richard Jones + + * libvirt/libvirt.mli, libvirt/libvirt.ml, libvirt/libvirt_c.c: + Added support for virNodeGetFreeMemory and virNodeGetCellsFreeMemory + * mlvirsh/mlvirsh.ml: Added 'freecell' command. + +2007-10-19 Richard Jones + + * virt-top/virt_top_calendar.ml: Added --end-time option. + Extra optional dep on ocaml-calendar. + * virt-top/virt-top.pod: Document how to compress and split + CSV files. Document --end-time option and time formats. + * virt-top/virt_top.ml: Allow sub-second delays when in batch + and script mode. + * virt-top/virt_top_utils.mli, virt-top/virt_top.mli: Reorganise + the code and add some interfaces. + +2007-10-17 Richard Jones + + * virt-top/virt_top.ml: Added --script option. + * virt-top/virt_top.ml: Log domain data to CSV file. + * virt-top/virt_top.ml: Added --no-csv-cpu, --no-csv-block and + --no-csv-net flags. + * virt-top/*.ml: Much code clean-up and restructuring. + * *: Added GNU GPL/LGPL copyright messages to all files. + +2007-09-27 Richard Jones + + * configure.ac: Changed version to 0.3.2.9. + * Makefile.in: Re-enable virt-df. + * virt-df/virt_df*.ml: Mostly finished off the core of virt-df. + Ext2/3 support. No LVM as yet. + * virt-df/README: Added README file. + +2007-09-24 Richard Jones + + * configure.ac: Version 0.3.2.8 for release. + * virt-top/virt-top.ml, virt-top/virt-top.pod: Support for + $HOME/.virt-toprc init file, modelled after top. + * virt-top/virt_top_utils.ml: Split out string utilities + into a separate file. + +2007-09-20 Richard Jones + + * virt-top/virt_top.ml: qemu:/// URIs (and others) don't support + virConnectGetHostname. Catch this exception. + + * Makefile.in: Disable virt-df in this release until I have + time to fix it properly. + * Makefile.in: Fix 'check-manifest' rule. Added 'make release'. + * MANIFEST: Updated MANIFEST. + +2007-09-19 Richard Jones + + * virt-top/virt_top.ml: Ignore transient error from + C.num_of_defined_domains when it cannot contact xend; that + was causing virt-top to exit when xend was restarted. + +2007-09-18 Richard Jones + + * virt-df/virt_df.ml: Handle domains with partition-backed + block devices. + + * virt-top/virt_top.ml: Don't fail on older libvirt which would + give an error if list_domains or list_defined_domains was called + with n = 0. + + * ChangeLog: Start tracking changes. + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..62bab23 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,43 @@ +aclocal.m4 +ChangeLog +config.guess +config.h.in +config.sub +configure.ac +COPYING +COPYING.LIB +examples/.depend +examples/list_domains.ml +examples/node_info.ml +examples/Makefile.in +.hgignore +install-sh +libvirt/.depend +libvirt/generator.pl +libvirt/libvirt_c.c +libvirt/libvirt_c_epilogue.c +libvirt/libvirt_c_oneoffs.c +libvirt/libvirt_c_prologue.c +libvirt/libvirt.ml +libvirt/libvirt.mli +libvirt/libvirt_version.ml.in +libvirt/libvirt_version.mli +libvirt/Makefile.in +libvirt/README +Makefile.in +Make.rules.in +MANIFEST +META.in +mlvirsh/.depend +mlvirsh/Makefile.in +mlvirsh/mlvirsh.ml +po/ja.po +po/LINGUAS +po/Makefile.in +po/pl.po +po/POTFILES +po/virt-top.pot +README +TODO.libvirt +wininstaller.nsis.in +winlicense.rtf diff --git a/META.in b/META.in new file mode 100644 index 0000000..960e07e --- /dev/null +++ b/META.in @@ -0,0 +1,5 @@ +name="libvirt" +version="@PACKAGE_VERSION@" +description="libvirt bindings for OCaml" +archive(byte)="mllibvirt.cma" +archive(native)="mllibvirt.cmxa" diff --git a/Make.rules.in b/Make.rules.in new file mode 100644 index 0000000..a25d485 --- /dev/null +++ b/Make.rules.in @@ -0,0 +1,68 @@ +# ocaml-libvirt +# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones +# +# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# This file is included by Makefiles in subdirectories. + +OCAMLFIND = @OCAMLFIND@ +OCAMLDEP = @OCAMLDEP@ +OCAMLC = @OCAMLC@ +OCAMLOPT = @OCAMLOPT@ + +# Common rules for building OCaml objects. + +ifneq ($(OCAMLFIND),) +.mli.cmi: + $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $< +.ml.cmo: + $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLCPACKAGES) -c $< +.ml.cmx: + $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) -c $< +else +.mli.cmi: + $(OCAMLC) $(OCAMLCFLAGS) $(OCAMLCINCS) -c $< +.ml.cmo: + $(OCAMLC) $(OCAMLCFLAGS) $(OCAMLCINCS) -c $< +.ml.cmx: + $(OCAMLOPT) $(OCAMLOPTFLAGS) $(OCAMLOPTINCS) -c $< +endif + +%.ml %.mli: %.mly + ocamlyacc $< +.mll.ml: + ocamllex $< + +# Dependencies. + +depend: .depend + +ifneq ($(OCAMLFIND),) +.depend: $(wildcard *.mli) $(wildcard *.ml) + rm -f .depend + $(OCAMLFIND) ocamldep $(OCAMLCPACKAGES) $(OCAMLDEPFLAGS) $^ > $@ +else +.depend: $(wildcard *.mli) $(wildcard *.ml) + rm -f .depend + $(OCAMLDEP) $(OCAMLCINCS) $(OCAMLDEPFLAGS) $^ > $@ +endif + +ifeq ($(wildcard .depend),.depend) +include .depend +endif + +.PHONY: depend dist check-manifest dpkg doc + +.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll .mly diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..52776e0 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,150 @@ +# ocaml-libvirt +# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones +# +# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +PACKAGE = @PACKAGE_NAME@ +VERSION = @PACKAGE_VERSION@ + +INSTALL = @INSTALL@ + +MAKENSIS = @MAKENSIS@ + +OCAMLDOC = @OCAMLDOC@ +OCAMLDOCFLAGS := -html -sort + +SUBDIRS = @subdirs@ + +all opt depend install: + for d in $(SUBDIRS); do \ + $(MAKE) -C $$d $@; \ + if [ $$? -ne 0 ]; then exit 1; fi; \ + done + +clean: + for d in . $(SUBDIRS); do \ + (cd $$d; rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so *.opt *~ *.dll *.exe core); \ + done + rm -f examples/list_domains + rm -f examples/node_info + rm -f mlvirsh/mlvirsh + rm -f virt-ctrl/virt-ctrl + rm -f virt-top/virt-top + rm -f virt-df/virt-df + +distclean: clean + rm -f config.h config.log config.status configure + rm -rf autom4te.cache + rm -f META + rm -f libvirt/libvirt_version.ml + rm -f Makefile + rm -f libvirt/Makefile + rm -f examples/Makefile + rm -f mlvirsh/Makefile + rm -f virt-ctrl/Makefile + rm -f virt-top/Makefile + rm -f virt-df/Makefile + +# Developer documentation (in html/ subdirectory). + +ifneq ($(OCAMLDOC),) +doc: + rm -rf html + mkdir html + -cd libvirt; \ + $(OCAMLDOC) $(OCAMLDOCFLAGS) -d ../html \ + libvirt.{ml,mli} libvirt_version.{ml,mli} +endif + +# Windows installer (requires NSIS). + +WININSTALLER := $(PACKAGE)-$(VERSION).exe + +ifneq ($(MAKENSIS),) +wininstaller: $(WININSTALLER) + +$(WININSTALLER): wininstaller.nsis all opt + "$(MAKENSIS)" \ + //DPACKAGE=$(PACKAGE) //DVERSION=$(VERSION) \ + //DOUTFILE=$@ $< + ls -l $@ +endif + +# Update configure and rerun. + +configure: force + autoreconf + CFLAGS=-g \ + ./configure \ + --enable-debug=yes --with-libvirt=/home/rjones/local + +# Distribution. + +dist: + $(MAKE) check-manifest + rm -rf $(PACKAGE)-$(VERSION) + mkdir $(PACKAGE)-$(VERSION) + tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf - + $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/ + tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) + rm -rf $(PACKAGE)-$(VERSION) + ls -l $(PACKAGE)-$(VERSION).tar.gz + +check-manifest: + hg manifest | sort > .check-manifest; \ + sort MANIFEST > .orig-manifest; \ + diff -u .orig-manifest .check-manifest; rv=$$?; \ + rm -f .orig-manifest .check-manifest; \ + exit $$rv + +# Do a release (update the website). + +release: configure + $(MAKE) release_stage_2 + +release_stage_2: clean all opt doc dist + $(MAKE) release_stage_3 + +WEBSITE = ../redhat/websites + +release_stage_3: + rm -f $(WEBSITE)/ocaml-libvirt/html/*.{html,css} + cp html/*.{html,css} $(WEBSITE)/ocaml-libvirt/html/ + cp README $(WEBSITE)/ocaml-libvirt/README.txt + cp ChangeLog $(WEBSITE)/ocaml-libvirt/ChangeLog.txt +# cp virt-top/virt-top.txt $(WEBSITE)/virt-top/ +# cp ChangeLog $(WEBSITE)/virt-top/ChangeLog.txt + +# Upload to main website. + +upload: + cd $(WEBSITE)/ocaml-libvirt && \ + scp ChangeLog.txt index.html README.txt Screenshot*.png \ + libvirt.org:/data/www/libvirt.org/ocaml && \ + scp css/*.css \ + libvirt.org:/data/www/libvirt.org/ocaml/css/ && \ + scp html/*.html html/*.css \ + libvirt.org:/data/www/libvirt.org/ocaml/html/ + scp $(PACKAGE)-$(VERSION).tar.gz libvirt.org:/data/ftp/libvirt/ocaml/ + +# Upload Windows binary installer to main website. + +winupload: + scp $(WININSTALLER) libvirt.org:/data/ftp/libvirt/ocaml/ + +force: + +.PHONY: all opt depend install clean distclean configure dist check-manifest \ + release release_stage_2 release_stage_3 force \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..7fb9726 --- /dev/null +++ b/README @@ -0,0 +1,251 @@ +ocaml-libvirt +---------------------------------------------------------------------- + +Copyright (C) 2007-2008 Richard W.M. Jones, Red Hat Inc. +http://libvirt.org/ocaml/ +http://libvirt.org/ + +This is a complete set of OCaml bindings around libvirt, exposing all +known functionality to OCaml programs. + + +Requirements +---------------------------------------------------------------------- + +PLEASE NOTE: The list of requirements looks long but you DO NOT NEED +all of these packages, so pay careful attention to what is required +('R') and what is optional ('O'). + +ALSO NOTE: Binaries are available for many platforms. You only need +the packages below if you want to build from source. + + W h a t y o u w a n t t o b u i l d + + |Bindings, |Docs, |virt-top |virt-ctrl |virt-df |Windows + |examples, |manpages | | | |version + |mlvirsh | | | | | + --------------+----------+---------+---------+----------+----------+------ + GNU make | R | R | R | R | R | R + | | | | | | + gcc | R | | R | R | R | R + | | | | | | + libvirt | R | | R | R | R | R + | >= 0.2.1 | | | | | + | | | | | | + ocaml | R | | R | R | R | R + | >= 3.08 | | | | >= 3.10 | + | | | | | | + findlib | HR | R | HR | HR | HR | Note [1] + | | | | | | + ocaml-gettext | O | O | O | O | O | Note [2] + | | | | | | + MinGW + MSYS | | | | | | R + --------------+----------+---------+---------+----------+----------+------ + ocamldoc | | R | | | | O + | | | | | | + perldoc | | O | | | | + --------------+----------+---------+---------+----------+----------+------ + ocaml-curses | | | R | | | + | | | | | | + Extlib | | | R | | R | + | | | | | | + xml-light | | | O | | R | + | | | | | | + ocaml-calendar| | | O | | | + | | | | | | + ocaml CSV | | | O | | | + | | | | | | + bitmatch | | | | | R | + --------------+----------+---------+---------+----------+----------+------ + GTK2 | | | | R | | O + | | | | | | + lablgtk2 | | | | R | | O + | | | | >= 2.10.0| | + ocaml-dbus | | | | O | | + | | | | >= 0.06 | | + gnome-icon-theme | | | O | | + --------------+----------+---------+---------+----------+----------+------ + NSIS | | | | | | O + --------------+----------+---------+---------+----------+----------+------ + + R = required + HR = highly recommended (use if possible) + O = optional (just improves functionality, but not required) + n/a = not available + +Note [1]: Findlib was recently ported to Windows and in future we may +require it because it will let us remove a lot of hacks from the +Makefiles. + +Note [2]: It's not clear if ocaml-gettext works on Windows. + +Where to get the packages: + + libvirt >= 0.2.1 from http://libvirt.org/ (get the latest version available) + or packaged in Debian, Ubuntu and Fedora + + ocaml >= 3.08 from http://caml.inria.fr/ + or packaged in Debian, Ubuntu and Fedora + + findlib from http://www.ocaml-programming.de/packages/ + or packaged in Debian, Ubuntu and Fedora as 'ocaml-findlib' + + ocaml-gettext from http://www.le-gall.net/sylvain+violaine/ocaml-gettext.html + + patch for OCaml 3.10: + http://www.annexia.org/tmp/ocaml-gettext-0.2.0-20080321.patch + (This should appear in ocaml-gettext 0.3.0 shortly). + + MinGW + MSYS from http://www.mingw.org/ (only needed for Windows) + + ocamldoc part of OCaml itself + or part of the ocaml package in Debian, Ubuntu + or packaged in Fedora as 'ocaml-ocamldoc' + + perldoc part of Perl + or packaged in Debian, Ubuntu and Fedora + + ocaml-curses from http://www.nongnu.org/ocaml-tmk/ + or packaged in Debian, Ubuntu as 'libcurses-ocaml-dev' + or packaged in Fedora as 'ocaml-curses-devel' + + Extlib from http://ocaml-lib.sourceforge.net/ + or packaged in Debian, Unbuntu as 'libextlib-ocaml-dev' + or packaged in Fedora as 'ocaml-extlib-devel' + + xml-light from http://tech.motion-twin.com/doc/xml-light/ + or packaged in Debian, Ubuntu as 'libxml-light-ocaml-dev' + or packaged in Fedora as 'ocaml-xml-light-devel' + + ocaml CSV from http://merjis.com/developers/csv + or packaged in Debian, Ubuntu as 'libcsv-ocaml-dev' + or packaged in Fedora as 'ocaml-csv-devel' + + ocaml-calendar from http://www.lri.fr/~signoles/prog.en.html + or packaged in Debian, Ubuntu as 'libcalendar-ocaml-dev' + or packaged in Fedora as 'ocaml-calendar-devel' + + bitmatch from http://et.redhat.com/~rjones/bitmatch/ + + GTK2 from http://gtk.org/ + or packaged in Debian, Ubuntu and Fedora + + lablgtk2 >= 2.10.0 + from http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgtk.html + or packaged in Debian, Ubuntu as 'liblablgtk2-ocaml-dev' + or packaged in Fedora 9 as 'ocaml-lablgtk-devel' + + gnome-icon-theme part of GNOME + + ocaml-dbus >= 0.06 + from http://tab.snarc.org/projects/ocaml_dbus/ + or packaged in Fedora 9 as 'ocaml-dbus-devel' + (not yet available for Debian or Ubuntu AFAIK) + + NSIS from http://nsis.sf.net + + +Building +---------------------------------------------------------------------- + + ./configure # Checks that you have all the required bits. + + make all # Builds the bytecode version of libs/programs. + make opt # Builds the native code version of libs/programs. + + make install # Install in OCaml directory, and the binaries + # in $prefix/bin. + + make doc # Build HTML documentation in html/ subdirectory. + +Then have a look at the programs 'mlvirsh.opt', 'virt-top.opt' +and 'virt-ctrl.opt'. + +Note: If you want to run the programs without first installing, you +may need to set your $LD_LIBRARY_PATH environment variable so it +contains the build directory. eg: + + LD_LIBRARY_PATH=libvirt/ mlvirsh/mlvirsh.opt + + +Windows +---------------------------------------------------------------------- + +I have built libvirt (the bindings), examples, mlvirsh and virt-ctrl +on Windows using the MinGW port of OCaml. It's quite likely that it +will also work under VC++, but I have not tested this. + +You should make sure that your $PATH (environment variable) contains +the names of the directories containing all required DLLs, in +particular you will require: + + libvirt-*.dll (from libvirt) + libgnutls-*.dll (from GnuTLS) + libgcrypt-*.dll + libgpg-error-*.dll + libtasn1-*.dll + libxdr.dll (from libxdr) + libxml2-*.dll (from libxml2) + and, a multitude of DLLs from GTK if you want to run virt-ctrl + +You can use a tool such as Dependency Walker to find/check the +locations of dependent libraries. + +To build the Windows installer, you will need NSIS. Then do: + + ./configure --with-nsis=/c/Progra~1/NSIS + make all opt + make wininstaller + +This should build a Windows binary installer called +ocaml-libvirt-$VERSION.exe which includes the bindings, all required +DLLs and all programs that can be built under Windows. + + +mlvirsh +---------------------------------------------------------------------- + +'mlvirsh' is an almost complete reimplementation of virsh, which is +mostly command compatible (there are a very few commands missing, and +some commands have a slightly different syntax, but broadly speaking +they are equivalent programs except that one is written in C and the +other in OCaml). + +At the time of writing: + + wc -c wc -l + + virsh 126,056 4,641 + mlvirsh 19,427 598 + + % size 15% 13% + + +virt-ctrl +---------------------------------------------------------------------- + +'virt-ctrl' (originally called 'mlvirtmanager') is a reimplementation +of virt-manager in OCaml. It is not feature-complete by any means, +but does allow you to show the running domains and start and stop +defined domains. The main functionality _missing_ is the ability to +define new virtual machines, change the resources allocated to +domains, or show the machine console. + + +Programming +---------------------------------------------------------------------- + +For documentation on these bindings, read libvirt.mli and/or 'make +doc' and browse the HTML documentation in the html/ subdirectory. + +For documentation on libvirt itself, see http://libvirt.org/html/ + + +Subdirectories +---------------------------------------------------------------------- + +libvirt/ The OCaml bindings. +examples/ Some example programs using the bindings. +mlvirsh/ 'mlvirsh' command line tool. +virt-ctrl/ 'virt-ctrl' graphical tool. +virt-top/ 'virt-top' tool. +virt-df/ 'virt-df' tool. diff --git a/TODO.libvirt b/TODO.libvirt new file mode 100644 index 0000000..d87b8b8 --- /dev/null +++ b/TODO.libvirt @@ -0,0 +1 @@ +Turn VIR_ERR_NO_DOMAIN and NO_NETWORK errors into Not_found exceptions. diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..38ad15f --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,170 @@ +dnl autoconf macros for OCaml +dnl by Olivier Andrieu +dnl modified by Richard W.M. Jones +dnl from a configure.in by Jean-Christophe Filliâtre, +dnl from a first script by Georges Mariano +dnl +dnl defines AC_PROG_OCAML that will check the OCaml compiler +dnl and set the following variables : +dnl OCAMLC "ocamlc" if present in the path, or a failure +dnl or "ocamlc.opt" if present with same version number as ocamlc +dnl OCAMLOPT "ocamlopt" (or "ocamlopt.opt" if present), or "no" +dnl OCAMLBEST either "byte" if no native compiler was found, +dnl or "opt" otherwise +dnl OCAMLDEP "ocamldep" +dnl OCAMLLIB the path to the ocaml standard library +dnl OCAMLVERSION the ocaml version number +AC_DEFUN(AC_PROG_OCAML, +[dnl +# checking for ocamlc +AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,AC_MSG_ERROR(Cannot find ocamlc.)) +OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` +AC_MSG_RESULT(OCaml version is $OCAMLVERSION) +OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f 4` +AC_MSG_RESULT(OCaml library path is $OCAMLLIB) +# checking for ocamlopt +AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt) +OCAMLBEST=byte +if test -z "$OCAMLOPT"; then + AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.) +else + TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + AC_MSG_RESULT(versions differs from ocamlc; ocamlopt discarded.) + unset OCAMLOPT + else + OCAMLBEST=opt + fi +fi +# checking for ocamlc.opt +AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt) +if test -z "$OCAMLCDOTOPT"; then + TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + AC_MSG_RESULT(versions differs from ocamlc; ocamlc.opt discarded.) + else + OCAMLC=$OCAMLCDOTOPT + fi +fi +# checking for ocamlopt.opt +if test "$OCAMLOPT" ; then + AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt) + if test "$OCAMLOPTDOTOPT"; then + TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' ` + if test "$TMPVER" != "$OCAMLVERSION" ; then + AC_MSG_RESULT(version differs from ocamlc; ocamlopt.opt discarded.) + else + OCAMLOPT=$OCAMLOPTDOTOPT + fi + fi +fi +# checking for ocamldep +AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,AC_MSG_ERROR(Cannot find ocamldep.)) + +#checking for ocamlmktop +AC_CHECK_PROG(OCAMLMKTOP,ocamlmktop,ocamlmktop, AC_MSG_WARN(Cannot find ocamlmktop.)) +#checking for ocamlmklib +AC_CHECK_PROG(OCAMLMKLIB,ocamlmklib,ocamlmklib, AC_MSG_WARN(Cannot find ocamlmklib.)) +# checking for ocamldoc +AC_CHECK_PROG(OCAMLDOC,ocamldoc,ocamldoc, AC_MSG_WARN(Cannot find ocamldoc.)) + + +AC_SUBST(OCAMLC) +AC_SUBST(OCAMLOPT) +AC_SUBST(OCAMLDEP) +AC_SUBST(OCAMLBEST) +AC_SUBST(OCAMLVERSION) +AC_SUBST(OCAMLLIB) +AC_SUBST(OCAMLMKLIB) +AC_SUBST(OCAMLDOC) +]) + + +dnl macro AC_PROG_OCAML_TOOLS will check OCamllex and OCamlyacc : +dnl OCAMLLEX "ocamllex" or "ocamllex.opt" if present +dnl OCAMLYACC "ocamlyac" +AC_DEFUN(AC_PROG_OCAML_TOOLS, +[dnl +# checking for ocamllex and ocamlyacc +AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex) +if test "$OCAMLLEX"; then + AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt) + if test "$OCAMLLEXDOTOPT"; then + OCAMLLEX=$OCAMLLEXDOTOPT + fi +else + AC_MSG_ERROR(Cannot find ocamllex.) +fi +AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,AC_MSG_ERROR(Cannot find ocamlyacc.)) +AC_SUBST(OCAMLLEX) +AC_SUBST(OCAMLYACC) +]) + + +dnl AC_PROG_CAMLP4 checks for Camlp4 +AC_DEFUN(AC_PROG_CAMLP4, +[dnl +AC_REQUIRE([AC_PROG_OCAML]) +# checking for camlp4 +AC_CHECK_PROG(CAMLP4,camlp4,camlp4) +if test "$CAMLP4"; then + TMPVERSION=`$CAMLP4 -v 2>&1| sed -n -e 's|.*version *\(.*\)$|\1|p'` + if test "$TMPVERSION" != "$OCAMLVERSION" ; then + AC_MSG_RESULT(versions differs from ocamlc) + fi +fi +]) + + +dnl macro AC_PROG_FINDLIB will check for the presence of +dnl ocamlfind +AC_DEFUN(AC_PROG_FINDLIB, +[dnl +# checking for ocamlfind +AC_CHECK_PROG(OCAMLFIND,ocamlfind,ocamlfind, + AC_MSG_WARN([ocamlfind not found])) +AC_SUBST(OCAMLFIND) +]) + + +dnl AC_CHECK_OCAML_PKG checks wether a findlib package is present +dnl defines pkg_name to "yes" +AC_DEFUN(AC_CHECK_OCAML_PKG, +[dnl +AC_REQUIRE([AC_PROG_FINDLIB]) +AC_MSG_CHECKING(findlib package $1) +if $OCAMLFIND query $1 >/dev/null 2>/dev/null; then +AC_MSG_RESULT(found) +eval "pkg_`echo $1 | tr - _`=yes" +else +AC_MSG_RESULT(not found) +eval "pkg_`echo $1 | tr - _`=no" +fi +]) + + +dnl AC_CHECK_OCAML_MODULE looks for a module in a given path +dnl 1st arg -> name (just for printing messages) +dnl 2nd arg -> env var name (set to include path, or "no" if not found) +dnl 3rd arg -> module to check +dnl 4th arg -> default include dirs to check +AC_DEFUN([AC_CHECK_OCAML_MODULE], +[dnl +AC_MSG_CHECKING(for module $1) +cat > conftest.ml <&5 2>&5 ; then + found=yes + break + fi +done +if test "$found" ; then + AC_MSG_RESULT($$2) +else + AC_MSG_RESULT(not found) + $2=no +fi +AC_SUBST($2)]) diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..396482d --- /dev/null +++ b/config.guess @@ -0,0 +1,1500 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-07-02' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[3456]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[3456]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..ab90ff8 --- /dev/null +++ b/config.h.in @@ -0,0 +1,216 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `ncurses' library (-lncurses). */ +#undef HAVE_LIBNCURSES + +/* Define to 1 if you have the `virt' library (-lvirt). */ +#undef HAVE_LIBVIRT + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `virConnectGetHostname' function. */ +#undef HAVE_VIRCONNECTGETHOSTNAME + +/* Define to 1 if you have the `virConnectGetURI' function. */ +#undef HAVE_VIRCONNECTGETURI + +/* Define to 1 if you have the `virConnectListDefinedStoragePools' function. + */ +#undef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS + +/* Define to 1 if you have the `virConnectListStoragePools' function. */ +#undef HAVE_VIRCONNECTLISTSTORAGEPOOLS + +/* Define to 1 if you have the `virConnectNumOfDefinedStoragePools' function. + */ +#undef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS + +/* Define to 1 if you have the `virConnectNumOfStoragePools' function. */ +#undef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS + +/* Define to 1 if you have the `virDomainBlockStats' function. */ +#undef HAVE_VIRDOMAINBLOCKSTATS + +/* Define to 1 if you have the `virDomainGetSchedulerParameters' function. */ +#undef HAVE_VIRDOMAINGETSCHEDULERPARAMETERS + +/* Define to 1 if you have the `virDomainGetSchedulerType' function. */ +#undef HAVE_VIRDOMAINGETSCHEDULERTYPE + +/* Define to 1 if you have the `virDomainInterfaceStats' function. */ +#undef HAVE_VIRDOMAININTERFACESTATS + +/* Define to 1 if you have the `virDomainMigrate' function. */ +#undef HAVE_VIRDOMAINMIGRATE + +/* Define to 1 if you have the `virDomainSetSchedulerParameters' function. */ +#undef HAVE_VIRDOMAINSETSCHEDULERPARAMETERS + +/* Define to 1 if the system has the type `virJobPtr'. */ +#undef HAVE_VIRJOBPTR + +/* Define to 1 if you have the `virNodeGetCellsFreeMemory' function. */ +#undef HAVE_VIRNODEGETCELLSFREEMEMORY + +/* Define to 1 if you have the `virNodeGetFreeMemory' function. */ +#undef HAVE_VIRNODEGETFREEMEMORY + +/* Define to 1 if you have the `virStoragePoolBuild' function. */ +#undef HAVE_VIRSTORAGEPOOLBUILD + +/* Define to 1 if you have the `virStoragePoolCreate' function. */ +#undef HAVE_VIRSTORAGEPOOLCREATE + +/* Define to 1 if you have the `virStoragePoolCreateXML' function. */ +#undef HAVE_VIRSTORAGEPOOLCREATEXML + +/* Define to 1 if you have the `virStoragePoolDefineXML' function. */ +#undef HAVE_VIRSTORAGEPOOLDEFINEXML + +/* Define to 1 if you have the `virStoragePoolDelete' function. */ +#undef HAVE_VIRSTORAGEPOOLDELETE + +/* Define to 1 if you have the `virStoragePoolDestroy' function. */ +#undef HAVE_VIRSTORAGEPOOLDESTROY + +/* Define to 1 if you have the `virStoragePoolFree' function. */ +#undef HAVE_VIRSTORAGEPOOLFREE + +/* Define to 1 if you have the `virStoragePoolGetAutostart' function. */ +#undef HAVE_VIRSTORAGEPOOLGETAUTOSTART + +/* Define to 1 if you have the `virStoragePoolGetConnect' function. */ +#undef HAVE_VIRSTORAGEPOOLGETCONNECT + +/* Define to 1 if you have the `virStoragePoolGetInfo' function. */ +#undef HAVE_VIRSTORAGEPOOLGETINFO + +/* Define to 1 if you have the `virStoragePoolGetName' function. */ +#undef HAVE_VIRSTORAGEPOOLGETNAME + +/* Define to 1 if you have the `virStoragePoolGetUUID' function. */ +#undef HAVE_VIRSTORAGEPOOLGETUUID + +/* Define to 1 if you have the `virStoragePoolGetUUIDString' function. */ +#undef HAVE_VIRSTORAGEPOOLGETUUIDSTRING + +/* Define to 1 if you have the `virStoragePoolGetXMLDesc' function. */ +#undef HAVE_VIRSTORAGEPOOLGETXMLDESC + +/* Define to 1 if you have the `virStoragePoolListVolumes' function. */ +#undef HAVE_VIRSTORAGEPOOLLISTVOLUMES + +/* Define to 1 if you have the `virStoragePoolLookupByName' function. */ +#undef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME + +/* Define to 1 if you have the `virStoragePoolLookupByUUID' function. */ +#undef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID + +/* Define to 1 if you have the `virStoragePoolLookupByUUIDString' function. */ +#undef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING + +/* Define to 1 if you have the `virStoragePoolLookupByVolume' function. */ +#undef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME + +/* Define to 1 if you have the `virStoragePoolNumOfVolumes' function. */ +#undef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES + +/* Define to 1 if the system has the type `virStoragePoolPtr'. */ +#undef HAVE_VIRSTORAGEPOOLPTR + +/* Define to 1 if you have the `virStoragePoolRefresh' function. */ +#undef HAVE_VIRSTORAGEPOOLREFRESH + +/* Define to 1 if you have the `virStoragePoolSetAutostart' function. */ +#undef HAVE_VIRSTORAGEPOOLSETAUTOSTART + +/* Define to 1 if you have the `virStoragePoolUndefine' function. */ +#undef HAVE_VIRSTORAGEPOOLUNDEFINE + +/* Define to 1 if you have the `virStorageVolCreateXML' function. */ +#undef HAVE_VIRSTORAGEVOLCREATEXML + +/* Define to 1 if you have the `virStorageVolDelete' function. */ +#undef HAVE_VIRSTORAGEVOLDELETE + +/* Define to 1 if you have the `virStorageVolFree' function. */ +#undef HAVE_VIRSTORAGEVOLFREE + +/* Define to 1 if you have the `virStorageVolGetInfo' function. */ +#undef HAVE_VIRSTORAGEVOLGETINFO + +/* Define to 1 if you have the `virStorageVolGetKey' function. */ +#undef HAVE_VIRSTORAGEVOLGETKEY + +/* Define to 1 if you have the `virStorageVolGetName' function. */ +#undef HAVE_VIRSTORAGEVOLGETNAME + +/* Define to 1 if you have the `virStorageVolGetPath' function. */ +#undef HAVE_VIRSTORAGEVOLGETPATH + +/* Define to 1 if you have the `virStorageVolGetXMLDesc' function. */ +#undef HAVE_VIRSTORAGEVOLGETXMLDESC + +/* Define to 1 if you have the `virStorageVolLookupByKey' function. */ +#undef HAVE_VIRSTORAGEVOLLOOKUPBYKEY + +/* Define to 1 if you have the `virStorageVolLookupByName' function. */ +#undef HAVE_VIRSTORAGEVOLLOOKUPBYNAME + +/* Define to 1 if you have the `virStorageVolLookupByPath' function. */ +#undef HAVE_VIRSTORAGEVOLLOOKUPBYPATH + +/* Define to 1 if the system has the type `virStorageVolPtr'. */ +#undef HAVE_VIRSTORAGEVOLPTR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if the C compiler supports function prototypes. */ +#undef PROTOTYPES + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define like PROTOTYPES; this can be used by system headers. */ +#undef __PROTOTYPES diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..fab0aa3 --- /dev/null +++ b/config.sub @@ -0,0 +1,1616 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-09-20' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4ed972e --- /dev/null +++ b/configure.ac @@ -0,0 +1,411 @@ +# ocaml-libvirt +# Copyright (C) 2007-2008 Red Hat Inc., Richard W.M. Jones +# +# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(ocaml-libvirt,0.4.2.1) + +dnl Check for basic C environment. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_CPP + +AC_C_PROTOTYPES +test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant) + +AC_PROG_CC_C_O + +dnl Select some C flags based on the host type. +AC_CANONICAL_HOST + +DEBUG="-g" +WARNINGS="-Wall -Werror" +CFLAGS_FPIC="-fPIC" +WIN32=no +case "$host" in + *-*-mingw*) + WARNINGS="$WARNINGS -Wno-unused" + CFLAGS_FPIC="" + WIN32=yes +esac +AC_SUBST(DEBUG) +AC_SUBST(WARNINGS) +AC_SUBST(CFLAGS_FPIC) +AC_SUBST(WIN32) + +dnl Check for libvirt development environment. +AC_ARG_WITH(libvirt, + AC_HELP_STRING([--with-libvirt=PATH],[Set path to installed libvirt]), + [if test "x$withval" != "x"; then + CFLAGS="$CFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + fi + ]) +AC_CHECK_LIB(virt,virConnectOpen, + [], + AC_MSG_ERROR([You must install libvirt library])) +AC_CHECK_HEADER([libvirt/libvirt.h], + [], + AC_MSG_ERROR([You must install libvirt development package])) + +dnl We also use +AC_CHECK_HEADER([libvirt/virterror.h], + [], + AC_MSG_ERROR([You must install libvirt development package])) + +dnl Check for libvirt >= 0.2.1 (our minimum supported version). +dnl See: http://libvirt.org/hvsupport.html +AC_CHECK_FUNC(virConnectGetCapabilities, + [], + AC_MSG_ERROR([You must have libvirt >= 0.2.1])) + +dnl Check for optional libvirt functions added since 0.2.1. +dnl See: http://libvirt.org/hvsupport.html +AC_CHECK_FUNCS([virConnectGetHostname \ + virConnectGetURI \ + virDomainBlockStats \ + virDomainGetSchedulerParameters \ + virDomainGetSchedulerType \ + virDomainInterfaceStats \ + virDomainMigrate \ + virDomainSetSchedulerParameters \ + virNodeGetFreeMemory \ + virNodeGetCellsFreeMemory \ + virStoragePoolGetConnect \ + virConnectNumOfStoragePools \ + virConnectListStoragePools \ + virConnectNumOfDefinedStoragePools \ + virConnectListDefinedStoragePools \ + virStoragePoolLookupByName \ + virStoragePoolLookupByUUID \ + virStoragePoolLookupByUUIDString \ + virStoragePoolLookupByVolume \ + virStoragePoolCreateXML \ + virStoragePoolDefineXML \ + virStoragePoolBuild \ + virStoragePoolUndefine \ + virStoragePoolCreate \ + virStoragePoolDestroy \ + virStoragePoolDelete \ + virStoragePoolFree \ + virStoragePoolRefresh \ + virStoragePoolGetName \ + virStoragePoolGetUUID \ + virStoragePoolGetUUIDString \ + virStoragePoolGetInfo \ + virStoragePoolGetXMLDesc \ + virStoragePoolGetAutostart \ + virStoragePoolSetAutostart \ + virStoragePoolNumOfVolumes \ + virStoragePoolListVolumes \ + virStorageVolLookupByName \ + virStorageVolLookupByKey \ + virStorageVolLookupByPath \ + virStorageVolGetName \ + virStorageVolGetKey \ + virStorageVolCreateXML \ + virStorageVolDelete \ + virStorageVolFree \ + virStorageVolGetInfo \ + virStorageVolGetXMLDesc \ + virStorageVolGetPath \ +]) + +# This jobs API was never published and is due to get overhauled +# in the near future: +# virJobGetInfo +# virJobGetDomain +# virJobGetNetwork +# virJobCancel +# virJobFree +# virDomainCreateLinuxJob +# virDomainSaveJob +# virDomainRestoreJob +# virDomainCoreDumpJob +# virDomainCreateJob +# virNetworkCreateXMLJob +# virNetworkCreateJob + +dnl Check for optional types added since 0.2.1. +AC_CHECK_TYPES([virJobPtr, virStoragePoolPtr, virStorageVolPtr],,, + [#include ]) + +dnl Check for optional ncurses. +AC_CHECK_LIB(ncurses,initscr) + +dnl Check for optional GNOME icons (from gnome-icon-theme package). +AC_ARG_WITH(icons, + AC_HELP_STRING([--with-icons=PATH], + [Set path to installed icons @<:@default=/usr/share/icons@:>@]), + [],[with_icons=/usr/share/icons]) +icons="" +if test "x$with_icons" != "xno"; then + for size in 16 24 32 48; do + for f in devices/computer.png; do + fname="${with_icons}/gnome/${size}x${size}/${f}" + AC_MSG_CHECKING([checking for icon $fname]) + if test -f "$fname"; then + AC_MSG_RESULT([yes]) + icons="$size $f $fname $icons" + else + AC_MSG_RESULT([no]) + fi + done + done +fi +AC_SUBST(with_icons) +AC_SUBST(icons) + +dnl Check for basic OCaml environment & findlib. +dnl Note that findlib is not necessary, but things will work better +dnl if it is present. +AC_PROG_OCAML +AC_PROG_FINDLIB + +if test "x$OCAMLFIND" != "x"; then + dnl Use ocamlfind to find the required packages ... + + dnl Check for required OCaml packages. + AC_CHECK_OCAML_PKG(unix) + if test "x$pkg_unix" != "xyes"; then + AC_MSG_ERROR([Cannot find required OCaml package 'unix']) + fi + + dnl Check for optional OCaml packages. + AC_CHECK_OCAML_PKG(extlib) + AC_CHECK_OCAML_PKG(lablgtk2) + AC_CHECK_OCAML_PKG(curses) + AC_CHECK_OCAML_PKG(gettext) + AC_CHECK_OCAML_PKG(xml-light) + AC_CHECK_OCAML_PKG(csv) + AC_CHECK_OCAML_PKG(dbus) + AC_CHECK_OCAML_PKG(gettext) + AC_CHECK_OCAML_PKG(bitmatch) + + dnl Need to check which version of calendar is installed. + AC_CHECK_OCAML_MODULE(calendar,pkg_calendar2,CalendarLib.Date,[+calendar]) + if test "x$pkg_calendar2" = "xno"; then + AC_CHECK_OCAML_PKG(calendar) + fi + + AC_SUBST(pkg_unix) + AC_SUBST(pkg_extlib) + AC_SUBST(pkg_lablgtk2) + AC_SUBST(pkg_curses) + AC_SUBST(pkg_gettext) + AC_SUBST(pkg_xml_light) + AC_SUBST(pkg_csv) + AC_SUBST(pkg_dbus) + AC_SUBST(pkg_gettext) + AC_SUBST(pkg_calendar) + AC_SUBST(pkg_calendar2) +else + dnl Use a basic module test if there is no findlib ... + + dnl Check for required OCaml modules. + AC_CHECK_OCAML_MODULE(unix,pkg_unix,Unix,[.]) + if test "x$pkg_unix" = "xno"; then + AC_MSG_ERROR([Cannot find required OCaml package 'unix']) + fi + + dnl Check for optional OCaml modules. + AC_CHECK_OCAML_MODULE(extlib,pkg_extlib,ExtString,[+extlib]) + AC_CHECK_OCAML_MODULE(lablgtk2,pkg_lablgtk2,GMain,[+lablgtk2]) + AC_CHECK_OCAML_MODULE(curses,pkg_curses,Curses,[+curses]) + AC_CHECK_OCAML_MODULE(gettext,pkg_gettext,Gettext,[+gettext]) dnl XXX + AC_CHECK_OCAML_MODULE(xml-light,pkg_xml_light,Xml,[+xml-light]) + AC_CHECK_OCAML_MODULE(csv,pkg_csv,Csv,[+csv]) + AC_CHECK_OCAML_MODULE(dbus,pkg_dbus,DBus,[+dbus]) + AC_CHECK_OCAML_MODULE(gettext,pkg_gettext,Gettext,[+gettext]) + AC_CHECK_OCAML_MODULE(bitmatch,pkg_bitmatch,Bitmatch,[+bitmatch]) + dnl XXX Version check - see above. + AC_CHECK_OCAML_MODULE(calendar,pkg_calendar,Calendar,[+calendar]) +fi + +dnl Which subpackages (== subdirs) will we build? +subdirs="libvirt examples mlvirsh" +if test "x$pkg_lablgtk2" != "xno"; then + subdirs="$subdirs virt-ctrl" +fi +if test "x$pkg_extlib" != "xno" -a "x$pkg_curses" != "xno"; then + subdirs="$subdirs virt-top" +fi +if test "x$pkg_extlib" != "xno" \ + -a "x$pkg_xml_light" != "xno" \ + -a "x$pkg_bitmatch" != "xno"; then + subdirs="$subdirs virt-df" +fi +AC_SUBST(subdirs) + +dnl Check for optional perldoc (for building manual pages). +AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc) + +dnl Check for optional gdk-pixbuf-mlsource (for icons). +AC_CHECK_PROG(HAVE_GDK_PIXBUF_MLSOURCE,gdk-pixbuf-mlsource,gdk-pixbuf-mlsource) + +dnl Check for recommended ocaml-gettext tool. +AC_CHECK_PROG(OCAML_GETTEXT,ocaml-gettext,ocaml-gettext) + +dnl Check for optional NSIS (for building a Windows installer). +AC_ARG_WITH([nsis], + [AS_HELP_STRING([--with-nsis], + [use NSIS to build a Windows installer])], + [], + [with_nsis=no]) + +MAKENSIS= +LIBVIRT_DLL_PATH= +LIBXDR_DLL_PATH= +LIBXML2_DLL_PATH= +GNUTLS_DLL_PATH= +GTK_PATH= +GTK_DLL_PATH= + +[ +msys_to_win_dir () { + eval pushd "\$$1" > /dev/null + eval $1=`pwd -W` + popd > /dev/null +} +] + +if test "x$with_nsis" != "xno"; then + AC_PATH_PROG(MAKENSIS,makensis,[],[$with_nsis:$PATH]) + if test "x$MAKENSIS" = "x"; then + AC_MSG_FAILURE([--with-nsis was given, but could not find MAKENSIS.EXE]) + fi + + # MAKENSIS is set so we will build a rule for making a Windows + # installer. To support this, generate wininstaller.nsis. + saved_IFS=$IFS + IFS=$PATH_SEPARATOR + for d in $PATH; do + IFS=$saved_IFS + echo Checking $d for DLLs ... >&5 + if test -f "$d/libvirt-0.dll"; then + LIBVIRT_DLL_PATH="$d" + fi + if test -f "$d/libxdr.dll"; then + LIBXDR_DLL_PATH="$d" + fi + if test -f "$d/libxml2-2.dll"; then + LIBXML2_DLL_PATH="$d" + fi + if test -f "$d/libgpg-error-0.dll"; then + GNUTLS_DLL_PATH="$d" + fi + if test -f "$d/libgtk-win32-2.0-0.dll"; then + GTK_DLL_PATH="$d" + GTK_PATH="$d/.." + fi + done + IFS=$saved_IFS + + if test "x$LIBVIRT_DLL_PATH" = "x"; then + AC_MSG_FAILURE([cannot find libvirt-0.dll in PATH]) + fi + if test "x$LIBXDR_DLL_PATH" = "x"; then + AC_MSG_FAILURE([cannot find libxdr.dll in PATH]) + fi + if test "x$LIBXML2_DLL_PATH" = "x"; then + AC_MSG_FAILURE([cannot find libxml2-2.dll in PATH]) + fi + if test "x$GNUTLS_DLL_PATH" = "x"; then + AC_MSG_FAILURE([cannot find GnuTLS DLLs in PATH]) + fi + if test "x$GTK_DLL_PATH" = "x"; then + AC_MSG_WARN([cannot find GTK DLLs in PATH]) + fi + + # Change the paths to Windows paths. + msys_to_win_dir LIBVIRT_DLL_PATH + msys_to_win_dir LIBXDR_DLL_PATH + msys_to_win_dir LIBXML2_DLL_PATH + msys_to_win_dir GNUTLS_DLL_PATH + if test "x$GTK_DLL_PATH" != "x"; then + msys_to_win_dir GTK_DLL_PATH + msys_to_win_dir GTK_PATH + fi +fi +AC_SUBST(MAKENSIS) +AC_SUBST(LIBVIRT_DLL_PATH) +AC_SUBST(LIBXDR_DLL_PATH) +AC_SUBST(LIBXML2_DLL_PATH) +AC_SUBST(GNUTLS_DLL_PATH) +AC_SUBST(GTK_DLL_PATH) +AC_SUBST(GTK_PATH) + +dnl Write gettext modules for the programs. +dnl http://www.le-gall.net/sylvain+violaine/documentation/ocaml-gettext/html/reference-manual/ch03s04.html +for d in mlvirsh virt-ctrl virt-df virt-top; do + f=`echo $d | tr - _`_gettext.ml + AC_MSG_NOTICE([creating $d/$f]) + rm -f $d/$f + echo "(* This file is generated automatically by ./configure. *)" > $d/$f + if test "x$pkg_gettext" != "xno"; then + # Gettext module is available, so use it. + cat <>$d/$f +module Gettext = Gettext.Program ( + struct + let textdomain = "$d" + let codeset = None + let dir = None + let dependencies = [[]] + end +) (GettextStub.Native) +EOT + else + # No gettext module is available, so fake the translation functions. + cat <>$d/$f +module Gettext = struct + external s_ : string -> string = "%identity" + external f_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format + = "%identity" + let sn_ : string -> string -> int -> string + = fun s p n -> if n = 1 then s else p + let fn_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format -> int + -> ('a -> 'b, 'c, 'd) format + = fun s p n -> if n = 1 then s else p +end +EOT + fi +done + +dnl Summary. +echo "------------------------------------------------------------" +echo "Thanks for downloading" $PACKAGE_STRING +echo " subpackages to build : $subdirs" +echo "------------------------------------------------------------" + +dnl Produce output files. +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([META + libvirt/libvirt_version.ml + Makefile + Make.rules + po/Makefile + libvirt/Makefile + examples/Makefile + mlvirsh/Makefile + virt-ctrl/Makefile + virt-top/Makefile + virt-df/Makefile + ]) +if test "x$MAKENSIS" != "x"; then + AC_CONFIG_FILES([wininstaller.nsis]) +fi +AC_OUTPUT diff --git a/examples/.depend b/examples/.depend new file mode 100644 index 0000000..334ba5d --- /dev/null +++ b/examples/.depend @@ -0,0 +1,4 @@ +list_domains.cmo: ../libvirt/libvirt.cmi +list_domains.cmx: ../libvirt/libvirt.cmx +node_info.cmo: ../libvirt/libvirt.cmi +node_info.cmx: ../libvirt/libvirt.cmx diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..75a98eb --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,90 @@ +# ocaml-libvirt +# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones +# +# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +OCAMLFIND = @OCAMLFIND@ + +ifneq ($(OCAMLFIND),) +OCAMLCPACKAGES := -package unix -I ../libvirt +OCAMLCFLAGS := -g +OCAMLCLIBS := -linkpkg +OCAMLOPTPACKAGES := $(OCAMLCPACKAGES) +OCAMLOPTFLAGS := +OCAMLOPTLIBS := $(OCAMLCLIBS) +else +OCAMLCINCS := -I ../libvirt +OCAMLCFLAGS := -g +OCAMLCLIBS := unix.cma +OCAMLOPTINCS := $(OCAMLCINCS) +OCAMLOPTFLAGS := +OCAMLOPTLIBS := unix.cmxa +endif + +export LIBRARY_PATH=../libvirt +export LD_LIBRARY_PATH=../libvirt + +BYTE_TARGETS := list_domains node_info +OPT_TARGETS := list_domains.opt node_info.opt + +all: $(BYTE_TARGETS) + +opt: $(OPT_TARGETS) + +ifneq ($(OCAMLFIND),) +list_domains: list_domains.cmo + $(OCAMLFIND) ocamlc \ + $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \ + ../libvirt/mllibvirt.cma -o $@ $< + +list_domains.opt: list_domains.cmx + $(OCAMLFIND) ocamlopt \ + $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \ + ../libvirt/mllibvirt.cmxa -o $@ $< + +node_info: node_info.cmo + $(OCAMLFIND) ocamlc \ + $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \ + ../libvirt/mllibvirt.cma -o $@ $< + +node_info.opt: node_info.cmx + $(OCAMLFIND) ocamlopt \ + $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \ + ../libvirt/mllibvirt.cmxa -o $@ $< +else +list_domains: list_domains.cmo + $(OCAMLC) \ + $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \ + ../libvirt/mllibvirt.cma -o $@ $< + +list_domains.opt: list_domains.cmx + $(OCAMLOPT) \ + $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \ + ../libvirt/mllibvirt.cmxa -o $@ $< + +node_info: node_info.cmo + $(OCAMLC) \ + $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \ + ../libvirt/mllibvirt.cma -o $@ $< + +node_info.opt: node_info.cmx + $(OCAMLOPT) \ + $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \ + ../libvirt/mllibvirt.cmxa -o $@ $< +endif + +install: + +include ../Make.rules diff --git a/examples/list_domains.ml b/examples/list_domains.ml new file mode 100644 index 0000000..c97432c --- /dev/null +++ b/examples/list_domains.ml @@ -0,0 +1,46 @@ +(* Simple demo program showing how to list out domains. + Usage: list_domains [URI] + (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + http://libvirt.org/ + *) + +open Printf + +module C = Libvirt.Connect +module D = Libvirt.Domain +module N = Libvirt.Network + +let () = + try + let name = + if Array.length Sys.argv >= 2 then + Some (Sys.argv.(1)) + else + None in + let conn = C.connect_readonly ?name () in + + (* List running domains. *) + let n = C.num_of_domains conn in + let ids = C.list_domains conn n in + let domains = Array.map (D.lookup_by_id conn) ids in + Array.iter ( + fun dom -> + printf "%8d %s\n%!" (D.get_id dom) (D.get_name dom) + ) domains; + + (* List inactive domains. *) + let n = C.num_of_defined_domains conn in + let names = C.list_defined_domains conn n in + Array.iter ( + fun name -> + printf "inactive %s\n%!" name + ) names; + with + Libvirt.Virterror err -> + eprintf "error: %s\n" (Libvirt.Virterror.to_string err) + +let () = + (* Run the garbage collector which is a good way to check for + * memory corruption errors and reference counting issues in libvirt. + *) + Gc.compact () diff --git a/examples/node_info.ml b/examples/node_info.ml new file mode 100644 index 0000000..c52615e --- /dev/null +++ b/examples/node_info.ml @@ -0,0 +1,48 @@ +(* Simple demo program showing node info. + Usage: node_info [URI] + (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + http://libvirt.org/ + *) + +open Printf + +module C = Libvirt.Connect + +let () = + try + let name = + if Array.length Sys.argv >= 2 then + Some (Sys.argv.(1)) + else + None in + let conn = C.connect_readonly ?name () in + + (* Get node_info, hostname, etc. *) + let node_info = C.get_node_info conn in + + printf "model = %s\n" node_info.C.model; + printf "memory = %Ld K\n" node_info.C.memory; + printf "cpus = %d\n" node_info.C.cpus; + printf "mhz = %d\n" node_info.C.mhz; + printf "nodes = %d\n" node_info.C.nodes; + printf "sockets = %d\n" node_info.C.sockets; + printf "cores = %d\n" node_info.C.cores; + printf "threads = %d\n%!" node_info.C.threads; + + let hostname = C.get_hostname conn in + + printf "hostname = %s\n%!" hostname; + + let uri = C.get_uri conn in + + printf "uri = %s\n%!" uri + + with + Libvirt.Virterror err -> + eprintf "error: %s\n" (Libvirt.Virterror.to_string err) + +let () = + (* Run the garbage collector which is a good way to check for + * memory corruption errors and reference counting issues in libvirt. + *) + Gc.compact () diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..4fbbae7 --- /dev/null +++ b/install-sh @@ -0,0 +1,507 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2006-10-14.15 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +posix_glob= +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chmodcmd=$chmodprog +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + shift + shift + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac +done + +if test $# -ne 0 && test -z "$dir_arg$dstarg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix=/ ;; + -*) prefix=./ ;; + *) prefix= ;; + esac + + case $posix_glob in + '') + if (set -f) 2>/dev/null; then + posix_glob=true + else + posix_glob=false + fi ;; + esac + + oIFS=$IFS + IFS=/ + $posix_glob && set -f + set fnord $dstdir + shift + $posix_glob && set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dst"; then + $doit $rmcmd -f "$dst" 2>/dev/null \ + || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ + && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ + || { + echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + } || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/libvirt/.depend b/libvirt/.depend new file mode 100644 index 0000000..5556d96 --- /dev/null +++ b/libvirt/.depend @@ -0,0 +1,4 @@ +libvirt.cmo: libvirt.cmi +libvirt.cmx: libvirt.cmi +libvirt_version.cmo: libvirt_version.cmi +libvirt_version.cmx: libvirt_version.cmi diff --git a/libvirt/Makefile.in b/libvirt/Makefile.in new file mode 100644 index 0000000..66ffc75 --- /dev/null +++ b/libvirt/Makefile.in @@ -0,0 +1,126 @@ +# ocaml-libvirt +# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones +# +# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +WIN32 = @WIN32@ + +CFLAGS = @CFLAGS@ \ + -I.. \ + -I"$(shell ocamlc -where)" \ + @DEBUG@ @WARNINGS@ @CFLAGS_FPIC@ +LDFLAGS = @LDFLAGS@ +# -L"$(shell ocamlc -where)" + +OCAMLC = @OCAMLC@ +OCAMLOPT = @OCAMLOPT@ +OCAMLFIND = @OCAMLFIND@ +OCAMLMKLIB = @OCAMLMKLIB@ + +ifneq ($(OCAMLFIND),) +OCAMLCPACKAGES := -package unix +OCAMLCFLAGS := -g +OCAMLCLIBS := -linkpkg +else +OCAMLCINCS := +OCAMLCFLAGS := -g +OCAMLCLIBS := unix.cma +endif + +OCAMLOPTFLAGS := +ifneq ($(OCAMLFIND),) +OCAMLOPTPACKAGES := $(OCAMLCPACKAGES) +OCAMLOPTLIBS := $(OCAMLCLIBS) +else +OCAMLOPTINCS := $(OCAMLCINCS) +OCAMLOPTLIBS := unix.cmxa +endif + +export LIBRARY_PATH=. +export LD_LIBRARY_PATH=. + +BYTE_TARGETS := mllibvirt.cma +OPT_TARGETS := mllibvirt.cmxa + +all: $(BYTE_TARGETS) + +opt: $(OPT_TARGETS) + +COBJS := libvirt.cmo libvirt_version.cmo +OPTOBJS := libvirt.cmx libvirt_version.cmx + +ifneq ($(OCAMLMKLIB),) +# Good, we can just use ocamlmklib +mllibvirt.cma: libvirt_c.o $(COBJS) + $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) -lvirt + +mllibvirt.cmxa: libvirt_c.o $(OPTOBJS) + $(OCAMLMKLIB) -o mllibvirt $^ $(LDFLAGS) -lvirt + +else +ifeq ($(WIN32),yes) +# Ugh, MinGW doesn't have ocamlmklib. This technique is copied from the +# example in OCaml distribution, otherlibs/win32unix/Makefile.nt + +mllibvirt.cma: dllmllibvirt.dll libmllibvirt.a $(COBJS) + $(OCAMLC) -a -linkall -o $@ $(COBJS) \ + -dllib -lmllibvirt -cclib -lmllibvirt -cclib "$(LDFLAGS) -lvirt" + +mllibvirt.cmxa: libmllibvirt.a $(OPTOBJS) + $(OCAMLOPT) -a -linkall -o $@ $(OPTOBJS) \ + -cclib -lmllibvirt -cclib "$(LDFLAGS) -lvirt" + +dllmllibvirt.dll: libvirt_c.o + $(CC) -shared -o $@ $^ \ + $(LDFLAGS) "$(shell ocamlc -where)"/ocamlrun.a -lvirt + +libmllibvirt.a: libvirt_c.o + ar rc $@ $^ + ranlib $@ + +else +# Don't know how to build a library on this platform. +$(BYTE_TARGETS) $(OPT_TARGETS): + echo "Error: ocamlmklib missing, and no known way to build libraries on this platform" + exit 1 +endif +endif + +# Automatically generate the C code from a Perl script 'generator.pl'. +libvirt_c.c: generator.pl + perl -w $< + +# Status of automatically generated bindings. +autostatus: libvirt_c.c + @echo -n "Functions which have manual bindings: " + @grep ^ocaml_libvirt_ libvirt_c_oneoffs.c | wc -l + @echo -n "Functions which have automatic bindings: " + @grep ^ocaml_libvirt_ libvirt_c.c | wc -l + @echo -n "LOC in manual bindings: " + @wc -l < libvirt_c_oneoffs.c + @echo -n "LOC in automatic bindings: " + @wc -l < libvirt_c.c + +libvirt.cmo: libvirt.cmi +libvirt.cmi: libvirt.mli + +libvirt_version.cmo: libvirt_version.cmi +libvirt_version.cmi: libvirt_version.mli + +install: + ocamlfind install libvirt \ + ../META *.so *.a *.cmx *.cma *.cmxa *.cmi *.mli + +include ../Make.rules diff --git a/libvirt/README b/libvirt/README new file mode 100644 index 0000000..be8300d --- /dev/null +++ b/libvirt/README @@ -0,0 +1,49 @@ +README +====== + +The public interface is described in 'libvirt.mli'. You may prefer to +do 'make doc' at the top level source directory and then read the HTML +documentation starting at html/index.html. + +'libvirt.ml' describes how OCaml functions map to C functions. + +'libvirt_c*.c' are the C functions which map OCaml objects to C +objects and vice versa (see next section). + +Generated code +-------------- + +The C bindings in 'libvirt_c.c' are now generated automatically by a +Perl script called 'generator.pl'. You do not normally need to run +this script, but you may need to if you want to extend libvirt +coverage. + +The majority of the functions are now generated automatically, but +there are a few one-off bindings (eg. one-of-a-type functions, +functions with particularly complex mappings). Our eventual aim to is +autogenerate as much as possible. Use 'make autostatus' in this +directory to find out how we're doing. + +The generated 'libvirt_c.c' #includes some other C files in this +directory: + + #include "libvirt_c_prologue.c" + + A prologue that prototypes some static functions which are defined + in the epilogue (see below), and provides some general macros. + + #include "libvirt_c_oneoffs.c" + + One-off bindings: Bindings which are too specialised or one-of-a-kind + to be worth generating automatically. + + [Followed by generated bindings, then ...] + + #include "libvirt_c_epilogue.c" + + An epilogue which defines some standard static functions (eg.) for + wrapping and unwrapping libvirt objects. + +The key to understanding the generator is to look at the generated +code (libvirt_c.c) first, and go from there back to parts of the +generator script. diff --git a/libvirt/generator.pl b/libvirt/generator.pl new file mode 100755 index 0000000..4fbace6 --- /dev/null +++ b/libvirt/generator.pl @@ -0,0 +1,1018 @@ +#!/usr/bin/perl -w +# +# OCaml bindings for libvirt. +# (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc. +# http://libvirt.org/ +# +# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# This generates libvirt_c.c (the core of the bindings). You don't +# need to run this program unless you are extending the bindings +# themselves (eg. because libvirt has been extended). +# +# Please read libvirt/README. + +use strict; + +#---------------------------------------------------------------------- + +# The functions in the libvirt API that we can generate. + +# The 'sig' (signature) doesn't have a meaning or any internal structure. +# It is interpreted by the generation functions below to indicate what +# "class" the function falls into, and to generate the right class of +# binding. +# +# Any function added since libvirt 0.2.1 must be marked weak. + +my @functions = ( + { name => "virConnectClose", sig => "conn : free" }, + { name => "virConnectGetHostname", sig => "conn : string", weak => 1 }, + { name => "virConnectGetURI", sig => "conn : string", weak => 1 }, + { name => "virConnectGetType", sig => "conn : static string" }, + { name => "virConnectNumOfDomains", sig => "conn : int" }, + { name => "virConnectListDomains", sig => "conn, int : int array" }, + { name => "virConnectNumOfDefinedDomains", sig => "conn : int" }, + { name => "virConnectListDefinedDomains", + sig => "conn, int : string array" }, + { name => "virConnectNumOfNetworks", sig => "conn : int" }, + { name => "virConnectListNetworks", sig => "conn, int : string array" }, + { name => "virConnectNumOfDefinedNetworks", sig => "conn : int" }, + { name => "virConnectListDefinedNetworks", + sig => "conn, int : string array" }, + { name => "virConnectNumOfStoragePools", sig => "conn : int", weak => 1 }, + { name => "virConnectListStoragePools", + sig => "conn, int : string array", weak => 1 }, + { name => "virConnectNumOfDefinedStoragePools", + sig => "conn : int", weak => 1 }, + { name => "virConnectListDefinedStoragePools", + sig => "conn, int : string array", weak => 1 }, + { name => "virConnectGetCapabilities", sig => "conn : string" }, + + { name => "virDomainCreateLinux", sig => "conn, string, 0U : dom" }, + { name => "virDomainCreateLinuxJob", + sig => "conn, string, 0U : job", weak => 1 }, + { name => "virDomainFree", sig => "dom : free" }, + { name => "virDomainDestroy", sig => "dom : free" }, + { name => "virDomainLookupByName", sig => "conn, string : dom" }, + { name => "virDomainLookupByID", sig => "conn, int : dom" }, + { name => "virDomainLookupByUUID", sig => "conn, uuid : dom" }, + { name => "virDomainLookupByUUIDString", sig => "conn, string : dom" }, + { name => "virDomainGetName", sig => "dom : static string" }, + { name => "virDomainGetOSType", sig => "dom : string" }, + { name => "virDomainGetXMLDesc", sig => "dom, 0 : string" }, + { name => "virDomainGetUUID", sig => "dom : uuid" }, + { name => "virDomainGetUUIDString", sig => "dom : uuid string" }, + { name => "virDomainGetMaxVcpus", sig => "dom : int" }, + { name => "virDomainSave", sig => "dom, string : unit" }, + { name => "virDomainSaveJob", + sig => "dom, string : job from dom", weak => 1 }, + { name => "virDomainRestore", sig => "conn, string : unit" }, + { name => "virDomainRestoreJob", + sig => "conn, string : job", weak => 1 }, + { name => "virDomainCoreDump", sig => "dom, string, 0 : unit" }, + { name => "virDomainCoreDumpJob", + sig => "dom, string, 0 : job from dom", weak => 1 }, + { name => "virDomainSuspend", sig => "dom : unit" }, + { name => "virDomainResume", sig => "dom : unit" }, + { name => "virDomainShutdown", sig => "dom : unit" }, + { name => "virDomainReboot", sig => "dom, 0 : unit" }, + { name => "virDomainDefineXML", sig => "conn, string : dom" }, + { name => "virDomainUndefine", sig => "dom : unit" }, + { name => "virDomainCreate", sig => "dom : unit" }, + { name => "virDomainCreateJob", + sig => "dom, 0U : job from dom", weak => 1 }, + { name => "virDomainAttachDevice", sig => "dom, string : unit" }, + { name => "virDomainDetachDevice", sig => "dom, string : unit" }, + { name => "virDomainGetAutostart", sig => "dom : bool" }, + { name => "virDomainSetAutostart", sig => "dom, bool : unit" }, + + { name => "virNetworkFree", sig => "net : free" }, + { name => "virNetworkDestroy", sig => "net : free" }, + { name => "virNetworkLookupByName", sig => "conn, string : net" }, + { name => "virNetworkLookupByUUID", sig => "conn, uuid : net" }, + { name => "virNetworkLookupByUUIDString", sig => "conn, string : net" }, + { name => "virNetworkGetName", sig => "net : static string" }, + { name => "virNetworkGetXMLDesc", sig => "net, 0 : string" }, + { name => "virNetworkGetBridgeName", sig => "net : string" }, + { name => "virNetworkGetUUID", sig => "net : uuid" }, + { name => "virNetworkGetUUIDString", sig => "net : uuid string" }, + { name => "virNetworkUndefine", sig => "net : unit" }, + { name => "virNetworkCreateXML", sig => "conn, string : net" }, + { name => "virNetworkCreateXMLJob", + sig => "conn, string : job", weak => 1 }, + { name => "virNetworkDefineXML", sig => "conn, string : net" }, + { name => "virNetworkCreate", sig => "net : unit" }, + { name => "virNetworkCreateJob", + sig => "net : job from net", weak => 1 }, + { name => "virNetworkGetAutostart", sig => "net : bool" }, + { name => "virNetworkSetAutostart", sig => "net, bool : unit" }, + + { name => "virStoragePoolFree", sig => "pool : free", weak => 1 }, + { name => "virStoragePoolDestroy", sig => "pool : free", weak => 1 }, + { name => "virStoragePoolLookupByName", + sig => "conn, string : pool", weak => 1 }, + { name => "virStoragePoolLookupByUUID", + sig => "conn, uuid : pool", weak => 1 }, + { name => "virStoragePoolLookupByUUIDString", + sig => "conn, string : pool", weak => 1 }, + { name => "virStoragePoolGetName", + sig => "pool : static string", weak => 1 }, + { name => "virStoragePoolGetXMLDesc", + sig => "pool, 0U : string", weak => 1 }, + { name => "virStoragePoolGetUUID", + sig => "pool : uuid", weak => 1 }, + { name => "virStoragePoolGetUUIDString", + sig => "pool : uuid string", weak => 1 }, + { name => "virStoragePoolCreateXML", + sig => "conn, string, 0U : pool", weak => 1 }, + { name => "virStoragePoolDefineXML", + sig => "conn, string, 0U : pool", weak => 1 }, + { name => "virStoragePoolBuild", + sig => "pool, uint : unit", weak => 1 }, + { name => "virStoragePoolUndefine", + sig => "pool : unit", weak => 1 }, + { name => "virStoragePoolCreate", + sig => "pool, 0U : unit", weak => 1 }, + { name => "virStoragePoolDelete", + sig => "pool, uint : unit", weak => 1 }, + { name => "virStoragePoolRefresh", + sig => "pool, 0U : unit", weak => 1 }, + { name => "virStoragePoolGetAutostart", + sig => "pool : bool", weak => 1 }, + { name => "virStoragePoolSetAutostart", + sig => "pool, bool : unit", weak => 1 }, + { name => "virStoragePoolNumOfVolumes", + sig => "pool : int", weak => 1 }, + { name => "virStoragePoolListVolumes", + sig => "pool, int : string array", weak => 1 }, + + { name => "virStorageVolFree", sig => "vol : free", weak => 1 }, + { name => "virStorageVolDelete", + sig => "vol, uint : unit", weak => 1 }, + { name => "virStorageVolLookupByName", + sig => "pool, string : vol from pool", weak => 1 }, + { name => "virStorageVolLookupByKey", + sig => "conn, string : vol", weak => 1 }, + { name => "virStorageVolLookupByPath", + sig => "conn, string : vol", weak => 1 }, + { name => "virStorageVolCreateXML", + sig => "pool, string, 0U : vol from pool", weak => 1 }, + { name => "virStorageVolGetXMLDesc", + sig => "vol, 0U : string", weak => 1 }, + { name => "virStorageVolGetPath", + sig => "vol : string", weak => 1 }, + { name => "virStorageVolGetKey", + sig => "vol : static string", weak => 1 }, + { name => "virStorageVolGetName", + sig => "vol : static string", weak => 1 }, + { name => "virStoragePoolLookupByVolume", + sig => "vol : pool from vol", weak => 1 }, + + { name => "virJobFree", + sig => "job : free", weak => 1 }, + { name => "virJobCancel", + sig => "job : unit", weak => 1 }, + { name => "virJobGetNetwork", + sig => "job : net from job", weak => 1 }, + { name => "virJobGetDomain", + sig => "job : dom from job", weak => 1 }, + + ); + +# Functions we haven't implemented anywhere yet but which are mentioned +# in 'libvirt.ml'. +# +# We create stubs for these, but eventually they need to either be +# moved ^^^ so they are auto-generated, or implementations of them +# written in 'libvirt_c_oneoffs.c'. + +my @unimplemented = ( + ); + +#---------------------------------------------------------------------- + +# Open the output file. + +my $filename = "libvirt_c.c"; +open F, ">$filename" or die "$filename: $!"; + +# Write the prologue. + +print F <<'END'; +/* !!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!! + * + * THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'. + * + * Any changes you make to this file may be overwritten. + */ + +/* OCaml bindings for libvirt. + * (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc. + * http://libvirt.org/ + * + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libvirt_c_prologue.c" + +#include "libvirt_c_oneoffs.c" + +END + +#---------------------------------------------------------------------- + +sub camel_case_to_underscores +{ + my $name = shift; + + $name =~ s/([A-Z][a-z]+|XML|URI|OS|UUID)/$1,/g; + my @subs = split (/,/, $name); + @subs = map { lc($_) } @subs; + join "_", @subs +} + +# Helper functions dealing with signatures. + +sub short_name_to_c_type +{ + local $_ = shift; + + if ($_ eq "conn") { "virConnectPtr" } + elsif ($_ eq "dom") { "virDomainPtr" } + elsif ($_ eq "net") { "virNetworkPtr" } + elsif ($_ eq "pool") { "virStoragePoolPtr" } + elsif ($_ eq "vol") { "virStorageVolPtr" } + elsif ($_ eq "job") { "virJobPtr" } + else { + die "unknown short name $_" + } +} + +# Generate a C signature for the original function. Used when building +# weak bindings. + +sub gen_c_signature +{ + my $sig = shift; + my $c_name = shift; + + if ($sig =~ /^(\w+) : string$/) { + my $c_type = short_name_to_c_type ($1); + "char *$c_name ($c_type $1)" + } elsif ($sig =~ /^(\w+) : static string$/) { + my $c_type = short_name_to_c_type ($1); + "const char *$c_name ($c_type $1)" + } elsif ($sig =~ /^(\w+) : int$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1)" + } elsif ($sig =~ /^(\w+) : uuid$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1, unsigned char *)" + } elsif ($sig =~ /^(\w+) : uuid string$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1, char *)" + } elsif ($sig =~ /^(\w+) : bool$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1, int *r)" + } elsif ($sig =~ /^(\w+), bool : unit$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1, int b)" + } elsif ($sig eq "conn, int : int array") { + "int $c_name (virConnectPtr conn, int *ids, int maxids)" + } elsif ($sig =~ /^(\w+), int : string array$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1, char **const names, int maxnames)" + } elsif ($sig =~ /^(\w+), 0(U?) : string$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "U" ? "unsigned " : ""; + "char *$c_name ($c_type $1, $unsigned int flags)" + } elsif ($sig =~ /^(\w+), 0(U?) : unit$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "U" ? "unsigned " : ""; + "int $c_name ($c_type $1, $unsigned int flags)" + } elsif ($sig =~ /^(\w+) : unit$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1)" + } elsif ($sig =~ /^(\w+) : free$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1)" + } elsif ($sig =~ /^(\w+), string : unit$/) { + my $c_type = short_name_to_c_type ($1); + "int $c_name ($c_type $1, const char *str)" + } elsif ($sig =~ /^(\w+), string, 0(U?) : unit$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "U" ? "unsigned " : ""; + "int $c_name ($c_type $1, const char *str, ${unsigned}int flags)" + } elsif ($sig =~ /^(\w+), string : (\w+)$/) { + my $c_type = short_name_to_c_type ($1); + my $c_ret_type = short_name_to_c_type ($2); + "$c_ret_type $c_name ($c_type $1, const char *str)" + } elsif ($sig =~ /^(\w+), string, 0(U?) : (\w+)$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "U" ? "unsigned " : ""; + my $c_ret_type = short_name_to_c_type ($3); + "$c_ret_type $c_name ($c_type $1, const char *str, ${unsigned}int flags)" + } elsif ($sig =~ /^(\w+), (u?)int : unit$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "u" ? "unsigned " : ""; + "int $c_name ($c_type $1, ${unsigned}int i)" + } elsif ($sig =~ /^(\w+), (u?)int : (\w+)$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "u" ? "unsigned " : ""; + my $c_ret_type = short_name_to_c_type ($3); + "$c_ret_type $c_name ($c_type $1, ${unsigned}int i)" + } elsif ($sig =~ /^(\w+), uuid : (\w+)$/) { + my $c_type = short_name_to_c_type ($1); + my $c_ret_type = short_name_to_c_type ($2); + "$c_ret_type $c_name ($c_type $1, const unsigned char *str)" + } elsif ($sig =~ /^(\w+), 0(U?) : (\w+)$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "U" ? "unsigned " : ""; + my $c_ret_type = short_name_to_c_type ($3); + "$c_ret_type $c_name ($c_type $1, $unsigned int flags)" + } elsif ($sig =~ /^(\w+) : (\w+)$/) { + my $c_type = short_name_to_c_type ($1); + my $c_ret_type = short_name_to_c_type ($2); + "$c_ret_type $c_name ($c_type $1)" + } elsif ($sig =~ /^(\w+), string : (\w+) from \w+$/) { + my $c_type = short_name_to_c_type ($1); + my $c_ret_type = short_name_to_c_type ($2); + "$c_ret_type $c_name ($c_type $1, const char *str)" + } elsif ($sig =~ /^(\w+), string, 0(U?) : (\w+) from \w+$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "U" ? "unsigned " : ""; + my $c_ret_type = short_name_to_c_type ($3); + "$c_ret_type $c_name ($c_type $1, const char *str, $unsigned int flags)" + } elsif ($sig =~ /^(\w+), 0(U?) : (\w+) from \w+$/) { + my $c_type = short_name_to_c_type ($1); + my $unsigned = $2 eq "U" ? "unsigned " : ""; + my $c_ret_type = short_name_to_c_type ($3); + "$c_ret_type $c_name ($c_type $1, $unsigned int flags)" + } elsif ($sig =~ /^(\w+) : (\w+) from \w+$/) { + my $c_type = short_name_to_c_type ($1); + my $c_ret_type = short_name_to_c_type ($2); + "$c_ret_type $c_name ($c_type $1)" + } else { + die "unknown signature $sig" + } +} + +# OCaml argument names. + +sub gen_arg_names +{ + my $sig = shift; + + if ($sig =~ /^(\w+) : string$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : static string$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : int$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : uuid$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : uuid string$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : bool$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+), bool : unit$/) { + ( "$1v", "bv" ) + } elsif ($sig eq "conn, int : int array") { + ( "connv", "iv" ) + } elsif ($sig =~ /^(\w+), int : string array$/) { + ( "$1v", "iv" ) + } elsif ($sig =~ /^(\w+), 0U? : string$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+), 0U? : unit$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : unit$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : free$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+), string : unit$/) { + ( "$1v", "strv" ) + } elsif ($sig =~ /^(\w+), string, 0U? : unit$/) { + ( "$1v", "strv" ) + } elsif ($sig =~ /^(\w+), string : (\w+)$/) { + ( "$1v", "strv" ) + } elsif ($sig =~ /^(\w+), string, 0U? : (\w+)$/) { + ( "$1v", "strv" ) + } elsif ($sig =~ /^(\w+), u?int : (\w+)$/) { + ( "$1v", "iv" ) + } elsif ($sig =~ /^(\w+), uuid : (\w+)$/) { + ( "$1v", "uuidv" ) + } elsif ($sig =~ /^(\w+), 0U? : (\w+)$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : (\w+)$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+), string : (\w+) from \w+$/) { + ( "$1v", "strv" ) + } elsif ($sig =~ /^(\w+), string, 0U? : (\w+) from \w+$/) { + ( "$1v", "strv" ) + } elsif ($sig =~ /^(\w+), 0U? : (\w+) from \w+$/) { + ( "$1v" ) + } elsif ($sig =~ /^(\w+) : (\w+) from \w+$/) { + ( "$1v" ) + } else { + die "unknown signature $sig" + } +} + +# Unpack the first (object) argument. + +sub gen_unpack_args +{ + local $_ = shift; + + if ($_ eq "conn") { + "virConnectPtr conn = Connect_val (connv);" + } elsif ($_ eq "dom") { + "virDomainPtr dom = Domain_val (domv);\n". + " virConnectPtr conn = Connect_domv (domv);" + } elsif ($_ eq "net") { + "virNetworkPtr net = Network_val (netv);\n". + " virConnectPtr conn = Connect_netv (netv);" + } elsif ($_ eq "pool") { + "virStoragePoolPtr pool = Pool_val (poolv);\n". + " virConnectPtr conn = Connect_polv (poolv);" + } elsif ($_ eq "vol") { + "virStorageVolPtr vol = Volume_val (volv);\n". + " virConnectPtr conn = Connect_volv (volv);" + } elsif ($_ eq "job") { + "virJobPtr job = Job_val (jobv);\n". + " virConnectPtr conn = Connect_jobv (jobv);" + } else { + die "unknown short name $_" + } +} + +# Pack the result if it's an object. + +sub gen_pack_result +{ + local $_ = shift; + + if ($_ eq "dom") { "rv = Val_domain (r, connv);" } + elsif ($_ eq "net") { "rv = Val_network (r, connv);" } + elsif ($_ eq "pool") { "rv = Val_pool (r, connv);" } + elsif ($_ eq "vol") { "rv = Val_volume (r, connv);" } + elsif ($_ eq "job") { "rv = Val_job (r, connv);" } + else { + die "unknown short name $_" + } +} + +sub gen_free_arg +{ + local $_ = shift; + + if ($_ eq "conn") { "Connect_val (connv) = NULL;" } + elsif ($_ eq "dom") { "Domain_val (domv) = NULL;" } + elsif ($_ eq "net") { "Network_val (netv) = NULL;" } + elsif ($_ eq "pool") { "Pool_val (poolv) = NULL;" } + elsif ($_ eq "vol") { "Volume_val (volv) = NULL;" } + elsif ($_ eq "job") { "Job_val (jobv) = NULL;" } + else { + die "unknown short name $_" + } +} + +# Generate the C body for each signature (class of function). + +sub gen_c_code +{ + my $sig = shift; + my $c_name = shift; + + if ($sig =~ /^(\w+) : string$/) { + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + char *r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+) : static string$/) { + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + const char *r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + rv = caml_copy_string (r); + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+) : int$/) { + "\ + " . gen_unpack_args ($1) . " + int r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + CAMLreturn (Val_int (r)); +" + } elsif ($sig =~ /^(\w+) : uuid$/) { + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + unsigned char uuid[VIR_UUID_BUFLEN]; + int r; + + NONBLOCKING (r = $c_name ($1, uuid)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + /* UUIDs are byte arrays with a fixed length. */ + rv = caml_alloc_string (VIR_UUID_BUFLEN); + memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN); + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+) : uuid string$/) { + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + char uuid[VIR_UUID_STRING_BUFLEN]; + int r; + + NONBLOCKING (r = $c_name ($1, uuid)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + rv = caml_copy_string (uuid); + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+) : bool$/) { + "\ + " . gen_unpack_args ($1) . " + int r, b; + + NONBLOCKING (r = $c_name ($1, &b)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + CAMLreturn (b ? Val_true : Val_false); +" + } elsif ($sig =~ /^(\w+), bool : unit$/) { + "\ + " . gen_unpack_args ($1) . " + int r, b; + + b = bv == Val_true ? 1 : 0; + + NONBLOCKING (r = $c_name ($1, b)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + CAMLreturn (Val_unit); +" + } elsif ($sig eq "conn, int : int array") { + "\ + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + int ids[i], r; + + NONBLOCKING (r = $c_name (conn, ids, i)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) + Store_field (rv, i, Val_int (ids[i])); + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), int : string array$/) { + "\ + CAMLlocal2 (rv, strv); + " . gen_unpack_args ($1) . " + int i = Int_val (iv); + char *names[i]; + int r; + + NONBLOCKING (r = $c_name ($1, names, i)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + strv = caml_copy_string (names[i]); + Store_field (rv, i, strv); + free (names[i]); + } + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), 0U? : string$/) { + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + char *r; + + NONBLOCKING (r = $c_name ($1, 0)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), 0U? : unit$/) { + "\ + " . gen_unpack_args ($1) . " + int r; + + NONBLOCKING (r = $c_name ($1, 0)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + CAMLreturn (Val_unit); +" + } elsif ($sig =~ /^(\w+) : unit$/) { + "\ + " . gen_unpack_args ($1) . " + int r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + CAMLreturn (Val_unit); +" + } elsif ($sig =~ /^(\w+) : free$/) { + "\ + " . gen_unpack_args ($1) . " + int r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + /* So that we don't double-free in the finalizer: */ + " . gen_free_arg ($1) . " + + CAMLreturn (Val_unit); +" + } elsif ($sig =~ /^(\w+), string : unit$/) { + "\ + " . gen_unpack_args ($1) . " + char *str = String_val (strv); + int r; + + NONBLOCKING (r = $c_name ($1, str)); + CHECK_ERROR (r == -1, conn, \"$c_name\"); + + CAMLreturn (Val_unit); +" + } elsif ($sig =~ /^(\w+), string, 0U? : unit$/) { + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + char *str = String_val (strv); + int r; + + NONBLOCKING (r = $c_name ($1, str, 0)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + CAMLreturn (Val_unit); +" + } elsif ($sig =~ /^(\w+), string : (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + char *str = String_val (strv); + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1, str)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), string, 0U? : (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + char *str = String_val (strv); + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1, str, 0)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), (u?)int : unit$/) { + my $unsigned = $2 eq "u" ? "unsigned " : ""; + "\ + " . gen_unpack_args ($1) . " + ${unsigned}int i = Int_val (iv); + int r; + + NONBLOCKING (r = $c_name ($1, i)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + CAMLreturn (Val_unit); +" + } elsif ($sig =~ /^(\w+), (u?)int : (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($3); + my $unsigned = $2 eq "u" ? "unsigned " : ""; + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + ${unsigned}int i = Int_val (iv); + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1, i)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + " . gen_pack_result ($3) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), uuid : (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + unsigned char *uuid = (unsigned char *) String_val (uuidv); + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1, uuid)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), 0U? : (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1, 0)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+) : (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), string : (\w+) from (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal2 (rv, connv); + " . gen_unpack_args ($1) . " + char *str = String_val (strv); + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1, str)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + connv = Field ($3v, 1); + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), string, 0U? : (\w+) from (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal2 (rv, connv); + " . gen_unpack_args ($1) . " + char *str = String_val (strv); + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1, str, 0)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + connv = Field ($3v, 1); + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+), 0U? : (\w+) from (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal2 (rv, connv); + " . gen_unpack_args ($1) . " + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1, 0)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + connv = Field ($3v, 1); + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+) : (\w+) from (\w+)$/) { + my $c_ret_type = short_name_to_c_type ($2); + "\ + CAMLlocal2 (rv, connv); + " . gen_unpack_args ($1) . " + $c_ret_type r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (!r, conn, \"$c_name\"); + + connv = Field ($3v, 1); + " . gen_pack_result ($2) . " + + CAMLreturn (rv); +" + } else { + die "unknown signature $sig" + } +} + +# Generate each function. + +foreach my $function (@functions) { + my $c_name = $function->{name}; + my $is_weak = $function->{weak}; + my $sig = $function->{sig}; + + #print "generating $c_name with sig \"$sig\" ...\n"; + + #my $is_pool_func = $c_name =~ /^virStoragePool/; + #my $is_vol_func = $c_name =~ /^virStorageVol/; + + # Generate an equivalent C-external name for the function, unless + # one is defined already. + my $c_external_name; + if (exists ($function->{c_external_name})) { + $c_external_name = $function->{c_external_name}; + } elsif ($c_name =~ /^vir/) { + $c_external_name = substr $c_name, 3; + $c_external_name = camel_case_to_underscores ($c_external_name); + $c_external_name = "ocaml_libvirt_" . $c_external_name; + } else { + die "cannot convert c_name $c_name to c_external_name" + } + + print F < unit -> int * int = "ocaml_libvirt_get_version" + +let uuid_length = 16 +let uuid_string_length = 36 + +(* http://caml.inria.fr/pub/ml-archives/caml-list/2004/07/80683af867cce6bf8fff273973f70c95.en.html *) +type rw = [`R|`W] +type ro = [`R] + +type ('a, 'b) job_t + +module Connect = +struct + type 'rw t + + type node_info = { + model : string; + memory : int64; + cpus : int; + mhz : int; + nodes : int; + sockets : int; + cores : int; + threads : int; + } + + external connect : ?name:string -> unit -> rw t = "ocaml_libvirt_connect_open" + external connect_readonly : ?name:string -> unit -> ro t = "ocaml_libvirt_connect_open_readonly" + external close : [>`R] t -> unit = "ocaml_libvirt_connect_close" + external get_type : [>`R] t -> string = "ocaml_libvirt_connect_get_type" + external get_version : [>`R] t -> int = "ocaml_libvirt_connect_get_version" + external get_hostname : [>`R] t -> string = "ocaml_libvirt_connect_get_hostname" + external get_uri : [>`R] t -> string = "ocaml_libvirt_connect_get_uri" + external get_max_vcpus : [>`R] t -> ?type_:string -> unit -> int = "ocaml_libvirt_connect_get_max_vcpus" + external list_domains : [>`R] t -> int -> int array = "ocaml_libvirt_connect_list_domains" + external num_of_domains : [>`R] t -> int = "ocaml_libvirt_connect_num_of_domains" + external get_capabilities : [>`R] t -> xml = "ocaml_libvirt_connect_get_capabilities" + external num_of_defined_domains : [>`R] t -> int = "ocaml_libvirt_connect_num_of_defined_domains" + external list_defined_domains : [>`R] t -> int -> string array = "ocaml_libvirt_connect_list_defined_domains" + external num_of_networks : [>`R] t -> int = "ocaml_libvirt_connect_num_of_networks" + external list_networks : [>`R] t -> int -> string array = "ocaml_libvirt_connect_list_networks" + external num_of_defined_networks : [>`R] t -> int = "ocaml_libvirt_connect_num_of_defined_networks" + external list_defined_networks : [>`R] t -> int -> string array = "ocaml_libvirt_connect_list_defined_networks" + external num_of_pools : [>`R] t -> int = "ocaml_libvirt_connect_num_of_storage_pools" + external list_pools : [>`R] t -> int -> string array = "ocaml_libvirt_connect_list_storage_pools" + external num_of_defined_pools : [>`R] t -> int = "ocaml_libvirt_connect_num_of_defined_storage_pools" + external list_defined_pools : [>`R] t -> int -> string array = "ocaml_libvirt_connect_list_defined_storage_pools" + + external get_node_info : [>`R] t -> node_info = "ocaml_libvirt_connect_get_node_info" + external node_get_free_memory : [> `R] t -> int64 = "ocaml_libvirt_connect_node_get_free_memory" + external node_get_cells_free_memory : [> `R] t -> int -> int -> int64 array = "ocaml_libvirt_connect_node_get_cells_free_memory" + + (* See VIR_NODEINFO_MAXCPUS macro defined in . *) + let maxcpus_of_node_info { nodes = nodes; sockets = sockets; + cores = cores; threads = threads } = + nodes * sockets * cores * threads + + (* See VIR_CPU_MAPLEN macro defined in . *) + let cpumaplen nr_cpus = + (nr_cpus + 7) / 8 + + (* See VIR_USE_CPU, VIR_UNUSE_CPU, VIR_CPU_USABLE macros defined in . *) + let use_cpu cpumap cpu = + cpumap.[cpu/8] <- + Char.chr (Char.code cpumap.[cpu/8] lor (1 lsl (cpu mod 8))) + let unuse_cpu cpumap cpu = + cpumap.[cpu/8] <- + Char.chr (Char.code cpumap.[cpu/8] land (lnot (1 lsl (cpu mod 8)))) + let cpu_usable cpumaps maplen vcpu cpu = + Char.code cpumaps.[vcpu*maplen + cpu/8] land (1 lsl (cpu mod 8)) <> 0 + + external const : [>`R] t -> ro t = "%identity" +end + +module Domain = +struct + type 'rw t + + type state = + | InfoNoState | InfoRunning | InfoBlocked | InfoPaused + | InfoShutdown | InfoShutoff | InfoCrashed + + type info = { + state : state; + max_mem : int64; + memory : int64; + nr_virt_cpu : int; + cpu_time : int64; + } + + type vcpu_state = VcpuOffline | VcpuRunning | VcpuBlocked + + type vcpu_info = { + number : int; + vcpu_state : vcpu_state; + vcpu_time : int64; + cpu : int; + } + + type sched_param = string * sched_param_value + and sched_param_value = + | SchedFieldInt32 of int32 | SchedFieldUInt32 of int32 + | SchedFieldInt64 of int64 | SchedFieldUInt64 of int64 + | SchedFieldFloat of float | SchedFieldBool of bool + + type migrate_flag = Live + + type block_stats = { + rd_req : int64; + rd_bytes : int64; + wr_req : int64; + wr_bytes : int64; + errs : int64; + } + + type interface_stats = { + rx_bytes : int64; + rx_packets : int64; + rx_errs : int64; + rx_drop : int64; + tx_bytes : int64; + tx_packets : int64; + tx_errs : int64; + tx_drop : int64; + } + + external create_linux : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_domain_create_linux" + external create_linux_job : [>`W] Connect.t -> xml -> ([`Domain], rw) job_t = "ocaml_libvirt_domain_create_linux_job" + external lookup_by_id : 'a Connect.t -> int -> 'a t = "ocaml_libvirt_domain_lookup_by_id" + external lookup_by_uuid : 'a Connect.t -> uuid -> 'a t = "ocaml_libvirt_domain_lookup_by_uuid" + external lookup_by_uuid_string : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_domain_lookup_by_uuid_string" + external lookup_by_name : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_domain_lookup_by_name" + external destroy : [>`W] t -> unit = "ocaml_libvirt_domain_destroy" + external free : [>`R] t -> unit = "ocaml_libvirt_domain_free" + external suspend : [>`W] t -> unit = "ocaml_libvirt_domain_suspend" + external resume : [>`W] t -> unit = "ocaml_libvirt_domain_resume" + external save : [>`W] t -> filename -> unit = "ocaml_libvirt_domain_save" + external save_job : [>`W] t -> filename -> ([`Domain_nocreate], rw) job_t = "ocaml_libvirt_domain_save_job" + external restore : [>`W] Connect.t -> filename -> unit = "ocaml_libvirt_domain_restore" + external restore_job : [>`W] Connect.t -> filename -> ([`Domain_nocreate], rw) job_t = "ocaml_libvirt_domain_restore_job" + external core_dump : [>`W] t -> filename -> unit = "ocaml_libvirt_domain_core_dump" + external core_dump_job : [>`W] t -> filename -> ([`Domain_nocreate], rw) job_t = "ocaml_libvirt_domain_core_dump_job" + external shutdown : [>`W] t -> unit = "ocaml_libvirt_domain_shutdown" + external reboot : [>`W] t -> unit = "ocaml_libvirt_domain_reboot" + external get_name : [>`R] t -> string = "ocaml_libvirt_domain_get_name" + external get_uuid : [>`R] t -> uuid = "ocaml_libvirt_domain_get_uuid" + external get_uuid_string : [>`R] t -> string = "ocaml_libvirt_domain_get_uuid_string" + external get_id : [>`R] t -> int = "ocaml_libvirt_domain_get_id" + external get_os_type : [>`R] t -> string = "ocaml_libvirt_domain_get_os_type" + external get_max_memory : [>`R] t -> int64 = "ocaml_libvirt_domain_get_max_memory" + external set_max_memory : [>`W] t -> int64 -> unit = "ocaml_libvirt_domain_set_max_memory" + external set_memory : [>`W] t -> int64 -> unit = "ocaml_libvirt_domain_set_memory" + external get_info : [>`R] t -> info = "ocaml_libvirt_domain_get_info" + external get_xml_desc : [>`R] t -> xml = "ocaml_libvirt_domain_get_xml_desc" + external get_scheduler_type : [>`R] t -> string * int = "ocaml_libvirt_domain_get_scheduler_type" + external get_scheduler_parameters : [>`R] t -> int -> sched_param array = "ocaml_libvirt_domain_get_scheduler_parameters" + external set_scheduler_parameters : [>`W] t -> sched_param array -> unit = "ocaml_libvirt_domain_set_scheduler_parameters" + external define_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_domain_define_xml" + external undefine : [>`W] t -> unit = "ocaml_libvirt_domain_undefine" + external create : [>`W] t -> unit = "ocaml_libvirt_domain_create" + external create_job : [>`W] t -> ([`Domain_nocreate], rw) job_t = "ocaml_libvirt_domain_create_job" + external get_autostart : [>`R] t -> bool = "ocaml_libvirt_domain_get_autostart" + external set_autostart : [>`W] t -> bool -> unit = "ocaml_libvirt_domain_set_autostart" + external set_vcpus : [>`W] t -> int -> unit = "ocaml_libvirt_domain_set_vcpus" + external pin_vcpu : [>`W] t -> int -> string -> unit = "ocaml_libvirt_domain_pin_vcpu" + external get_vcpus : [>`R] t -> int -> int -> int * vcpu_info array * string = "ocaml_libvirt_domain_get_vcpus" + external get_max_vcpus : [>`R] t -> int = "ocaml_libvirt_domain_get_max_vcpus" + external attach_device : [>`W] t -> xml -> unit = "ocaml_libvirt_domain_attach_device" + external detach_device : [>`W] t -> xml -> unit = "ocaml_libvirt_domain_detach_device" + external migrate : [>`W] t -> [>`W] Connect.t -> migrate_flag list -> ?dname:string -> ?uri:string -> ?bandwidth:int -> unit -> rw t = "ocaml_libvirt_domain_migrate_bytecode" "ocaml_libvirt_domain_migrate_native" + external block_stats : [>`R] t -> string -> block_stats = "ocaml_libvirt_domain_block_stats" + external interface_stats : [>`R] t -> string -> interface_stats = "ocaml_libvirt_domain_interface_stats" + + external const : [>`R] t -> ro t = "%identity" +end + +module Network = +struct + type 'rw t + + external lookup_by_name : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_network_lookup_by_name" + external lookup_by_uuid : 'a Connect.t -> uuid -> 'a t = "ocaml_libvirt_network_lookup_by_uuid" + external lookup_by_uuid_string : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_network_lookup_by_uuid_string" + external create_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_network_create_xml" + external create_xml_job : [>`W] Connect.t -> xml -> ([`Network], rw) job_t = "ocaml_libvirt_network_create_xml_job" + external define_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_network_define_xml" + external undefine : [>`W] t -> unit = "ocaml_libvirt_network_undefine" + external create : [>`W] t -> unit = "ocaml_libvirt_network_create" + external create_job : [>`W] t -> ([`Network_nocreate], rw) job_t = "ocaml_libvirt_network_create_job" + external destroy : [>`W] t -> unit = "ocaml_libvirt_network_destroy" + external free : [>`R] t -> unit = "ocaml_libvirt_network_free" + external get_name : [>`R] t -> string = "ocaml_libvirt_network_get_name" + external get_uuid : [>`R] t -> uuid = "ocaml_libvirt_network_get_uuid" + external get_uuid_string : [>`R] t -> string = "ocaml_libvirt_network_get_uuid_string" + external get_xml_desc : [>`R] t -> xml = "ocaml_libvirt_network_get_xml_desc" + external get_bridge_name : [>`R] t -> string = "ocaml_libvirt_network_get_bridge_name" + external get_autostart : [>`R] t -> bool = "ocaml_libvirt_network_get_autostart" + external set_autostart : [>`W] t -> bool -> unit = "ocaml_libvirt_network_set_autostart" + + external const : [>`R] t -> ro t = "%identity" +end + +module Pool = +struct + type 'rw t + type pool_state = Inactive | Building | Running | Degraded + type pool_build_flags = New | Repair | Resize + type pool_delete_flags = Normal | Zeroed + type pool_info = { + state : pool_state; + capacity : int64; + allocation : int64; + available : int64; + } + + external lookup_by_name : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_storage_pool_lookup_by_name" + external lookup_by_uuid : 'a Connect.t -> uuid -> 'a t = "ocaml_libvirt_storage_pool_lookup_by_uuid" + external lookup_by_uuid_string : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_storage_pool_lookup_by_uuid_string" + external create_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_storage_pool_create_xml" + external define_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_storage_pool_define_xml" + external build : [>`W] t -> pool_build_flags -> unit = "ocaml_libvirt_storage_pool_build" + external undefine : [>`W] t -> unit = "ocaml_libvirt_storage_pool_undefine" + external create : [>`W] t -> unit = "ocaml_libvirt_storage_pool_create" + external destroy : [>`W] t -> unit = "ocaml_libvirt_storage_pool_destroy" + external delete : [>`W] t -> unit = "ocaml_libvirt_storage_pool_delete" + external free : [>`R] t -> unit = "ocaml_libvirt_storage_pool_free" + external refresh : [`R] t -> unit = "ocaml_libvirt_storage_pool_refresh" + external get_name : [`R] t -> string = "ocaml_libvirt_storage_pool_get_name" + external get_uuid : [`R] t -> uuid = "ocaml_libvirt_storage_pool_get_uuid" + external get_uuid_string : [`R] t -> string = "ocaml_libvirt_storage_pool_get_uuid_string" + external get_info : [`R] t -> pool_info = "ocaml_libvirt_storage_pool_get_info" + external get_xml_desc : [`R] t -> xml = "ocaml_libvirt_storage_pool_get_xml_desc" + external get_autostart : [`R] t -> bool = "ocaml_libvirt_storage_pool_get_autostart" + external set_autostart : [`W] t -> bool -> unit = "ocaml_libvirt_storage_pool_set_autostart" + external num_of_volumes : [`R] t -> int = "ocaml_libvirt_storage_pool_num_of_volumes" + external list_volumes : [`R] t -> int -> string array = "ocaml_libvirt_storage_pool_list_volumes" + external const : [>`R] t -> ro t = "%identity" +end + +module Volume = +struct + type 'rw t + type vol_type = File | Block + type vol_delete_flags = Normal | Zeroed + type vol_info = { + typ : vol_type; + capacity : int64; + allocation : int64; + } + + external lookup_by_name : 'a Pool.t -> string -> 'a t = "ocaml_libvirt_storage_vol_lookup_by_name" + external lookup_by_key : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_storage_vol_lookup_by_key" + external lookup_by_path : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_storage_vol_lookup_by_path" + external pool_of_volume : 'a t -> 'a Pool.t = "ocaml_libvirt_storage_pool_lookup_by_volume" + external get_name : [`R] t -> string = "ocaml_libvirt_storage_vol_get_name" + external get_key : [`R] t -> string = "ocaml_libvirt_storage_vol_get_key" + external get_path : [`R] t -> string = "ocaml_libvirt_storage_vol_get_path" + external get_info : [`R] t -> vol_info = "ocaml_libvirt_storage_vol_get_info" + external get_xml_desc : [`R] t -> xml = "ocaml_libvirt_storage_vol_get_xml_desc" + external create_xml : [`W] Pool.t -> xml -> unit = "ocaml_libvirt_storage_vol_create_xml" + external delete : [`W] t -> unit = "ocaml_libvirt_storage_vol_delete" + external free : [>`R] t -> unit = "ocaml_libvirt_storage_vol_free" + external const : [>`R] t -> ro t = "%identity" +end + +module Job = +struct + type ('jobclass, 'rw) t = ('jobclass, 'rw) job_t + type job_type = Bounded | Unbounded + type job_state = Running | Complete | Failed | Cancelled + type job_info = { + typ : job_type; + state : job_state; + running_time : int; + remaining_time : int; + percent_complete : int + } + external get_info : ('a,'b) t -> job_info = "ocaml_libvirt_job_get_info" + external get_domain : ([`Domain], 'a) t -> 'a Domain.t = "ocaml_libvirt_job_get_domain" + external get_network : ([`Network], 'a) t -> 'a Network.t = "ocaml_libvirt_job_get_network" + external cancel : ('a,'b) t -> unit = "ocaml_libvirt_job_cancel" + external free : ('a, [>`R]) t -> unit = "ocaml_libvirt_job_free" + external const : ('a, [>`R]) t -> ('a, ro) t = "%identity" +end + +module Virterror = +struct + type code = + | VIR_ERR_OK + | VIR_ERR_INTERNAL_ERROR + | VIR_ERR_NO_MEMORY + | VIR_ERR_NO_SUPPORT + | VIR_ERR_UNKNOWN_HOST + | VIR_ERR_NO_CONNECT + | VIR_ERR_INVALID_CONN + | VIR_ERR_INVALID_DOMAIN + | VIR_ERR_INVALID_ARG + | VIR_ERR_OPERATION_FAILED + | VIR_ERR_GET_FAILED + | VIR_ERR_POST_FAILED + | VIR_ERR_HTTP_ERROR + | VIR_ERR_SEXPR_SERIAL + | VIR_ERR_NO_XEN + | VIR_ERR_XEN_CALL + | VIR_ERR_OS_TYPE + | VIR_ERR_NO_KERNEL + | VIR_ERR_NO_ROOT + | VIR_ERR_NO_SOURCE + | VIR_ERR_NO_TARGET + | VIR_ERR_NO_NAME + | VIR_ERR_NO_OS + | VIR_ERR_NO_DEVICE + | VIR_ERR_NO_XENSTORE + | VIR_ERR_DRIVER_FULL + | VIR_ERR_CALL_FAILED + | VIR_ERR_XML_ERROR + | VIR_ERR_DOM_EXIST + | VIR_ERR_OPERATION_DENIED + | VIR_ERR_OPEN_FAILED + | VIR_ERR_READ_FAILED + | VIR_ERR_PARSE_FAILED + | VIR_ERR_CONF_SYNTAX + | VIR_ERR_WRITE_FAILED + | VIR_ERR_XML_DETAIL + | VIR_ERR_INVALID_NETWORK + | VIR_ERR_NETWORK_EXIST + | VIR_ERR_SYSTEM_ERROR + | VIR_ERR_RPC + | VIR_ERR_GNUTLS_ERROR + | VIR_WAR_NO_NETWORK + | VIR_ERR_NO_DOMAIN + | VIR_ERR_NO_NETWORK + | VIR_ERR_INVALID_MAC + | VIR_ERR_AUTH_FAILED + | VIR_ERR_INVALID_STORAGE_POOL + | VIR_ERR_INVALID_STORAGE_VOL + | VIR_WAR_NO_STORAGE + | VIR_ERR_NO_STORAGE_POOL + | VIR_ERR_NO_STORAGE_VOL + | VIR_ERR_UNKNOWN of int + + let string_of_code = function + | VIR_ERR_OK -> "VIR_ERR_OK" + | VIR_ERR_INTERNAL_ERROR -> "VIR_ERR_INTERNAL_ERROR" + | VIR_ERR_NO_MEMORY -> "VIR_ERR_NO_MEMORY" + | VIR_ERR_NO_SUPPORT -> "VIR_ERR_NO_SUPPORT" + | VIR_ERR_UNKNOWN_HOST -> "VIR_ERR_UNKNOWN_HOST" + | VIR_ERR_NO_CONNECT -> "VIR_ERR_NO_CONNECT" + | VIR_ERR_INVALID_CONN -> "VIR_ERR_INVALID_CONN" + | VIR_ERR_INVALID_DOMAIN -> "VIR_ERR_INVALID_DOMAIN" + | VIR_ERR_INVALID_ARG -> "VIR_ERR_INVALID_ARG" + | VIR_ERR_OPERATION_FAILED -> "VIR_ERR_OPERATION_FAILED" + | VIR_ERR_GET_FAILED -> "VIR_ERR_GET_FAILED" + | VIR_ERR_POST_FAILED -> "VIR_ERR_POST_FAILED" + | VIR_ERR_HTTP_ERROR -> "VIR_ERR_HTTP_ERROR" + | VIR_ERR_SEXPR_SERIAL -> "VIR_ERR_SEXPR_SERIAL" + | VIR_ERR_NO_XEN -> "VIR_ERR_NO_XEN" + | VIR_ERR_XEN_CALL -> "VIR_ERR_XEN_CALL" + | VIR_ERR_OS_TYPE -> "VIR_ERR_OS_TYPE" + | VIR_ERR_NO_KERNEL -> "VIR_ERR_NO_KERNEL" + | VIR_ERR_NO_ROOT -> "VIR_ERR_NO_ROOT" + | VIR_ERR_NO_SOURCE -> "VIR_ERR_NO_SOURCE" + | VIR_ERR_NO_TARGET -> "VIR_ERR_NO_TARGET" + | VIR_ERR_NO_NAME -> "VIR_ERR_NO_NAME" + | VIR_ERR_NO_OS -> "VIR_ERR_NO_OS" + | VIR_ERR_NO_DEVICE -> "VIR_ERR_NO_DEVICE" + | VIR_ERR_NO_XENSTORE -> "VIR_ERR_NO_XENSTORE" + | VIR_ERR_DRIVER_FULL -> "VIR_ERR_DRIVER_FULL" + | VIR_ERR_CALL_FAILED -> "VIR_ERR_CALL_FAILED" + | VIR_ERR_XML_ERROR -> "VIR_ERR_XML_ERROR" + | VIR_ERR_DOM_EXIST -> "VIR_ERR_DOM_EXIST" + | VIR_ERR_OPERATION_DENIED -> "VIR_ERR_OPERATION_DENIED" + | VIR_ERR_OPEN_FAILED -> "VIR_ERR_OPEN_FAILED" + | VIR_ERR_READ_FAILED -> "VIR_ERR_READ_FAILED" + | VIR_ERR_PARSE_FAILED -> "VIR_ERR_PARSE_FAILED" + | VIR_ERR_CONF_SYNTAX -> "VIR_ERR_CONF_SYNTAX" + | VIR_ERR_WRITE_FAILED -> "VIR_ERR_WRITE_FAILED" + | VIR_ERR_XML_DETAIL -> "VIR_ERR_XML_DETAIL" + | VIR_ERR_INVALID_NETWORK -> "VIR_ERR_INVALID_NETWORK" + | VIR_ERR_NETWORK_EXIST -> "VIR_ERR_NETWORK_EXIST" + | VIR_ERR_SYSTEM_ERROR -> "VIR_ERR_SYSTEM_ERROR" + | VIR_ERR_RPC -> "VIR_ERR_RPC" + | VIR_ERR_GNUTLS_ERROR -> "VIR_ERR_GNUTLS_ERROR" + | VIR_WAR_NO_NETWORK -> "VIR_WAR_NO_NETWORK" + | VIR_ERR_NO_DOMAIN -> "VIR_ERR_NO_DOMAIN" + | VIR_ERR_NO_NETWORK -> "VIR_ERR_NO_NETWORK" + | VIR_ERR_INVALID_MAC -> "VIR_ERR_INVALID_MAC" + | VIR_ERR_AUTH_FAILED -> "VIR_ERR_AUTH_FAILED" + | VIR_ERR_INVALID_STORAGE_POOL -> "VIR_ERR_INVALID_STORAGE_POOL" + | VIR_ERR_INVALID_STORAGE_VOL -> "VIR_ERR_INVALID_STORAGE_VOL" + | VIR_WAR_NO_STORAGE -> "VIR_WAR_NO_STORAGE" + | VIR_ERR_NO_STORAGE_POOL -> "VIR_ERR_NO_STORAGE_POOL" + | VIR_ERR_NO_STORAGE_VOL -> "VIR_ERR_NO_STORAGE_VOL" + | VIR_ERR_UNKNOWN i -> "VIR_ERR_" ^ string_of_int i + + type domain = + | VIR_FROM_NONE + | VIR_FROM_XEN + | VIR_FROM_XEND + | VIR_FROM_XENSTORE + | VIR_FROM_SEXPR + | VIR_FROM_XML + | VIR_FROM_DOM + | VIR_FROM_RPC + | VIR_FROM_PROXY + | VIR_FROM_CONF + | VIR_FROM_QEMU + | VIR_FROM_NET + | VIR_FROM_TEST + | VIR_FROM_REMOTE + | VIR_FROM_OPENVZ + | VIR_FROM_XENXM + | VIR_FROM_STATS_LINUX + | VIR_FROM_STORAGE + | VIR_FROM_UNKNOWN of int + + let string_of_domain = function + | VIR_FROM_NONE -> "VIR_FROM_NONE" + | VIR_FROM_XEN -> "VIR_FROM_XEN" + | VIR_FROM_XEND -> "VIR_FROM_XEND" + | VIR_FROM_XENSTORE -> "VIR_FROM_XENSTORE" + | VIR_FROM_SEXPR -> "VIR_FROM_SEXPR" + | VIR_FROM_XML -> "VIR_FROM_XML" + | VIR_FROM_DOM -> "VIR_FROM_DOM" + | VIR_FROM_RPC -> "VIR_FROM_RPC" + | VIR_FROM_PROXY -> "VIR_FROM_PROXY" + | VIR_FROM_CONF -> "VIR_FROM_CONF" + | VIR_FROM_QEMU -> "VIR_FROM_QEMU" + | VIR_FROM_NET -> "VIR_FROM_NET" + | VIR_FROM_TEST -> "VIR_FROM_TEST" + | VIR_FROM_REMOTE -> "VIR_FROM_REMOTE" + | VIR_FROM_OPENVZ -> "VIR_FROM_OPENVZ" + | VIR_FROM_XENXM -> "VIR_FROM_XENXM" + | VIR_FROM_STATS_LINUX -> "VIR_FROM_STATS_LINUX" + | VIR_FROM_STORAGE -> "VIR_FROM_STORAGE" + | VIR_FROM_UNKNOWN i -> "VIR_FROM_" ^ string_of_int i + + type level = + | VIR_ERR_NONE + | VIR_ERR_WARNING + | VIR_ERR_ERROR + | VIR_ERR_UNKNOWN_LEVEL of int + + let string_of_level = function + | VIR_ERR_NONE -> "VIR_ERR_NONE" + | VIR_ERR_WARNING -> "VIR_ERR_WARNING" + | VIR_ERR_ERROR -> "VIR_ERR_ERROR" + | VIR_ERR_UNKNOWN_LEVEL i -> "VIR_ERR_LEVEL_" ^ string_of_int i + + type t = { + code : code; + domain : domain; + message : string option; + level : level; + conn : ro Connect.t option; + dom : ro Domain.t option; + str1 : string option; + str2 : string option; + str3 : string option; + int1 : int32; + int2 : int32; + net : ro Network.t option; + } + + let to_string { code = code; domain = domain; message = message } = + let buf = Buffer.create 128 in + Buffer.add_string buf "libvirt: "; + Buffer.add_string buf (string_of_code code); + Buffer.add_string buf ": "; + Buffer.add_string buf (string_of_domain domain); + Buffer.add_string buf ": "; + (match message with Some msg -> Buffer.add_string buf msg | None -> ()); + Buffer.contents buf + + external get_last_error : unit -> t option = "ocaml_libvirt_virterror_get_last_error" + external get_last_conn_error : [>`R] Connect.t -> t option = "ocaml_libvirt_virterror_get_last_conn_error" + external reset_last_error : unit -> unit = "ocaml_libvirt_virterror_reset_last_error" + external reset_last_conn_error : [>`R] Connect.t -> unit = "ocaml_libvirt_virterror_reset_last_conn_error" + + let no_error () = + { code = VIR_ERR_OK; domain = VIR_FROM_NONE; message = None; + level = VIR_ERR_NONE; conn = None; dom = None; + str1 = None; str2 = None; str3 = None; + int1 = 0_l; int2 = 0_l; net = None } +end + +exception Virterror of Virterror.t +exception Not_supported of string + +(* Initialization. *) +external c_init : unit -> unit = "ocaml_libvirt_init" +let () = + Callback.register_exception + "ocaml_libvirt_virterror" (Virterror (Virterror.no_error ())); + Callback.register_exception + "ocaml_libvirt_not_supported" (Not_supported ""); + c_init () diff --git a/libvirt/libvirt.mli b/libvirt/libvirt.mli new file mode 100644 index 0000000..af372af --- /dev/null +++ b/libvirt/libvirt.mli @@ -0,0 +1,994 @@ +(** OCaml bindings for libvirt. *) +(* (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + http://libvirt.org/ + + 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*) + +(** + {2 Introduction and examples} + + This is a set of bindings for writing OCaml programs to + manage virtual machines through {{:http://libvirt.org/}libvirt}. + + {3 Using libvirt interactively} + + Using the interactive toplevel: + +{v +$ ocaml -I +libvirt + Objective Caml version 3.10.0 + +# #load "unix.cma";; +# #load "mllibvirt.cma";; +# let name = "test:///default";; +val name : string = "test:///default" +# let conn = Libvirt.Connect.connect_readonly ~name () ;; +val conn : Libvirt.ro Libvirt.Connect.t = +# Libvirt.Connect.get_node_info conn;; + : Libvirt.Connect.node_info = +{Libvirt.Connect.model = "i686"; Libvirt.Connect.memory = 3145728L; + Libvirt.Connect.cpus = 16; Libvirt.Connect.mhz = 1400; + Libvirt.Connect.nodes = 2; Libvirt.Connect.sockets = 2; + Libvirt.Connect.cores = 2; Libvirt.Connect.threads = 2} +v} + + {3 Compiling libvirt programs} + + This command compiles a program to native code: + +{v +ocamlopt -I +libvirt mllibvirt.cmxa list_domains.ml -o list_domains +v} + + {3 Example: Connect to the hypervisor} + + The main modules are {!Libvirt.Connect}, {!Libvirt.Domain} and + {!Libvirt.Network} corresponding respectively to the + {{:http://libvirt.org/html/libvirt-libvirt.html}virConnect*, virDomain* and virNetwork* functions from libvirt}. + For brevity I usually rename these modules like this: + +{v +module C = Libvirt.Connect +module D = Libvirt.Domain +module N = Libvirt.Network +v} + + To get a connection handle, assuming a Xen hypervisor: + +{v +let name = "xen:///" +let conn = C.connect_readonly ~name () +v} + + {3 Example: List running domains} + +{v +open Printf + +let n = C.num_of_domains conn in +let ids = C.list_domains conn n in +let domains = Array.map (D.lookup_by_id conn) ids in +Array.iter ( + fun dom -> + printf "%8d %s\n%!" (D.get_id dom) (D.get_name dom) +) domains; +v} + + {3 Example: List inactive domains} + +{v +let n = C.num_of_defined_domains conn in +let names = C.list_defined_domains conn n in +Array.iter ( + fun name -> + printf "inactive %s\n%!" name +) names; +v} + + {3 Example: Print node info} + +{v +let node_info = C.get_node_info conn in +printf "model = %s\n" node_info.C.model; +printf "memory = %Ld K\n" node_info.C.memory; +printf "cpus = %d\n" node_info.C.cpus; +printf "mhz = %d\n" node_info.C.mhz; +printf "nodes = %d\n" node_info.C.nodes; +printf "sockets = %d\n" node_info.C.sockets; +printf "cores = %d\n" node_info.C.cores; +printf "threads = %d\n%!" node_info.C.threads; + +let hostname = C.get_hostname conn in +printf "hostname = %s\n%!" hostname; + +let uri = C.get_uri conn in +printf "uri = %s\n%!" uri +v} + +*) + + +(** {2 Programming issues} + + {3 General safety issues} + + Memory allocation / automatic garbage collection of all libvirt + objects should be completely safe (except in the specific + virterror case noted below). If you find any safety issues or if your + pure OCaml program ever segfaults, please contact the author. + + You can force a libvirt object to be freed early by calling + the [close] function on the object. This shouldn't affect + the safety of garbage collection and should only be used when + you want to explicitly free memory. Note that explicitly + closing a connection object does nothing if there are still + unclosed domain or network objects referencing it. + + Note that even though you hold open (eg) a domain object, that + doesn't mean that the domain (virtual machine) actually exists. + The domain could have been shut down or deleted by another user. + Thus domain objects can through odd exceptions at any time. + This is just the nature of virtualisation. + + Virterror has a specific design error which means that the + objects embedded in a virterror exception message are only + valid as long as the connection handle is still open. This + is a design flaw in the C code of libvirt and we cannot fix + or work around it in the OCaml bindings. + + {3 Backwards and forwards compatibility} + + OCaml-libvirt is backwards and forwards compatible with + any libvirt >= 0.2.1. One consequence of this is that + your program can dynamically link to a {i newer} version of + libvirt than it was compiled with, and it should still + work. + + When we link to an older version of libvirt.so, there may + be missing functions. If ocaml-libvirt was compiled with + gcc, then these are turned into OCaml {!Libvirt.Not_supported} + exceptions. + + We don't support libvirt < 0.2.1, and never will so don't ask us. + + {3 Threads} + + You can issue multiple concurrent libvirt requests in + different threads. However you must follow this rule: + Each thread must have its own separate libvirt connection, {i or} + you must implement your own mutex scheme to ensure that no + two threads can ever make concurrent calls using the same + libvirt connection. + + (Note that multithreaded code is not well tested. If you find + bugs please report them.) + + {3 Initialisation} + + Libvirt requires all callers to call virInitialize before + using the library. This is done automatically for you by + these bindings when the program starts up, and we believe + that the way this is done is safe. + + {2 Reference} +*) + +type uuid = string + (** This is a "raw" UUID, ie. a packed string of bytes. *) + +type xml = string + (** Type of XML (an uninterpreted string of bytes). Use PXP, expat, + xml-light, etc. if you want to do anything useful with the XML. + *) + +type filename = string + (** A filename. *) + +val get_version : ?driver:string -> unit -> int * int + (** [get_version ()] returns the library version in the first part + of the tuple, and [0] in the second part. + + [get_version ~driver ()] returns the library version in the first + part of the tuple, and the version of the driver called [driver] + in the second part. + + The version numbers are encoded as + 1,000,000 * major + 1,000 * minor + release. + *) + +val uuid_length : int + (** Length of packed UUIDs. *) + +val uuid_string_length : int + (** Length of UUID strings. *) + +type rw = [`R|`W] +type ro = [`R] + (** These + {{:http://caml.inria.fr/pub/ml-archives/caml-list/2004/07/80683af867cce6bf8fff273973f70c95.en.html}phantom types} + are used to ensure the type-safety of read-only + versus read-write connections. + + All connection/domain/etc. objects are marked with + a phantom read-write or read-only type, and trying to + pass a read-only object into a function which could + mutate the object will cause a compile time error. + + Each module provides a function like {!Libvirt.Connect.const} + to demote a read-write object into a read-only object. The + opposite operation is, of course, not allowed. + + If you want to handle both read-write and read-only + connections at runtime, use a variant similar to this: +{v +type conn_t = + | No_connection + | Read_only of Libvirt.ro Libvirt.Connect.t + | Read_write of Libvirt.rw Libvirt.Connect.t +v} + See also the source of [mlvirsh]. + *) + +type ('a, 'b) job_t +(** Forward definition of {!Job.t} to avoid recursive module dependencies. *) + +(** {3 Connections} *) + +module Connect : +sig + type 'rw t + (** Connection. Read-only connections have type [ro Connect.t] and + read-write connections have type [rw Connect.t]. + *) + + type node_info = { + model : string; (** CPU model *) + memory : int64; (** memory size in kilobytes *) + cpus : int; (** number of active CPUs *) + mhz : int; (** expected CPU frequency *) + nodes : int; (** number of NUMA nodes (1 = UMA) *) + sockets : int; (** number of CPU sockets per node *) + cores : int; (** number of cores per socket *) + threads : int; (** number of threads per core *) + } + + val connect : ?name:string -> unit -> rw t + val connect_readonly : ?name:string -> unit -> ro t + (** [connect ~name ()] connects to the hypervisor with URI [name]. + + [connect ()] connects to the default hypervisor. + + [connect_readonly] is the same but connects in read-only mode. + *) + + val close : [>`R] t -> unit + (** [close conn] closes and frees the connection object in memory. + + The connection is automatically closed if it is garbage + collected. This function just forces it to be closed + and freed right away. + *) + + val get_type : [>`R] t -> string + (** Returns the name of the driver (hypervisor). *) + + val get_version : [>`R] t -> int + (** Returns the driver version + [major * 1_000_000 + minor * 1000 + release] + *) + val get_hostname : [>`R] t -> string + (** Returns the hostname of the physical server. *) + val get_uri : [>`R] t -> string + (** Returns the canonical connection URI. *) + val get_max_vcpus : [>`R] t -> ?type_:string -> unit -> int + (** Returns the maximum number of virtual CPUs + supported by a guest VM of a particular type. *) + val list_domains : [>`R] t -> int -> int array + (** [list_domains conn max] returns the running domain IDs, + up to a maximum of [max] entries. + Call {!num_of_domains} first to get a value for [max]. + *) + val num_of_domains : [>`R] t -> int + (** Returns the number of running domains. *) + val get_capabilities : [>`R] t -> xml + (** Returns the hypervisor capabilities (as XML). *) + val num_of_defined_domains : [>`R] t -> int + (** Returns the number of inactive (shutdown) domains. *) + val list_defined_domains : [>`R] t -> int -> string array + (** [list_defined_domains conn max] + returns the names of the inactive domains, up to + a maximum of [max] entries. + Call {!num_of_defined_domains} first to get a value for [max]. + *) + val num_of_networks : [>`R] t -> int + (** Returns the number of networks. *) + val list_networks : [>`R] t -> int -> string array + (** [list_networks conn max] + returns the names of the networks, up to a maximum + of [max] entries. + Call {!num_of_networks} first to get a value for [max]. + *) + val num_of_defined_networks : [>`R] t -> int + (** Returns the number of inactive networks. *) + val list_defined_networks : [>`R] t -> int -> string array + (** [list_defined_networks conn max] + returns the names of the inactive networks, up to a maximum + of [max] entries. + Call {!num_of_defined_networks} first to get a value for [max]. + *) + + val num_of_pools : [>`R] t -> int + (** Returns the number of storage pools. *) + val list_pools : [>`R] t -> int -> string array + (** Return list of storage pools. *) + val num_of_defined_pools : [>`R] t -> int + (** Returns the number of storage pools. *) + val list_defined_pools : [>`R] t -> int -> string array + (** Return list of storage pools. *) + + (* The name of this function is inconsistent, but the inconsistency + * is really in libvirt itself. + *) + val get_node_info : [>`R] t -> node_info + (** Return information about the physical server. *) + + val node_get_free_memory : [> `R] t -> int64 + (** + [node_get_free_memory conn] + returns the amount of free memory (not allocated to any guest) + in the machine. + *) + + val node_get_cells_free_memory : [> `R] t -> int -> int -> int64 array + (** + [node_get_cells_free_memory conn start max] + returns the amount of free memory on each NUMA cell in kilobytes. + [start] is the first cell for which we return free memory. + [max] is the maximum number of cells for which we return free memory. + Returns an array of up to [max] entries in length. + *) + + val maxcpus_of_node_info : node_info -> int + (** Calculate the total number of CPUs supported (but not necessarily + active) in the host. + *) + + val cpumaplen : int -> int + (** Calculate the length (in bytes) required to store the complete + CPU map between a single virtual and all physical CPUs of a domain. + *) + + val use_cpu : string -> int -> unit + (** [use_cpu cpumap cpu] marks [cpu] as usable in [cpumap]. *) + val unuse_cpu : string -> int -> unit + (** [unuse_cpu cpumap cpu] marks [cpu] as not usable in [cpumap]. *) + val cpu_usable : string -> int -> int -> int -> bool + (** [cpu_usable cpumaps maplen vcpu cpu] checks returns true iff the + [cpu] is usable by [vcpu]. *) + + external const : [>`R] t -> ro t = "%identity" + (** [const conn] turns a read/write connection into a read-only + connection. Note that the opposite operation is impossible. + *) +end + (** Module dealing with connections. [Connect.t] is the + connection object. *) + +(** {3 Domains} *) + +module Domain : +sig + type 'rw t + (** Domain handle. Read-only handles have type [ro Domain.t] and + read-write handles have type [rw Domain.t]. + *) + + type state = + | InfoNoState | InfoRunning | InfoBlocked | InfoPaused + | InfoShutdown | InfoShutoff | InfoCrashed + + type info = { + state : state; (** running state *) + max_mem : int64; (** maximum memory in kilobytes *) + memory : int64; (** memory used in kilobytes *) + nr_virt_cpu : int; (** number of virtual CPUs *) + cpu_time : int64; (** CPU time used in nanoseconds *) + } + + type vcpu_state = VcpuOffline | VcpuRunning | VcpuBlocked + + type vcpu_info = { + number : int; (** virtual CPU number *) + vcpu_state : vcpu_state; (** state *) + vcpu_time : int64; (** CPU time used in nanoseconds *) + cpu : int; (** real CPU number, -1 if offline *) + } + + type sched_param = string * sched_param_value + and sched_param_value = + | SchedFieldInt32 of int32 | SchedFieldUInt32 of int32 + | SchedFieldInt64 of int64 | SchedFieldUInt64 of int64 + | SchedFieldFloat of float | SchedFieldBool of bool + + type migrate_flag = Live + + type block_stats = { + rd_req : int64; + rd_bytes : int64; + wr_req : int64; + wr_bytes : int64; + errs : int64; + } + + type interface_stats = { + rx_bytes : int64; + rx_packets : int64; + rx_errs : int64; + rx_drop : int64; + tx_bytes : int64; + tx_packets : int64; + tx_errs : int64; + tx_drop : int64; + } + + val create_linux : [>`W] Connect.t -> xml -> rw t + (** Create a new guest domain (not necessarily a Linux one) + from the given XML. + *) + val create_linux_job : [>`W] Connect.t -> xml -> ([`Domain], rw) job_t + (** Asynchronous domain creation. *) + val lookup_by_id : 'a Connect.t -> int -> 'a t + (** Lookup a domain by ID. *) + val lookup_by_uuid : 'a Connect.t -> uuid -> 'a t + (** Lookup a domain by UUID. This uses the packed byte array UUID. *) + val lookup_by_uuid_string : 'a Connect.t -> string -> 'a t + (** Lookup a domain by (string) UUID. *) + val lookup_by_name : 'a Connect.t -> string -> 'a t + (** Lookup a domain by name. *) + val destroy : [>`W] t -> unit + (** Abruptly destroy a domain. *) + val free : [>`R] t -> unit + (** [free domain] frees the domain object in memory. + + The domain object is automatically freed if it is garbage + collected. This function just forces it to be freed right + away. + *) + + val suspend : [>`W] t -> unit + (** Suspend a domain. *) + val resume : [>`W] t -> unit + (** Resume a domain. *) + val save : [>`W] t -> filename -> unit + (** Suspend a domain, then save it to the file. *) + val save_job : [>`W] t -> filename -> ([`Domain_nocreate], rw) job_t + (** Asynchronous domain suspend. *) + val restore : [>`W] Connect.t -> filename -> unit + (** Restore a domain from a file. *) + val restore_job : [>`W] Connect.t -> filename -> ([`Domain_nocreate], rw) job_t + (** Asynchronous domain restore. *) + val core_dump : [>`W] t -> filename -> unit + (** Force a domain to core dump to the named file. *) + val core_dump_job : [>`W] t -> filename -> ([`Domain_nocreate], rw) job_t + (** Asynchronous core dump. *) + val shutdown : [>`W] t -> unit + (** Shutdown a domain. *) + val reboot : [>`W] t -> unit + (** Reboot a domain. *) + val get_name : [>`R] t -> string + (** Get the domain name. *) + val get_uuid : [>`R] t -> uuid + (** Get the domain UUID (as a packed byte array). *) + val get_uuid_string : [>`R] t -> string + (** Get the domain UUID (as a printable string). *) + val get_id : [>`R] t -> int + (** [getid dom] returns the ID of the domain. + + Do not call this on a defined but not running domain. Those + domains don't have IDs, and you'll get an error here. + *) + + val get_os_type : [>`R] t -> string + (** Get the operating system type. *) + val get_max_memory : [>`R] t -> int64 + (** Get the maximum memory allocation. *) + val set_max_memory : [>`W] t -> int64 -> unit + (** Set the maximum memory allocation. *) + val set_memory : [>`W] t -> int64 -> unit + (** Set the normal memory allocation. *) + val get_info : [>`R] t -> info + (** Get information about a domain. *) + val get_xml_desc : [>`R] t -> xml + (** Get the XML description of a domain. *) + val get_scheduler_type : [>`R] t -> string * int + (** Get the scheduler type. *) + val get_scheduler_parameters : [>`R] t -> int -> sched_param array + (** Get the array of scheduler parameters. *) + val set_scheduler_parameters : [>`W] t -> sched_param array -> unit + (** Set the array of scheduler parameters. *) + val define_xml : [>`W] Connect.t -> xml -> rw t + (** Define a new domain (but don't start it up) from the XML. *) + val undefine : [>`W] t -> unit + (** Undefine a domain - removes its configuration. *) + val create : [>`W] t -> unit + (** Launch a defined (inactive) domain. *) + val create_job : [>`W] t -> ([`Domain_nocreate], rw) job_t + (** Asynchronous launch domain. *) + val get_autostart : [>`R] t -> bool + (** Get the autostart flag for a domain. *) + val set_autostart : [>`W] t -> bool -> unit + (** Set the autostart flag for a domain. *) + val set_vcpus : [>`W] t -> int -> unit + (** Change the number of vCPUs available to a domain. *) + val pin_vcpu : [>`W] t -> int -> string -> unit + (** [pin_vcpu dom vcpu bitmap] pins a domain vCPU to a bitmap of physical + CPUs. See the libvirt documentation for details of the + layout of the bitmap. *) + val get_vcpus : [>`R] t -> int -> int -> int * vcpu_info array * string + (** [get_vcpus dom maxinfo maplen] returns the pinning information + for a domain. See the libvirt documentation for details + of the array and bitmap returned from this function. + *) + val get_max_vcpus : [>`R] t -> int + (** Returns the maximum number of vCPUs supported for this domain. *) + val attach_device : [>`W] t -> xml -> unit + (** Attach a device (described by the device XML) to a domain. *) + val detach_device : [>`W] t -> xml -> unit + (** Detach a device (described by the device XML) from a domain. *) + + val migrate : [>`W] t -> [>`W] Connect.t -> migrate_flag list -> + ?dname:string -> ?uri:string -> ?bandwidth:int -> unit -> rw t + (** [migrate dom dconn flags ()] migrates a domain to a + destination host described by [dconn]. + + The optional flag [?dname] is used to rename the domain. + + The optional flag [?uri] is used to route the migration. + + The optional flag [?bandwidth] is used to limit the bandwidth + used for migration (in Mbps). *) + + val block_stats : [>`R] t -> string -> block_stats + (** Returns block device stats. *) + val interface_stats : [>`R] t -> string -> interface_stats + (** Returns network interface stats. *) + + external const : [>`R] t -> ro t = "%identity" + (** [const dom] turns a read/write domain handle into a read-only + domain handle. Note that the opposite operation is impossible. + *) +end + (** Module dealing with domains. [Domain.t] is the + domain object. *) + +(** {3 Networks} *) + +module Network : +sig + type 'rw t + (** Network handle. Read-only handles have type [ro Network.t] and + read-write handles have type [rw Network.t]. + *) + + val lookup_by_name : 'a Connect.t -> string -> 'a t + (** Lookup a network by name. *) + val lookup_by_uuid : 'a Connect.t -> uuid -> 'a t + (** Lookup a network by (packed) UUID. *) + val lookup_by_uuid_string : 'a Connect.t -> string -> 'a t + (** Lookup a network by UUID string. *) + val create_xml : [>`W] Connect.t -> xml -> rw t + (** Create a network. *) + val create_xml_job : [>`W] Connect.t -> xml -> ([`Network], rw) job_t + (** Asynchronous create network. *) + val define_xml : [>`W] Connect.t -> xml -> rw t + (** Define but don't activate a network. *) + val undefine : [>`W] t -> unit + (** Undefine configuration of a network. *) + val create : [>`W] t -> unit + (** Start up a defined (inactive) network. *) + val create_job : [>`W] t -> ([`Network_nocreate], rw) job_t + (** Asynchronous start network. *) + val destroy : [>`W] t -> unit + (** Destroy a network. *) + val free : [>`R] t -> unit + (** [free network] frees the network object in memory. + + The network object is automatically freed if it is garbage + collected. This function just forces it to be freed right + away. + *) + + val get_name : [>`R] t -> string + (** Get network name. *) + val get_uuid : [>`R] t -> uuid + (** Get network packed UUID. *) + val get_uuid_string : [>`R] t -> string + (** Get network UUID as a printable string. *) + val get_xml_desc : [>`R] t -> xml + (** Get XML description of a network. *) + val get_bridge_name : [>`R] t -> string + (** Get bridge device name of a network. *) + val get_autostart : [>`R] t -> bool + (** Get the autostart flag for a network. *) + val set_autostart : [>`W] t -> bool -> unit + (** Set the autostart flag for a network. *) + + external const : [>`R] t -> ro t = "%identity" + (** [const network] turns a read/write network handle into a read-only + network handle. Note that the opposite operation is impossible. + *) +end + (** Module dealing with networks. [Network.t] is the + network object. *) + +(** {3 Storage pools} *) + +module Pool : +sig + type 'rw t + (** Storage pool handle. *) + + type pool_state = Inactive | Building | Running | Degraded + (** State of the storage pool. *) + + type pool_build_flags = New | Repair | Resize + (** Flags for creating a storage pool. *) + + type pool_delete_flags = Normal | Zeroed + (** Flags for deleting a storage pool. *) + + type pool_info = { + state : pool_state; (** Pool state. *) + capacity : int64; (** Logical size in bytes. *) + allocation : int64; (** Currently allocated in bytes. *) + available : int64; (** Remaining free space bytes. *) + } + + val lookup_by_name : 'a Connect.t -> string -> 'a t + val lookup_by_uuid : 'a Connect.t -> uuid -> 'a t + val lookup_by_uuid_string : 'a Connect.t -> string -> 'a t + (** Look up a storage pool by name, UUID or UUID string. *) + + val create_xml : [>`W] Connect.t -> xml -> rw t + (** Create a storage pool. *) + val define_xml : [>`W] Connect.t -> xml -> rw t + (** Define but don't activate a storage pool. *) + val build : [>`W] t -> pool_build_flags -> unit + (** Build a storage pool. *) + val undefine : [>`W] t -> unit + (** Undefine configuration of a storage pool. *) + val create : [>`W] t -> unit + (** Start up a defined (inactive) storage pool. *) + val destroy : [>`W] t -> unit + (** Destroy a storage pool. *) + val delete : [>`W] t -> unit + (** Delete a storage pool. *) + val free : [>`R] t -> unit + (** Free a storage pool object in memory. + + The storage pool object is automatically freed if it is garbage + collected. This function just forces it to be freed right + away. + *) + val refresh : [`R] t -> unit + (** Refresh the list of volumes in the storage pool. *) + + val get_name : [`R] t -> string + (** Name of the pool. *) + val get_uuid : [`R] t -> uuid + (** Get the UUID (as a packed byte array). *) + val get_uuid_string : [`R] t -> string + (** Get the UUID (as a printable string). *) + val get_info : [`R] t -> pool_info + (** Get information about the pool. *) + val get_xml_desc : [`R] t -> xml + (** Get the XML description. *) + val get_autostart : [`R] t -> bool + (** Get the autostart flag for the storage pool. *) + val set_autostart : [`W] t -> bool -> unit + (** Set the autostart flag for the storage pool. *) + + val num_of_volumes : [`R] t -> int + (** Returns the number of storage volumes within the storage pool. *) + val list_volumes : [`R] t -> int -> string array + (** Return list of storage volumes. *) + + external const : [>`R] t -> ro t = "%identity" + (** [const conn] turns a read/write storage pool into a read-only + pool. Note that the opposite operation is impossible. + *) +end + (** Module dealing with storage pools. *) + +(** {3 Storage volumes} *) + +module Volume : +sig + type 'rw t + (** Storage volume handle. *) + + type vol_type = File | Block + (** Type of a storage volume. *) + + type vol_delete_flags = Normal | Zeroed + (** Flags for deleting a storage volume. *) + + type vol_info = { + typ : vol_type; (** Type of storage volume. *) + capacity : int64; (** Logical size in bytes. *) + allocation : int64; (** Currently allocated in bytes. *) + } + + val lookup_by_name : 'a Pool.t -> string -> 'a t + val lookup_by_key : 'a Connect.t -> string -> 'a t + val lookup_by_path : 'a Connect.t -> string -> 'a t + (** Look up a storage volume by name, key or path volume. *) + + val pool_of_volume : 'a t -> 'a Pool.t + (** Get the storage pool containing this volume. *) + + val get_name : [`R] t -> string + (** Name of the volume. *) + val get_key : [`R] t -> string + (** Key of the volume. *) + val get_path : [`R] t -> string + (** Path of the volume. *) + val get_info : [`R] t -> vol_info + (** Get information about the storage volume. *) + val get_xml_desc : [`R] t -> xml + (** Get the XML description. *) + + val create_xml : [`W] Pool.t -> xml -> unit + (** Create a storage volume. *) + val delete : [`W] t -> unit + (** Delete a storage volume. *) + val free : [>`R] t -> unit + (** Free a storage volume object in memory. + + The storage volume object is automatically freed if it is garbage + collected. This function just forces it to be freed right + away. + *) + + external const : [>`R] t -> ro t = "%identity" + (** [const conn] turns a read/write storage volume into a read-only + volume. Note that the opposite operation is impossible. + *) +end + (** Module dealing with storage volumes. *) + +(** {3 Jobs and asynchronous processing} *) + +module Job : +sig + type ('jobclass, 'rw) t = ('jobclass, 'rw) job_t + (** A background asynchronous job. + + Jobs represent a pending operation such as domain creation. + The possible types for a job are: + +{v +(`Domain, `W) Job.t Job creating a new domain +(`Domain_nocreate, `W) Job.t Job acting on an existing domain +(`Network, `W) Job.t Job creating a new network +(`Network_nocreate, `W) Job.t Job acting on an existing network +v} + *) + + type job_type = Bounded | Unbounded + (** A Bounded job is one where we can estimate time to completion. *) + + type job_state = Running | Complete | Failed | Cancelled + (** State of the job. *) + + type job_info = { + typ : job_type; (** Job type (Bounded, Unbounded) *) + state : job_state; (** Job state (Running, etc.) *) + running_time : int; (** Actual running time (seconds) *) + (** The following fields are only available in Bounded jobs: *) + remaining_time : int; (** Estimated time left (seconds) *) + percent_complete : int (** Estimated percent complete *) + } + + val get_info : ('a,'b) t -> job_info + (** Get information and status about the job. *) + + val get_domain : ([`Domain], 'a) t -> 'a Domain.t + (** Get the completed domain from a job. + + You should only call it on a job in state Complete. *) + + val get_network : ([`Network], 'a) t -> 'a Network.t + (** Get the completed network from a job. + + You should only call it on a job in state Complete. *) + + val cancel : ('a,'b) t -> unit + (** Cancel a job. *) + + val free : ('a, [>`R]) t -> unit + (** Free a job object in memory. + + The job object is automatically freed if it is garbage + collected. This function just forces it to be freed right + away. + *) + + external const : ('a, [>`R]) t -> ('a, ro) t = "%identity" + (** [const conn] turns a read/write job into a read-only + job. Note that the opposite operation is impossible. + *) +end + (** Module dealing with asynchronous jobs. *) + +(** {3 Error handling and exceptions} *) + +module Virterror : +sig + type code = + | VIR_ERR_OK + | VIR_ERR_INTERNAL_ERROR + | VIR_ERR_NO_MEMORY + | VIR_ERR_NO_SUPPORT + | VIR_ERR_UNKNOWN_HOST + | VIR_ERR_NO_CONNECT + | VIR_ERR_INVALID_CONN + | VIR_ERR_INVALID_DOMAIN + | VIR_ERR_INVALID_ARG + | VIR_ERR_OPERATION_FAILED + | VIR_ERR_GET_FAILED + | VIR_ERR_POST_FAILED + | VIR_ERR_HTTP_ERROR + | VIR_ERR_SEXPR_SERIAL + | VIR_ERR_NO_XEN + | VIR_ERR_XEN_CALL + | VIR_ERR_OS_TYPE + | VIR_ERR_NO_KERNEL + | VIR_ERR_NO_ROOT + | VIR_ERR_NO_SOURCE + | VIR_ERR_NO_TARGET + | VIR_ERR_NO_NAME + | VIR_ERR_NO_OS + | VIR_ERR_NO_DEVICE + | VIR_ERR_NO_XENSTORE + | VIR_ERR_DRIVER_FULL + | VIR_ERR_CALL_FAILED + | VIR_ERR_XML_ERROR + | VIR_ERR_DOM_EXIST + | VIR_ERR_OPERATION_DENIED + | VIR_ERR_OPEN_FAILED + | VIR_ERR_READ_FAILED + | VIR_ERR_PARSE_FAILED + | VIR_ERR_CONF_SYNTAX + | VIR_ERR_WRITE_FAILED + | VIR_ERR_XML_DETAIL + | VIR_ERR_INVALID_NETWORK + | VIR_ERR_NETWORK_EXIST + | VIR_ERR_SYSTEM_ERROR + | VIR_ERR_RPC + | VIR_ERR_GNUTLS_ERROR + | VIR_WAR_NO_NETWORK + | VIR_ERR_NO_DOMAIN + | VIR_ERR_NO_NETWORK + | VIR_ERR_INVALID_MAC + | VIR_ERR_AUTH_FAILED + | VIR_ERR_INVALID_STORAGE_POOL + | VIR_ERR_INVALID_STORAGE_VOL + | VIR_WAR_NO_STORAGE + | VIR_ERR_NO_STORAGE_POOL + | VIR_ERR_NO_STORAGE_VOL + (* ^^ NB: If you add a variant you MUST edit + libvirt_c_epilogue.c:MAX_VIR_* *) + | VIR_ERR_UNKNOWN of int + (** See [] for meaning of these codes. *) + + val string_of_code : code -> string + + type domain = + | VIR_FROM_NONE + | VIR_FROM_XEN + | VIR_FROM_XEND + | VIR_FROM_XENSTORE + | VIR_FROM_SEXPR + | VIR_FROM_XML + | VIR_FROM_DOM + | VIR_FROM_RPC + | VIR_FROM_PROXY + | VIR_FROM_CONF + | VIR_FROM_QEMU + | VIR_FROM_NET + | VIR_FROM_TEST + | VIR_FROM_REMOTE + | VIR_FROM_OPENVZ + | VIR_FROM_XENXM + | VIR_FROM_STATS_LINUX + | VIR_FROM_STORAGE + (* ^^ NB: If you add a variant you MUST edit + libvirt_c_epilogue.c: MAX_VIR_* *) + | VIR_FROM_UNKNOWN of int + (** Subsystem / driver which produced the error. *) + + val string_of_domain : domain -> string + + type level = + | VIR_ERR_NONE + | VIR_ERR_WARNING + | VIR_ERR_ERROR + (* ^^ NB: If you add a variant you MUST edit libvirt_c.c: MAX_VIR_* *) + | VIR_ERR_UNKNOWN_LEVEL of int + (** No error, a warning or an error. *) + + val string_of_level : level -> string + + type t = { + code : code; (** Error code. *) + domain : domain; (** Origin of the error. *) + message : string option; (** Human-readable message. *) + level : level; (** Error or warning. *) + conn : ro Connect.t option; (** Associated connection. *) + dom : ro Domain.t option; (** Associated domain. *) + str1 : string option; (** Informational string. *) + str2 : string option; (** Informational string. *) + str3 : string option; (** Informational string. *) + int1 : int32; (** Informational integer. *) + int2 : int32; (** Informational integer. *) + net : ro Network.t option; (** Associated network. *) + } + (** An error object. *) + + val to_string : t -> string + (** Turn the exception into a printable string. *) + + val get_last_error : unit -> t option + val get_last_conn_error : [>`R] Connect.t -> t option + (** Get the last error at a global or connection level. + + Normally you do not need to use these functions because + the library automatically turns errors into exceptions. + *) + + val reset_last_error : unit -> unit + val reset_last_conn_error : [>`R] Connect.t -> unit + (** Reset the error at a global or connection level. + + Normally you do not need to use these functions. + *) + + val no_error : unit -> t + (** Creates an empty error message. + + Normally you do not need to use this function. + *) +end + (** Module dealing with errors. *) + +exception Virterror of Virterror.t +(** This exception can be raised by any library function that detects + an error. To get a printable error message, call + {!Virterror.to_string} on the content of this exception. +*) + +exception Not_supported of string +(** + Functions may raise + [Not_supported "virFoo"] + (where [virFoo] is the libvirt function name) if a function is + not supported at either compile or run time. This applies to + any libvirt function added after version 0.2.1. + + See also {{:http://libvirt.org/hvsupport.html}http://libvirt.org/hvsupport.html} +*) + diff --git a/libvirt/libvirt_c.c b/libvirt/libvirt_c.c new file mode 100644 index 0000000..ca7f303 --- /dev/null +++ b/libvirt/libvirt_c.c @@ -0,0 +1,3017 @@ +/* !!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!! + * + * THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'. + * + * Any changes you make to this file may be overwritten. + */ + +/* OCaml bindings for libvirt. + * (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc. + * http://libvirt.org/ + * + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libvirt_c_prologue.c" + +#include "libvirt_c_oneoffs.c" + +/* Automatically generated binding for virConnectClose. + * In generator.pl this function has signature "conn : free". + */ + +CAMLprim value +ocaml_libvirt_connect_close (value connv) +{ + CAMLparam1 (connv); + + virConnectPtr conn = Connect_val (connv); + int r; + + NONBLOCKING (r = virConnectClose (conn)); + CHECK_ERROR (r == -1, conn, "virConnectClose"); + + /* So that we don't double-free in the finalizer: */ + Connect_val (connv) = NULL; + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virConnectGetHostname. + * In generator.pl this function has signature "conn : string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRCONNECTGETHOSTNAME +extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_connect_get_hostname (value connv) +{ + CAMLparam1 (connv); +#ifndef HAVE_VIRCONNECTGETHOSTNAME + /* Symbol virConnectGetHostname not found at compile time. */ + not_supported ("virConnectGetHostname"); + CAMLnoreturn; +#else + /* Check that the symbol virConnectGetHostname + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virConnectGetHostname); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *r; + + NONBLOCKING (r = virConnectGetHostname (conn)); + CHECK_ERROR (!r, conn, "virConnectGetHostname"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virConnectGetURI. + * In generator.pl this function has signature "conn : string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRCONNECTGETURI +extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_connect_get_uri (value connv) +{ + CAMLparam1 (connv); +#ifndef HAVE_VIRCONNECTGETURI + /* Symbol virConnectGetURI not found at compile time. */ + not_supported ("virConnectGetURI"); + CAMLnoreturn; +#else + /* Check that the symbol virConnectGetURI + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virConnectGetURI); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *r; + + NONBLOCKING (r = virConnectGetURI (conn)); + CHECK_ERROR (!r, conn, "virConnectGetURI"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virConnectGetType. + * In generator.pl this function has signature "conn : static string". + */ + +CAMLprim value +ocaml_libvirt_connect_get_type (value connv) +{ + CAMLparam1 (connv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + const char *r; + + NONBLOCKING (r = virConnectGetType (conn)); + CHECK_ERROR (!r, conn, "virConnectGetType"); + + rv = caml_copy_string (r); + CAMLreturn (rv); +} + +/* Automatically generated binding for virConnectNumOfDomains. + * In generator.pl this function has signature "conn : int". + */ + +CAMLprim value +ocaml_libvirt_connect_num_of_domains (value connv) +{ + CAMLparam1 (connv); + + virConnectPtr conn = Connect_val (connv); + int r; + + NONBLOCKING (r = virConnectNumOfDomains (conn)); + CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains"); + + CAMLreturn (Val_int (r)); +} + +/* Automatically generated binding for virConnectListDomains. + * In generator.pl this function has signature "conn, int : int array". + */ + +CAMLprim value +ocaml_libvirt_connect_list_domains (value connv, value iv) +{ + CAMLparam2 (connv, iv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + int ids[i], r; + + NONBLOCKING (r = virConnectListDomains (conn, ids, i)); + CHECK_ERROR (r == -1, conn, "virConnectListDomains"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) + Store_field (rv, i, Val_int (ids[i])); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virConnectNumOfDefinedDomains. + * In generator.pl this function has signature "conn : int". + */ + +CAMLprim value +ocaml_libvirt_connect_num_of_defined_domains (value connv) +{ + CAMLparam1 (connv); + + virConnectPtr conn = Connect_val (connv); + int r; + + NONBLOCKING (r = virConnectNumOfDefinedDomains (conn)); + CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains"); + + CAMLreturn (Val_int (r)); +} + +/* Automatically generated binding for virConnectListDefinedDomains. + * In generator.pl this function has signature "conn, int : string array". + */ + +CAMLprim value +ocaml_libvirt_connect_list_defined_domains (value connv, value iv) +{ + CAMLparam2 (connv, iv); + + CAMLlocal2 (rv, strv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + char *names[i]; + int r; + + NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i)); + CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + strv = caml_copy_string (names[i]); + Store_field (rv, i, strv); + free (names[i]); + } + + CAMLreturn (rv); +} + +/* Automatically generated binding for virConnectNumOfNetworks. + * In generator.pl this function has signature "conn : int". + */ + +CAMLprim value +ocaml_libvirt_connect_num_of_networks (value connv) +{ + CAMLparam1 (connv); + + virConnectPtr conn = Connect_val (connv); + int r; + + NONBLOCKING (r = virConnectNumOfNetworks (conn)); + CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks"); + + CAMLreturn (Val_int (r)); +} + +/* Automatically generated binding for virConnectListNetworks. + * In generator.pl this function has signature "conn, int : string array". + */ + +CAMLprim value +ocaml_libvirt_connect_list_networks (value connv, value iv) +{ + CAMLparam2 (connv, iv); + + CAMLlocal2 (rv, strv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + char *names[i]; + int r; + + NONBLOCKING (r = virConnectListNetworks (conn, names, i)); + CHECK_ERROR (r == -1, conn, "virConnectListNetworks"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + strv = caml_copy_string (names[i]); + Store_field (rv, i, strv); + free (names[i]); + } + + CAMLreturn (rv); +} + +/* Automatically generated binding for virConnectNumOfDefinedNetworks. + * In generator.pl this function has signature "conn : int". + */ + +CAMLprim value +ocaml_libvirt_connect_num_of_defined_networks (value connv) +{ + CAMLparam1 (connv); + + virConnectPtr conn = Connect_val (connv); + int r; + + NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn)); + CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks"); + + CAMLreturn (Val_int (r)); +} + +/* Automatically generated binding for virConnectListDefinedNetworks. + * In generator.pl this function has signature "conn, int : string array". + */ + +CAMLprim value +ocaml_libvirt_connect_list_defined_networks (value connv, value iv) +{ + CAMLparam2 (connv, iv); + + CAMLlocal2 (rv, strv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + char *names[i]; + int r; + + NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i)); + CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + strv = caml_copy_string (names[i]); + Store_field (rv, i, strv); + free (names[i]); + } + + CAMLreturn (rv); +} + +/* Automatically generated binding for virConnectNumOfStoragePools. + * In generator.pl this function has signature "conn : int". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS +extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_connect_num_of_storage_pools (value connv) +{ + CAMLparam1 (connv); +#ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS + /* Symbol virConnectNumOfStoragePools not found at compile time. */ + not_supported ("virConnectNumOfStoragePools"); + CAMLnoreturn; +#else + /* Check that the symbol virConnectNumOfStoragePools + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools); + + virConnectPtr conn = Connect_val (connv); + int r; + + NONBLOCKING (r = virConnectNumOfStoragePools (conn)); + CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools"); + + CAMLreturn (Val_int (r)); +#endif +} + +/* Automatically generated binding for virConnectListStoragePools. + * In generator.pl this function has signature "conn, int : string array". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS +extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_connect_list_storage_pools (value connv, value iv) +{ + CAMLparam2 (connv, iv); +#ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS + /* Symbol virConnectListStoragePools not found at compile time. */ + not_supported ("virConnectListStoragePools"); + CAMLnoreturn; +#else + /* Check that the symbol virConnectListStoragePools + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virConnectListStoragePools); + + CAMLlocal2 (rv, strv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + char *names[i]; + int r; + + NONBLOCKING (r = virConnectListStoragePools (conn, names, i)); + CHECK_ERROR (r == -1, conn, "virConnectListStoragePools"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + strv = caml_copy_string (names[i]); + Store_field (rv, i, strv); + free (names[i]); + } + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virConnectNumOfDefinedStoragePools. + * In generator.pl this function has signature "conn : int". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS +extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_connect_num_of_defined_storage_pools (value connv) +{ + CAMLparam1 (connv); +#ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS + /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */ + not_supported ("virConnectNumOfDefinedStoragePools"); + CAMLnoreturn; +#else + /* Check that the symbol virConnectNumOfDefinedStoragePools + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools); + + virConnectPtr conn = Connect_val (connv); + int r; + + NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn)); + CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools"); + + CAMLreturn (Val_int (r)); +#endif +} + +/* Automatically generated binding for virConnectListDefinedStoragePools. + * In generator.pl this function has signature "conn, int : string array". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS +extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv) +{ + CAMLparam2 (connv, iv); +#ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS + /* Symbol virConnectListDefinedStoragePools not found at compile time. */ + not_supported ("virConnectListDefinedStoragePools"); + CAMLnoreturn; +#else + /* Check that the symbol virConnectListDefinedStoragePools + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools); + + CAMLlocal2 (rv, strv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + char *names[i]; + int r; + + NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i)); + CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + strv = caml_copy_string (names[i]); + Store_field (rv, i, strv); + free (names[i]); + } + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virConnectGetCapabilities. + * In generator.pl this function has signature "conn : string". + */ + +CAMLprim value +ocaml_libvirt_connect_get_capabilities (value connv) +{ + CAMLparam1 (connv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *r; + + NONBLOCKING (r = virConnectGetCapabilities (conn)); + CHECK_ERROR (!r, conn, "virConnectGetCapabilities"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainCreateLinux. + * In generator.pl this function has signature "conn, string, 0U : dom". + */ + +CAMLprim value +ocaml_libvirt_domain_create_linux (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virDomainPtr r; + + NONBLOCKING (r = virDomainCreateLinux (conn, str, 0)); + CHECK_ERROR (!r, conn, "virDomainCreateLinux"); + + rv = Val_domain (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainCreateLinuxJob. + * In generator.pl this function has signature "conn, string, 0U : job". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINCREATELINUXJOB +extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_create_linux_job (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRDOMAINCREATELINUXJOB + /* Symbol virDomainCreateLinuxJob not found at compile time. */ + not_supported ("virDomainCreateLinuxJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainCreateLinuxJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainCreateLinuxJob); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virJobPtr r; + + NONBLOCKING (r = virDomainCreateLinuxJob (conn, str, 0)); + CHECK_ERROR (!r, conn, "virDomainCreateLinuxJob"); + + rv = Val_job (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virDomainFree. + * In generator.pl this function has signature "dom : free". + */ + +CAMLprim value +ocaml_libvirt_domain_free (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainFree (dom)); + CHECK_ERROR (r == -1, conn, "virDomainFree"); + + /* So that we don't double-free in the finalizer: */ + Domain_val (domv) = NULL; + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainDestroy. + * In generator.pl this function has signature "dom : free". + */ + +CAMLprim value +ocaml_libvirt_domain_destroy (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainDestroy (dom)); + CHECK_ERROR (r == -1, conn, "virDomainDestroy"); + + /* So that we don't double-free in the finalizer: */ + Domain_val (domv) = NULL; + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainLookupByName. + * In generator.pl this function has signature "conn, string : dom". + */ + +CAMLprim value +ocaml_libvirt_domain_lookup_by_name (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virDomainPtr r; + + NONBLOCKING (r = virDomainLookupByName (conn, str)); + CHECK_ERROR (!r, conn, "virDomainLookupByName"); + + rv = Val_domain (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainLookupByID. + * In generator.pl this function has signature "conn, int : dom". + */ + +CAMLprim value +ocaml_libvirt_domain_lookup_by_id (value connv, value iv) +{ + CAMLparam2 (connv, iv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + int i = Int_val (iv); + virDomainPtr r; + + NONBLOCKING (r = virDomainLookupByID (conn, i)); + CHECK_ERROR (!r, conn, "virDomainLookupByID"); + + rv = Val_domain (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainLookupByUUID. + * In generator.pl this function has signature "conn, uuid : dom". + */ + +CAMLprim value +ocaml_libvirt_domain_lookup_by_uuid (value connv, value uuidv) +{ + CAMLparam2 (connv, uuidv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + unsigned char *uuid = (unsigned char *) String_val (uuidv); + virDomainPtr r; + + NONBLOCKING (r = virDomainLookupByUUID (conn, uuid)); + CHECK_ERROR (!r, conn, "virDomainLookupByUUID"); + + rv = Val_domain (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainLookupByUUIDString. + * In generator.pl this function has signature "conn, string : dom". + */ + +CAMLprim value +ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virDomainPtr r; + + NONBLOCKING (r = virDomainLookupByUUIDString (conn, str)); + CHECK_ERROR (!r, conn, "virDomainLookupByUUIDString"); + + rv = Val_domain (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainGetName. + * In generator.pl this function has signature "dom : static string". + */ + +CAMLprim value +ocaml_libvirt_domain_get_name (value domv) +{ + CAMLparam1 (domv); + + CAMLlocal1 (rv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + const char *r; + + NONBLOCKING (r = virDomainGetName (dom)); + CHECK_ERROR (!r, conn, "virDomainGetName"); + + rv = caml_copy_string (r); + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainGetOSType. + * In generator.pl this function has signature "dom : string". + */ + +CAMLprim value +ocaml_libvirt_domain_get_os_type (value domv) +{ + CAMLparam1 (domv); + + CAMLlocal1 (rv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *r; + + NONBLOCKING (r = virDomainGetOSType (dom)); + CHECK_ERROR (!r, conn, "virDomainGetOSType"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainGetXMLDesc. + * In generator.pl this function has signature "dom, 0 : string". + */ + +CAMLprim value +ocaml_libvirt_domain_get_xml_desc (value domv) +{ + CAMLparam1 (domv); + + CAMLlocal1 (rv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *r; + + NONBLOCKING (r = virDomainGetXMLDesc (dom, 0)); + CHECK_ERROR (!r, conn, "virDomainGetXMLDesc"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainGetUUID. + * In generator.pl this function has signature "dom : uuid". + */ + +CAMLprim value +ocaml_libvirt_domain_get_uuid (value domv) +{ + CAMLparam1 (domv); + + CAMLlocal1 (rv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + unsigned char uuid[VIR_UUID_BUFLEN]; + int r; + + NONBLOCKING (r = virDomainGetUUID (dom, uuid)); + CHECK_ERROR (r == -1, conn, "virDomainGetUUID"); + + /* UUIDs are byte arrays with a fixed length. */ + rv = caml_alloc_string (VIR_UUID_BUFLEN); + memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN); + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainGetUUIDString. + * In generator.pl this function has signature "dom : uuid string". + */ + +CAMLprim value +ocaml_libvirt_domain_get_uuid_string (value domv) +{ + CAMLparam1 (domv); + + CAMLlocal1 (rv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char uuid[VIR_UUID_STRING_BUFLEN]; + int r; + + NONBLOCKING (r = virDomainGetUUIDString (dom, uuid)); + CHECK_ERROR (r == -1, conn, "virDomainGetUUIDString"); + + rv = caml_copy_string (uuid); + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainGetMaxVcpus. + * In generator.pl this function has signature "dom : int". + */ + +CAMLprim value +ocaml_libvirt_domain_get_max_vcpus (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainGetMaxVcpus (dom)); + CHECK_ERROR (r == -1, conn, "virDomainGetMaxVcpus"); + + CAMLreturn (Val_int (r)); +} + +/* Automatically generated binding for virDomainSave. + * In generator.pl this function has signature "dom, string : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_save (value domv, value strv) +{ + CAMLparam2 (domv, strv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *str = String_val (strv); + int r; + + NONBLOCKING (r = virDomainSave (dom, str)); + CHECK_ERROR (r == -1, conn, "virDomainSave"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainSaveJob. + * In generator.pl this function has signature "dom, string : job from dom". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINSAVEJOB +extern virJobPtr virDomainSaveJob (virDomainPtr dom, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_save_job (value domv, value strv) +{ + CAMLparam2 (domv, strv); +#ifndef HAVE_VIRDOMAINSAVEJOB + /* Symbol virDomainSaveJob not found at compile time. */ + not_supported ("virDomainSaveJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainSaveJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainSaveJob); + + CAMLlocal2 (rv, connv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *str = String_val (strv); + virJobPtr r; + + NONBLOCKING (r = virDomainSaveJob (dom, str)); + CHECK_ERROR (!r, conn, "virDomainSaveJob"); + + connv = Field (domv, 1); + rv = Val_job (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virDomainRestore. + * In generator.pl this function has signature "conn, string : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_restore (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + int r; + + NONBLOCKING (r = virDomainRestore (conn, str)); + CHECK_ERROR (r == -1, conn, "virDomainRestore"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainRestoreJob. + * In generator.pl this function has signature "conn, string : job". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINRESTOREJOB +extern virJobPtr virDomainRestoreJob (virConnectPtr conn, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_restore_job (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRDOMAINRESTOREJOB + /* Symbol virDomainRestoreJob not found at compile time. */ + not_supported ("virDomainRestoreJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainRestoreJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainRestoreJob); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virJobPtr r; + + NONBLOCKING (r = virDomainRestoreJob (conn, str)); + CHECK_ERROR (!r, conn, "virDomainRestoreJob"); + + rv = Val_job (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virDomainCoreDump. + * In generator.pl this function has signature "dom, string, 0 : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_core_dump (value domv, value strv) +{ + CAMLparam2 (domv, strv); + + CAMLlocal1 (rv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *str = String_val (strv); + int r; + + NONBLOCKING (r = virDomainCoreDump (dom, str, 0)); + CHECK_ERROR (!r, conn, "virDomainCoreDump"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainCoreDumpJob. + * In generator.pl this function has signature "dom, string, 0 : job from dom". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINCOREDUMPJOB +extern virJobPtr virDomainCoreDumpJob (virDomainPtr dom, const char *str, int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_core_dump_job (value domv, value strv) +{ + CAMLparam2 (domv, strv); +#ifndef HAVE_VIRDOMAINCOREDUMPJOB + /* Symbol virDomainCoreDumpJob not found at compile time. */ + not_supported ("virDomainCoreDumpJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainCoreDumpJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainCoreDumpJob); + + CAMLlocal2 (rv, connv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *str = String_val (strv); + virJobPtr r; + + NONBLOCKING (r = virDomainCoreDumpJob (dom, str, 0)); + CHECK_ERROR (!r, conn, "virDomainCoreDumpJob"); + + connv = Field (domv, 1); + rv = Val_job (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virDomainSuspend. + * In generator.pl this function has signature "dom : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_suspend (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainSuspend (dom)); + CHECK_ERROR (r == -1, conn, "virDomainSuspend"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainResume. + * In generator.pl this function has signature "dom : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_resume (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainResume (dom)); + CHECK_ERROR (r == -1, conn, "virDomainResume"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainShutdown. + * In generator.pl this function has signature "dom : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_shutdown (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainShutdown (dom)); + CHECK_ERROR (r == -1, conn, "virDomainShutdown"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainReboot. + * In generator.pl this function has signature "dom, 0 : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_reboot (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainReboot (dom, 0)); + CHECK_ERROR (r == -1, conn, "virDomainReboot"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainDefineXML. + * In generator.pl this function has signature "conn, string : dom". + */ + +CAMLprim value +ocaml_libvirt_domain_define_xml (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virDomainPtr r; + + NONBLOCKING (r = virDomainDefineXML (conn, str)); + CHECK_ERROR (!r, conn, "virDomainDefineXML"); + + rv = Val_domain (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virDomainUndefine. + * In generator.pl this function has signature "dom : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_undefine (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainUndefine (dom)); + CHECK_ERROR (r == -1, conn, "virDomainUndefine"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainCreate. + * In generator.pl this function has signature "dom : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_create (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r; + + NONBLOCKING (r = virDomainCreate (dom)); + CHECK_ERROR (r == -1, conn, "virDomainCreate"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainCreateJob. + * In generator.pl this function has signature "dom, 0U : job from dom". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINCREATEJOB +extern virJobPtr virDomainCreateJob (virDomainPtr dom, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_create_job (value domv) +{ + CAMLparam1 (domv); +#ifndef HAVE_VIRDOMAINCREATEJOB + /* Symbol virDomainCreateJob not found at compile time. */ + not_supported ("virDomainCreateJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainCreateJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainCreateJob); + + CAMLlocal2 (rv, connv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + virJobPtr r; + + NONBLOCKING (r = virDomainCreateJob (dom, 0)); + CHECK_ERROR (!r, conn, "virDomainCreateJob"); + + connv = Field (domv, 1); + rv = Val_job (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virDomainAttachDevice. + * In generator.pl this function has signature "dom, string : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_attach_device (value domv, value strv) +{ + CAMLparam2 (domv, strv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *str = String_val (strv); + int r; + + NONBLOCKING (r = virDomainAttachDevice (dom, str)); + CHECK_ERROR (r == -1, conn, "virDomainAttachDevice"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainDetachDevice. + * In generator.pl this function has signature "dom, string : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_detach_device (value domv, value strv) +{ + CAMLparam2 (domv, strv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *str = String_val (strv); + int r; + + NONBLOCKING (r = virDomainDetachDevice (dom, str)); + CHECK_ERROR (r == -1, conn, "virDomainDetachDevice"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virDomainGetAutostart. + * In generator.pl this function has signature "dom : bool". + */ + +CAMLprim value +ocaml_libvirt_domain_get_autostart (value domv) +{ + CAMLparam1 (domv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r, b; + + NONBLOCKING (r = virDomainGetAutostart (dom, &b)); + CHECK_ERROR (r == -1, conn, "virDomainGetAutostart"); + + CAMLreturn (b ? Val_true : Val_false); +} + +/* Automatically generated binding for virDomainSetAutostart. + * In generator.pl this function has signature "dom, bool : unit". + */ + +CAMLprim value +ocaml_libvirt_domain_set_autostart (value domv, value bv) +{ + CAMLparam2 (domv, bv); + + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r, b; + + b = bv == Val_true ? 1 : 0; + + NONBLOCKING (r = virDomainSetAutostart (dom, b)); + CHECK_ERROR (r == -1, conn, "virDomainSetAutostart"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virNetworkFree. + * In generator.pl this function has signature "net : free". + */ + +CAMLprim value +ocaml_libvirt_network_free (value netv) +{ + CAMLparam1 (netv); + + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + int r; + + NONBLOCKING (r = virNetworkFree (net)); + CHECK_ERROR (r == -1, conn, "virNetworkFree"); + + /* So that we don't double-free in the finalizer: */ + Network_val (netv) = NULL; + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virNetworkDestroy. + * In generator.pl this function has signature "net : free". + */ + +CAMLprim value +ocaml_libvirt_network_destroy (value netv) +{ + CAMLparam1 (netv); + + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + int r; + + NONBLOCKING (r = virNetworkDestroy (net)); + CHECK_ERROR (r == -1, conn, "virNetworkDestroy"); + + /* So that we don't double-free in the finalizer: */ + Network_val (netv) = NULL; + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virNetworkLookupByName. + * In generator.pl this function has signature "conn, string : net". + */ + +CAMLprim value +ocaml_libvirt_network_lookup_by_name (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virNetworkPtr r; + + NONBLOCKING (r = virNetworkLookupByName (conn, str)); + CHECK_ERROR (!r, conn, "virNetworkLookupByName"); + + rv = Val_network (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkLookupByUUID. + * In generator.pl this function has signature "conn, uuid : net". + */ + +CAMLprim value +ocaml_libvirt_network_lookup_by_uuid (value connv, value uuidv) +{ + CAMLparam2 (connv, uuidv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + unsigned char *uuid = (unsigned char *) String_val (uuidv); + virNetworkPtr r; + + NONBLOCKING (r = virNetworkLookupByUUID (conn, uuid)); + CHECK_ERROR (!r, conn, "virNetworkLookupByUUID"); + + rv = Val_network (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkLookupByUUIDString. + * In generator.pl this function has signature "conn, string : net". + */ + +CAMLprim value +ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virNetworkPtr r; + + NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str)); + CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString"); + + rv = Val_network (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkGetName. + * In generator.pl this function has signature "net : static string". + */ + +CAMLprim value +ocaml_libvirt_network_get_name (value netv) +{ + CAMLparam1 (netv); + + CAMLlocal1 (rv); + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + const char *r; + + NONBLOCKING (r = virNetworkGetName (net)); + CHECK_ERROR (!r, conn, "virNetworkGetName"); + + rv = caml_copy_string (r); + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkGetXMLDesc. + * In generator.pl this function has signature "net, 0 : string". + */ + +CAMLprim value +ocaml_libvirt_network_get_xml_desc (value netv) +{ + CAMLparam1 (netv); + + CAMLlocal1 (rv); + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + char *r; + + NONBLOCKING (r = virNetworkGetXMLDesc (net, 0)); + CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkGetBridgeName. + * In generator.pl this function has signature "net : string". + */ + +CAMLprim value +ocaml_libvirt_network_get_bridge_name (value netv) +{ + CAMLparam1 (netv); + + CAMLlocal1 (rv); + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + char *r; + + NONBLOCKING (r = virNetworkGetBridgeName (net)); + CHECK_ERROR (!r, conn, "virNetworkGetBridgeName"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkGetUUID. + * In generator.pl this function has signature "net : uuid". + */ + +CAMLprim value +ocaml_libvirt_network_get_uuid (value netv) +{ + CAMLparam1 (netv); + + CAMLlocal1 (rv); + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + unsigned char uuid[VIR_UUID_BUFLEN]; + int r; + + NONBLOCKING (r = virNetworkGetUUID (net, uuid)); + CHECK_ERROR (r == -1, conn, "virNetworkGetUUID"); + + /* UUIDs are byte arrays with a fixed length. */ + rv = caml_alloc_string (VIR_UUID_BUFLEN); + memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN); + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkGetUUIDString. + * In generator.pl this function has signature "net : uuid string". + */ + +CAMLprim value +ocaml_libvirt_network_get_uuid_string (value netv) +{ + CAMLparam1 (netv); + + CAMLlocal1 (rv); + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + char uuid[VIR_UUID_STRING_BUFLEN]; + int r; + + NONBLOCKING (r = virNetworkGetUUIDString (net, uuid)); + CHECK_ERROR (r == -1, conn, "virNetworkGetUUIDString"); + + rv = caml_copy_string (uuid); + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkUndefine. + * In generator.pl this function has signature "net : unit". + */ + +CAMLprim value +ocaml_libvirt_network_undefine (value netv) +{ + CAMLparam1 (netv); + + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + int r; + + NONBLOCKING (r = virNetworkUndefine (net)); + CHECK_ERROR (r == -1, conn, "virNetworkUndefine"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virNetworkCreateXML. + * In generator.pl this function has signature "conn, string : net". + */ + +CAMLprim value +ocaml_libvirt_network_create_xml (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virNetworkPtr r; + + NONBLOCKING (r = virNetworkCreateXML (conn, str)); + CHECK_ERROR (!r, conn, "virNetworkCreateXML"); + + rv = Val_network (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkCreateXMLJob. + * In generator.pl this function has signature "conn, string : job". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRNETWORKCREATEXMLJOB +extern virJobPtr virNetworkCreateXMLJob (virConnectPtr conn, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_network_create_xml_job (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRNETWORKCREATEXMLJOB + /* Symbol virNetworkCreateXMLJob not found at compile time. */ + not_supported ("virNetworkCreateXMLJob"); + CAMLnoreturn; +#else + /* Check that the symbol virNetworkCreateXMLJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virNetworkCreateXMLJob); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virJobPtr r; + + NONBLOCKING (r = virNetworkCreateXMLJob (conn, str)); + CHECK_ERROR (!r, conn, "virNetworkCreateXMLJob"); + + rv = Val_job (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virNetworkDefineXML. + * In generator.pl this function has signature "conn, string : net". + */ + +CAMLprim value +ocaml_libvirt_network_define_xml (value connv, value strv) +{ + CAMLparam2 (connv, strv); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virNetworkPtr r; + + NONBLOCKING (r = virNetworkDefineXML (conn, str)); + CHECK_ERROR (!r, conn, "virNetworkDefineXML"); + + rv = Val_network (r, connv); + + CAMLreturn (rv); +} + +/* Automatically generated binding for virNetworkCreate. + * In generator.pl this function has signature "net : unit". + */ + +CAMLprim value +ocaml_libvirt_network_create (value netv) +{ + CAMLparam1 (netv); + + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + int r; + + NONBLOCKING (r = virNetworkCreate (net)); + CHECK_ERROR (r == -1, conn, "virNetworkCreate"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virNetworkCreateJob. + * In generator.pl this function has signature "net : job from net". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRNETWORKCREATEJOB +extern virJobPtr virNetworkCreateJob (virNetworkPtr net) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_network_create_job (value netv) +{ + CAMLparam1 (netv); +#ifndef HAVE_VIRNETWORKCREATEJOB + /* Symbol virNetworkCreateJob not found at compile time. */ + not_supported ("virNetworkCreateJob"); + CAMLnoreturn; +#else + /* Check that the symbol virNetworkCreateJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virNetworkCreateJob); + + CAMLlocal2 (rv, connv); + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + virJobPtr r; + + NONBLOCKING (r = virNetworkCreateJob (net)); + CHECK_ERROR (!r, conn, "virNetworkCreateJob"); + + connv = Field (netv, 1); + rv = Val_job (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virNetworkGetAutostart. + * In generator.pl this function has signature "net : bool". + */ + +CAMLprim value +ocaml_libvirt_network_get_autostart (value netv) +{ + CAMLparam1 (netv); + + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + int r, b; + + NONBLOCKING (r = virNetworkGetAutostart (net, &b)); + CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart"); + + CAMLreturn (b ? Val_true : Val_false); +} + +/* Automatically generated binding for virNetworkSetAutostart. + * In generator.pl this function has signature "net, bool : unit". + */ + +CAMLprim value +ocaml_libvirt_network_set_autostart (value netv, value bv) +{ + CAMLparam2 (netv, bv); + + virNetworkPtr net = Network_val (netv); + virConnectPtr conn = Connect_netv (netv); + int r, b; + + b = bv == Val_true ? 1 : 0; + + NONBLOCKING (r = virNetworkSetAutostart (net, b)); + CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart"); + + CAMLreturn (Val_unit); +} + +/* Automatically generated binding for virStoragePoolFree. + * In generator.pl this function has signature "pool : free". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLFREE +extern int virStoragePoolFree (virStoragePoolPtr pool) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_free (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLFREE + /* Symbol virStoragePoolFree not found at compile time. */ + not_supported ("virStoragePoolFree"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolFree + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolFree); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r; + + NONBLOCKING (r = virStoragePoolFree (pool)); + CHECK_ERROR (r == -1, conn, "virStoragePoolFree"); + + /* So that we don't double-free in the finalizer: */ + Pool_val (poolv) = NULL; + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolDestroy. + * In generator.pl this function has signature "pool : free". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLDESTROY +extern int virStoragePoolDestroy (virStoragePoolPtr pool) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_destroy (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLDESTROY + /* Symbol virStoragePoolDestroy not found at compile time. */ + not_supported ("virStoragePoolDestroy"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolDestroy + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolDestroy); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r; + + NONBLOCKING (r = virStoragePoolDestroy (pool)); + CHECK_ERROR (r == -1, conn, "virStoragePoolDestroy"); + + /* So that we don't double-free in the finalizer: */ + Pool_val (poolv) = NULL; + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolLookupByName. + * In generator.pl this function has signature "conn, string : pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME +extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME + /* Symbol virStoragePoolLookupByName not found at compile time. */ + not_supported ("virStoragePoolLookupByName"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolLookupByName + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolLookupByName); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virStoragePoolPtr r; + + NONBLOCKING (r = virStoragePoolLookupByName (conn, str)); + CHECK_ERROR (!r, conn, "virStoragePoolLookupByName"); + + rv = Val_pool (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolLookupByUUID. + * In generator.pl this function has signature "conn, uuid : pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID +extern virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv) +{ + CAMLparam2 (connv, uuidv); +#ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID + /* Symbol virStoragePoolLookupByUUID not found at compile time. */ + not_supported ("virStoragePoolLookupByUUID"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolLookupByUUID + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUID); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + unsigned char *uuid = (unsigned char *) String_val (uuidv); + virStoragePoolPtr r; + + NONBLOCKING (r = virStoragePoolLookupByUUID (conn, uuid)); + CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUID"); + + rv = Val_pool (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolLookupByUUIDString. + * In generator.pl this function has signature "conn, string : pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING +extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING + /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */ + not_supported ("virStoragePoolLookupByUUIDString"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolLookupByUUIDString + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virStoragePoolPtr r; + + NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str)); + CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString"); + + rv = Val_pool (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolGetName. + * In generator.pl this function has signature "pool : static string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLGETNAME +extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_get_name (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLGETNAME + /* Symbol virStoragePoolGetName not found at compile time. */ + not_supported ("virStoragePoolGetName"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolGetName + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolGetName); + + CAMLlocal1 (rv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + const char *r; + + NONBLOCKING (r = virStoragePoolGetName (pool)); + CHECK_ERROR (!r, conn, "virStoragePoolGetName"); + + rv = caml_copy_string (r); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolGetXMLDesc. + * In generator.pl this function has signature "pool, 0U : string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC +extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_get_xml_desc (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC + /* Symbol virStoragePoolGetXMLDesc not found at compile time. */ + not_supported ("virStoragePoolGetXMLDesc"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolGetXMLDesc + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc); + + CAMLlocal1 (rv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + char *r; + + NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0)); + CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolGetUUID. + * In generator.pl this function has signature "pool : uuid". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLGETUUID +extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_get_uuid (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLGETUUID + /* Symbol virStoragePoolGetUUID not found at compile time. */ + not_supported ("virStoragePoolGetUUID"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolGetUUID + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolGetUUID); + + CAMLlocal1 (rv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + unsigned char uuid[VIR_UUID_BUFLEN]; + int r; + + NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid)); + CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID"); + + /* UUIDs are byte arrays with a fixed length. */ + rv = caml_alloc_string (VIR_UUID_BUFLEN); + memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolGetUUIDString. + * In generator.pl this function has signature "pool : uuid string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING +extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_get_uuid_string (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING + /* Symbol virStoragePoolGetUUIDString not found at compile time. */ + not_supported ("virStoragePoolGetUUIDString"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolGetUUIDString + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolGetUUIDString); + + CAMLlocal1 (rv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + char uuid[VIR_UUID_STRING_BUFLEN]; + int r; + + NONBLOCKING (r = virStoragePoolGetUUIDString (pool, uuid)); + CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUIDString"); + + rv = caml_copy_string (uuid); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolCreateXML. + * In generator.pl this function has signature "conn, string, 0U : pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLCREATEXML +extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_create_xml (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRSTORAGEPOOLCREATEXML + /* Symbol virStoragePoolCreateXML not found at compile time. */ + not_supported ("virStoragePoolCreateXML"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolCreateXML + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolCreateXML); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virStoragePoolPtr r; + + NONBLOCKING (r = virStoragePoolCreateXML (conn, str, 0)); + CHECK_ERROR (!r, conn, "virStoragePoolCreateXML"); + + rv = Val_pool (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolDefineXML. + * In generator.pl this function has signature "conn, string, 0U : pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLDEFINEXML +extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_define_xml (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRSTORAGEPOOLDEFINEXML + /* Symbol virStoragePoolDefineXML not found at compile time. */ + not_supported ("virStoragePoolDefineXML"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolDefineXML + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolDefineXML); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virStoragePoolPtr r; + + NONBLOCKING (r = virStoragePoolDefineXML (conn, str, 0)); + CHECK_ERROR (!r, conn, "virStoragePoolDefineXML"); + + rv = Val_pool (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolBuild. + * In generator.pl this function has signature "pool, uint : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLBUILD +extern int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int i) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_build (value poolv, value iv) +{ + CAMLparam2 (poolv, iv); +#ifndef HAVE_VIRSTORAGEPOOLBUILD + /* Symbol virStoragePoolBuild not found at compile time. */ + not_supported ("virStoragePoolBuild"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolBuild + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolBuild); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + unsigned int i = Int_val (iv); + int r; + + NONBLOCKING (r = virStoragePoolBuild (pool, i)); + CHECK_ERROR (!r, conn, "virStoragePoolBuild"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolUndefine. + * In generator.pl this function has signature "pool : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLUNDEFINE +extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_undefine (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLUNDEFINE + /* Symbol virStoragePoolUndefine not found at compile time. */ + not_supported ("virStoragePoolUndefine"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolUndefine + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolUndefine); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r; + + NONBLOCKING (r = virStoragePoolUndefine (pool)); + CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolCreate. + * In generator.pl this function has signature "pool, 0U : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLCREATE +extern int virStoragePoolCreate (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_create (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLCREATE + /* Symbol virStoragePoolCreate not found at compile time. */ + not_supported ("virStoragePoolCreate"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolCreate + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolCreate); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r; + + NONBLOCKING (r = virStoragePoolCreate (pool, 0)); + CHECK_ERROR (r == -1, conn, "virStoragePoolCreate"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolDelete. + * In generator.pl this function has signature "pool, uint : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLDELETE +extern int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int i) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_delete (value poolv, value iv) +{ + CAMLparam2 (poolv, iv); +#ifndef HAVE_VIRSTORAGEPOOLDELETE + /* Symbol virStoragePoolDelete not found at compile time. */ + not_supported ("virStoragePoolDelete"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolDelete + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolDelete); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + unsigned int i = Int_val (iv); + int r; + + NONBLOCKING (r = virStoragePoolDelete (pool, i)); + CHECK_ERROR (!r, conn, "virStoragePoolDelete"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolRefresh. + * In generator.pl this function has signature "pool, 0U : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLREFRESH +extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_refresh (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLREFRESH + /* Symbol virStoragePoolRefresh not found at compile time. */ + not_supported ("virStoragePoolRefresh"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolRefresh + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolRefresh); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r; + + NONBLOCKING (r = virStoragePoolRefresh (pool, 0)); + CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolGetAutostart. + * In generator.pl this function has signature "pool : bool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART +extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_get_autostart (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART + /* Symbol virStoragePoolGetAutostart not found at compile time. */ + not_supported ("virStoragePoolGetAutostart"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolGetAutostart + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r, b; + + NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b)); + CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart"); + + CAMLreturn (b ? Val_true : Val_false); +#endif +} + +/* Automatically generated binding for virStoragePoolSetAutostart. + * In generator.pl this function has signature "pool, bool : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART +extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv) +{ + CAMLparam2 (poolv, bv); +#ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART + /* Symbol virStoragePoolSetAutostart not found at compile time. */ + not_supported ("virStoragePoolSetAutostart"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolSetAutostart + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r, b; + + b = bv == Val_true ? 1 : 0; + + NONBLOCKING (r = virStoragePoolSetAutostart (pool, b)); + CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolNumOfVolumes. + * In generator.pl this function has signature "pool : int". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES +extern int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_num_of_volumes (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES + /* Symbol virStoragePoolNumOfVolumes not found at compile time. */ + not_supported ("virStoragePoolNumOfVolumes"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolNumOfVolumes + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolNumOfVolumes); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r; + + NONBLOCKING (r = virStoragePoolNumOfVolumes (pool)); + CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes"); + + CAMLreturn (Val_int (r)); +#endif +} + +/* Automatically generated binding for virStoragePoolListVolumes. + * In generator.pl this function has signature "pool, int : string array". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLLISTVOLUMES +extern int virStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int maxnames) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv) +{ + CAMLparam2 (poolv, iv); +#ifndef HAVE_VIRSTORAGEPOOLLISTVOLUMES + /* Symbol virStoragePoolListVolumes not found at compile time. */ + not_supported ("virStoragePoolListVolumes"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolListVolumes + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolListVolumes); + + CAMLlocal2 (rv, strv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int i = Int_val (iv); + char *names[i]; + int r; + + NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i)); + CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + strv = caml_copy_string (names[i]); + Store_field (rv, i, strv); + free (names[i]); + } + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolFree. + * In generator.pl this function has signature "vol : free". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLFREE +extern int virStorageVolFree (virStorageVolPtr vol) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_free (value volv) +{ + CAMLparam1 (volv); +#ifndef HAVE_VIRSTORAGEVOLFREE + /* Symbol virStorageVolFree not found at compile time. */ + not_supported ("virStorageVolFree"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolFree + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolFree); + + virStorageVolPtr vol = Volume_val (volv); + virConnectPtr conn = Connect_volv (volv); + int r; + + NONBLOCKING (r = virStorageVolFree (vol)); + CHECK_ERROR (r == -1, conn, "virStorageVolFree"); + + /* So that we don't double-free in the finalizer: */ + Volume_val (volv) = NULL; + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStorageVolDelete. + * In generator.pl this function has signature "vol, uint : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLDELETE +extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_delete (value volv, value iv) +{ + CAMLparam2 (volv, iv); +#ifndef HAVE_VIRSTORAGEVOLDELETE + /* Symbol virStorageVolDelete not found at compile time. */ + not_supported ("virStorageVolDelete"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolDelete + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolDelete); + + virStorageVolPtr vol = Volume_val (volv); + virConnectPtr conn = Connect_volv (volv); + unsigned int i = Int_val (iv); + int r; + + NONBLOCKING (r = virStorageVolDelete (vol, i)); + CHECK_ERROR (!r, conn, "virStorageVolDelete"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStorageVolLookupByName. + * In generator.pl this function has signature "pool, string : vol from pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME +extern virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv) +{ + CAMLparam2 (poolv, strv); +#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME + /* Symbol virStorageVolLookupByName not found at compile time. */ + not_supported ("virStorageVolLookupByName"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolLookupByName + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolLookupByName); + + CAMLlocal2 (rv, connv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + char *str = String_val (strv); + virStorageVolPtr r; + + NONBLOCKING (r = virStorageVolLookupByName (pool, str)); + CHECK_ERROR (!r, conn, "virStorageVolLookupByName"); + + connv = Field (poolv, 1); + rv = Val_volume (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolLookupByKey. + * In generator.pl this function has signature "conn, string : vol". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY +extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY + /* Symbol virStorageVolLookupByKey not found at compile time. */ + not_supported ("virStorageVolLookupByKey"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolLookupByKey + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolLookupByKey); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virStorageVolPtr r; + + NONBLOCKING (r = virStorageVolLookupByKey (conn, str)); + CHECK_ERROR (!r, conn, "virStorageVolLookupByKey"); + + rv = Val_volume (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolLookupByPath. + * In generator.pl this function has signature "conn, string : vol". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH +extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv) +{ + CAMLparam2 (connv, strv); +#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH + /* Symbol virStorageVolLookupByPath not found at compile time. */ + not_supported ("virStorageVolLookupByPath"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolLookupByPath + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolLookupByPath); + + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + char *str = String_val (strv); + virStorageVolPtr r; + + NONBLOCKING (r = virStorageVolLookupByPath (conn, str)); + CHECK_ERROR (!r, conn, "virStorageVolLookupByPath"); + + rv = Val_volume (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolCreateXML. + * In generator.pl this function has signature "pool, string, 0U : vol from pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLCREATEXML +extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_create_xml (value poolv, value strv) +{ + CAMLparam2 (poolv, strv); +#ifndef HAVE_VIRSTORAGEVOLCREATEXML + /* Symbol virStorageVolCreateXML not found at compile time. */ + not_supported ("virStorageVolCreateXML"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolCreateXML + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolCreateXML); + + CAMLlocal2 (rv, connv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + char *str = String_val (strv); + virStorageVolPtr r; + + NONBLOCKING (r = virStorageVolCreateXML (pool, str, 0)); + CHECK_ERROR (!r, conn, "virStorageVolCreateXML"); + + connv = Field (poolv, 1); + rv = Val_volume (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolGetXMLDesc. + * In generator.pl this function has signature "vol, 0U : string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLGETXMLDESC +extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_get_xml_desc (value volv) +{ + CAMLparam1 (volv); +#ifndef HAVE_VIRSTORAGEVOLGETXMLDESC + /* Symbol virStorageVolGetXMLDesc not found at compile time. */ + not_supported ("virStorageVolGetXMLDesc"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolGetXMLDesc + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc); + + CAMLlocal1 (rv); + virStorageVolPtr vol = Volume_val (volv); + virConnectPtr conn = Connect_volv (volv); + char *r; + + NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0)); + CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolGetPath. + * In generator.pl this function has signature "vol : string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLGETPATH +extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_get_path (value volv) +{ + CAMLparam1 (volv); +#ifndef HAVE_VIRSTORAGEVOLGETPATH + /* Symbol virStorageVolGetPath not found at compile time. */ + not_supported ("virStorageVolGetPath"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolGetPath + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolGetPath); + + CAMLlocal1 (rv); + virStorageVolPtr vol = Volume_val (volv); + virConnectPtr conn = Connect_volv (volv); + char *r; + + NONBLOCKING (r = virStorageVolGetPath (vol)); + CHECK_ERROR (!r, conn, "virStorageVolGetPath"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolGetKey. + * In generator.pl this function has signature "vol : static string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLGETKEY +extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_get_key (value volv) +{ + CAMLparam1 (volv); +#ifndef HAVE_VIRSTORAGEVOLGETKEY + /* Symbol virStorageVolGetKey not found at compile time. */ + not_supported ("virStorageVolGetKey"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolGetKey + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolGetKey); + + CAMLlocal1 (rv); + virStorageVolPtr vol = Volume_val (volv); + virConnectPtr conn = Connect_volv (volv); + const char *r; + + NONBLOCKING (r = virStorageVolGetKey (vol)); + CHECK_ERROR (!r, conn, "virStorageVolGetKey"); + + rv = caml_copy_string (r); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolGetName. + * In generator.pl this function has signature "vol : static string". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLGETNAME +extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_get_name (value volv) +{ + CAMLparam1 (volv); +#ifndef HAVE_VIRSTORAGEVOLGETNAME + /* Symbol virStorageVolGetName not found at compile time. */ + not_supported ("virStorageVolGetName"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolGetName + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolGetName); + + CAMLlocal1 (rv); + virStorageVolPtr vol = Volume_val (volv); + virConnectPtr conn = Connect_volv (volv); + const char *r; + + NONBLOCKING (r = virStorageVolGetName (vol)); + CHECK_ERROR (!r, conn, "virStorageVolGetName"); + + rv = caml_copy_string (r); + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStoragePoolLookupByVolume. + * In generator.pl this function has signature "vol : pool from vol". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME +extern virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_lookup_by_volume (value volv) +{ + CAMLparam1 (volv); +#ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME + /* Symbol virStoragePoolLookupByVolume not found at compile time. */ + not_supported ("virStoragePoolLookupByVolume"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolLookupByVolume + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolLookupByVolume); + + CAMLlocal2 (rv, connv); + virStorageVolPtr vol = Volume_val (volv); + virConnectPtr conn = Connect_volv (volv); + virStoragePoolPtr r; + + NONBLOCKING (r = virStoragePoolLookupByVolume (vol)); + CHECK_ERROR (!r, conn, "virStoragePoolLookupByVolume"); + + connv = Field (volv, 1); + rv = Val_pool (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virJobFree. + * In generator.pl this function has signature "job : free". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRJOBFREE +extern int virJobFree (virJobPtr job) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_job_free (value jobv) +{ + CAMLparam1 (jobv); +#ifndef HAVE_VIRJOBFREE + /* Symbol virJobFree not found at compile time. */ + not_supported ("virJobFree"); + CAMLnoreturn; +#else + /* Check that the symbol virJobFree + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virJobFree); + + virJobPtr job = Job_val (jobv); + virConnectPtr conn = Connect_jobv (jobv); + int r; + + NONBLOCKING (r = virJobFree (job)); + CHECK_ERROR (r == -1, conn, "virJobFree"); + + /* So that we don't double-free in the finalizer: */ + Job_val (jobv) = NULL; + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virJobCancel. + * In generator.pl this function has signature "job : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRJOBCANCEL +extern int virJobCancel (virJobPtr job) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_job_cancel (value jobv) +{ + CAMLparam1 (jobv); +#ifndef HAVE_VIRJOBCANCEL + /* Symbol virJobCancel not found at compile time. */ + not_supported ("virJobCancel"); + CAMLnoreturn; +#else + /* Check that the symbol virJobCancel + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virJobCancel); + + virJobPtr job = Job_val (jobv); + virConnectPtr conn = Connect_jobv (jobv); + int r; + + NONBLOCKING (r = virJobCancel (job)); + CHECK_ERROR (r == -1, conn, "virJobCancel"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virJobGetNetwork. + * In generator.pl this function has signature "job : net from job". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRJOBGETNETWORK +extern virNetworkPtr virJobGetNetwork (virJobPtr job) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_job_get_network (value jobv) +{ + CAMLparam1 (jobv); +#ifndef HAVE_VIRJOBGETNETWORK + /* Symbol virJobGetNetwork not found at compile time. */ + not_supported ("virJobGetNetwork"); + CAMLnoreturn; +#else + /* Check that the symbol virJobGetNetwork + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virJobGetNetwork); + + CAMLlocal2 (rv, connv); + virJobPtr job = Job_val (jobv); + virConnectPtr conn = Connect_jobv (jobv); + virNetworkPtr r; + + NONBLOCKING (r = virJobGetNetwork (job)); + CHECK_ERROR (!r, conn, "virJobGetNetwork"); + + connv = Field (jobv, 1); + rv = Val_network (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virJobGetDomain. + * In generator.pl this function has signature "job : dom from job". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRJOBGETDOMAIN +extern virDomainPtr virJobGetDomain (virJobPtr job) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_job_get_domain (value jobv) +{ + CAMLparam1 (jobv); +#ifndef HAVE_VIRJOBGETDOMAIN + /* Symbol virJobGetDomain not found at compile time. */ + not_supported ("virJobGetDomain"); + CAMLnoreturn; +#else + /* Check that the symbol virJobGetDomain + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virJobGetDomain); + + CAMLlocal2 (rv, connv); + virJobPtr job = Job_val (jobv); + virConnectPtr conn = Connect_jobv (jobv); + virDomainPtr r; + + NONBLOCKING (r = virJobGetDomain (job)); + CHECK_ERROR (!r, conn, "virJobGetDomain"); + + connv = Field (jobv, 1); + rv = Val_domain (r, connv); + + CAMLreturn (rv); +#endif +} + +#include "libvirt_c_epilogue.c" + +/* EOF */ diff --git a/libvirt/libvirt_c_epilogue.c b/libvirt/libvirt_c_epilogue.c new file mode 100644 index 0000000..78bd23e --- /dev/null +++ b/libvirt/libvirt_c_epilogue.c @@ -0,0 +1,548 @@ +/* OCaml bindings for libvirt. + * (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + * http://libvirt.org/ + * + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* Please read libvirt/README file. */ + +static char * +Optstring_val (value strv) +{ + if (strv == Val_int (0)) /* None */ + return NULL; + else /* Some string */ + return String_val (Field (strv, 0)); +} + +static value +Val_opt (void *ptr, Val_ptr_t Val_ptr) +{ + CAMLparam0 (); + CAMLlocal2 (optv, ptrv); + + if (ptr) { /* Some ptr */ + optv = caml_alloc (1, 0); + ptrv = Val_ptr (ptr); + Store_field (optv, 0, ptrv); + } else /* None */ + optv = Val_int (0); + + CAMLreturn (optv); +} + +#if 0 +static value +option_default (value option, value deflt) +{ + if (option == Val_int (0)) /* "None" */ + return deflt; + else /* "Some 'a" */ + return Field (option, 0); +} +#endif + +static void +_raise_virterror (virConnectPtr conn, const char *fn) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + virErrorPtr errp; + struct _virError err; + + errp = conn ? virConnGetLastError (conn) : virGetLastError (); + + if (!errp) { + /* Fake a _virError structure. */ + memset (&err, 0, sizeof err); + err.code = VIR_ERR_INTERNAL_ERROR; + err.domain = VIR_FROM_NONE; + err.level = VIR_ERR_ERROR; + err.message = (char *) fn; + errp = &err; + } + + rv = Val_virterror (errp); + caml_raise_with_arg (*caml_named_value ("ocaml_libvirt_virterror"), rv); + + /*NOTREACHED*/ + /* Suppresses a compiler warning. */ + (void) caml__frame; +} + +/* Raise an error if a function is not supported. */ +static void +not_supported (const char *fn) +{ + CAMLparam0 (); + CAMLlocal1 (fnv); + + fnv = caml_copy_string (fn); + caml_raise_with_arg (*caml_named_value ("ocaml_libvirt_not_supported"), fnv); + + /*NOTREACHED*/ + /* Suppresses a compiler warning. */ + (void) caml__frame; +} + +/* Convert the virErrorNumber, virErrorDomain and virErrorLevel enums + * into values (longs because they are variants in OCaml). + * + * The enum values are part of the libvirt ABI so they cannot change, + * which means that we can convert these numbers directly into + * OCaml variants (which use the same ordering) very fast. + * + * The tricky part here is when we are linked to a newer version of + * libvirt than the one we were compiled against. If the newer libvirt + * generates an error code which we don't know about then we need + * to convert it into VIR_*_UNKNOWN (code). + */ + +#define MAX_VIR_CODE 50 /* VIR_ERR_NO_STORAGE_VOL */ +#define MAX_VIR_DOMAIN 17 /* VIR_FROM_STORAGE */ +#define MAX_VIR_LEVEL VIR_ERR_ERROR + +static inline value +Val_err_number (virErrorNumber code) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + + if (0 <= code && code <= MAX_VIR_CODE) + rv = Val_int (code); + else { + rv = caml_alloc (1, 0); /* VIR_ERR_UNKNOWN (code) */ + Store_field (rv, 0, Val_int (code)); + } + + CAMLreturn (rv); +} + +static inline value +Val_err_domain (virErrorDomain code) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + + if (0 <= code && code <= MAX_VIR_DOMAIN) + rv = Val_int (code); + else { + rv = caml_alloc (1, 0); /* VIR_FROM_UNKNOWN (code) */ + Store_field (rv, 0, Val_int (code)); + } + + CAMLreturn (rv); +} + +static inline value +Val_err_level (virErrorLevel code) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + + if (0 <= code && code <= MAX_VIR_LEVEL) + rv = Val_int (code); + else { + rv = caml_alloc (1, 0); /* VIR_ERR_UNKNOWN_LEVEL (code) */ + Store_field (rv, 0, Val_int (code)); + } + + CAMLreturn (rv); +} + +/* Convert a virterror to a value. */ +static value +Val_virterror (virErrorPtr err) +{ + CAMLparam0 (); + CAMLlocal3 (rv, connv, optv); + + rv = caml_alloc (12, 0); + Store_field (rv, 0, Val_err_number (err->code)); + Store_field (rv, 1, Val_err_domain (err->domain)); + Store_field (rv, 2, + Val_opt (err->message, (Val_ptr_t) caml_copy_string)); + Store_field (rv, 3, Val_err_level (err->level)); + + /* conn, dom and net fields, all optional */ + if (err->conn) { + connv = Val_connect_no_finalize (err->conn); + optv = caml_alloc (1, 0); + Store_field (optv, 0, connv); + Store_field (rv, 4, optv); /* Some conn */ + + if (err->dom) { + optv = caml_alloc (1, 0); + Store_field (optv, 0, Val_domain_no_finalize (err->dom, connv)); + Store_field (rv, 5, optv); /* Some (dom, conn) */ + } + else + Store_field (rv, 5, Val_int (0)); /* None */ + if (err->net) { + optv = caml_alloc (1, 0); + Store_field (optv, 0, Val_network_no_finalize (err->net, connv)); + Store_field (rv, 11, optv); /* Some (net, conn) */ + } else + Store_field (rv, 11, Val_int (0)); /* None */ + } else { + Store_field (rv, 4, Val_int (0)); /* None */ + Store_field (rv, 5, Val_int (0)); /* None */ + Store_field (rv, 11, Val_int (0)); /* None */ + } + + Store_field (rv, 6, + Val_opt (err->str1, (Val_ptr_t) caml_copy_string)); + Store_field (rv, 7, + Val_opt (err->str2, (Val_ptr_t) caml_copy_string)); + Store_field (rv, 8, + Val_opt (err->str3, (Val_ptr_t) caml_copy_string)); + Store_field (rv, 9, caml_copy_int32 (err->int1)); + Store_field (rv, 10, caml_copy_int32 (err->int2)); + + CAMLreturn (rv); +} + +static void conn_finalize (value); +static void dom_finalize (value); +static void net_finalize (value); +#ifdef HAVE_VIRSTORAGEPOOLPTR +static void pol_finalize (value); +#endif +#ifdef HAVE_VIRSTORAGEVOLPTR +static void vol_finalize (value); +#endif +#ifdef HAVE_VIRJOBPTR +static void jb_finalize (value); +#endif + +static struct custom_operations conn_custom_operations = { + "conn_custom_operations", + conn_finalize, + custom_compare_default, + custom_hash_default, + custom_serialize_default, + custom_deserialize_default +}; + +static struct custom_operations dom_custom_operations = { + "dom_custom_operations", + dom_finalize, + custom_compare_default, + custom_hash_default, + custom_serialize_default, + custom_deserialize_default + +}; + +static struct custom_operations net_custom_operations = { + "net_custom_operations", + net_finalize, + custom_compare_default, + custom_hash_default, + custom_serialize_default, + custom_deserialize_default +}; + +#ifdef HAVE_VIRSTORAGEPOOLPTR +static struct custom_operations pol_custom_operations = { + "pol_custom_operations", + pol_finalize, + custom_compare_default, + custom_hash_default, + custom_serialize_default, + custom_deserialize_default +}; +#endif + +#ifdef HAVE_VIRSTORAGEVOLPTR +static struct custom_operations vol_custom_operations = { + "vol_custom_operations", + vol_finalize, + custom_compare_default, + custom_hash_default, + custom_serialize_default, + custom_deserialize_default +}; +#endif + +#ifdef HAVE_VIRJOBPTR +static struct custom_operations jb_custom_operations = { + "jb_custom_operations", + jb_finalize, + custom_compare_default, + custom_hash_default, + custom_serialize_default, + custom_deserialize_default +}; +#endif + +static value +Val_connect (virConnectPtr conn) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc_custom (&conn_custom_operations, + sizeof (virConnectPtr), 0, 1); + Connect_val (rv) = conn; + CAMLreturn (rv); +} + +static value +Val_dom (virDomainPtr dom) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc_custom (&dom_custom_operations, + sizeof (virDomainPtr), 0, 1); + Dom_val (rv) = dom; + CAMLreturn (rv); +} + +static value +Val_net (virNetworkPtr net) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc_custom (&net_custom_operations, + sizeof (virNetworkPtr), 0, 1); + Net_val (rv) = net; + CAMLreturn (rv); +} + +#ifdef HAVE_VIRSTORAGEPOOLPTR +static value +Val_pol (virStoragePoolPtr pol) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc_custom (&pol_custom_operations, + sizeof (virStoragePoolPtr), 0, 1); + Pol_val (rv) = pol; + CAMLreturn (rv); +} +#endif + +#ifdef HAVE_VIRSTORAGEVOLPTR +static value +Val_vol (virStorageVolPtr vol) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc_custom (&vol_custom_operations, + sizeof (virStorageVolPtr), 0, 1); + Vol_val (rv) = vol; + CAMLreturn (rv); +} +#endif + +#ifdef HAVE_VIRJOBPTR +static value +Val_jb (virJobPtr jb) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc_custom (&jb_custom_operations, + sizeof (virJobPtr), 0, 1); + Jb_val (rv) = jb; + CAMLreturn (rv); +} +#endif + +/* No-finalize versions of Val_connect, Val_dom, Val_net ONLY for use + * by virterror wrappers. + */ +static value +Val_connect_no_finalize (virConnectPtr conn) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc (1, Abstract_tag); + Store_field (rv, 0, (value) conn); + CAMLreturn (rv); +} + +static value +Val_dom_no_finalize (virDomainPtr dom) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc (1, Abstract_tag); + Store_field (rv, 0, (value) dom); + CAMLreturn (rv); +} + +static value +Val_net_no_finalize (virNetworkPtr net) +{ + CAMLparam0 (); + CAMLlocal1 (rv); + rv = caml_alloc (1, Abstract_tag); + Store_field (rv, 0, (value) net); + CAMLreturn (rv); +} + +/* This wraps up the (dom, conn) pair (Domain.t). */ +static value +Val_domain (virDomainPtr dom, value connv) +{ + CAMLparam1 (connv); + CAMLlocal2 (rv, v); + + rv = caml_alloc_tuple (2); + v = Val_dom (dom); + Store_field (rv, 0, v); + Store_field (rv, 1, connv); + CAMLreturn (rv); +} + +/* This wraps up the (net, conn) pair (Network.t). */ +static value +Val_network (virNetworkPtr net, value connv) +{ + CAMLparam1 (connv); + CAMLlocal2 (rv, v); + + rv = caml_alloc_tuple (2); + v = Val_net (net); + Store_field (rv, 0, v); + Store_field (rv, 1, connv); + CAMLreturn (rv); +} + +#ifdef HAVE_VIRSTORAGEPOOLPTR +/* This wraps up the (pol, conn) pair (Pool.t). */ +static value +Val_pool (virStoragePoolPtr pol, value connv) +{ + CAMLparam1 (connv); + CAMLlocal2 (rv, v); + + rv = caml_alloc_tuple (2); + v = Val_pol (pol); + Store_field (rv, 0, v); + Store_field (rv, 1, connv); + CAMLreturn (rv); +} +#endif + +#ifdef HAVE_VIRSTORAGEVOLPTR +/* This wraps up the (vol, conn) pair (Volume.t). */ +static value +Val_volume (virStorageVolPtr vol, value connv) +{ + CAMLparam1 (connv); + CAMLlocal2 (rv, v); + + rv = caml_alloc_tuple (2); + v = Val_vol (vol); + Store_field (rv, 0, v); + Store_field (rv, 1, connv); + CAMLreturn (rv); +} +#endif + +#ifdef HAVE_VIRJOBPTR +/* This wraps up the (jb, conn) pair (Job.t). */ +static value +Val_job (virJobPtr jb, value connv) +{ + CAMLparam1 (connv); + CAMLlocal2 (rv, v); + + rv = caml_alloc_tuple (2); + v = Val_jb (jb); + Store_field (rv, 0, v); + Store_field (rv, 1, connv); + CAMLreturn (rv); +} +#endif + +/* No-finalize versions of Val_domain, Val_network ONLY for use by + * virterror wrappers. + */ +static value +Val_domain_no_finalize (virDomainPtr dom, value connv) +{ + CAMLparam1 (connv); + CAMLlocal2 (rv, v); + + rv = caml_alloc_tuple (2); + v = Val_dom_no_finalize (dom); + Store_field (rv, 0, v); + Store_field (rv, 1, connv); + CAMLreturn (rv); +} + +static value +Val_network_no_finalize (virNetworkPtr net, value connv) +{ + CAMLparam1 (connv); + CAMLlocal2 (rv, v); + + rv = caml_alloc_tuple (2); + v = Val_net_no_finalize (net); + Store_field (rv, 0, v); + Store_field (rv, 1, connv); + CAMLreturn (rv); +} + +static void +conn_finalize (value connv) +{ + virConnectPtr conn = Connect_val (connv); + if (conn) (void) virConnectClose (conn); +} + +static void +dom_finalize (value domv) +{ + virDomainPtr dom = Dom_val (domv); + if (dom) (void) virDomainFree (dom); +} + +static void +net_finalize (value netv) +{ + virNetworkPtr net = Net_val (netv); + if (net) (void) virNetworkFree (net); +} + +#ifdef HAVE_VIRSTORAGEPOOLPTR +static void +pol_finalize (value polv) +{ + virStoragePoolPtr pol = Pol_val (polv); + if (pol) (void) virStoragePoolFree (pol); +} +#endif + +#ifdef HAVE_VIRSTORAGEVOLPTR +static void +vol_finalize (value volv) +{ + virStorageVolPtr vol = Vol_val (volv); + if (vol) (void) virStorageVolFree (vol); +} +#endif + +#ifdef HAVE_VIRJOBPTR +static void +jb_finalize (value jbv) +{ + virJobPtr jb = Jb_val (jbv); + if (jb) (void) virJobFree (jb); +} +#endif diff --git a/libvirt/libvirt_c_oneoffs.c b/libvirt/libvirt_c_oneoffs.c new file mode 100644 index 0000000..5df783e --- /dev/null +++ b/libvirt/libvirt_c_oneoffs.c @@ -0,0 +1,822 @@ +/* OCaml bindings for libvirt. + * (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + * http://libvirt.org/ + * + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* Please read libvirt/README file. */ + +/*----------------------------------------------------------------------*/ + +CAMLprim value +ocaml_libvirt_get_version (value driverv, value unit) +{ + CAMLparam2 (driverv, unit); + CAMLlocal1 (rv); + const char *driver = Optstring_val (driverv); + unsigned long libVer, typeVer = 0, *typeVer_ptr; + int r; + + typeVer_ptr = driver ? &typeVer : NULL; + NONBLOCKING (r = virGetVersion (&libVer, driver, typeVer_ptr)); + CHECK_ERROR (r == -1, NULL, "virGetVersion"); + + rv = caml_alloc_tuple (2); + Store_field (rv, 0, Val_int (libVer)); + Store_field (rv, 1, Val_int (typeVer)); + CAMLreturn (rv); +} + +/*----------------------------------------------------------------------*/ + +/* Connection object. */ + +CAMLprim value +ocaml_libvirt_connect_open (value namev, value unit) +{ + CAMLparam2 (namev, unit); + CAMLlocal1 (rv); + const char *name = Optstring_val (namev); + virConnectPtr conn; + + NONBLOCKING (conn = virConnectOpen (name)); + CHECK_ERROR (!conn, NULL, "virConnectOpen"); + + rv = Val_connect (conn); + + CAMLreturn (rv); +} + +CAMLprim value +ocaml_libvirt_connect_open_readonly (value namev, value unit) +{ + CAMLparam2 (namev, unit); + CAMLlocal1 (rv); + const char *name = Optstring_val (namev); + virConnectPtr conn; + + NONBLOCKING (conn = virConnectOpenReadOnly (name)); + CHECK_ERROR (!conn, NULL, "virConnectOpen"); + + rv = Val_connect (conn); + + CAMLreturn (rv); +} + +CAMLprim value +ocaml_libvirt_connect_get_version (value connv) +{ + CAMLparam1 (connv); + virConnectPtr conn = Connect_val (connv); + unsigned long hvVer; + int r; + + NONBLOCKING (r = virConnectGetVersion (conn, &hvVer)); + CHECK_ERROR (r == -1, conn, "virConnectGetVersion"); + + CAMLreturn (Val_int (hvVer)); +} + +CAMLprim value +ocaml_libvirt_connect_get_max_vcpus (value connv, value typev) +{ + CAMLparam2 (connv, typev); + virConnectPtr conn = Connect_val (connv); + const char *type = Optstring_val (typev); + int r; + + NONBLOCKING (r = virConnectGetMaxVcpus (conn, type)); + CHECK_ERROR (r == -1, conn, "virConnectGetMaxVcpus"); + + CAMLreturn (Val_int (r)); +} + +CAMLprim value +ocaml_libvirt_connect_get_node_info (value connv) +{ + CAMLparam1 (connv); + CAMLlocal2 (rv, v); + virConnectPtr conn = Connect_val (connv); + virNodeInfo info; + int r; + + NONBLOCKING (r = virNodeGetInfo (conn, &info)); + CHECK_ERROR (r == -1, conn, "virNodeGetInfo"); + + rv = caml_alloc (8, 0); + v = caml_copy_string (info.model); Store_field (rv, 0, v); + v = caml_copy_int64 (info.memory); Store_field (rv, 1, v); + Store_field (rv, 2, Val_int (info.cpus)); + Store_field (rv, 3, Val_int (info.mhz)); + Store_field (rv, 4, Val_int (info.nodes)); + Store_field (rv, 5, Val_int (info.sockets)); + Store_field (rv, 6, Val_int (info.cores)); + Store_field (rv, 7, Val_int (info.threads)); + + CAMLreturn (rv); +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRNODEGETFREEMEMORY +extern unsigned long long virNodeGetFreeMemory (virConnectPtr conn) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_connect_node_get_free_memory (value connv) +{ +#ifdef HAVE_VIRNODEGETFREEMEMORY + CAMLparam1 (connv); + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + unsigned long long r; + + WEAK_SYMBOL_CHECK (virNodeGetFreeMemory); + NONBLOCKING (r = virNodeGetFreeMemory (conn)); + CHECK_ERROR (r == 0, conn, "virNodeGetFreeMemory"); + + rv = caml_copy_int64 ((int64) r); + CAMLreturn (rv); +#else + not_supported ("virNodeGetFreeMemory"); +#endif +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRNODEGETCELLSFREEMEMORY +extern int virNodeGetCellsFreeMemory (virConnectPtr conn, + unsigned long long *freeMems, + int startCell, int maxCells) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_connect_node_get_cells_free_memory (value connv, + value startv, value maxv) +{ +#ifdef HAVE_VIRNODEGETCELLSFREEMEMORY + CAMLparam3 (connv, startv, maxv); + CAMLlocal2 (rv, iv); + virConnectPtr conn = Connect_val (connv); + int start = Int_val (startv); + int max = Int_val (maxv); + int r, i; + unsigned long long freemems[max]; + + WEAK_SYMBOL_CHECK (virNodeGetCellsFreeMemory); + NONBLOCKING (r = virNodeGetCellsFreeMemory (conn, freemems, start, max)); + CHECK_ERROR (r == -1, conn, "virNodeGetCellsFreeMemory"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + iv = caml_copy_int64 ((int64) freemems[i]); + Store_field (rv, i, iv); + } + + CAMLreturn (rv); +#else + not_supported ("virNodeGetCellsFreeMemory"); +#endif +} + +CAMLprim value +ocaml_libvirt_domain_get_id (value domv) +{ + CAMLparam1 (domv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + unsigned int r; + + NONBLOCKING (r = virDomainGetID (dom)); + /* There's a bug in libvirt which means that if you try to get + * the ID of a defined-but-not-running domain, it returns -1, + * and there's no way to distinguish that from an error. + */ + CHECK_ERROR (r == (unsigned int) -1, conn, "virDomainGetID"); + + CAMLreturn (Val_int ((int) r)); +} + +CAMLprim value +ocaml_libvirt_domain_get_max_memory (value domv) +{ + CAMLparam1 (domv); + CAMLlocal1 (rv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + unsigned long r; + + NONBLOCKING (r = virDomainGetMaxMemory (dom)); + CHECK_ERROR (r == 0 /* [sic] */, conn, "virDomainGetMaxMemory"); + + rv = caml_copy_int64 (r); + CAMLreturn (rv); +} + +CAMLprim value +ocaml_libvirt_domain_set_max_memory (value domv, value memv) +{ + CAMLparam2 (domv, memv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + unsigned long mem = Int64_val (memv); + int r; + + NONBLOCKING (r = virDomainSetMaxMemory (dom, mem)); + CHECK_ERROR (r == -1, conn, "virDomainSetMaxMemory"); + + CAMLreturn (Val_unit); +} + +CAMLprim value +ocaml_libvirt_domain_set_memory (value domv, value memv) +{ + CAMLparam2 (domv, memv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + unsigned long mem = Int64_val (memv); + int r; + + NONBLOCKING (r = virDomainSetMemory (dom, mem)); + CHECK_ERROR (r == -1, conn, "virDomainSetMemory"); + + CAMLreturn (Val_unit); +} + +CAMLprim value +ocaml_libvirt_domain_get_info (value domv) +{ + CAMLparam1 (domv); + CAMLlocal2 (rv, v); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + virDomainInfo info; + int r; + + NONBLOCKING (r = virDomainGetInfo (dom, &info)); + CHECK_ERROR (r == -1, conn, "virDomainGetInfo"); + + rv = caml_alloc (5, 0); + Store_field (rv, 0, Val_int (info.state)); // These flags are compatible. + v = caml_copy_int64 (info.maxMem); Store_field (rv, 1, v); + v = caml_copy_int64 (info.memory); Store_field (rv, 2, v); + Store_field (rv, 3, Val_int (info.nrVirtCpu)); + v = caml_copy_int64 (info.cpuTime); Store_field (rv, 4, v); + + CAMLreturn (rv); +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINGETSCHEDULERTYPE +extern char *virDomainGetSchedulerType(virDomainPtr domain, + int *nparams) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_get_scheduler_type (value domv) +{ +#ifdef HAVE_VIRDOMAINGETSCHEDULERTYPE + CAMLparam1 (domv); + CAMLlocal2 (rv, strv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *r; + int nparams; + + WEAK_SYMBOL_CHECK (virDomainGetSchedulerType); + NONBLOCKING (r = virDomainGetSchedulerType (dom, &nparams)); + CHECK_ERROR (!r, conn, "virDomainGetSchedulerType"); + + rv = caml_alloc_tuple (2); + strv = caml_copy_string (r); Store_field (rv, 0, strv); + free (r); + Store_field (rv, 1, nparams); + CAMLreturn (rv); +#else + not_supported ("virDomainGetSchedulerType"); +#endif +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINGETSCHEDULERPARAMETERS +extern int virDomainGetSchedulerParameters (virDomainPtr domain, + virSchedParameterPtr params, + int *nparams) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_get_scheduler_parameters (value domv, value nparamsv) +{ +#ifdef HAVE_VIRDOMAINGETSCHEDULERPARAMETERS + CAMLparam2 (domv, nparamsv); + CAMLlocal4 (rv, v, v2, v3); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int nparams = Int_val (nparamsv); + virSchedParameter params[nparams]; + int r, i; + + WEAK_SYMBOL_CHECK (virDomainGetSchedulerParameters); + NONBLOCKING (r = virDomainGetSchedulerParameters (dom, params, &nparams)); + CHECK_ERROR (r == -1, conn, "virDomainGetSchedulerParameters"); + + rv = caml_alloc (nparams, 0); + for (i = 0; i < nparams; ++i) { + v = caml_alloc_tuple (2); Store_field (rv, i, v); + v2 = caml_copy_string (params[i].field); Store_field (v, 0, v2); + switch (params[i].type) { + case VIR_DOMAIN_SCHED_FIELD_INT: + v2 = caml_alloc (1, 0); + v3 = caml_copy_int32 (params[i].value.i); Store_field (v2, 0, v3); + break; + case VIR_DOMAIN_SCHED_FIELD_UINT: + v2 = caml_alloc (1, 1); + v3 = caml_copy_int32 (params[i].value.ui); Store_field (v2, 0, v3); + break; + case VIR_DOMAIN_SCHED_FIELD_LLONG: + v2 = caml_alloc (1, 2); + v3 = caml_copy_int64 (params[i].value.l); Store_field (v2, 0, v3); + break; + case VIR_DOMAIN_SCHED_FIELD_ULLONG: + v2 = caml_alloc (1, 3); + v3 = caml_copy_int64 (params[i].value.ul); Store_field (v2, 0, v3); + break; + case VIR_DOMAIN_SCHED_FIELD_DOUBLE: + v2 = caml_alloc (1, 4); + v3 = caml_copy_double (params[i].value.d); Store_field (v2, 0, v3); + break; + case VIR_DOMAIN_SCHED_FIELD_BOOLEAN: + v2 = caml_alloc (1, 5); + Store_field (v2, 0, Val_int (params[i].value.b)); + break; + default: + caml_failwith ((char *)__FUNCTION__); + } + Store_field (v, 1, v2); + } + CAMLreturn (rv); +#else + not_supported ("virDomainGetSchedulerParameters"); +#endif +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINSETSCHEDULERPARAMETERS +extern int virDomainSetSchedulerParameters (virDomainPtr domain, + virSchedParameterPtr params, + int nparams) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_set_scheduler_parameters (value domv, value paramsv) +{ +#ifdef HAVE_VIRDOMAINSETSCHEDULERPARAMETERS + CAMLparam2 (domv, paramsv); + CAMLlocal1 (v); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int nparams = Wosize_val (paramsv); + virSchedParameter params[nparams]; + int r, i; + char *name; + + for (i = 0; i < nparams; ++i) { + v = Field (paramsv, i); /* Points to the two-element tuple. */ + name = String_val (Field (v, 0)); + strncpy (params[i].field, name, VIR_DOMAIN_SCHED_FIELD_LENGTH); + params[i].field[VIR_DOMAIN_SCHED_FIELD_LENGTH-1] = '\0'; + v = Field (v, 1); /* Points to the sched_param_value block. */ + switch (Tag_val (v)) { + case 0: + params[i].type = VIR_DOMAIN_SCHED_FIELD_INT; + params[i].value.i = Int32_val (Field (v, 0)); + break; + case 1: + params[i].type = VIR_DOMAIN_SCHED_FIELD_UINT; + params[i].value.ui = Int32_val (Field (v, 0)); + break; + case 2: + params[i].type = VIR_DOMAIN_SCHED_FIELD_LLONG; + params[i].value.l = Int64_val (Field (v, 0)); + break; + case 3: + params[i].type = VIR_DOMAIN_SCHED_FIELD_ULLONG; + params[i].value.ul = Int64_val (Field (v, 0)); + break; + case 4: + params[i].type = VIR_DOMAIN_SCHED_FIELD_DOUBLE; + params[i].value.d = Double_val (Field (v, 0)); + break; + case 5: + params[i].type = VIR_DOMAIN_SCHED_FIELD_BOOLEAN; + params[i].value.b = Int_val (Field (v, 0)); + break; + default: + caml_failwith ((char *)__FUNCTION__); + } + } + + WEAK_SYMBOL_CHECK (virDomainSetSchedulerParameters); + NONBLOCKING (r = virDomainSetSchedulerParameters (dom, params, nparams)); + CHECK_ERROR (r == -1, conn, "virDomainSetSchedulerParameters"); + + CAMLreturn (Val_unit); +#else + not_supported ("virDomainSetSchedulerParameters"); +#endif +} + +CAMLprim value +ocaml_libvirt_domain_set_vcpus (value domv, value nvcpusv) +{ + CAMLparam2 (domv, nvcpusv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int r, nvcpus = Int_val (nvcpusv); + + NONBLOCKING (r = virDomainSetVcpus (dom, nvcpus)); + CHECK_ERROR (r == -1, conn, "virDomainSetVcpus"); + + CAMLreturn (Val_unit); +} + +CAMLprim value +ocaml_libvirt_domain_pin_vcpu (value domv, value vcpuv, value cpumapv) +{ + CAMLparam3 (domv, vcpuv, cpumapv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int maplen = caml_string_length (cpumapv); + unsigned char *cpumap = (unsigned char *) String_val (cpumapv); + int vcpu = Int_val (vcpuv); + int r; + + NONBLOCKING (r = virDomainPinVcpu (dom, vcpu, cpumap, maplen)); + CHECK_ERROR (r == -1, conn, "virDomainPinVcpu"); + + CAMLreturn (Val_unit); +} + +CAMLprim value +ocaml_libvirt_domain_get_vcpus (value domv, value maxinfov, value maplenv) +{ + CAMLparam3 (domv, maxinfov, maplenv); + CAMLlocal5 (rv, infov, strv, v, v2); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + int maxinfo = Int_val (maxinfov); + int maplen = Int_val (maplenv); + virVcpuInfo info[maxinfo]; + unsigned char cpumaps[maxinfo * maplen]; + int r, i; + + memset (info, 0, sizeof (virVcpuInfo) * maxinfo); + memset (cpumaps, 0, maxinfo * maplen); + + NONBLOCKING (r = virDomainGetVcpus (dom, info, maxinfo, cpumaps, maplen)); + CHECK_ERROR (r == -1, conn, "virDomainPinVcpu"); + + /* Copy the virVcpuInfo structures. */ + infov = caml_alloc (maxinfo, 0); + for (i = 0; i < maxinfo; ++i) { + v2 = caml_alloc (4, 0); Store_field (infov, i, v2); + Store_field (v2, 0, Val_int (info[i].number)); + Store_field (v2, 1, Val_int (info[i].state)); + v = caml_copy_int64 (info[i].cpuTime); Store_field (v2, 2, v); + Store_field (v2, 3, Val_int (info[i].cpu)); + } + + /* Copy the bitmap. */ + strv = caml_alloc_string (maxinfo * maplen); + memcpy (String_val (strv), cpumaps, maxinfo * maplen); + + /* Allocate the tuple and return it. */ + rv = caml_alloc_tuple (3); + Store_field (rv, 0, Val_int (r)); /* number of CPUs. */ + Store_field (rv, 1, infov); + Store_field (rv, 2, strv); + + CAMLreturn (rv); +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINMIGRATE +extern virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn, + unsigned long flags, const char *dname, + const char *uri, unsigned long bandwidth) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_migrate_native (value domv, value dconnv, value flagsv, value optdnamev, value opturiv, value optbandwidthv, value unitv) +{ +#ifdef HAVE_VIRDOMAINMIGRATE + CAMLparam5 (domv, dconnv, flagsv, optdnamev, opturiv); + CAMLxparam2 (optbandwidthv, unitv); + CAMLlocal2 (flagv, rv); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + virConnectPtr dconn = Connect_val (dconnv); + int flags = 0; + const char *dname = Optstring_val (optdnamev); + const char *uri = Optstring_val (opturiv); + unsigned long bandwidth; + virDomainPtr r; + + /* Iterate over the list of flags. */ + for (; flagsv != Val_int (0); flagsv = Field (flagsv, 1)) + { + flagv = Field (flagsv, 0); + if (flagv == Int_val(0)) + flags |= VIR_MIGRATE_LIVE; + } + + if (optbandwidthv == Val_int (0)) /* None */ + bandwidth = 0; + else /* Some bandwidth */ + bandwidth = Int_val (Field (optbandwidthv, 0)); + + WEAK_SYMBOL_CHECK (virDomainMigrate); + NONBLOCKING (r = virDomainMigrate (dom, dconn, flags, dname, uri, bandwidth)); + CHECK_ERROR (!r, conn, "virDomainMigrate"); + + rv = Val_domain (r, dconnv); + + CAMLreturn (rv); + +#else /* virDomainMigrate not supported */ + not_supported ("virDomainMigrate"); +#endif +} + +CAMLprim value +ocaml_libvirt_domain_migrate_bytecode (value *argv, int argn) +{ + return ocaml_libvirt_domain_migrate_native (argv[0], argv[1], argv[2], + argv[3], argv[4], argv[5], + argv[6]); +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINBLOCKSTATS +extern int virDomainBlockStats (virDomainPtr dom, + const char *path, + virDomainBlockStatsPtr stats, + size_t size) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_block_stats (value domv, value pathv) +{ +#if HAVE_VIRDOMAINBLOCKSTATS + CAMLparam2 (domv, pathv); + CAMLlocal2 (rv,v); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *path = String_val (pathv); + struct _virDomainBlockStats stats; + int r; + + WEAK_SYMBOL_CHECK (virDomainBlockStats); + NONBLOCKING (r = virDomainBlockStats (dom, path, &stats, sizeof stats)); + CHECK_ERROR (r == -1, conn, "virDomainBlockStats"); + + rv = caml_alloc (5, 0); + v = caml_copy_int64 (stats.rd_req); Store_field (rv, 0, v); + v = caml_copy_int64 (stats.rd_bytes); Store_field (rv, 1, v); + v = caml_copy_int64 (stats.wr_req); Store_field (rv, 2, v); + v = caml_copy_int64 (stats.wr_bytes); Store_field (rv, 3, v); + v = caml_copy_int64 (stats.errs); Store_field (rv, 4, v); + + CAMLreturn (rv); +#else + not_supported ("virDomainBlockStats"); +#endif +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAININTERFACESTATS +extern int virDomainInterfaceStats (virDomainPtr dom, + const char *path, + virDomainInterfaceStatsPtr stats, + size_t size) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_domain_interface_stats (value domv, value pathv) +{ +#if HAVE_VIRDOMAININTERFACESTATS + CAMLparam2 (domv, pathv); + CAMLlocal2 (rv,v); + virDomainPtr dom = Domain_val (domv); + virConnectPtr conn = Connect_domv (domv); + char *path = String_val (pathv); + struct _virDomainInterfaceStats stats; + int r; + + WEAK_SYMBOL_CHECK (virDomainInterfaceStats); + NONBLOCKING (r = virDomainInterfaceStats (dom, path, &stats, sizeof stats)); + CHECK_ERROR (r == -1, conn, "virDomainInterfaceStats"); + + rv = caml_alloc (8, 0); + v = caml_copy_int64 (stats.rx_bytes); Store_field (rv, 0, v); + v = caml_copy_int64 (stats.rx_packets); Store_field (rv, 1, v); + v = caml_copy_int64 (stats.rx_errs); Store_field (rv, 2, v); + v = caml_copy_int64 (stats.rx_drop); Store_field (rv, 3, v); + v = caml_copy_int64 (stats.tx_bytes); Store_field (rv, 4, v); + v = caml_copy_int64 (stats.tx_packets); Store_field (rv, 5, v); + v = caml_copy_int64 (stats.tx_errs); Store_field (rv, 6, v); + v = caml_copy_int64 (stats.tx_drop); Store_field (rv, 7, v); + + CAMLreturn (rv); +#else + not_supported ("virDomainInterfaceStats"); +#endif +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLGETINFO +extern int virStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_get_info (value poolv) +{ +#if HAVE_VIRSTORAGEPOOLGETINFO + CAMLparam1 (poolv); + CAMLlocal2 (rv, v); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + virStoragePoolInfo info; + int r; + + WEAK_SYMBOL_CHECK (virStoragePoolGetInfo); + NONBLOCKING (r = virStoragePoolGetInfo (pool, &info)); + CHECK_ERROR (r == -1, conn, "virStoragePoolGetInfo"); + + rv = caml_alloc (4, 0); + Store_field (rv, 0, Val_int (info.state)); + v = caml_copy_int64 (info.capacity); Store_field (rv, 1, v); + v = caml_copy_int64 (info.allocation); Store_field (rv, 2, v); + v = caml_copy_int64 (info.available); Store_field (rv, 3, v); + + CAMLreturn (rv); +#else + not_supported ("virStoragePoolGetInfo"); +#endif +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLGETINFO +extern int virStorageVolGetInfo(virStorageVolPtr vol, virStorageVolInfoPtr info) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_get_info (value volv) +{ +#if HAVE_VIRSTORAGEVOLGETINFO + CAMLparam1 (volv); + CAMLlocal2 (rv, v); + virStorageVolPtr vol = Volume_val (volv); + virConnectPtr conn = Connect_volv (volv); + virStorageVolInfo info; + int r; + + WEAK_SYMBOL_CHECK (virStorageVolGetInfo); + NONBLOCKING (r = virStorageVolGetInfo (vol, &info)); + CHECK_ERROR (r == -1, conn, "virStorageVolGetInfo"); + + rv = caml_alloc (3, 0); + Store_field (rv, 0, Val_int (info.type)); + v = caml_copy_int64 (info.capacity); Store_field (rv, 1, v); + v = caml_copy_int64 (info.allocation); Store_field (rv, 1, v); + + CAMLreturn (rv); +#else + not_supported ("virStorageVolGetInfo"); +#endif +} + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRJOBGETINFO +extern int virJobGetInfo(virJobPtr job, virJobInfoPtr info) + __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_job_get_info (value jobv) +{ +#if HAVE_VIRJOBGETINFO + CAMLparam1 (jobv); + CAMLlocal1 (rv); + virJobPtr job = Job_val (jobv); + virConnectPtr conn = Connect_jobv (jobv); + virJobInfo info; + int r; + + WEAK_SYMBOL_CHECK (virJobGetInfo); + NONBLOCKING (r = virJobGetInfo (job, &info)); + CHECK_ERROR (r == -1, conn, "virJobGetInfo"); + + rv = caml_alloc (5, 0); + Store_field (rv, 0, Val_int (info.type)); + Store_field (rv, 1, Val_int (info.state)); + Store_field (rv, 2, Val_int (info.runningTime)); + Store_field (rv, 3, Val_int (info.remainingTime)); + Store_field (rv, 4, Val_int (info.percentComplete)); + + CAMLreturn (rv); +#else + not_supported ("virJobGetInfo"); +#endif +} + +/*----------------------------------------------------------------------*/ + +CAMLprim value +ocaml_libvirt_virterror_get_last_error (value unitv) +{ + CAMLparam1 (unitv); + CAMLlocal1 (rv); + virErrorPtr err = virGetLastError (); + + rv = Val_opt (err, (Val_ptr_t) Val_virterror); + + CAMLreturn (rv); +} + +CAMLprim value +ocaml_libvirt_virterror_get_last_conn_error (value connv) +{ + CAMLparam1 (connv); + CAMLlocal1 (rv); + virConnectPtr conn = Connect_val (connv); + + rv = Val_opt (conn, (Val_ptr_t) Val_connect); + + CAMLreturn (rv); +} + +CAMLprim value +ocaml_libvirt_virterror_reset_last_error (value unitv) +{ + CAMLparam1 (unitv); + virResetLastError (); + CAMLreturn (Val_unit); +} + +CAMLprim value +ocaml_libvirt_virterror_reset_last_conn_error (value connv) +{ + CAMLparam1 (connv); + virConnectPtr conn = Connect_val (connv); + virConnResetLastError (conn); + CAMLreturn (Val_unit); +} + +/*----------------------------------------------------------------------*/ + +/* Initialise the library. */ +CAMLprim value +ocaml_libvirt_init (value unit) +{ + CAMLparam1 (unit); + CAMLlocal1 (rv); + int r; + + r = virInitialize (); + CHECK_ERROR (r == -1, NULL, "virInitialize"); + + CAMLreturn (Val_unit); +} diff --git a/libvirt/libvirt_c_prologue.c b/libvirt/libvirt_c_prologue.c new file mode 100644 index 0000000..7fe9714 --- /dev/null +++ b/libvirt/libvirt_c_prologue.c @@ -0,0 +1,191 @@ +/* OCaml bindings for libvirt. + * (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + * http://libvirt.org/ + * + * 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* Please read libvirt/README file. */ + +static char *Optstring_val (value strv); +typedef value (*Val_ptr_t) (void *); +static value Val_opt (void *ptr, Val_ptr_t Val_ptr); +/*static value option_default (value option, value deflt);*/ +static void _raise_virterror (virConnectPtr conn, const char *fn) Noreturn; +static void not_supported (const char *fn) Noreturn; +static value Val_virterror (virErrorPtr err); + +/* Use this around synchronous libvirt API calls to release the OCaml + * lock, allowing other threads to run simultaneously. 'code' must not + * perform any caml_* calls, run any OCaml code, or raise any exception. + * http://web.archive.org/web/20030521020915/http://caml.inria.fr/archives/200106/msg00199.html + */ +#define NONBLOCKING(code) \ + do { \ + caml_enter_blocking_section (); \ + code; \ + caml_leave_blocking_section (); \ + } while (0) + +/* Check error condition from a libvirt function, and automatically raise + * an exception if one is found. + */ +#define CHECK_ERROR(cond, conn, fn) \ + do { if (cond) _raise_virterror (conn, fn); } while (0) + +/* For more about weak symbols, see: + * http://kolpackov.net/pipermail/notes/2004-March/000006.html + * We are using this to do runtime detection of library functions + * so that if we dynamically link with an older version of + * libvirt than we were compiled against, it won't fail (provided + * libvirt >= 0.2.1 - we don't support anything older). + */ +#ifdef __GNUC__ +#ifdef linux +#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) +#define HAVE_WEAK_SYMBOLS 1 +#endif +#endif +#endif + +#ifdef HAVE_WEAK_SYMBOLS +#define WEAK_SYMBOL_CHECK(sym) \ + do { if (!sym) not_supported(#sym); } while (0) +#else +#define WEAK_SYMBOL_CHECK(sym) +#endif /* HAVE_WEAK_SYMBOLS */ + +/*----------------------------------------------------------------------*/ + +/* Some notes about the use of custom blocks to store virConnectPtr, + * virDomainPtr and virNetworkPtr. + *------------------------------------------------------------------ + * + * Libvirt does some tricky reference counting to keep track of + * virConnectPtr's, virDomainPtr's and virNetworkPtr's. + * + * There is only one function which can return a virConnectPtr + * (virConnectOpen*) and that allocates a new one each time. + * + * virDomainPtr/virNetworkPtr's on the other hand can be returned + * repeatedly (for the same underlying domain/network), and we must + * keep track of each one and explicitly free it with virDomainFree + * or virNetworkFree. If we lose track of one then the reference + * counting in libvirt will keep it open. We therefore wrap these + * in a custom block with a finalizer function. + * + * We also have to allow the user to explicitly free them, in + * which case we set the pointer inside the custom block to NULL. + * The finalizer notices this and doesn't free the object. + * + * Domains and networks "belong to" a connection. We have to avoid + * the situation like this: + * + * let conn = Connect.open ... in + * let dom = Domain.lookup_by_id conn 0 in + * (* conn goes out of scope and is garbage collected *) + * printf "dom name = %s\n" (Domain.get_name dom) + * + * The reason is that when conn is garbage collected, virConnectClose + * is called and any subsequent operations on dom will fail (in fact + * will probably segfault). To stop this from happening, the OCaml + * wrappers store domains (and networks) as explicit (dom, conn) + * pairs. + * + * Further complication with virterror / exceptions: Virterror gives + * us virConnectPtr, virDomainPtr, virNetworkPtr pointers. If we + * follow standard practice and wrap these up in blocks with + * finalizers then we'll end up double-freeing (in particular, calling + * virConnectClose at the wrong time). So for virterror, we have + * "special" wrapper functions (Val_connect_no_finalize, etc.). + * + * Update 2008/01: Storage pools and volumes work the same way as + * domains and networks. And jobs. + */ + +/* Unwrap a custom block. */ +#define Connect_val(rv) (*((virConnectPtr *)Data_custom_val(rv))) +#define Dom_val(rv) (*((virDomainPtr *)Data_custom_val(rv))) +#define Net_val(rv) (*((virNetworkPtr *)Data_custom_val(rv))) +#ifdef HAVE_VIRSTORAGEPOOLPTR +#define Pol_val(rv) (*((virStoragePoolPtr *)Data_custom_val(rv))) +#endif +#ifdef HAVE_VIRSTORAGEVOLPTR +#define Vol_val(rv) (*((virStorageVolPtr *)Data_custom_val(rv))) +#endif +#ifdef HAVE_VIRJOBPTR +#define Jb_val(rv) (*((virJobPtr *)Data_custom_val(rv))) +#endif + +/* Wrap up a pointer to something in a custom block. */ +static value Val_connect (virConnectPtr conn); +static value Val_dom (virDomainPtr dom); +static value Val_net (virNetworkPtr net); +#ifdef HAVE_VIRSTORAGEPOOLPTR +static value Val_pol (virStoragePoolPtr pool); +#endif +#ifdef HAVE_VIRSTORAGEVOLPTR +static value Val_vol (virStorageVolPtr vol); +#endif +#ifdef HAVE_VIRJOBPTR +static value Val_jb (virJobPtr jb); +#endif + +/* ONLY for use by virterror wrappers. */ +static value Val_connect_no_finalize (virConnectPtr conn); +static value Val_dom_no_finalize (virDomainPtr dom); +static value Val_net_no_finalize (virNetworkPtr net); + +/* Domains and networks are stored as pairs (dom/net, conn), so have + * some convenience functions for unwrapping and wrapping them. + */ +#define Domain_val(rv) (Dom_val(Field((rv),0))) +#define Network_val(rv) (Net_val(Field((rv),0))) +#ifdef HAVE_VIRSTORAGEPOOLPTR +#define Pool_val(rv) (Pol_val(Field((rv),0))) +#endif +#ifdef HAVE_VIRSTORAGEVOLPTR +#define Volume_val(rv) (Vol_val(Field((rv),0))) +#endif +#ifdef HAVE_VIRJOBPTR +#define Job_val(rv) (Jb_val(Field((rv),0))) +#endif +#define Connect_domv(rv) (Connect_val(Field((rv),1))) +#define Connect_netv(rv) (Connect_val(Field((rv),1))) +#ifdef HAVE_VIRSTORAGEPOOLPTR +#define Connect_polv(rv) (Connect_val(Field((rv),1))) +#endif +#ifdef HAVE_VIRSTORAGEVOLPTR +#define Connect_volv(rv) (Connect_val(Field((rv),1))) +#endif +#ifdef HAVE_VIRJOBPTR +#define Connect_jobv(rv) (Connect_val(Field((rv),1))) +#endif + +static value Val_domain (virDomainPtr dom, value connv); +static value Val_network (virNetworkPtr net, value connv); +#ifdef HAVE_VIRSTORAGEPOOLPTR +static value Val_pool (virStoragePoolPtr pol, value connv); +#endif +#ifdef HAVE_VIRSTORAGEVOLPTR +static value Val_volume (virStorageVolPtr vol, value connv); +#endif +#ifdef HAVE_VIRJOBPTR +static value Val_job (virJobPtr jb, value connv); +#endif + +/* ONLY for use by virterror wrappers. */ +static value Val_domain_no_finalize (virDomainPtr dom, value connv); +static value Val_network_no_finalize (virNetworkPtr net, value connv); diff --git a/libvirt/libvirt_version.ml.in b/libvirt/libvirt_version.ml.in new file mode 100644 index 0000000..ef7aea5 --- /dev/null +++ b/libvirt/libvirt_version.ml.in @@ -0,0 +1,21 @@ +(* Helper module containing the version of the OCaml bindings. + (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + http://libvirt.org/ + + 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +let package = "@PACKAGE_NAME@" +let version = "@PACKAGE_VERSION@" diff --git a/libvirt/libvirt_version.mli b/libvirt/libvirt_version.mli new file mode 100644 index 0000000..b1755ba --- /dev/null +++ b/libvirt/libvirt_version.mli @@ -0,0 +1,25 @@ +(** OCaml bindings for libvirt. + (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + http://libvirt.org/ + + 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*) + +val package : string +val version : string +(** The name and version of the OCaml libvirt bindings. + + (To get the version of libvirt C library itself + use {!Libvirt.get_version}). *) diff --git a/mlvirsh/.depend b/mlvirsh/.depend new file mode 100644 index 0000000..7dbe514 --- /dev/null +++ b/mlvirsh/.depend @@ -0,0 +1,2 @@ +mlvirsh.cmo: mlvirsh_gettext.cmo ../libvirt/libvirt.cmi +mlvirsh.cmx: mlvirsh_gettext.cmx ../libvirt/libvirt.cmx diff --git a/mlvirsh/Makefile.in b/mlvirsh/Makefile.in new file mode 100644 index 0000000..23d6e1e --- /dev/null +++ b/mlvirsh/Makefile.in @@ -0,0 +1,93 @@ +# mlvirsh +# Copyright (C) 2007 Red Hat Inc., Richard W.M. Jones +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +INSTALL := @INSTALL@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ + +pkg_gettext = @pkg_gettext@ + +OCAMLFIND = @OCAMLFIND@ + +ifneq ($(OCAMLFIND),) +OCAMLCPACKAGES := -package unix -I ../libvirt +OCAMLCFLAGS := -g +OCAMLCLIBS := -linkpkg +OCAMLOPTPACKAGES := $(OCAMLCPACKAGES) +OCAMLOPTFLAGS := +OCAMLOPTLIBS := $(OCAMLCLIBS) +else +OCAMLCINCS := -I ../libvirt +OCAMLCFLAGS := -g +OCAMLCLIBS := unix.cma +OCAMLOPTINCS := $(OCAMLCINCS) +OCAMLOPTFLAGS := +OCAMLOPTLIBS := unix.cmxa +endif + +ifneq ($(pkg_gettext),no) +ifneq ($(OCAMLFIND),) +OCAMLCPACKAGES += -package gettext-stub +OCAMLOPTPACKAGES += -package gettext-stub +else +OCAMLCINCS += -I gettext -I gettext-stub +OCAMLOPTINCS += -I gettext -I gettext-stub +endif +endif + +OBJS := mlvirsh_gettext.cmo mlvirsh.cmo +XOBJS := $(OBJS:.cmo=.cmx) + +export LIBRARY_PATH=../libvirt +export LD_LIBRARY_PATH=../libvirt + +BYTE_TARGETS := mlvirsh +OPT_TARGETS := mlvirsh.opt + +all: $(BYTE_TARGETS) + +opt: $(OPT_TARGETS) + +ifneq ($(OCAMLFIND),) +mlvirsh: $(OBJS) + $(OCAMLFIND) ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \ + ../libvirt/mllibvirt.cma -o $@ $^ + +mlvirsh.opt: $(XOBJS) + $(OCAMLFIND) ocamlopt \ + $(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \ + ../libvirt/mllibvirt.cmxa -o $@ $^ +else +mlvirsh: $(OBJS) + $(OCAMLC) $(OCAMLCINCS) $(OCAMLCFLAGS) $(OCAMLCLIBS) \ + ../libvirt/mllibvirt.cma -o $@ $^ + +mlvirsh.opt: $(XOBJS) + $(OCAMLOPT) \ + $(OCAMLOPTINCS) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \ + ../libvirt/mllibvirt.cmxa -o $@ $^ +endif + +install: + if [ -x mlvirsh.opt ]; then \ + mkdir -p $(DESTDIR)$(bindir); \ + $(INSTALL) -m 0755 mlvirsh.opt $(DESTDIR)$(bindir)/mlvirsh; \ + fi + +include ../Make.rules diff --git a/mlvirsh/mlvirsh.ml b/mlvirsh/mlvirsh.ml new file mode 100644 index 0000000..ba4860f --- /dev/null +++ b/mlvirsh/mlvirsh.ml @@ -0,0 +1,770 @@ +(* virsh-like command line tool. + (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc. + http://libvirt.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*) + +open Printf +open Mlvirsh_gettext.Gettext + +module C = Libvirt.Connect +module D = Libvirt.Domain +module N = Libvirt.Network + +(* Program name. *) +let program_name = Filename.basename Sys.executable_name + +(* Parse arguments. *) +let name = ref "" +let readonly = ref false + +let argspec = Arg.align [ + "-c", Arg.Set_string name, "URI " ^ s_ "Hypervisor connection URI"; + "-r", Arg.Set readonly, " " ^ s_ "Read-only connection"; +] + +let usage_msg = + sprintf (f_ "Synopsis: + %s [options] [command] + +List of all commands: + %s help + +Full description of a single command: + %s help command + +Options:") + program_name program_name program_name + +let add_extra_arg, get_extra_args = + let extra_args = ref [] in + let add_extra_arg s = extra_args := s :: !extra_args in + let get_extra_args () = List.rev !extra_args in + add_extra_arg, get_extra_args + +let () = Arg.parse argspec add_extra_arg usage_msg + +let name = match !name with "" -> None | name -> Some name +let readonly = !readonly +let extra_args = get_extra_args () + +(* Read a whole file into memory and return it (as a string). *) +let rec input_file filename = + let chan = open_in_bin filename in + let data = input_all chan in + close_in chan; + data +and input_all chan = + let buf = Buffer.create 16384 in + let tmpsize = 16384 in + let tmp = String.create tmpsize in + let n = ref 0 in + while n := input chan tmp 0 tmpsize; !n > 0 do + Buffer.add_substring buf tmp 0 !n; + done; + Buffer.contents buf + +(* Split a string at a separator. + * Functions copied from extlib Copyright (C) 2003 Nicolas Cannasse et al. + * to avoid the explicit dependency on extlib. + *) +let str_find str sub = + let sublen = String.length sub in + if sublen = 0 then + 0 + else + let found = ref 0 in + let len = String.length str in + try + for i = 0 to len - sublen do + let j = ref 0 in + while String.unsafe_get str (i + !j) = String.unsafe_get sub !j do + incr j; + if !j = sublen then begin found := i; raise Exit; end; + done; + done; + raise Not_found + with + Exit -> !found + +let str_split str sep = + let p = str_find str sep in + let len = String.length sep in + let slen = String.length str in + String.sub str 0 p, String.sub str (p + len) (slen - p - len) + +let str_nsplit str sep = + if str = "" then [] + else ( + let rec nsplit str sep = + try + let s1 , s2 = str_split str sep in + s1 :: nsplit s2 sep + with + Not_found -> [str] + in + nsplit str sep + ) + +(* Hypervisor connection. *) +type conn_t = No_connection | RO of Libvirt.ro C.t | RW of Libvirt.rw C.t +let conn = ref No_connection + +let close_connection () = + match !conn with + | No_connection -> () + | RO c -> + C.close c; + conn := No_connection + | RW c -> + C.close c; + conn := No_connection + +let do_command = + (* Command helper functions. + * + * Each cmd is a function that constructs a command. + * string string string ... <--- user types on the command line + * | | | + * arg1 arg2 arg3 ... <--- conversion functions + * | | | + * V V V + * function f <--- work function + * | + * V + * print result <--- printing function + * + * (Note that cmd function constructs and returns the above + * function, it isn't the function itself.) + * + * Example: If the function takes one parameter (an int) and + * returns a string to be printed, you would use: + * + * cmd1 print_endline f int_of_string + *) + let cmd0 print fn = function (* Command with no args. *) + | [] -> print (fn ()) + | _ -> failwith (s_ "incorrect number of arguments for function") + in + let cmd1 print fn arg1 = function (* Command with one arg. *) + | [str1] -> print (fn (arg1 str1)) + | _ -> failwith (s_ "incorrect number of arguments for function") + in + let cmd2 print fn arg1 arg2 = function (* Command with 2 args. *) + | [str1; str2] -> print (fn (arg1 str1) (arg2 str2)) + | _ -> failwith (s_ "incorrect number of arguments for function") + in + let cmd3 print fn arg1 arg2 arg3 = function (* Command with 3 args. *) + | [str1; str2; str3] -> print (fn (arg1 str1) (arg2 str2) (arg3 str3)) + | _ -> failwith (s_ "incorrect number of arguments for function") + in + let cmd01 print fn arg1 = function (* Command with 0 or 1 arg. *) + | [] -> print (fn None) + | [str1] -> print (fn (Some (arg1 str1))) + | _ -> failwith (s_ "incorrect number of arguments for function") + in + let cmd12 print fn arg1 arg2 = function (* Command with 1 or 2 args. *) + | [str1] -> print (fn (arg1 str1) None) + | [str1; str2] -> print (fn (arg1 str1) (Some (arg2 str2))) + | _ -> failwith (s_ "incorrect number of arguments for function") + in + let cmd012 print fn arg1 arg2 = function (* Command with 0, 1 or 2 args. *) + | [] -> print (fn None None) + | [str1] -> print (fn (Some (arg1 str1)) None) + | [str1; str2] -> print (fn (Some (arg1 str1)) (Some (arg2 str2))) + | _ -> failwith (s_ "incorrect number of arguments for function") + in + let cmdN print fn = (* Command with any number of args. *) + fun args -> print (fn args) + in + + (* Get the connection or fail if we don't have one. *) + let rec get_full_connection () = + match !conn with + | No_connection -> failwith (s_ "not connected to the hypervisor") + | RO _ -> failwith (s_ "tried to do read-write operation on read-only hypervisor connection") + | RW conn -> conn + and get_readonly_connection () = + match !conn with + | No_connection -> failwith (s_ "not connected to the hypervisor") + | RO conn -> conn + | RW conn -> C.const conn +(* + and with_full_connection fn = + fun () -> fn (get_full_connection ()) +*) + and with_readonly_connection fn = + fun () -> fn (get_readonly_connection ()) + and arg_full_connection fn = + fun str -> fn (get_full_connection ()) str + and arg_readonly_connection fn = + fun str -> fn (get_readonly_connection ()) str + in + + (* Parsing of command arguments. *) + let string_of_readonly = function + | "readonly" | "read-only" | "ro" -> true + | _ -> failwith (sprintf (f_ "flag should be '%s'") "readonly") + in + let string_of_string (str : string) = str in + let boolean_of_string = function + | "enable" | "enabled" | "on" | "1" | "true" -> true + | "disable" | "disabled" | "off" | "0" | "false" -> false + | _ -> failwith (sprintf (f_ "setting should be '%s' or '%s'") "on" "off") + in + let domain_of_string conn str = + try + (try + let id = int_of_string str in + D.lookup_by_id conn id + with + Failure "int_of_string" -> + if String.length str = Libvirt.uuid_string_length then + D.lookup_by_uuid_string conn str + else + D.lookup_by_name conn str + ) + with + Libvirt.Virterror err -> + failwith (sprintf (f_ "domain %s: not found. Additional info: %s") + str (Libvirt.Virterror.to_string err)); + in + let network_of_string conn str = + try + if String.length str = Libvirt.uuid_string_length then + N.lookup_by_uuid_string conn str + else + N.lookup_by_name conn str + with + Libvirt.Virterror err -> + failwith (sprintf (f_ "network %s: not found. Additional info: %s") + str (Libvirt.Virterror.to_string err)); + in + let rec parse_sched_params = function + | [] -> [] + | [_] -> failwith (s_ "expected field value pairs, but got an odd number of arguments") + | field :: value :: rest -> + (* XXX We only support the UINT type at the moment. *) + (field, D.SchedFieldUInt32 (Int32.of_string value)) + :: parse_sched_params rest + in + let cpumap_of_string str = + let c = get_readonly_connection () in + let info = C.get_node_info c in + let cpumap = + String.make (C.cpumaplen (C.maxcpus_of_node_info info)) '\000' in + List.iter (C.use_cpu cpumap) + (List.map int_of_string (str_nsplit str ",")); + cpumap + in + + (* Printing of command results. *) + let no_return _ = () in + let print_int i = print_endline (string_of_int i) in + let print_int64 i = print_endline (Int64.to_string i) in + let print_int64_array a = Array.iter print_int64 a in + let print_bool b = print_endline (string_of_bool b) in + let print_version v = + let major = v / 1000000 in + let minor = (v - major * 1000000) / 1000 in + let release = (v - major * 1000000 - minor * 1000) in + printf "%d.%d.%d\n" major minor release + in + let string_of_domain_state = function + | D.InfoNoState -> s_ "unknown" + | D.InfoRunning -> s_ "running" + | D.InfoBlocked -> s_ "blocked" + | D.InfoPaused -> s_ "paused" + | D.InfoShutdown -> s_ "shutdown" + | D.InfoShutoff -> s_ "shutoff" + | D.InfoCrashed -> s_ "crashed" + in + let string_of_vcpu_state = function + | D.VcpuOffline -> s_ "offline" + | D.VcpuRunning -> s_ "running" + | D.VcpuBlocked -> s_ "blocked" + in + let print_domain_array doms = + Array.iter ( + fun dom -> + let id = + try sprintf "%d" (D.get_id dom) + with Libvirt.Virterror _ -> "" in + let name = + try sprintf "%s" (D.get_name dom) + with Libvirt.Virterror _ -> "" in + let state = + try + let { D.state = state } = D.get_info dom in + string_of_domain_state state + with Libvirt.Virterror _ -> "" in + printf "%5s %-30s %s\n" id name state + ) doms + in + let print_network_array nets = + Array.iter ( + fun net -> + printf "%s\n" (N.get_name net) + ) nets + in + let print_node_info info = + let () = printf (f_ "model: %s\n") info.C.model in + let () = printf (f_ "memory: %Ld K\n") info.C.memory in + let () = printf (f_ "cpus: %d\n") info.C.cpus in + let () = printf (f_ "mhz: %d\n") info.C.mhz in + let () = printf (f_ "nodes: %d\n") info.C.nodes in + let () = printf (f_ "sockets: %d\n") info.C.sockets in + let () = printf (f_ "cores: %d\n") info.C.cores in + let () = printf (f_ "threads: %d\n") info.C.threads in + () + in + let print_domain_state { D.state = state } = + print_endline (string_of_domain_state state) + in + let print_domain_info info = + let () = printf (f_ "state: %s\n") (string_of_domain_state info.D.state) in + let () = printf (f_ "max_mem: %Ld K\n") info.D.max_mem in + let () = printf (f_ "memory: %Ld K\n") info.D.memory in + let () = printf (f_ "nr_virt_cpu: %d\n") info.D.nr_virt_cpu in + let () = printf (f_ "cpu_time: %Ld ns\n") info.D.cpu_time in + () + in + let print_sched_param_array params = + Array.iter ( + fun (name, value) -> + printf "%-20s" name; + match value with + | D.SchedFieldInt32 i -> printf " %ld\n" i + | D.SchedFieldUInt32 i -> printf " %lu\n" i + | D.SchedFieldInt64 i -> printf " %Ld\n" i + | D.SchedFieldUInt64 i -> printf " %Lu\n" i + | D.SchedFieldFloat f -> printf " %g\n" f + | D.SchedFieldBool b -> printf " %b\n" b + ) params + in + let print_vcpu_info (ncpus, vcpu_infos, cpumaps, maplen, maxcpus) = + for n = 0 to ncpus-1 do + let () = printf (f_ "virtual CPU: %d\n") n in + let () = printf (f_ "\ton physical CPU: %d\n") vcpu_infos.(n).D.cpu in + let () = printf (f_ "\tcurrent state: %s\n") + (string_of_vcpu_state vcpu_infos.(n).D.vcpu_state) in + let () = printf (f_ "\tCPU time: %Ld ns\n") vcpu_infos.(n).D.vcpu_time in + print_string ("\t" ^ s_ "CPU affinity" ^ ": "); + for m = 0 to maxcpus-1 do + print_char (if C.cpu_usable cpumaps maplen n m then 'y' else '-') + done; + print_endline ""; + done + in + let print_block_stats { D.rd_req = rd_req; rd_bytes = rd_bytes; + wr_req = wr_req; wr_bytes = wr_bytes; + errs = errs } = + if rd_req >= 0L then printf (f_ "read requests: %Ld\n") rd_req; + if rd_bytes >= 0L then printf (f_ "read bytes: %Ld\n") rd_bytes; + if wr_req >= 0L then printf (f_ "write requests: %Ld\n") wr_req; + if wr_bytes >= 0L then printf (f_ "write bytes: %Ld\n") wr_bytes; + if errs >= 0L then printf (f_ "errors: %Ld\n") errs; + and print_interface_stats { D.rx_bytes = rx_bytes; rx_packets = rx_packets; + rx_errs = rx_errs; rx_drop = rx_drop; + tx_bytes = tx_bytes; tx_packets = tx_packets; + tx_errs = tx_errs; tx_drop = tx_drop } = + if rx_bytes >= 0L then printf (f_ "rx bytes: %Ld\n") rx_bytes; + if rx_packets >= 0L then printf (f_ "rx packets: %Ld\n") rx_packets; + if rx_errs >= 0L then printf (f_ "rx errs: %Ld\n") rx_errs; + if rx_drop >= 0L then printf (f_ "rx dropped: %Ld\n") rx_drop; + if tx_bytes >= 0L then printf (f_ "tx bytes: %Ld\n") tx_bytes; + if tx_packets >= 0L then printf (f_ "tx packets: %Ld\n") tx_packets; + if tx_errs >= 0L then printf (f_ "tx errs: %Ld\n") tx_errs; + if tx_drop >= 0L then printf (f_ "tx dropped: %Ld\n") tx_drop; + in + + (* List of commands. *) + let commands = [ + "attach-device", + cmd2 no_return D.attach_device + (arg_full_connection domain_of_string) input_file, + s_ "Attach device to domain."; + "autostart", + cmd2 no_return D.set_autostart + (arg_full_connection domain_of_string) boolean_of_string, + s_ "Set whether a domain autostarts at boot."; + "capabilities", + cmd0 print_endline (with_readonly_connection C.get_capabilities), + s_ "Returns capabilities of hypervisor/driver."; + "close", + cmd0 no_return close_connection, + s_ "Close an existing hypervisor connection."; + "connect", + cmd12 no_return + (fun name readonly -> + close_connection (); + match readonly with + | None | Some false -> conn := RW (C.connect ~name ()) + | Some true -> conn := RO (C.connect_readonly ~name ()) + ) string_of_string string_of_readonly, + s_ "Open a new hypervisor connection."; + "create", + cmd1 no_return + (fun xml -> D.create_linux (get_full_connection ()) xml) input_file, + s_ "Create a domain from an XML file."; + "define", + cmd1 no_return + (fun xml -> D.define_xml (get_full_connection ()) xml) input_file, + s_ "Define (but don't start) a domain from an XML file."; + "detach-device", + cmd2 no_return D.detach_device + (arg_full_connection domain_of_string) input_file, + s_ "Detach device from domain."; + "destroy", + cmd1 no_return D.destroy (arg_full_connection domain_of_string), + s_ "Destroy a domain."; + "domblkstat", + cmd2 print_block_stats D.block_stats + (arg_readonly_connection domain_of_string) string_of_string, + s_ "Display the block device statistics for a domain."; + "domid", + cmd1 print_int D.get_id (arg_readonly_connection domain_of_string), + s_ "Print the ID of a domain."; + "domifstat", + cmd2 print_interface_stats D.interface_stats + (arg_readonly_connection domain_of_string) string_of_string, + s_ "Display the network interface statistics for a domain."; + "dominfo", + cmd1 print_domain_info D.get_info + (arg_readonly_connection domain_of_string), + s_ "Print the domain info."; + "dommaxmem", + cmd1 print_int64 D.get_max_memory + (arg_readonly_connection domain_of_string), + s_ "Print the max memory (in kilobytes) of a domain."; + "dommaxvcpus", + cmd1 print_int D.get_max_vcpus + (arg_readonly_connection domain_of_string), + s_ "Print the max VCPUs of a domain."; + "domname", + cmd1 print_endline D.get_name + (arg_readonly_connection domain_of_string), + s_ "Print the name of a domain."; + "domostype", + cmd1 print_endline D.get_os_type + (arg_readonly_connection domain_of_string), + s_ "Print the OS type of a domain."; + "domstate", + cmd1 print_domain_state D.get_info + (arg_readonly_connection domain_of_string), + s_ "Print the domain state."; + "domuuid", + cmd1 print_endline D.get_uuid_string + (arg_readonly_connection domain_of_string), + s_ "Print the UUID of a domain."; + "dump", + cmd2 no_return D.core_dump + (arg_full_connection domain_of_string) string_of_string, + s_ "Core dump a domain to a file for analysis."; + "dumpxml", + cmd1 print_endline D.get_xml_desc + (arg_full_connection domain_of_string), + s_ "Print the XML description of a domain."; + "freecell", + cmd012 print_int64_array ( + fun start max -> + let conn = get_readonly_connection () in + match start, max with + | None, _ -> + [| C.node_get_free_memory conn |] + | Some start, None -> + C.node_get_cells_free_memory conn start 1 + | Some start, Some max -> + C.node_get_cells_free_memory conn start max + ) int_of_string int_of_string, + s_ "Display free memory for machine, NUMA cell or range of cells"; + "get-autostart", + cmd1 print_bool D.get_autostart + (arg_readonly_connection domain_of_string), + s_ "Print whether a domain autostarts at boot."; + "hostname", + cmd0 print_endline (with_readonly_connection C.get_hostname), + s_ "Print the hostname."; + "list", + cmd0 print_domain_array + (fun () -> + let c = get_readonly_connection () in + let n = C.num_of_domains c in + let domids = C.list_domains c n in + Array.map (D.lookup_by_id c) domids), + s_ "List the running domains."; + "list-defined", + cmd0 print_domain_array + (fun () -> + let c = get_readonly_connection () in + let n = C.num_of_defined_domains c in + let domnames = C.list_defined_domains c n in + Array.map (D.lookup_by_name c) domnames), + s_ "List the defined but not running domains."; + "quit", + cmd0 no_return (fun () -> exit 0), + s_ "Quit the interactive terminal."; + "maxvcpus", + cmd0 print_int (fun () -> C.get_max_vcpus (get_readonly_connection ()) ()), + s_ "Print the max VCPUs available."; + "net-autostart", + cmd2 no_return N.set_autostart + (arg_full_connection network_of_string) boolean_of_string, + s_ "Set whether a network autostarts at boot."; + "net-bridgename", + cmd1 print_endline N.get_bridge_name + (arg_readonly_connection network_of_string), + s_ "Print the bridge name of a network."; + "net-create", + cmd1 no_return + (fun xml -> N.create_xml (get_full_connection ()) xml) input_file, + s_ "Create a network from an XML file."; + "net-define", + cmd1 no_return + (fun xml -> N.define_xml (get_full_connection ()) xml) input_file, + s_ "Define (but don't start) a network from an XML file."; + "net-destroy", + cmd1 no_return N.destroy (arg_full_connection network_of_string), + s_ "Destroy a network."; + "net-dumpxml", + cmd1 print_endline N.get_xml_desc + (arg_full_connection network_of_string), + s_ "Print the XML description of a network."; + "net-get-autostart", + cmd1 print_bool N.get_autostart + (arg_full_connection network_of_string), + s_ "Print whether a network autostarts at boot."; + "net-list", + cmd0 print_network_array + (fun () -> + let c = get_readonly_connection () in + let n = C.num_of_networks c in + let nets = C.list_networks c n in + Array.map (N.lookup_by_name c) nets), + s_ "List the active networks."; + "net-list-defined", + cmd0 print_network_array + (fun () -> + let c = get_readonly_connection () in + let n = C.num_of_defined_networks c in + let nets = C.list_defined_networks c n in + Array.map (N.lookup_by_name c) nets), + s_ "List the defined but inactive networks."; + "net-name", + cmd1 print_endline N.get_name + (arg_readonly_connection network_of_string), + s_ "Print the name of a network."; + "net-start", + cmd1 no_return N.create + (arg_full_connection network_of_string), + s_ "Start a previously defined inactive network."; + "net-undefine", + cmd1 no_return N.undefine + (arg_full_connection network_of_string), + s_ "Undefine an inactive network."; + "net-uuid", + cmd1 print_endline N.get_uuid_string + (arg_readonly_connection network_of_string), + s_ "Print the UUID of a network."; + "nodeinfo", + cmd0 print_node_info (with_readonly_connection C.get_node_info), + s_ "Print node information."; + "reboot", + cmd1 no_return D.reboot (arg_full_connection domain_of_string), + s_ "Reboot a domain."; + "restore", + cmd1 no_return ( + fun path -> D.restore (get_full_connection ()) path + ) string_of_string, + s_ "Restore a domain from the named file."; + "resume", + cmd1 no_return D.resume (arg_full_connection domain_of_string), + s_ "Resume a domain."; + "save", + cmd2 no_return D.save + (arg_full_connection domain_of_string) string_of_string, + s_ "Save a domain to a file."; + "schedparams", + cmd1 print_sched_param_array ( + fun dom -> + let n = snd (D.get_scheduler_type dom) in + D.get_scheduler_parameters dom n + ) (arg_readonly_connection domain_of_string), + s_ "Get the current scheduler parameters for a domain."; + "schedparamset", + cmdN no_return ( + function + | [] -> failwith (s_ "expecting domain followed by field value pairs") + | dom :: pairs -> + let conn = get_full_connection () in + let dom = domain_of_string conn dom in + let params = parse_sched_params pairs in + let params = Array.of_list params in + D.set_scheduler_parameters dom params + ), + s_ "Set the scheduler parameters for a domain."; + "schedtype", + cmd1 print_endline + (fun dom -> fst (D.get_scheduler_type dom)) + (arg_readonly_connection domain_of_string), + s_ "Get the scheduler type."; + "setmem", + cmd2 no_return D.set_memory + (arg_full_connection domain_of_string) Int64.of_string, + s_ "Set the memory used by the domain (in kilobytes)."; + "setmaxmem", + cmd2 no_return D.set_max_memory + (arg_full_connection domain_of_string) Int64.of_string, + s_ "Set the maximum memory used by the domain (in kilobytes)."; + "shutdown", + cmd1 no_return D.shutdown + (arg_full_connection domain_of_string), + s_ "Gracefully shutdown a domain."; + "start", + cmd1 no_return D.create + (arg_full_connection domain_of_string), + s_ "Start a previously defined inactive domain."; + "suspend", + cmd1 no_return D.suspend + (arg_full_connection domain_of_string), + s_ "Suspend a domain."; + "type", + cmd0 print_endline (with_readonly_connection C.get_type), + s_ "Print the driver name"; + "undefine", + cmd1 no_return D.undefine + (arg_full_connection domain_of_string), + s_ "Undefine an inactive domain."; + "uri", + cmd0 print_endline (with_readonly_connection C.get_uri), + s_ "Print the canonical URI."; + "vcpuinfo", + cmd1 print_vcpu_info ( + fun dom -> + let c = get_readonly_connection () in + let info = C.get_node_info c in + let dominfo = D.get_info dom in + let maxcpus = C.maxcpus_of_node_info info in + let maplen = C.cpumaplen maxcpus in + let maxinfo = dominfo.D.nr_virt_cpu in + let ncpus, vcpu_infos, cpumaps = D.get_vcpus dom maxinfo maplen in + ncpus, vcpu_infos, cpumaps, maplen, maxcpus + ) (arg_readonly_connection domain_of_string), + s_ "Pin domain VCPU to a list of physical CPUs."; + "vcpupin", + cmd3 no_return D.pin_vcpu + (arg_full_connection domain_of_string) int_of_string cpumap_of_string, + s_ "Pin domain VCPU to a list of physical CPUs."; + "vcpus", + cmd2 no_return D.set_vcpus + (arg_full_connection domain_of_string) int_of_string, + s_ "Set the number of virtual CPUs assigned to a domain."; + "version", + cmd0 print_version (with_readonly_connection C.get_version), + s_ "Print the driver version"; + ] in + + (* Command help. *) + let help = function + | None -> (* List of commands. *) + String.concat "\n" ( + List.map ( + fun (cmd, _, description) -> + sprintf "%-12s %s" cmd description + ) commands + ) ^ + "\n\n" ^ + (sprintf (f_ "Use '%s help command' for help on a command.") + program_name) + + | Some command -> (* Full description of one command. *) + try + let (command, _, description) = + List.find (fun (c, _, _) -> c = command) commands in + sprintf "%s %s\n\n%s" program_name command description + with + Not_found -> + failwith (sprintf (f_ "help: %s: command not found") command); + in + + let commands = + ("help", + cmd01 print_endline help string_of_string, + s_ "Print list of commands or full description of one command."; + ) :: commands in + + (* Execute a command. *) + let do_command command args = + try + let (_, cmd, _) = List.find (fun (c, _, _) -> c = command) commands in + cmd args + with + Not_found -> + failwith (sprintf (f_ "%s: command not found") command); + in + + do_command + +(* Interactive mode. *) +let rec interactive_mode () = + let prompt = + match !conn with + | No_connection -> s_ "mlvirsh(no connection)" ^ "$ " + | RO _ -> s_ "mlvirsh(ro)" ^ "$ " + | RW _ -> s_ "mlvirsh" ^ "# " in + print_string prompt; + let command = read_line () in + (match str_nsplit command " " with + | [] -> () + | command :: args -> + do_command command args + ); + Gc.full_major (); (* Free up all unreachable domain and network objects. *) + interactive_mode () + +(* Connect to hypervisor. Allow the connection to fail. *) +let () = + conn := + try + if readonly then RO (C.connect_readonly ?name ()) + else RW (C.connect ?name ()) + with + Libvirt.Virterror err -> + eprintf "%s: %s\n" program_name (Libvirt.Virterror.to_string err); + No_connection + +let () = + try + (* Execute the command on the command line, if there was one. + * Otherwise go into interactive mode. + *) + (match extra_args with + | command :: args -> + do_command command args + | [] -> + try interactive_mode () with End_of_file -> () + ); + + (* If we are connected to a hypervisor, close the connection. *) + close_connection (); + + (* A good way to find heap bugs: *) + Gc.compact () + with + | Libvirt.Virterror err -> + eprintf "%s: %s\n" program_name (Libvirt.Virterror.to_string err) + | Failure msg -> + eprintf "%s: %s\n" program_name msg diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..ffff11a --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,2 @@ +ja +pl diff --git a/po/Makefile.in b/po/Makefile.in new file mode 100644 index 0000000..9398e2f --- /dev/null +++ b/po/Makefile.in @@ -0,0 +1,79 @@ +# Makefile for po subdirectory. +# @configure_input@ +# +# Copyright (C) 2007-2008 Red Hat Inc. +# Written by Richard W.M. Jones +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +OCAML_GETTEXT_PACKAGE = virt-top +LINGUAS = $(shell cat LINGUAS) +SOURCES = POTFILES + +OCAML_GETTEXT = @OCAML_GETTEXT@ +OCAML_GETTEXT_EXTRACT_OPTIONS = +OCAML_GETTEXT_COMPILE_OPTIONS = +OCAML_GETTEXT_INSTALL_OPTIONS = +OCAML_GETTEXT_MERGE_OPTIONS = + +PODIR = @prefix@/share/locale + +POFILES = $(addsuffix .po,$(LINGUAS)) +MOFILES = $(addsuffix .mo,$(LINGUAS)) +POTFILE = $(OCAML_GETTEXT_PACKAGE).pot + +all: $(MOFILES) $(POTFILE) + +install: install-po + +uninstall: uninstall-po + +clean:: clean-po + +%.mo: %.po + $(OCAML_GETTEXT) --action compile $(OCAML_GETTEXT_COMPILE_OPTIONS) \ + --compile-output $@ $^ + +%.pot: $(SOURCES) $(shell cat $(SOURCES)) + $(OCAML_GETTEXT) --action extract $(OCAML_GETTEXT_EXTRACT_OPTIONS) \ + --extract-pot $@ $< + +# Also includes a fix for incorrectly escaped multi-byte sequences. +%.po: $(POTFILE) + $(OCAML_GETTEXT) --action merge $(OCAML_GETTEXT_MERGE_OPTIONS) \ + --merge-pot $(POTFILE) $@ + mv $@ $@.orig + perl -wpe 's/\\(\d{3})/pack "C*", $$1/ge' < $@.orig > $@ + +$(BUILDPO): + mkdir -p $(BUILDPO) + +.PRECIOUS: $(POTFILE) + +install-po: $(MOFILES) + $(OCAML_GETTEXT) --action install $(OCAML_GETTEXT_INSTALL_OPTIONS) \ + --install-textdomain $(OCAML_GETTEXT_PACKAGE) \ + --install-destdir $(PODIR) $(MOFILES) + +uninstall-po: + $(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \ + --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \ + --uninstall-orgdir $(PODIR) $(MOFILES) + +clean-po: + -$(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \ + --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \ + --uninstall-orgdir $(BUILDPO) $(MOFILES) + -$(RM) $(MOFILES) diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 0000000..938a847 --- /dev/null +++ b/po/POTFILES @@ -0,0 +1,22 @@ +../mlvirsh/mlvirsh.ml +../virt-ctrl/mingw-gcc-wrapper.ml +../virt-ctrl/vc_connection_dlg.ml +../virt-ctrl/vc_connections.ml +../virt-ctrl/vc_dbus.ml +../virt-ctrl/vc_domain_ops.ml +../virt-ctrl/vc_helpers.ml +../virt-ctrl/vc_icons.ml +../virt-ctrl/vc_mainwindow.ml +../virt-ctrl/virt_ctrl.ml +../virt-df/virt_df_ext2.ml +../virt-df/virt_df_linux_swap.ml +../virt-df/virt_df_lvm2.ml +../virt-df/virt_df_main.ml +../virt-df/virt_df.ml +../virt-top/virt_top_calendar1.ml +../virt-top/virt_top_calendar2.ml +../virt-top/virt_top_csv.ml +../virt-top/virt_top_main.ml +../virt-top/virt_top.ml +../virt-top/virt_top_utils.ml +../virt-top/virt_top_xml.ml diff --git a/po/ja.po b/po/ja.po new file mode 100644 index 0000000..ebef7a4 --- /dev/null +++ b/po/ja.po @@ -0,0 +1,1017 @@ +msgid "" +msgstr "" +"Project-Id-Version: virt-p2v--devel\n" +"Report-Msgid-Bugs-To: rjones@redhat.com\n" +"POT-Creation-Date: 2008-03-22 15:53+0000\n" +"PO-Revision-Date: 2008-03-28 17:00+0000\n" +"Last-Translator: Naoko - \n" +"Language-Team: Japanese\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: ../virt-top/virt_top.ml:1490 +msgid "# .virt-toprc virt-top configuration file\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:1508 +msgid "# Enable CSV output to the named file\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:1511 +msgid "# To protect this file from being overwritten, uncomment next line\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:1505 +msgid "# To send debug and error messages to a file, uncomment next line\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:1491 +msgid "# generated on %s by %s\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:63 +msgid "%CPU" +msgstr "" + +#: ../virt-top/virt_top.ml:64 +msgid "%MEM" +msgstr "" + +#: ../virt-top/virt_top.ml:1144 +msgid "%d domains, %d active, %d running, %d sleeping, %d paused, %d inactive D:%d O:%d X:%d" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:716 +msgid "%s: command not found" +msgstr "" + +#: ../virt-top/virt_top.ml:105 +msgid "%s: display should be %s" +msgstr "" + +#: ../virt-top/virt_top.ml:82 +msgid "%s: sort order should be: %s" +msgstr "" + +#: ../virt-top/virt_top.ml:202 ../virt-df/virt_df.ml:362 +msgid "%s: unknown parameter" +msgstr "" + +#: ../virt-top/virt_top.ml:233 +msgid "%s:%d: configuration item ``%s'' ignored\\n%!" +msgstr "" + +#: ../virt-df/virt_df.ml:514 +msgid "(device omitted)" +msgstr "" + +#: ../virt-top/virt_top.ml:145 +msgid "-d: cannot set a negative delay" +msgstr "" + +#: ../virt-df/virt_df.ml:498 +msgid "1K-blocks" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:97 +msgid "About ..." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:399 +msgid "Attach device to domain." +msgstr "" + +#: ../virt-df/virt_df.ml:498 ../virt-df/virt_df.ml:499 +msgid "Available" +msgstr "" + +#: ../virt-top/virt_top.ml:167 +msgid "Batch mode" +msgstr "" + +#: ../virt-top/virt_top.ml:70 +msgid "Block read reqs" +msgstr "" + +#: ../virt-top/virt_top.ml:71 +msgid "Block write reqs" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:408 +msgid "CPU" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:365 +msgid "CPU affinity" +msgstr "" + +#: ../virt-top/virt_top.ml:1151 +msgid "CPU: %2.1f%% Mem: %Ld MB (%Ld MB by guests)" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:182 +msgid "Cancel" +msgstr "" + +#: ../virt-top/virt_top.ml:1319 +msgid "Change delay from %.1f to: " +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:409 +msgid "Close an existing hypervisor connection." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:118 +msgid "Connect ..." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:160 +msgid "Connect to ..." +msgstr "" + +#: ../virt-top/virt_top.ml:169 ../virt-top/virt_top.ml:171 ../virt-df/virt_df.ml:346 ../virt-df/virt_df.ml:348 +msgid "Connect to URI (default: Xen)" +msgstr "" + +#: ../virt-top/virt_top.ml:1558 +msgid "Connect: %s; Hostname: %s" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:476 +msgid "Core dump a domain to a file for analysis." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:422 +msgid "Create a domain from an XML file." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:534 +msgid "Create a network from an XML file." +msgstr "" + +#: ../virt-top/virt_top.ml:1596 +msgid "DISPLAY MODES" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:426 +msgid "Define (but don't start) a domain from an XML file." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:538 +msgid "Define (but don't start) a network from an XML file." +msgstr "" + +#: ../virt-top/virt_top.ml:1326 +msgid "Delay must be > 0" +msgstr "" + +#: ../virt-top/virt_top.ml:181 +msgid "Delay time interval (seconds)" +msgstr "" + +#: ../virt-top/virt_top.ml:1552 +msgid "Delay: %.1f secs; Batch: %s; Secure: %s; Sort: %s" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:433 +msgid "Destroy a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:541 +msgid "Destroy a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:430 +msgid "Detach device from domain." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:123 +msgid "Details" +msgstr "" + +#: ../virt-top/virt_top.ml:175 +msgid "Disable CPU stats in CSV" +msgstr "" + +#: ../virt-top/virt_top.ml:177 +msgid "Disable block device stats in CSV" +msgstr "" + +#: ../virt-top/virt_top.ml:179 +msgid "Disable net stats in CSV" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:493 +msgid "Display free memory for machine, NUMA cell or range of cells" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:437 +msgid "Display the block device statistics for a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:444 +msgid "Display the network interface statistics for a domain." +msgstr "" + +#: ../virt-df/virt_df.ml:358 +msgid "Display version and exit" +msgstr "" + +#: ../virt-top/virt_top.ml:191 +msgid "Do not read init file" +msgstr "" + +#: ../virt-top/virt_top.ml:66 +msgid "Domain ID" +msgstr "" + +#: ../virt-top/virt_top.ml:67 +msgid "Domain name" +msgstr "" + +#: ../virt-top/virt_top.ml:1610 +msgid "Domains display" +msgstr "" + +#: ../virt-top/virt_top.ml:1528 ../virt-top/virt_top_main.ml:47 ../virt-ctrl/vc_mainwindow.ml:61 +msgid "Error" +msgstr "エラー" + +#: ../virt-top/virt_top.ml:185 +msgid "Exit at given time" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:79 +msgid "File" +msgstr "ファイル" + +#: ../virt-df/virt_df.ml:502 +msgid "Filesystem" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:606 +msgid "Get the current scheduler parameters for a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:623 +msgid "Get the scheduler type." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:635 +msgid "Gracefully shutdown a domain." +msgstr "" + +#: ../virt-top/virt_top.ml:1580 ../virt-ctrl/vc_mainwindow.ml:80 ../virt-ctrl/vc_mainwindow.ml:96 +msgid "Help" +msgstr "" + +#: ../virt-top/virt_top.ml:187 +msgid "Historical CPU delay" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:35 +msgid "Hypervisor connection URI" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:405 +msgid "ID" +msgstr "" + +#: ../virt-df/virt_df.ml:500 +msgid "IFree" +msgstr "" + +#: ../virt-df/virt_df.ml:500 +msgid "IUse" +msgstr "" + +#: ../virt-df/virt_df.ml:500 +msgid "Inodes" +msgstr "" + +#: ../virt-df/virt_df_lvm2.ml:33 +msgid "LVM2 not supported yet" +msgstr "" + +#: ../virt-df/virt_df_ext2.ml:82 +msgid "Linux ext2/3" +msgstr "" + +#: ../virt-df/virt_df_linux_swap.ml:33 +msgid "Linux swap" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:557 +msgid "List the active networks." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:565 +msgid "List the defined but inactive networks." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:516 +msgid "List the defined but not running domains." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:508 +msgid "List the running domains." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:158 +msgid "Local QEMU/KVM" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:157 +msgid "Local Xen" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:93 +msgid "Local network" +msgstr "" + +#: ../virt-top/virt_top.ml:173 +msgid "Log statistics to CSV file" +msgstr "" + +#: ../virt-top/virt_top.ml:1563 +msgid "MAIN KEYS" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:409 +msgid "Memory" +msgstr "" + +#: ../virt-top/virt_top.ml:1617 +msgid "More help in virt-top(1) man page. Press any key to return." +msgstr "" + +#: ../virt-top/virt_top.ml:258 ../virt-df/virt_df.ml:382 +msgid "NB: If you want to monitor a local Xen hypervisor, you usually need to be root" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:406 +msgid "Name" +msgstr "" + +#: ../virt-top/virt_top.ml:68 +msgid "Net RX bytes" +msgstr "" + +#: ../virt-top/virt_top.ml:69 +msgid "Net TX bytes" +msgstr "" + +#: ../virt-top/virt_top.ml:1332 +msgid "Not a valid number" +msgstr "" + +#: ../virt-top/virt_top.ml:193 +msgid "Number of iterations to run" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:137 ../virt-ctrl/vc_connection_dlg.ml:170 +msgid "Open" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:418 +msgid "Open a new hypervisor connection." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:86 +msgid "Open connection ..." +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:40 +msgid "Open connection to hypervisor" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:130 +msgid "Pause" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:666 ../mlvirsh/mlvirsh.ml:670 +msgid "Pin domain VCPU to a list of physical CPUs." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:706 +msgid "Print list of commands or full description of one command." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:584 +msgid "Print node information." +msgstr "" + +#: ../virt-df/virt_df.ml:350 ../virt-df/virt_df.ml:352 +msgid "Print sizes in human-readable format" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:440 +msgid "Print the ID of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:464 +msgid "Print the OS type of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:472 +msgid "Print the UUID of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:581 +msgid "Print the UUID of a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:480 +msgid "Print the XML description of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:545 +msgid "Print the XML description of a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:530 +msgid "Print the bridge name of a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:653 +msgid "Print the canonical URI." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:448 +msgid "Print the domain info." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:468 +msgid "Print the domain state." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:646 +msgid "Print the driver name" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:677 +msgid "Print the driver version" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:500 +msgid "Print the hostname." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:522 +msgid "Print the max VCPUs available." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:456 +msgid "Print the max VCPUs of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:452 +msgid "Print the max memory (in kilobytes) of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:460 +msgid "Print the name of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:569 +msgid "Print the name of a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:497 +msgid "Print whether a domain autostarts at boot." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:549 +msgid "Print whether a network autostarts at boot." +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:83 +msgid "QEMU or KVM" +msgstr "" + +#: ../virt-top/virt_top.ml:1578 ../virt-ctrl/vc_mainwindow.ml:89 +msgid "Quit" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:519 +msgid "Quit the interactive terminal." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:36 +msgid "Read-only connection" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:587 +msgid "Reboot a domain." +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:134 +msgid "Refresh" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:592 +msgid "Restore a domain from the named file." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:133 +msgid "Resume" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:595 +msgid "Resume a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:406 +msgid "Returns capabilities of hypervisor/driver." +msgstr "" + +#: ../virt-top/virt_top.ml:199 +msgid "Run from a script (no user interface)" +msgstr "" + +#: ../virt-top/virt_top.ml:1584 +msgid "SORTING" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:599 +msgid "Save a domain to a file." +msgstr "" + +#: ../virt-top/virt_top.ml:197 +msgid "Secure (\\\"kiosk\\\") mode" +msgstr "" + +#: ../virt-top/virt_top.ml:1593 +msgid "Select sort field" +msgstr "" + +#: ../virt-top/virt_top.ml:183 +msgid "Send debug messages to file" +msgstr "" + +#: ../virt-top/virt_top.ml:189 +msgid "Set name of init file" +msgstr "" + +#: ../virt-top/virt_top.ml:195 +msgid "Set sort order (%s)" +msgstr "" + +#: ../virt-top/virt_top.ml:1340 +msgid "Set sort order for main display" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:631 +msgid "Set the maximum memory used by the domain (in kilobytes)." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:627 +msgid "Set the memory used by the domain (in kilobytes)." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:674 +msgid "Set the number of virtual CPUs assigned to a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:618 +msgid "Set the scheduler parameters for a domain." +msgstr "" + +#: ../virt-top/virt_top.ml:1579 +msgid "Set update interval" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:403 +msgid "Set whether a domain autostarts at boot." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:526 +msgid "Set whether a network autostarts at boot." +msgstr "" + +#: ../virt-df/virt_df.ml:342 ../virt-df/virt_df.ml:344 +msgid "Show all domains (default: only active domains)" +msgstr "" + +#: ../virt-df/virt_df.ml:354 ../virt-df/virt_df.ml:356 +msgid "Show inodes instead of blocks" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:137 +msgid "Shutdown" +msgstr "" + +#: ../virt-df/virt_df.ml:499 +msgid "Size" +msgstr "" + +#: ../virt-top/virt_top.ml:1589 +msgid "Sort by %CPU" +msgstr "" + +#: ../virt-top/virt_top.ml:1590 +msgid "Sort by %MEM" +msgstr "" + +#: ../virt-top/virt_top.ml:1592 +msgid "Sort by ID" +msgstr "" + +#: ../virt-top/virt_top.ml:1591 +msgid "Sort by TIME" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:127 +msgid "Start" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:639 +msgid "Start a previously defined inactive domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:573 +msgid "Start a previously defined inactive network." +msgstr "" + +#: ../virt-top/virt_top.ml:165 +msgid "Start by displaying block devices" +msgstr "" + +#: ../virt-top/virt_top.ml:163 +msgid "Start by displaying network interfaces" +msgstr "" + +#: ../virt-top/virt_top.ml:161 +msgid "Start by displaying pCPUs (default: tasks)" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:407 +msgid "Status" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:643 +msgid "Suspend a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:40 +msgid "Synopsis:\n %s [options] [command]\n\nList of all commands:\n %s help\n\nFull description of a single command:\n %s help command\n\nOptions:" +msgstr "" + +#: ../virt-top/virt_top.ml:65 +msgid "TIME (CPU time)" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:62 +msgid "This machine" +msgstr "" + +#: ../virt-top/virt_top.ml:1613 +msgid "Toggle block devices" +msgstr "" + +#: ../virt-top/virt_top.ml:1612 +msgid "Toggle network interfaces" +msgstr "" + +#: ../virt-top/virt_top.ml:1611 +msgid "Toggle physical CPUs" +msgstr "" + +#: ../virt-df/virt_df.ml:502 +msgid "Type" +msgstr "" + +#: ../virt-top/virt_top.ml:1341 +msgid "Type key or use up and down cursor keys." +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:160 +msgid "URI connection" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:650 +msgid "Undefine an inactive domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:577 +msgid "Undefine an inactive network." +msgstr "" + +#: ../virt-top/virt_top.ml:1622 +msgid "Unknown command - try 'h' for help" +msgstr "" + +#: ../virt-top/virt_top.ml:1577 +msgid "Update display" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:690 +msgid "Use '%s help command' for help on a command." +msgstr "" + +#: ../virt-df/virt_df.ml:498 ../virt-df/virt_df.ml:499 +msgid "Used" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:23 +msgid "Virtual Control" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:53 +msgid "Virtualisation error" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:39 +msgid "Virtualization control tool (virt-ctrl) by\nRichard W.M. Jones (rjones@redhat.com).\n\nCopyright %s 2007-2008 Red Hat Inc.\n\nLibvirt version: %s\n\nGtk toolkit version: %s" +msgstr "" + +#: ../virt-top/virt_top.ml:1523 +msgid "Wrote settings to %s" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:76 +msgid "Xen hypervisor" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:364 +msgid "\\tCPU time: %Ld ns\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:362 +msgid "\\tcurrent state: %s\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:361 +msgid "\\ton physical CPU: %d\\n" +msgstr "" + +#: ../virt-ctrl/vc_helpers.ml:54 ../mlvirsh/mlvirsh.ml:289 ../mlvirsh/mlvirsh.ml:298 +msgid "blocked" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:330 +msgid "cores: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:342 +msgid "cpu_time: %Ld ns\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:326 +msgid "cpus: %d\\n" +msgstr "" + +#: ../virt-ctrl/vc_helpers.ml:58 ../mlvirsh/mlvirsh.ml:293 +msgid "crashed" +msgstr "" + +#: ../virt-df/virt_df.ml:236 +msgid "detection of unpartitioned devices not yet supported" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:242 +msgid "domain %s: not found. Additional info: %s" +msgstr "" + +#: ../virt-df/virt_df_ext2.ml:39 +msgid "error reading ext2/ext3 magic" +msgstr "" + +#: ../virt-df/virt_df.ml:182 +msgid "error reading extended partition" +msgstr "" + +#: ../virt-df/virt_df.ml:149 +msgid "error reading partition table" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:239 +msgid "error set after getting System bus" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:379 +msgid "errors: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:258 +msgid "expected field value pairs, but got an odd number of arguments" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:610 +msgid "expecting domain followed by field value pairs" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:220 +msgid "flag should be '%s'" +msgstr "" + +#: ../virt-top/virt_top_xml.ml:46 ../virt-df/virt_df.ml:419 +msgid "get_xml_desc didn't return " +msgstr "" + +#: ../virt-df/virt_df.ml:427 +msgid "get_xml_desc returned no node in XML" +msgstr "" + +#: ../virt-df/virt_df.ml:430 +msgid "get_xml_desc returned strange node" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:700 +msgid "help: %s: command not found" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:160 ../mlvirsh/mlvirsh.ml:164 ../mlvirsh/mlvirsh.ml:168 ../mlvirsh/mlvirsh.ml:172 ../mlvirsh/mlvirsh.ml:177 ../mlvirsh/mlvirsh.ml:182 ../mlvirsh/mlvirsh.ml:188 +msgid "incorrect number of arguments for function" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:339 +msgid "max_mem: %Ld K\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:325 ../mlvirsh/mlvirsh.ml:340 +msgid "memory: %Ld K\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:327 +msgid "mhz: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:727 +msgid "mlvirsh" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:725 +msgid "mlvirsh(no connection)" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:726 +msgid "mlvirsh(ro)" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:324 +msgid "model: %s\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:253 +msgid "network %s: not found. Additional info: %s" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:328 +msgid "nodes: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:197 ../mlvirsh/mlvirsh.ml:202 +msgid "not connected to the hypervisor" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:341 +msgid "nr_virt_cpu: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:296 +msgid "offline" +msgstr "" + +#: ../virt-df/virt_df_ext2.ml:42 +msgid "partition marked EXT2/3 but no valid filesystem" +msgstr "" + +#: ../virt-ctrl/vc_helpers.ml:55 ../mlvirsh/mlvirsh.ml:290 +msgid "paused" +msgstr "" + +#: ../virt-df/virt_df.ml:188 +msgid "probe_extended_partition: internal error" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:376 +msgid "read bytes: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:375 +msgid "read requests: %Ld\\n" +msgstr "" + +#: ../virt-ctrl/vc_helpers.ml:53 ../mlvirsh/mlvirsh.ml:288 ../mlvirsh/mlvirsh.ml:297 +msgid "running" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:384 +msgid "rx bytes: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:387 +msgid "rx dropped: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:386 +msgid "rx errs: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:385 +msgid "rx packets: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:226 +msgid "setting should be '%s' or '%s'" +msgstr "" + +#: ../virt-ctrl/vc_helpers.ml:56 ../mlvirsh/mlvirsh.ml:291 +msgid "shutdown" +msgstr "" + +#: ../virt-ctrl/vc_helpers.ml:57 ../mlvirsh/mlvirsh.ml:292 +msgid "shutoff" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:329 +msgid "sockets: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:338 +msgid "state: %s\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:331 +msgid "threads: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:198 +msgid "tried to do read-write operation on read-only hypervisor connection" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:388 +msgid "tx bytes: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:391 +msgid "tx dropped: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:390 +msgid "tx errs: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:389 +msgid "tx packets: %Ld\\n" +msgstr "" + +#: ../virt-ctrl/vc_helpers.ml:52 ../mlvirsh/mlvirsh.ml:287 +msgid "unknown" +msgstr "" + +#: ../virt-df/virt_df.ml:246 +msgid "unsupported partition type %02x" +msgstr "" + +#: ../virt-df/virt_df.ml:363 +msgid "virt-df : like 'df', shows disk space used in guests\n\nSUMMARY\n virt-df [-options]\n\nOPTIONS" +msgstr "" + +#: ../virt-top/virt_top.ml:1543 +msgid "virt-top %s (libvirt %d.%d.%d) by Red Hat" +msgstr "" + +#: ../virt-top/virt_top.ml:203 +msgid "virt-top : a 'top'-like utility for virtualization\n\nSUMMARY\n virt-top [-options]\n\nOPTIONS" +msgstr "" + +#: ../virt-top/virt_top.ml:40 +msgid "virt-top was compiled without support for CSV files" +msgstr "" + +#: ../virt-top/virt_top.ml:51 +msgid "virt-top was compiled without support for dates and times" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:360 +msgid "virtual CPU: %d\\n" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:219 +msgid "warning: ignored unknown message %s from %s\\n%!" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:124 +msgid "warning: unexpected message contents of Found signal" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:188 +msgid "warning: unexpected message contents of ItemNew signal" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:140 +msgid "warning: unexpected message contents of ItemRemove signal" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:378 +msgid "write bytes: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:377 +msgid "write requests: %Ld\\n" +msgstr "" + diff --git a/po/pl.po b/po/pl.po new file mode 100644 index 0000000..a1474af --- /dev/null +++ b/po/pl.po @@ -0,0 +1,1018 @@ +# translation of pl.po to Polish +# Piotr Drąg , 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: pl\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2008-03-28 17:30+0000\n" +"PO-Revision-Date: 2008-04-12 21:09+0200\n" +"Last-Translator: Piotr Drąg \n" +"Language-Team: Polish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../virt-top/virt_top.ml:1490 +msgid "# .virt-toprc virt-top configuration file\\n" +msgstr "# plik konfiguracji virt-top .virt-toprc\\n" + +#: ../virt-top/virt_top.ml:1508 +msgid "# Enable CSV output to the named file\\n" +msgstr "# Włącz wyjście CSV do pliku named\\n" + +#: ../virt-top/virt_top.ml:1511 +msgid "# To protect this file from being overwritten, uncomment next line\\n" +msgstr "# Aby ochronić ten plik przed zastąpieniem, usuń komentarz z następnego wiersza\\n" + +#: ../virt-top/virt_top.ml:1505 +msgid "# To send debug and error messages to a file, uncomment next line\\n" +msgstr "# Aby wysłać komunikaty debugowania i błędów do pliku, usuń komentarz z następnego wiersza\\n" + +#: ../virt-top/virt_top.ml:1491 +msgid "# generated on %s by %s\\n" +msgstr "# utworzone %s przez %s\\n" + +#: ../virt-top/virt_top.ml:63 +msgid "%CPU" +msgstr "%CPU" + +#: ../virt-top/virt_top.ml:64 +msgid "%MEM" +msgstr "%MEM" + +#: ../virt-top/virt_top.ml:1144 +msgid "%d domains, %d active, %d running, %d sleeping, %d paused, %d inactive D:%d O:%d X:%d" +msgstr "%d domeny, %d aktywne, %d uruchomionych, %d uśpionych, %d wstrzymanych, %d nieaktywnych D:%d O:%d X:%d" + +#: ../mlvirsh/mlvirsh.ml:716 +msgid "%s: command not found" +msgstr "%s: nie znaleziono polecenia" + +#: ../virt-top/virt_top.ml:105 +msgid "%s: display should be %s" +msgstr "%s: ekran powinien być %s" + +#: ../virt-top/virt_top.ml:82 +msgid "%s: sort order should be: %s" +msgstr "%s: porządek sortowania powinien być: %s" + +#: ../virt-df/virt_df.ml:362 ../virt-top/virt_top.ml:202 +msgid "%s: unknown parameter" +msgstr "%s: nieznany parametr" + +#: ../virt-top/virt_top.ml:233 +msgid "%s:%d: configuration item ``%s'' ignored\\n%!" +msgstr "%s:%d: zignorowano element konfiguracji ``%s''\\n%!" + +#: ../virt-df/virt_df.ml:514 +msgid "(device omitted)" +msgstr "(pominięto urządzenie)" + +#: ../virt-top/virt_top.ml:145 +msgid "-d: cannot set a negative delay" +msgstr "-d: nie można ustawić negatywnego opóźnienia" + +#: ../virt-df/virt_df.ml:498 +msgid "1K-blocks" +msgstr "Bloki 1K" + +#: ../virt-ctrl/vc_mainwindow.ml:97 +msgid "About ..." +msgstr "Informacje o..." + +#: ../mlvirsh/mlvirsh.ml:399 +msgid "Attach device to domain." +msgstr "Podłącz urządzenie do domeny." + +#: ../virt-df/virt_df.ml:499 ../virt-df/virt_df.ml:498 +msgid "Available" +msgstr "Dostępne" + +#: ../virt-top/virt_top.ml:167 +msgid "Batch mode" +msgstr "Tryb wsadowy" + +#: ../virt-top/virt_top.ml:70 +msgid "Block read reqs" +msgstr "Wymagania odczytania blokowego" + +#: ../virt-top/virt_top.ml:71 +msgid "Block write reqs" +msgstr "Wymagania zapisania blokowego" + +#: ../virt-ctrl/vc_connections.ml:408 +msgid "CPU" +msgstr "Procesor" + +#: ../mlvirsh/mlvirsh.ml:365 +msgid "CPU affinity" +msgstr "Dopasowanie procesora" + +#: ../virt-top/virt_top.ml:1151 +msgid "CPU: %2.1f%% Mem: %Ld MB (%Ld MB by guests)" +msgstr "Procesor: %2.1f%% Pamięć: %Ld MB (%Ld MB przez gości)" + +#: ../virt-ctrl/vc_connection_dlg.ml:182 +msgid "Cancel" +msgstr "Anuluj" + +#: ../virt-top/virt_top.ml:1319 +msgid "Change delay from %.1f to: " +msgstr "Zmień opóźnienie z %.1f na: " + +#: ../mlvirsh/mlvirsh.ml:409 +msgid "Close an existing hypervisor connection." +msgstr "Zamknij istniejące połączenie nadzorcy." + +#: ../virt-ctrl/vc_mainwindow.ml:118 +msgid "Connect ..." +msgstr "Połącz się..." + +#: ../virt-ctrl/vc_mainwindow.ml:160 +msgid "Connect to ..." +msgstr "Połącz się z..." + +#: ../virt-df/virt_df.ml:348 ../virt-df/virt_df.ml:346 ../virt-top/virt_top.ml:171 ../virt-top/virt_top.ml:169 +msgid "Connect to URI (default: Xen)" +msgstr "Połącz się z URI (domyślnie: Xen)" + +#: ../virt-top/virt_top.ml:1558 +msgid "Connect: %s; Hostname: %s" +msgstr "Połącz się: %s; nazwa hosta: %s" + +#: ../mlvirsh/mlvirsh.ml:476 +msgid "Core dump a domain to a file for analysis." +msgstr "Zrzut core domeny do pliku do analizy." + +#: ../mlvirsh/mlvirsh.ml:422 +msgid "Create a domain from an XML file." +msgstr "Utwórz domenę z pliku XML." + +#: ../mlvirsh/mlvirsh.ml:534 +msgid "Create a network from an XML file." +msgstr "Utwórz sieć z pliku XML." + +#: ../virt-top/virt_top.ml:1596 +msgid "DISPLAY MODES" +msgstr "TRYBY WYŚWIETLANIA" + +#: ../mlvirsh/mlvirsh.ml:426 +msgid "Define (but don't start) a domain from an XML file." +msgstr "Określ (ale nie uruchamiaj) domenę z pliku XML." + +#: ../mlvirsh/mlvirsh.ml:538 +msgid "Define (but don't start) a network from an XML file." +msgstr "Określ (ale nie uruchamiaj) sieć z pliku XML." + +#: ../virt-top/virt_top.ml:1326 +msgid "Delay must be > 0" +msgstr "Opóźnienie musi być > 0" + +#: ../virt-top/virt_top.ml:181 +msgid "Delay time interval (seconds)" +msgstr "Czas między opóźnieniami (sekundy)" + +#: ../virt-top/virt_top.ml:1552 +msgid "Delay: %.1f secs; Batch: %s; Secure: %s; Sort: %s" +msgstr "Opóźnienie: %.1f sekundy; wsadowo: %s; bezpieczeństwo: %s; sortowanie: %s" + +#: ../mlvirsh/mlvirsh.ml:433 +msgid "Destroy a domain." +msgstr "Zniszcz domenę." + +#: ../mlvirsh/mlvirsh.ml:541 +msgid "Destroy a network." +msgstr "Zniszcz sieć." + +#: ../mlvirsh/mlvirsh.ml:430 +msgid "Detach device from domain." +msgstr "Odłącz urządzenie z domeny." + +#: ../virt-ctrl/vc_mainwindow.ml:123 +msgid "Details" +msgstr "Szczegóły" + +#: ../virt-top/virt_top.ml:175 +msgid "Disable CPU stats in CSV" +msgstr "Wyłącz statystyki procesora w CSV" + +#: ../virt-top/virt_top.ml:177 +msgid "Disable block device stats in CSV" +msgstr "Wyłącz statystyki urządzenia blokowego w CSV" + +#: ../virt-top/virt_top.ml:179 +msgid "Disable net stats in CSV" +msgstr "Wyłącz statystyki sieci w CSV" + +#: ../mlvirsh/mlvirsh.ml:493 +msgid "Display free memory for machine, NUMA cell or range of cells" +msgstr "Wyświetl wolną pamięć dla komputera, komórkę NUMA lub zakres komórek" + +#: ../mlvirsh/mlvirsh.ml:437 +msgid "Display the block device statistics for a domain." +msgstr "Wyświetl statystyki urządzenia blokowego dla domeny." + +#: ../mlvirsh/mlvirsh.ml:444 +msgid "Display the network interface statistics for a domain." +msgstr "Wyświetl statystyki interfejsu sieciowego dla domeny." + +#: ../virt-df/virt_df.ml:358 +msgid "Display version and exit" +msgstr "Wyświetl wersję i zakończ" + +#: ../virt-top/virt_top.ml:191 +msgid "Do not read init file" +msgstr "Nie odczytuj pliku init" + +#: ../virt-top/virt_top.ml:66 +msgid "Domain ID" +msgstr "Identyfikator domeny" + +#: ../virt-top/virt_top.ml:67 +msgid "Domain name" +msgstr "Nazwa domeny" + +#: ../virt-top/virt_top.ml:1610 +msgid "Domains display" +msgstr "Ekran domen" + +#: ../virt-ctrl/vc_mainwindow.ml:61 ../virt-top/virt_top_main.ml:47 ../virt-top/virt_top.ml:1528 +msgid "Error" +msgstr "Błąd" + +#: ../virt-top/virt_top.ml:185 +msgid "Exit at given time" +msgstr "Zakończ o podanym czasie" + +#: ../virt-ctrl/vc_mainwindow.ml:79 +msgid "File" +msgstr "Plik" + +#: ../virt-df/virt_df.ml:502 +msgid "Filesystem" +msgstr "System plików" + +#: ../mlvirsh/mlvirsh.ml:606 +msgid "Get the current scheduler parameters for a domain." +msgstr "Uzyskaj obecne parametry planisty dla domeny." + +#: ../mlvirsh/mlvirsh.ml:623 +msgid "Get the scheduler type." +msgstr "Uzyskaj typ planisty." + +#: ../mlvirsh/mlvirsh.ml:635 +msgid "Gracefully shutdown a domain." +msgstr "Wyłącz domenę." + +#: ../virt-ctrl/vc_mainwindow.ml:96 ../virt-ctrl/vc_mainwindow.ml:80 ../virt-top/virt_top.ml:1580 +msgid "Help" +msgstr "Pomoc" + +#: ../virt-top/virt_top.ml:187 +msgid "Historical CPU delay" +msgstr "Historyczne opóźnienie procsora" + +#: ../mlvirsh/mlvirsh.ml:35 +msgid "Hypervisor connection URI" +msgstr "URI połączenia nadzorcy" + +#: ../virt-ctrl/vc_connections.ml:405 +msgid "ID" +msgstr "Identyfikator" + +#: ../virt-df/virt_df.ml:500 +msgid "IFree" +msgstr "IWolne" + +#: ../virt-df/virt_df.ml:500 +msgid "IUse" +msgstr "IUżyte" + +#: ../virt-df/virt_df.ml:500 +msgid "Inodes" +msgstr "Iwęzły" + +#: ../virt-df/virt_df_lvm2.ml:33 +msgid "LVM2 not supported yet" +msgstr "LVM2 nie jest jeszcze obsługiwane" + +#: ../virt-df/virt_df_ext2.ml:82 +msgid "Linux ext2/3" +msgstr "Linuksowe ext2/3" + +#: ../virt-df/virt_df_linux_swap.ml:33 +msgid "Linux swap" +msgstr "Linuksowa przestrzeń wymiany" + +#: ../mlvirsh/mlvirsh.ml:557 +msgid "List the active networks." +msgstr "Wyświetl listę aktywnych sieci." + +#: ../mlvirsh/mlvirsh.ml:565 +msgid "List the defined but inactive networks." +msgstr "Wyświetl listę określonych, ale nieaktywnych sieci." + +#: ../mlvirsh/mlvirsh.ml:516 +msgid "List the defined but not running domains." +msgstr "Wyświetl listę określonych, ale nie uruchomionych domen." + +#: ../mlvirsh/mlvirsh.ml:508 +msgid "List the running domains." +msgstr "Wyświetl listę uruchomionych domen." + +#: ../virt-ctrl/vc_mainwindow.ml:158 +msgid "Local QEMU/KVM" +msgstr "Lokalny QEMU/KVM" + +#: ../virt-ctrl/vc_mainwindow.ml:157 +msgid "Local Xen" +msgstr "Lokalny Xen" + +#: ../virt-ctrl/vc_connection_dlg.ml:93 +msgid "Local network" +msgstr "Lokalna sieć" + +#: ../virt-top/virt_top.ml:173 +msgid "Log statistics to CSV file" +msgstr "Zapisz statystyki do pliku CSV" + +#: ../virt-top/virt_top.ml:1563 +msgid "MAIN KEYS" +msgstr "GŁÓWNE KLUCZE" + +#: ../virt-ctrl/vc_connections.ml:409 +msgid "Memory" +msgstr "Pamięć" + +#: ../virt-top/virt_top.ml:1617 +msgid "More help in virt-top(1) man page. Press any key to return." +msgstr "Więcej pomocy na stronie podręcznika virt-top(1). Naciśnij dowolny klawisz, aby kontynuować." + +#: ../virt-df/virt_df.ml:382 ../virt-top/virt_top.ml:258 +msgid "NB: If you want to monitor a local Xen hypervisor, you usually need to be root" +msgstr "NB: jeśli chcesz monitorować lokalnego nadzorcę Xena, zwykle musisz być rootem" + +#: ../virt-ctrl/vc_connections.ml:406 +msgid "Name" +msgstr "Nazwa" + +#: ../virt-top/virt_top.ml:68 +msgid "Net RX bytes" +msgstr "Sieciowe bajty RX" + +#: ../virt-top/virt_top.ml:69 +msgid "Net TX bytes" +msgstr "Sieciowe bajty TX" + +#: ../virt-top/virt_top.ml:1332 +msgid "Not a valid number" +msgstr "Nie jest prawidłowym numerem" + +#: ../virt-top/virt_top.ml:193 +msgid "Number of iterations to run" +msgstr "Liczba iteracji do uruchomienia" + +#: ../virt-ctrl/vc_connection_dlg.ml:170 ../virt-ctrl/vc_connection_dlg.ml:137 +msgid "Open" +msgstr "Otwórz" + +#: ../mlvirsh/mlvirsh.ml:418 +msgid "Open a new hypervisor connection." +msgstr "Otwórz nowe połączenie nadzorcy." + +#: ../virt-ctrl/vc_mainwindow.ml:86 +msgid "Open connection ..." +msgstr "Otwórz połączenie..." + +#: ../virt-ctrl/vc_connection_dlg.ml:40 +msgid "Open connection to hypervisor" +msgstr "Otwórz połączenie do nadzorcy" + +#: ../virt-ctrl/vc_mainwindow.ml:130 +msgid "Pause" +msgstr "Wstrzymaj" + +#: ../mlvirsh/mlvirsh.ml:670 ../mlvirsh/mlvirsh.ml:666 +msgid "Pin domain VCPU to a list of physical CPUs." +msgstr "Przypnij wirtualny procesor do listy fizycznych procesorów." + +#: ../mlvirsh/mlvirsh.ml:706 +msgid "Print list of commands or full description of one command." +msgstr "Wyświetl listę poleceń lub pełny opis jednego polecenia." + +#: ../mlvirsh/mlvirsh.ml:584 +msgid "Print node information." +msgstr "Wyświetl informacje o węźle." + +#: ../virt-df/virt_df.ml:352 ../virt-df/virt_df.ml:350 +msgid "Print sizes in human-readable format" +msgstr "Wyświetl rozmiary w formacie czytelnym dla człowieka" + +#: ../mlvirsh/mlvirsh.ml:440 +msgid "Print the ID of a domain." +msgstr "Wyświetl identyfikator domeny." + +#: ../mlvirsh/mlvirsh.ml:464 +msgid "Print the OS type of a domain." +msgstr "Wyświetl typ systemu operacyjnego domeny." + +#: ../mlvirsh/mlvirsh.ml:472 +msgid "Print the UUID of a domain." +msgstr "Wyświetl UUID domeny." + +#: ../mlvirsh/mlvirsh.ml:581 +msgid "Print the UUID of a network." +msgstr "Wyświetl UUID sieci." + +#: ../mlvirsh/mlvirsh.ml:480 +msgid "Print the XML description of a domain." +msgstr "Wyświetl opis XML domeny." + +#: ../mlvirsh/mlvirsh.ml:545 +msgid "Print the XML description of a network." +msgstr "Wyświetl opis XML sieci." + +#: ../mlvirsh/mlvirsh.ml:530 +msgid "Print the bridge name of a network." +msgstr "Wyświetl nazwę mostka sieci." + +#: ../mlvirsh/mlvirsh.ml:653 +msgid "Print the canonical URI." +msgstr "Wyświetl kanoniczne URI." + +#: ../mlvirsh/mlvirsh.ml:448 +msgid "Print the domain info." +msgstr "Wyświetl informacje o domenie." + +#: ../mlvirsh/mlvirsh.ml:468 +msgid "Print the domain state." +msgstr "Wyświetl stan domeny." + +#: ../mlvirsh/mlvirsh.ml:646 +msgid "Print the driver name" +msgstr "Wyświetl nazwę sterownika" + +#: ../mlvirsh/mlvirsh.ml:677 +msgid "Print the driver version" +msgstr "Wyświetl wersję sterownika" + +#: ../mlvirsh/mlvirsh.ml:500 +msgid "Print the hostname." +msgstr "Wyświetl nazwę hosta." + +#: ../mlvirsh/mlvirsh.ml:522 +msgid "Print the max VCPUs available." +msgstr "Wyświetl maksymalną ilość dostępnych wirtualnych procesorów." + +#: ../mlvirsh/mlvirsh.ml:456 +msgid "Print the max VCPUs of a domain." +msgstr "Wyświetl maksymalną ilość wirtualnych procesorów domeny." + +#: ../mlvirsh/mlvirsh.ml:452 +msgid "Print the max memory (in kilobytes) of a domain." +msgstr "Wyświetl maksymalną pamięć (w kilobitach) domeny." + +#: ../mlvirsh/mlvirsh.ml:460 +msgid "Print the name of a domain." +msgstr "Wyświetl nazwę domeny." + +#: ../mlvirsh/mlvirsh.ml:569 +msgid "Print the name of a network." +msgstr "Wyświetl nazwę sieci." + +#: ../mlvirsh/mlvirsh.ml:497 +msgid "Print whether a domain autostarts at boot." +msgstr "Wyświetl, czy domena powinna być automatycznie uruchamiania po starcie." + +#: ../mlvirsh/mlvirsh.ml:549 +msgid "Print whether a network autostarts at boot." +msgstr "Wyświetl, czy sieć powinna być automatycznie uruchamiania po starcie." + +#: ../virt-ctrl/vc_connection_dlg.ml:83 +msgid "QEMU or KVM" +msgstr "QEMU lub KVM" + +#: ../virt-ctrl/vc_mainwindow.ml:89 ../virt-top/virt_top.ml:1578 +msgid "Quit" +msgstr "Zakończ" + +#: ../mlvirsh/mlvirsh.ml:519 +msgid "Quit the interactive terminal." +msgstr "Zakończ interaktywny terminal." + +#: ../mlvirsh/mlvirsh.ml:36 +msgid "Read-only connection" +msgstr "Połączenie tylko do odczytu" + +#: ../mlvirsh/mlvirsh.ml:587 +msgid "Reboot a domain." +msgstr "Ponownie uruchom domenę." + +#: ../virt-ctrl/vc_connection_dlg.ml:134 +msgid "Refresh" +msgstr "Odśwież" + +#: ../mlvirsh/mlvirsh.ml:592 +msgid "Restore a domain from the named file." +msgstr "Przywróć domenę z pliku named." + +#: ../virt-ctrl/vc_mainwindow.ml:133 +msgid "Resume" +msgstr "Wznów" + +#: ../mlvirsh/mlvirsh.ml:595 +msgid "Resume a domain." +msgstr "Wznów domenę." + +#: ../mlvirsh/mlvirsh.ml:406 +msgid "Returns capabilities of hypervisor/driver." +msgstr "Zwraca możliwości nadzorcy/sterownika." + +#: ../virt-top/virt_top.ml:199 +msgid "Run from a script (no user interface)" +msgstr "Uruchom ze skryptu (brak interfejsu użytkownika)" + +#: ../virt-top/virt_top.ml:1584 +msgid "SORTING" +msgstr "SORTOWANIE" + +#: ../mlvirsh/mlvirsh.ml:599 +msgid "Save a domain to a file." +msgstr "Zapisz domenę do pliku." + +#: ../virt-top/virt_top.ml:197 +msgid "Secure (\\\"kiosk\\\") mode" +msgstr "Tryb bezpieczny (\\\"kiosk\\\")" + +#: ../virt-top/virt_top.ml:1593 +msgid "Select sort field" +msgstr "Wybierz pole sortowania" + +#: ../virt-top/virt_top.ml:183 +msgid "Send debug messages to file" +msgstr "Wyślij komunikaty debugowania do pliku" + +#: ../virt-top/virt_top.ml:189 +msgid "Set name of init file" +msgstr "Ustaw nazwę pliku init" + +#: ../virt-top/virt_top.ml:195 +msgid "Set sort order (%s)" +msgstr "Ustaw porządek sortowania (%s)" + +#: ../virt-top/virt_top.ml:1340 +msgid "Set sort order for main display" +msgstr "Ustaw porządek sortowania dla głównego ekranu" + +#: ../mlvirsh/mlvirsh.ml:631 +msgid "Set the maximum memory used by the domain (in kilobytes)." +msgstr "Ustaw maksymalną pamięć używaną przez domenę (w kilobajtach)." + +#: ../mlvirsh/mlvirsh.ml:627 +msgid "Set the memory used by the domain (in kilobytes)." +msgstr "Ustaw pamięć używaną przez domenę (w kilobajtach)." + +#: ../mlvirsh/mlvirsh.ml:674 +msgid "Set the number of virtual CPUs assigned to a domain." +msgstr "Ustaw liczbę wirtualnych procesorów powiązanych z domeną." + +#: ../mlvirsh/mlvirsh.ml:618 +msgid "Set the scheduler parameters for a domain." +msgstr "Ustaw parametry planisty domeny." + +#: ../virt-top/virt_top.ml:1579 +msgid "Set update interval" +msgstr "Ustaw czas między aktualizacjami" + +#: ../mlvirsh/mlvirsh.ml:403 +msgid "Set whether a domain autostarts at boot." +msgstr "Ustaw, czy automatycznie uruchamiać domenę po starcie." + +#: ../mlvirsh/mlvirsh.ml:526 +msgid "Set whether a network autostarts at boot." +msgstr "Ustaw, czy automatycznie uruchamiać sieć po starcie." + +#: ../virt-df/virt_df.ml:344 ../virt-df/virt_df.ml:342 +msgid "Show all domains (default: only active domains)" +msgstr "Wyświetl wszystkie domeny (domyślnie: tylko aktywne domeny)" + +#: ../virt-df/virt_df.ml:356 ../virt-df/virt_df.ml:354 +msgid "Show inodes instead of blocks" +msgstr "Wyświetl i-węzły zamiast bloków" + +#: ../virt-ctrl/vc_mainwindow.ml:137 +msgid "Shutdown" +msgstr "Wyłącz" + +#: ../virt-df/virt_df.ml:499 +msgid "Size" +msgstr "Rozmiar" + +#: ../virt-top/virt_top.ml:1589 +msgid "Sort by %CPU" +msgstr "Uporządkuj według %CPU" + +#: ../virt-top/virt_top.ml:1590 +msgid "Sort by %MEM" +msgstr "Uporządkuj według %MEM" + +#: ../virt-top/virt_top.ml:1592 +msgid "Sort by ID" +msgstr "Uporządkuj według identyfikatorów" + +#: ../virt-top/virt_top.ml:1591 +msgid "Sort by TIME" +msgstr "Uporządkuj według TIME" + +#: ../virt-ctrl/vc_mainwindow.ml:127 +msgid "Start" +msgstr "Uruchom" + +#: ../mlvirsh/mlvirsh.ml:639 +msgid "Start a previously defined inactive domain." +msgstr "Uruchom poprzednio określoną nieaktywną domenę." + +#: ../mlvirsh/mlvirsh.ml:573 +msgid "Start a previously defined inactive network." +msgstr "Uruchom poprzednio określoną nieaktywną sieć." + +#: ../virt-top/virt_top.ml:165 +msgid "Start by displaying block devices" +msgstr "Uruchom przez wyświetlenie urządzeń blokowych" + +#: ../virt-top/virt_top.ml:163 +msgid "Start by displaying network interfaces" +msgstr "Uruchom przez wyświetlenie interfejsów sieciowych" + +#: ../virt-top/virt_top.ml:161 +msgid "Start by displaying pCPUs (default: tasks)" +msgstr "Uruchom przez wyświetlanie fizycznych procesorów (domyślnie: zadania)" + +#: ../virt-ctrl/vc_connections.ml:407 +msgid "Status" +msgstr "Stan" + +#: ../mlvirsh/mlvirsh.ml:643 +msgid "Suspend a domain." +msgstr "Uśpij domenę." + +#: ../mlvirsh/mlvirsh.ml:40 +msgid "Synopsis:\n %s [options] [command]\n\nList of all commands:\n %s help\n\nFull description of a single command:\n %s help command\n\nOptions:" +msgstr "Podsumowanie:\n %s [opcje] [polecenie]\n\nWyświetl listę wszystkich poleceń:\n %s help\n\nPełny opis jednego polecenia:\n %s help polecenie\n\nOpcje:" + +#: ../virt-top/virt_top.ml:65 +msgid "TIME (CPU time)" +msgstr "TIME (czas procesora)" + +#: ../virt-ctrl/vc_connection_dlg.ml:62 +msgid "This machine" +msgstr "Ten komputer" + +#: ../virt-top/virt_top.ml:1613 +msgid "Toggle block devices" +msgstr "Przełącz urządzenia blokowe" + +#: ../virt-top/virt_top.ml:1612 +msgid "Toggle network interfaces" +msgstr "Przełącz interfejsy sieciowe" + +#: ../virt-top/virt_top.ml:1611 +msgid "Toggle physical CPUs" +msgstr "Przełącz fizyczne procesory" + +#: ../virt-df/virt_df.ml:502 +msgid "Type" +msgstr "Podaj" + +#: ../virt-top/virt_top.ml:1341 +msgid "Type key or use up and down cursor keys." +msgstr "Podaj klucz lub użyj klawiszy kursora w górę i w dół." + +#: ../virt-ctrl/vc_connection_dlg.ml:160 +msgid "URI connection" +msgstr "Połączenie URI" + +#: ../mlvirsh/mlvirsh.ml:650 +msgid "Undefine an inactive domain." +msgstr "Usuń określenie nieaktywnej domeny." + +#: ../mlvirsh/mlvirsh.ml:577 +msgid "Undefine an inactive network." +msgstr "Usuń określenie nieaktywnej sieci." + +#: ../virt-top/virt_top.ml:1622 +msgid "Unknown command - try 'h' for help" +msgstr "Nieznane polecenie - wypróbuj \"h\", aby uzyskać pomoc" + +#: ../virt-top/virt_top.ml:1577 +msgid "Update display" +msgstr "Zaktualizuj ekran" + +#: ../mlvirsh/mlvirsh.ml:690 +msgid "Use '%s help command' for help on a command." +msgstr "Użyj \"%s help polecenie\", aby uzyskać pomoc o poleceniu." + +#: ../virt-df/virt_df.ml:499 ../virt-df/virt_df.ml:498 +msgid "Used" +msgstr "Użyte" + +#: ../virt-ctrl/vc_mainwindow.ml:23 +msgid "Virtual Control" +msgstr "Kontrola wirtualna" + +#: ../virt-ctrl/vc_mainwindow.ml:53 +msgid "Virtualisation error" +msgstr "Błąd wirtualizacji" + +#: ../virt-ctrl/vc_mainwindow.ml:39 +msgid "Virtualization control tool (virt-ctrl) by\nRichard W.M. Jones (rjones@redhat.com).\n\nCopyright %s 2007-2008 Red Hat Inc.\n\nLibvirt version: %s\n\nGtk toolkit version: %s" +msgstr "Narzędzie kontroli wirtualizacji (virt-ctrl) by\nRichard W.M. Jones (rjones@redhat.com).\n\nCopyright %s 2007-2008 Red Hat Inc.\n\nWersja libvirt: %s\n\nWersja zestawu narzędzi GTK: %s" + +#: ../virt-top/virt_top.ml:1523 +msgid "Wrote settings to %s" +msgstr "Zapisano ustawienia do %s" + +#: ../virt-ctrl/vc_connection_dlg.ml:76 +msgid "Xen hypervisor" +msgstr "Nadzorca Xen" + +#: ../mlvirsh/mlvirsh.ml:364 +msgid "\\tCPU time: %Ld ns\\n" +msgstr "\\tCzas procesora: %Ld ns\\n" + +#: ../mlvirsh/mlvirsh.ml:362 +msgid "\\tcurrent state: %s\\n" +msgstr "\\tobecny stan: %s\\n" + +#: ../mlvirsh/mlvirsh.ml:361 +msgid "\\ton physical CPU: %d\\n" +msgstr "\\tna fizycznym procesorze: %d\\n" + +#: ../mlvirsh/mlvirsh.ml:298 ../mlvirsh/mlvirsh.ml:289 ../virt-ctrl/vc_helpers.ml:54 +msgid "blocked" +msgstr "zablokowano" + +#: ../mlvirsh/mlvirsh.ml:330 +msgid "cores: %d\\n" +msgstr "rdzenie: %d\\n" + +#: ../mlvirsh/mlvirsh.ml:342 +msgid "cpu_time: %Ld ns\\n" +msgstr "cpu_time: %Ld ns\\n" + +#: ../mlvirsh/mlvirsh.ml:326 +msgid "cpus: %d\\n" +msgstr "procesory: %d\\n" + +#: ../mlvirsh/mlvirsh.ml:293 ../virt-ctrl/vc_helpers.ml:58 +msgid "crashed" +msgstr "zawiesił się" + +#: ../virt-df/virt_df.ml:236 +msgid "detection of unpartitioned devices not yet supported" +msgstr "wykrywanie niespartycjonowanych urządzeń nie jest jeszcze obsługiwane" + +#: ../mlvirsh/mlvirsh.ml:242 +msgid "domain %s: not found. Additional info: %s" +msgstr "domena %s: nie znaleziono. Dodatkowe informacje: %s" + +#: ../virt-df/virt_df_ext2.ml:39 +msgid "error reading ext2/ext3 magic" +msgstr "błąd podczas odczytywanie magii ext2/ext3" + +#: ../virt-df/virt_df.ml:182 +msgid "error reading extended partition" +msgstr "błąd podczas odczytywania partycji rozszerzonej" + +#: ../virt-df/virt_df.ml:149 +msgid "error reading partition table" +msgstr "błąd podczas odczytywania tablicy partycji" + +#: ../virt-ctrl/vc_dbus.ml:239 +msgid "error set after getting System bus" +msgstr "błąd podczas ustawiania po otrzymaniu magistrali systemowej" + +#: ../mlvirsh/mlvirsh.ml:379 +msgid "errors: %Ld\\n" +msgstr "błędy: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:258 +msgid "expected field value pairs, but got an odd number of arguments" +msgstr "oczekiwano pary wartości pól, ale otrzymano nieparzystą liczbę argumentów" + +#: ../mlvirsh/mlvirsh.ml:610 +msgid "expecting domain followed by field value pairs" +msgstr "oczekiwano domenę poprzedzoną parami wartości pól" + +#: ../mlvirsh/mlvirsh.ml:220 +msgid "flag should be '%s'" +msgstr "flaga powinna być \"%s\"" + +#: ../virt-df/virt_df.ml:419 ../virt-top/virt_top_xml.ml:46 +msgid "get_xml_desc didn't return " +msgstr "get_xml_desc nie zwróciło " + +#: ../virt-df/virt_df.ml:427 +msgid "get_xml_desc returned no node in XML" +msgstr "get_xml_desc nie zwróciło węzła w XML-u" + +#: ../virt-df/virt_df.ml:430 +msgid "get_xml_desc returned strange node" +msgstr "get_xml_desc zwróciło dziwny węzeł " + +#: ../mlvirsh/mlvirsh.ml:700 +msgid "help: %s: command not found" +msgstr "help: %s: nie znaleziono polecenia" + +#: ../mlvirsh/mlvirsh.ml:188 ../mlvirsh/mlvirsh.ml:182 ../mlvirsh/mlvirsh.ml:177 ../mlvirsh/mlvirsh.ml:172 ../mlvirsh/mlvirsh.ml:168 ../mlvirsh/mlvirsh.ml:164 ../mlvirsh/mlvirsh.ml:160 +msgid "incorrect number of arguments for function" +msgstr "niepoprawna liczba argumentów dla funkcji" + +#: ../mlvirsh/mlvirsh.ml:339 +msgid "max_mem: %Ld K\\n" +msgstr "max_mem: %Ld K\\n" + +#: ../mlvirsh/mlvirsh.ml:340 ../mlvirsh/mlvirsh.ml:325 +msgid "memory: %Ld K\\n" +msgstr "pamięć: %Ld K\\n" + +#: ../mlvirsh/mlvirsh.ml:327 +msgid "mhz: %d\\n" +msgstr "MHz: %d\\n" + +#: ../mlvirsh/mlvirsh.ml:727 +msgid "mlvirsh" +msgstr "mlvirsh" + +#: ../mlvirsh/mlvirsh.ml:725 +msgid "mlvirsh(no connection)" +msgstr "mlvirsh (brak połączenia)" + +#: ../mlvirsh/mlvirsh.ml:726 +msgid "mlvirsh(ro)" +msgstr "mlvirsh (tylko do odczytu)" + +#: ../mlvirsh/mlvirsh.ml:324 +msgid "model: %s\\n" +msgstr "model: %s\\n" + +#: ../mlvirsh/mlvirsh.ml:253 +msgid "network %s: not found. Additional info: %s" +msgstr "sieć %s: nie znaleziono. Dodatkowe informacje: %s" + +#: ../mlvirsh/mlvirsh.ml:328 +msgid "nodes: %d\\n" +msgstr "węzły: %d\\n" + +#: ../mlvirsh/mlvirsh.ml:202 ../mlvirsh/mlvirsh.ml:197 +msgid "not connected to the hypervisor" +msgstr "nie połączono z nadzorcą" + +#: ../mlvirsh/mlvirsh.ml:341 +msgid "nr_virt_cpu: %d\\n" +msgstr "nr_virt_cpu: %d\\n" + +#: ../mlvirsh/mlvirsh.ml:296 +msgid "offline" +msgstr "offline" + +#: ../virt-df/virt_df_ext2.ml:42 +msgid "partition marked EXT2/3 but no valid filesystem" +msgstr "partycja jest oznaczona jako ext2/3, ale nie jest prawidłowym system plików" + +#: ../mlvirsh/mlvirsh.ml:290 ../virt-ctrl/vc_helpers.ml:55 +msgid "paused" +msgstr "wstrzymano" + +#: ../virt-df/virt_df.ml:188 +msgid "probe_extended_partition: internal error" +msgstr "probe_extended_partition: wewnętrzny błąd" + +#: ../mlvirsh/mlvirsh.ml:376 +msgid "read bytes: %Ld\\n" +msgstr "odczytaj bajty: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:375 +msgid "read requests: %Ld\\n" +msgstr "odczytaj żądania: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:297 ../mlvirsh/mlvirsh.ml:288 ../virt-ctrl/vc_helpers.ml:53 +msgid "running" +msgstr "uruchomione" + +#: ../mlvirsh/mlvirsh.ml:384 +msgid "rx bytes: %Ld\\n" +msgstr "bajty RX: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:387 +msgid "rx dropped: %Ld\\n" +msgstr "opuszczono RX: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:386 +msgid "rx errs: %Ld\\n" +msgstr "błędy RX: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:385 +msgid "rx packets: %Ld\\n" +msgstr "pakiety RX: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:226 +msgid "setting should be '%s' or '%s'" +msgstr "ustawienie powinno być \"%s\" lub \"%s\"" + +#: ../mlvirsh/mlvirsh.ml:291 ../virt-ctrl/vc_helpers.ml:56 +msgid "shutdown" +msgstr "wyłącz" + +#: ../mlvirsh/mlvirsh.ml:292 ../virt-ctrl/vc_helpers.ml:57 +msgid "shutoff" +msgstr "wyłącz" + +#: ../mlvirsh/mlvirsh.ml:329 +msgid "sockets: %d\\n" +msgstr "gniazda: %d\\n" + +#: ../mlvirsh/mlvirsh.ml:338 +msgid "state: %s\\n" +msgstr "stan: %s\\n" + +#: ../mlvirsh/mlvirsh.ml:331 +msgid "threads: %d\\n" +msgstr "wątki: %d\\n" + +#: ../mlvirsh/mlvirsh.ml:198 +msgid "tried to do read-write operation on read-only hypervisor connection" +msgstr "spróbowano wykonać operację odczytu/zapisu na połączeniu nadzorcy tylko do odczytu" + +#: ../mlvirsh/mlvirsh.ml:388 +msgid "tx bytes: %Ld\\n" +msgstr "bajty TX: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:391 +msgid "tx dropped: %Ld\\n" +msgstr "opuszczono TX: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:390 +msgid "tx errs: %Ld\\n" +msgstr "błędy TX: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:389 +msgid "tx packets: %Ld\\n" +msgstr "pakiety TX: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:287 ../virt-ctrl/vc_helpers.ml:52 +msgid "unknown" +msgstr "nieznane" + +#: ../virt-df/virt_df.ml:246 +msgid "unsupported partition type %02x" +msgstr "nieobsługiwany typ partycji %02x" + +#: ../virt-df/virt_df.ml:363 +msgid "virt-df : like 'df', shows disk space used in guests\n\nSUMMARY\n virt-df [-options]\n\nOPTIONS" +msgstr "virt-df: podobne do \"df\", pokazuje użytą przestrzeń na dysku w gościach\n\nPODSUMOWANIE\n virt-df [-opcje]\n\nOPCJE" + +#: ../virt-top/virt_top.ml:1543 +msgid "virt-top %s (libvirt %d.%d.%d) by Red Hat" +msgstr "virt-top %s (libvirt %d.%d.%d) od Red Hata" + +#: ../virt-top/virt_top.ml:203 +msgid "virt-top : a 'top'-like utility for virtualization\n\nSUMMARY\n virt-top [-options]\n\nOPTIONS" +msgstr "virt-top: narzędzie podobne do \"top\" dla wirtualizacji\n\nPODSUMOWANIE\n virt-top [-opcje]\n\nOPCJE" + +#: ../virt-top/virt_top.ml:40 +msgid "virt-top was compiled without support for CSV files" +msgstr "virt-top został skompilowany bez obsługi plików CSV" + +#: ../virt-top/virt_top.ml:51 +msgid "virt-top was compiled without support for dates and times" +msgstr "virt-top został skompilowany bez obsługi dat i czasu" + +#: ../mlvirsh/mlvirsh.ml:360 +msgid "virtual CPU: %d\\n" +msgstr "wirtualny procesor: %d\\n" + +#: ../virt-ctrl/vc_dbus.ml:219 +msgid "warning: ignored unknown message %s from %s\\n%!" +msgstr "ostrzeżenie: zignorowano nieznany komunikat %s z %s\\n%!" + +#: ../virt-ctrl/vc_dbus.ml:124 +msgid "warning: unexpected message contents of Found signal" +msgstr "ostrzeżenie: nieoczekiwana zawartość komunikatu sygnału \"Found\"" + +#: ../virt-ctrl/vc_dbus.ml:188 +msgid "warning: unexpected message contents of ItemNew signal" +msgstr "ostrzeżenie: nieoczekiwana zawartość komunikatu sygnału \"ItemNew\"" + +#: ../virt-ctrl/vc_dbus.ml:140 +msgid "warning: unexpected message contents of ItemRemove signal" +msgstr "ostrzeżenie: nieoczekiwana zawartość komunikatu sygnału \"ItemRemove\"" + +#: ../mlvirsh/mlvirsh.ml:378 +msgid "write bytes: %Ld\\n" +msgstr "bajty zapisu: %Ld\\n" + +#: ../mlvirsh/mlvirsh.ml:377 +msgid "write requests: %Ld\\n" +msgstr "żądania zapisu: %Ld\\n" diff --git a/po/virt-top.pot b/po/virt-top.pot new file mode 100644 index 0000000..68806b4 --- /dev/null +++ b/po/virt-top.pot @@ -0,0 +1,1023 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2008-03-28 17:30+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: ../virt-top/virt_top.ml:1490 +msgid "# .virt-toprc virt-top configuration file\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:1508 +msgid "# Enable CSV output to the named file\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:1511 +msgid "# To protect this file from being overwritten, uncomment next line\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:1505 +msgid "# To send debug and error messages to a file, uncomment next line\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:1491 +msgid "# generated on %s by %s\\n" +msgstr "" + +#: ../virt-top/virt_top.ml:63 +msgid "%CPU" +msgstr "" + +#: ../virt-top/virt_top.ml:64 +msgid "%MEM" +msgstr "" + +#: ../virt-top/virt_top.ml:1144 +msgid "%d domains, %d active, %d running, %d sleeping, %d paused, %d inactive D:%d O:%d X:%d" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:716 +msgid "%s: command not found" +msgstr "" + +#: ../virt-top/virt_top.ml:105 +msgid "%s: display should be %s" +msgstr "" + +#: ../virt-top/virt_top.ml:82 +msgid "%s: sort order should be: %s" +msgstr "" + +#: ../virt-df/virt_df.ml:362 ../virt-top/virt_top.ml:202 +msgid "%s: unknown parameter" +msgstr "" + +#: ../virt-top/virt_top.ml:233 +msgid "%s:%d: configuration item ``%s'' ignored\\n%!" +msgstr "" + +#: ../virt-df/virt_df.ml:514 +msgid "(device omitted)" +msgstr "" + +#: ../virt-top/virt_top.ml:145 +msgid "-d: cannot set a negative delay" +msgstr "" + +#: ../virt-df/virt_df.ml:498 +msgid "1K-blocks" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:97 +msgid "About ..." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:399 +msgid "Attach device to domain." +msgstr "" + +#: ../virt-df/virt_df.ml:499 ../virt-df/virt_df.ml:498 +msgid "Available" +msgstr "" + +#: ../virt-top/virt_top.ml:167 +msgid "Batch mode" +msgstr "" + +#: ../virt-top/virt_top.ml:70 +msgid "Block read reqs" +msgstr "" + +#: ../virt-top/virt_top.ml:71 +msgid "Block write reqs" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:408 +msgid "CPU" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:365 +msgid "CPU affinity" +msgstr "" + +#: ../virt-top/virt_top.ml:1151 +msgid "CPU: %2.1f%% Mem: %Ld MB (%Ld MB by guests)" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:182 +msgid "Cancel" +msgstr "" + +#: ../virt-top/virt_top.ml:1319 +msgid "Change delay from %.1f to: " +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:409 +msgid "Close an existing hypervisor connection." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:118 +msgid "Connect ..." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:160 +msgid "Connect to ..." +msgstr "" + +#: ../virt-df/virt_df.ml:348 ../virt-df/virt_df.ml:346 ../virt-top/virt_top.ml:171 ../virt-top/virt_top.ml:169 +msgid "Connect to URI (default: Xen)" +msgstr "" + +#: ../virt-top/virt_top.ml:1558 +msgid "Connect: %s; Hostname: %s" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:476 +msgid "Core dump a domain to a file for analysis." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:422 +msgid "Create a domain from an XML file." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:534 +msgid "Create a network from an XML file." +msgstr "" + +#: ../virt-top/virt_top.ml:1596 +msgid "DISPLAY MODES" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:426 +msgid "Define (but don't start) a domain from an XML file." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:538 +msgid "Define (but don't start) a network from an XML file." +msgstr "" + +#: ../virt-top/virt_top.ml:1326 +msgid "Delay must be > 0" +msgstr "" + +#: ../virt-top/virt_top.ml:181 +msgid "Delay time interval (seconds)" +msgstr "" + +#: ../virt-top/virt_top.ml:1552 +msgid "Delay: %.1f secs; Batch: %s; Secure: %s; Sort: %s" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:433 +msgid "Destroy a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:541 +msgid "Destroy a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:430 +msgid "Detach device from domain." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:123 +msgid "Details" +msgstr "" + +#: ../virt-top/virt_top.ml:175 +msgid "Disable CPU stats in CSV" +msgstr "" + +#: ../virt-top/virt_top.ml:177 +msgid "Disable block device stats in CSV" +msgstr "" + +#: ../virt-top/virt_top.ml:179 +msgid "Disable net stats in CSV" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:493 +msgid "Display free memory for machine, NUMA cell or range of cells" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:437 +msgid "Display the block device statistics for a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:444 +msgid "Display the network interface statistics for a domain." +msgstr "" + +#: ../virt-df/virt_df.ml:358 +msgid "Display version and exit" +msgstr "" + +#: ../virt-top/virt_top.ml:191 +msgid "Do not read init file" +msgstr "" + +#: ../virt-top/virt_top.ml:66 +msgid "Domain ID" +msgstr "" + +#: ../virt-top/virt_top.ml:67 +msgid "Domain name" +msgstr "" + +#: ../virt-top/virt_top.ml:1610 +msgid "Domains display" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:61 ../virt-top/virt_top_main.ml:47 ../virt-top/virt_top.ml:1528 +msgid "Error" +msgstr "" + +#: ../virt-top/virt_top.ml:185 +msgid "Exit at given time" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:79 +msgid "File" +msgstr "" + +#: ../virt-df/virt_df.ml:502 +msgid "Filesystem" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:606 +msgid "Get the current scheduler parameters for a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:623 +msgid "Get the scheduler type." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:635 +msgid "Gracefully shutdown a domain." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:96 ../virt-ctrl/vc_mainwindow.ml:80 ../virt-top/virt_top.ml:1580 +msgid "Help" +msgstr "" + +#: ../virt-top/virt_top.ml:187 +msgid "Historical CPU delay" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:35 +msgid "Hypervisor connection URI" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:405 +msgid "ID" +msgstr "" + +#: ../virt-df/virt_df.ml:500 +msgid "IFree" +msgstr "" + +#: ../virt-df/virt_df.ml:500 +msgid "IUse" +msgstr "" + +#: ../virt-df/virt_df.ml:500 +msgid "Inodes" +msgstr "" + +#: ../virt-df/virt_df_lvm2.ml:33 +msgid "LVM2 not supported yet" +msgstr "" + +#: ../virt-df/virt_df_ext2.ml:82 +msgid "Linux ext2/3" +msgstr "" + +#: ../virt-df/virt_df_linux_swap.ml:33 +msgid "Linux swap" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:557 +msgid "List the active networks." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:565 +msgid "List the defined but inactive networks." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:516 +msgid "List the defined but not running domains." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:508 +msgid "List the running domains." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:158 +msgid "Local QEMU/KVM" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:157 +msgid "Local Xen" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:93 +msgid "Local network" +msgstr "" + +#: ../virt-top/virt_top.ml:173 +msgid "Log statistics to CSV file" +msgstr "" + +#: ../virt-top/virt_top.ml:1563 +msgid "MAIN KEYS" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:409 +msgid "Memory" +msgstr "" + +#: ../virt-top/virt_top.ml:1617 +msgid "More help in virt-top(1) man page. Press any key to return." +msgstr "" + +#: ../virt-df/virt_df.ml:382 ../virt-top/virt_top.ml:258 +msgid "NB: If you want to monitor a local Xen hypervisor, you usually need to be root" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:406 +msgid "Name" +msgstr "" + +#: ../virt-top/virt_top.ml:68 +msgid "Net RX bytes" +msgstr "" + +#: ../virt-top/virt_top.ml:69 +msgid "Net TX bytes" +msgstr "" + +#: ../virt-top/virt_top.ml:1332 +msgid "Not a valid number" +msgstr "" + +#: ../virt-top/virt_top.ml:193 +msgid "Number of iterations to run" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:170 ../virt-ctrl/vc_connection_dlg.ml:137 +msgid "Open" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:418 +msgid "Open a new hypervisor connection." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:86 +msgid "Open connection ..." +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:40 +msgid "Open connection to hypervisor" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:130 +msgid "Pause" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:670 ../mlvirsh/mlvirsh.ml:666 +msgid "Pin domain VCPU to a list of physical CPUs." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:706 +msgid "Print list of commands or full description of one command." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:584 +msgid "Print node information." +msgstr "" + +#: ../virt-df/virt_df.ml:352 ../virt-df/virt_df.ml:350 +msgid "Print sizes in human-readable format" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:440 +msgid "Print the ID of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:464 +msgid "Print the OS type of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:472 +msgid "Print the UUID of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:581 +msgid "Print the UUID of a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:480 +msgid "Print the XML description of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:545 +msgid "Print the XML description of a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:530 +msgid "Print the bridge name of a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:653 +msgid "Print the canonical URI." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:448 +msgid "Print the domain info." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:468 +msgid "Print the domain state." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:646 +msgid "Print the driver name" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:677 +msgid "Print the driver version" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:500 +msgid "Print the hostname." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:522 +msgid "Print the max VCPUs available." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:456 +msgid "Print the max VCPUs of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:452 +msgid "Print the max memory (in kilobytes) of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:460 +msgid "Print the name of a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:569 +msgid "Print the name of a network." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:497 +msgid "Print whether a domain autostarts at boot." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:549 +msgid "Print whether a network autostarts at boot." +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:83 +msgid "QEMU or KVM" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:89 ../virt-top/virt_top.ml:1578 +msgid "Quit" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:519 +msgid "Quit the interactive terminal." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:36 +msgid "Read-only connection" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:587 +msgid "Reboot a domain." +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:134 +msgid "Refresh" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:592 +msgid "Restore a domain from the named file." +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:133 +msgid "Resume" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:595 +msgid "Resume a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:406 +msgid "Returns capabilities of hypervisor/driver." +msgstr "" + +#: ../virt-top/virt_top.ml:199 +msgid "Run from a script (no user interface)" +msgstr "" + +#: ../virt-top/virt_top.ml:1584 +msgid "SORTING" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:599 +msgid "Save a domain to a file." +msgstr "" + +#: ../virt-top/virt_top.ml:197 +msgid "Secure (\\\"kiosk\\\") mode" +msgstr "" + +#: ../virt-top/virt_top.ml:1593 +msgid "Select sort field" +msgstr "" + +#: ../virt-top/virt_top.ml:183 +msgid "Send debug messages to file" +msgstr "" + +#: ../virt-top/virt_top.ml:189 +msgid "Set name of init file" +msgstr "" + +#: ../virt-top/virt_top.ml:195 +msgid "Set sort order (%s)" +msgstr "" + +#: ../virt-top/virt_top.ml:1340 +msgid "Set sort order for main display" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:631 +msgid "Set the maximum memory used by the domain (in kilobytes)." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:627 +msgid "Set the memory used by the domain (in kilobytes)." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:674 +msgid "Set the number of virtual CPUs assigned to a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:618 +msgid "Set the scheduler parameters for a domain." +msgstr "" + +#: ../virt-top/virt_top.ml:1579 +msgid "Set update interval" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:403 +msgid "Set whether a domain autostarts at boot." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:526 +msgid "Set whether a network autostarts at boot." +msgstr "" + +#: ../virt-df/virt_df.ml:344 ../virt-df/virt_df.ml:342 +msgid "Show all domains (default: only active domains)" +msgstr "" + +#: ../virt-df/virt_df.ml:356 ../virt-df/virt_df.ml:354 +msgid "Show inodes instead of blocks" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:137 +msgid "Shutdown" +msgstr "" + +#: ../virt-df/virt_df.ml:499 +msgid "Size" +msgstr "" + +#: ../virt-top/virt_top.ml:1589 +msgid "Sort by %CPU" +msgstr "" + +#: ../virt-top/virt_top.ml:1590 +msgid "Sort by %MEM" +msgstr "" + +#: ../virt-top/virt_top.ml:1592 +msgid "Sort by ID" +msgstr "" + +#: ../virt-top/virt_top.ml:1591 +msgid "Sort by TIME" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:127 +msgid "Start" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:639 +msgid "Start a previously defined inactive domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:573 +msgid "Start a previously defined inactive network." +msgstr "" + +#: ../virt-top/virt_top.ml:165 +msgid "Start by displaying block devices" +msgstr "" + +#: ../virt-top/virt_top.ml:163 +msgid "Start by displaying network interfaces" +msgstr "" + +#: ../virt-top/virt_top.ml:161 +msgid "Start by displaying pCPUs (default: tasks)" +msgstr "" + +#: ../virt-ctrl/vc_connections.ml:407 +msgid "Status" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:643 +msgid "Suspend a domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:40 +msgid "Synopsis:\n %s [options] [command]\n\nList of all commands:\n %s help\n\nFull description of a single command:\n %s help command\n\nOptions:" +msgstr "" + +#: ../virt-top/virt_top.ml:65 +msgid "TIME (CPU time)" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:62 +msgid "This machine" +msgstr "" + +#: ../virt-top/virt_top.ml:1613 +msgid "Toggle block devices" +msgstr "" + +#: ../virt-top/virt_top.ml:1612 +msgid "Toggle network interfaces" +msgstr "" + +#: ../virt-top/virt_top.ml:1611 +msgid "Toggle physical CPUs" +msgstr "" + +#: ../virt-df/virt_df.ml:502 +msgid "Type" +msgstr "" + +#: ../virt-top/virt_top.ml:1341 +msgid "Type key or use up and down cursor keys." +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:160 +msgid "URI connection" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:650 +msgid "Undefine an inactive domain." +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:577 +msgid "Undefine an inactive network." +msgstr "" + +#: ../virt-top/virt_top.ml:1622 +msgid "Unknown command - try 'h' for help" +msgstr "" + +#: ../virt-top/virt_top.ml:1577 +msgid "Update display" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:690 +msgid "Use '%s help command' for help on a command." +msgstr "" + +#: ../virt-df/virt_df.ml:499 ../virt-df/virt_df.ml:498 +msgid "Used" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:23 +msgid "Virtual Control" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:53 +msgid "Virtualisation error" +msgstr "" + +#: ../virt-ctrl/vc_mainwindow.ml:39 +msgid "Virtualization control tool (virt-ctrl) by\nRichard W.M. Jones (rjones@redhat.com).\n\nCopyright %s 2007-2008 Red Hat Inc.\n\nLibvirt version: %s\n\nGtk toolkit version: %s" +msgstr "" + +#: ../virt-top/virt_top.ml:1523 +msgid "Wrote settings to %s" +msgstr "" + +#: ../virt-ctrl/vc_connection_dlg.ml:76 +msgid "Xen hypervisor" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:364 +msgid "\\tCPU time: %Ld ns\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:362 +msgid "\\tcurrent state: %s\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:361 +msgid "\\ton physical CPU: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:298 ../mlvirsh/mlvirsh.ml:289 ../virt-ctrl/vc_helpers.ml:54 +msgid "blocked" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:330 +msgid "cores: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:342 +msgid "cpu_time: %Ld ns\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:326 +msgid "cpus: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:293 ../virt-ctrl/vc_helpers.ml:58 +msgid "crashed" +msgstr "" + +#: ../virt-df/virt_df.ml:236 +msgid "detection of unpartitioned devices not yet supported" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:242 +msgid "domain %s: not found. Additional info: %s" +msgstr "" + +#: ../virt-df/virt_df_ext2.ml:39 +msgid "error reading ext2/ext3 magic" +msgstr "" + +#: ../virt-df/virt_df.ml:182 +msgid "error reading extended partition" +msgstr "" + +#: ../virt-df/virt_df.ml:149 +msgid "error reading partition table" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:239 +msgid "error set after getting System bus" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:379 +msgid "errors: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:258 +msgid "expected field value pairs, but got an odd number of arguments" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:610 +msgid "expecting domain followed by field value pairs" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:220 +msgid "flag should be '%s'" +msgstr "" + +#: ../virt-df/virt_df.ml:419 ../virt-top/virt_top_xml.ml:46 +msgid "get_xml_desc didn't return " +msgstr "" + +#: ../virt-df/virt_df.ml:427 +msgid "get_xml_desc returned no node in XML" +msgstr "" + +#: ../virt-df/virt_df.ml:430 +msgid "get_xml_desc returned strange node" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:700 +msgid "help: %s: command not found" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:188 ../mlvirsh/mlvirsh.ml:182 ../mlvirsh/mlvirsh.ml:177 ../mlvirsh/mlvirsh.ml:172 ../mlvirsh/mlvirsh.ml:168 ../mlvirsh/mlvirsh.ml:164 ../mlvirsh/mlvirsh.ml:160 +msgid "incorrect number of arguments for function" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:339 +msgid "max_mem: %Ld K\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:340 ../mlvirsh/mlvirsh.ml:325 +msgid "memory: %Ld K\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:327 +msgid "mhz: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:727 +msgid "mlvirsh" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:725 +msgid "mlvirsh(no connection)" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:726 +msgid "mlvirsh(ro)" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:324 +msgid "model: %s\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:253 +msgid "network %s: not found. Additional info: %s" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:328 +msgid "nodes: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:202 ../mlvirsh/mlvirsh.ml:197 +msgid "not connected to the hypervisor" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:341 +msgid "nr_virt_cpu: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:296 +msgid "offline" +msgstr "" + +#: ../virt-df/virt_df_ext2.ml:42 +msgid "partition marked EXT2/3 but no valid filesystem" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:290 ../virt-ctrl/vc_helpers.ml:55 +msgid "paused" +msgstr "" + +#: ../virt-df/virt_df.ml:188 +msgid "probe_extended_partition: internal error" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:376 +msgid "read bytes: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:375 +msgid "read requests: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:297 ../mlvirsh/mlvirsh.ml:288 ../virt-ctrl/vc_helpers.ml:53 +msgid "running" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:384 +msgid "rx bytes: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:387 +msgid "rx dropped: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:386 +msgid "rx errs: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:385 +msgid "rx packets: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:226 +msgid "setting should be '%s' or '%s'" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:291 ../virt-ctrl/vc_helpers.ml:56 +msgid "shutdown" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:292 ../virt-ctrl/vc_helpers.ml:57 +msgid "shutoff" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:329 +msgid "sockets: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:338 +msgid "state: %s\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:331 +msgid "threads: %d\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:198 +msgid "tried to do read-write operation on read-only hypervisor connection" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:388 +msgid "tx bytes: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:391 +msgid "tx dropped: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:390 +msgid "tx errs: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:389 +msgid "tx packets: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:287 ../virt-ctrl/vc_helpers.ml:52 +msgid "unknown" +msgstr "" + +#: ../virt-df/virt_df.ml:246 +msgid "unsupported partition type %02x" +msgstr "" + +#: ../virt-df/virt_df.ml:363 +msgid "virt-df : like 'df', shows disk space used in guests\n\nSUMMARY\n virt-df [-options]\n\nOPTIONS" +msgstr "" + +#: ../virt-top/virt_top.ml:1543 +msgid "virt-top %s (libvirt %d.%d.%d) by Red Hat" +msgstr "" + +#: ../virt-top/virt_top.ml:203 +msgid "virt-top : a 'top'-like utility for virtualization\n\nSUMMARY\n virt-top [-options]\n\nOPTIONS" +msgstr "" + +#: ../virt-top/virt_top.ml:40 +msgid "virt-top was compiled without support for CSV files" +msgstr "" + +#: ../virt-top/virt_top.ml:51 +msgid "virt-top was compiled without support for dates and times" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:360 +msgid "virtual CPU: %d\\n" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:219 +msgid "warning: ignored unknown message %s from %s\\n%!" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:124 +msgid "warning: unexpected message contents of Found signal" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:188 +msgid "warning: unexpected message contents of ItemNew signal" +msgstr "" + +#: ../virt-ctrl/vc_dbus.ml:140 +msgid "warning: unexpected message contents of ItemRemove signal" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:378 +msgid "write bytes: %Ld\\n" +msgstr "" + +#: ../mlvirsh/mlvirsh.ml:377 +msgid "write requests: %Ld\\n" +msgstr "" + diff --git a/wininstaller.nsis.in b/wininstaller.nsis.in new file mode 100644 index 0000000..b5971a5 --- /dev/null +++ b/wininstaller.nsis.in @@ -0,0 +1,131 @@ +#!Nsis Installer Command Script +# @configure_input@ +# Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones +# +# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# To build the installer: +# +# ./configure --with-nsis=/c/Progra~1/NSIS +# make all opt +# make wininstaller + +# Installer name. +Name "OCaml Libvirt ${VERSION}" + +# This is where we will write the installer to, set by Makefile. +OutFile "${OUTFILE}" + +# Target directory, or use value from the registry. +InstallDir "c:\${PACKAGE}" +InstallDirRegKey HKLM SOFTWARE\OCAML-LIBVIRT "Install_Dir" + +# Hide details. +ShowInstDetails hide +ShowUninstDetails hide + +# BZip2-compressed files are smaller but use more memory at runtime. +SetCompressor bzip2 + +# Include an XP manifest. +XPStyle on + +# Pages in the installer wizard. +Page license +Page components +Page directory +Page instfiles + +# Title, data for license page. +LicenseText "Continue" +LicenseData "winlicense.rtf" + +# Title for components page. +ComponentText "This will install OCaml libvirt bindings, dependent libraries and programs on your computer. Select which optional components you want installed." + +# Title for the install directory page. +DirText "Please select the installation folder." + +# Installer sections. +Section "Libvirt and its libraries (required)" + # Make this required. + SectionIn RO + + SetOutPath $INSTDIR + File "@LIBVIRT_DLL_PATH@\libvirt-0.dll" + File "@LIBXDR_DLL_PATH@\libxdr.dll" + File "@LIBXML2_DLL_PATH@\libxml2-2.dll" + File "@GNUTLS_DLL_PATH@\libgcrypt-??.dll" + File "@GNUTLS_DLL_PATH@\libgnutls-??.dll" + File "@GNUTLS_DLL_PATH@\libgpg-error-?.dll" + File "@GNUTLS_DLL_PATH@\libtasn1-?.dll" + File "@GTK_DLL_PATH@\*.dll" + + SetOutPath $INSTDIR\lib + File /r "@GTK_PATH@\lib\gtk-2.0" + File /r "@GTK_PATH@\lib\pango" + + SetOutPath $INSTDIR + File /r "@GTK_PATH@\etc" + + SetOutPath $INSTDIR +SectionEnd + +Section "Programs (recommended)" + SetOutPath $INSTDIR + File "/oname=mlvirsh.exe" "mlvirsh\mlvirsh.opt" + File "/oname=virt-ctrl.exe" "virt-ctrl\virt-ctrl.opt" +SectionEnd + +Section "OCaml Libvirt bindings (for developers only)" + # XXX Need to find out where Objective CAML is installed. +SectionEnd + +Section "Start Menu Shortcuts" + CreateDirectory "$SMPROGRAMS\${PACKAGE}" + CreateShortCut "$SMPROGRAMS\${PACKAGE}\Uninstall.lnk" "$INSTDIR\Uninstall ${PACKAGE}.exe" "" "$INSTDIR\Uninstall ${PACKAGE}.exe" 0 + CreateShortCut "$SMPROGRAMS\${PACKAGE}\Virt Shell.lnk" "$INSTDIR\mlvirsh.exe" "" "$INSTDIR\mlvirsh.exe" 0 + CreateShortCut "$SMPROGRAMS\${PACKAGE}\Virt Control.lnk" "$INSTDIR\virt-ctrl.exe" "" "$INSTDIR\virt-ctrl.exe" 0 +SectionEnd + +Section "Desktop Icons" + CreateShortCut "$DESKTOP\Virt Shell.lnk" "$INSTDIR\mlvirsh.exe" "" "$INSTDIR\mlvirsh.exe" 0 + CreateShortCut "$DESKTOP\Virt Control.lnk" "$INSTDIR\virt-ctrl.exe" "" "$INSTDIR\virt-ctrl.exe" 0 +SectionEnd + +Section "Uninstall" + # Desktop icons + Delete /rebootok "$DESKTOP\Virt Shell.lnk" + Delete /rebootok "$DESKTOP\Virt Control.lnk" + + # Menu shortcuts + Delete /rebootok "$SMPROGRAMS\${PACKAGE}\Virt Shell.lnk" + Delete /rebootok "$SMPROGRAMS\${PACKAGE}\Virt Control.lnk" + Delete /rebootok "$SMPROGRAMS\${PACKAGE}\Uninstall.lnk" + RMDir "$SMPROGRAMS\${PACKAGE}" + + # Files in installation directory. + RMDir /r "$INSTDIR\etc" + RMDir /r "$INSTDIR\lib" + Delete /rebootok "$INSTDIR\*.exe" + Delete /rebootok "$INSTDIR\*.dll" + + RMDir "$INSTDIR" +SectionEnd + +# Write an uninstaller into the installation directory. +Section -post + WriteUninstaller "$INSTDIR\Uninstall ${PACKAGE}.exe" +SectionEnd diff --git a/winlicense.rtf b/winlicense.rtf new file mode 100644 index 0000000..42a4a80 --- /dev/null +++ b/winlicense.rtf @@ -0,0 +1,871 @@ +{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil\fcharset0 Courier New;}} +{\*\generator Msftedit 5.41.21.2507;}\viewkind4\uc1\pard\f0\fs20 OCaml libvirt bindings and programs\par +Copyright \'a9 2007-2008 Red Hat Inc.\par +http://libvirt.org\par +\par +Programs and libraries in this installer are licensed variously under the GNU General Public License (GPL) and GNU Lesser General Public License (LGPL) version 2 and above. These licenses are reproduced below. Source for all parts is available from the website at http://libvirt.org.\par +\par +\par +\par +\par +\f1\tab\tab GNU GENERAL PUBLIC LICENSE\par +\tab\tab Version 2, June 1991\par +\par + Copyright (C) 1989, 1991 Free Software Foundation, Inc.\par + 675 Mass Ave, Cambridge, MA 02139, USA\par + Everyone is permitted to copy and distribute verbatim copies\par + of this license document, but changing it is not allowed.\par +\par +\tab\tab\tab Preamble\par +\par + The licenses for most software are designed to take away your\par +freedom to share and change it. By contrast, the GNU General Public\par +License is intended to guarantee your freedom to share and change free\par +software--to make sure the software is free for all its users. This\par +General Public License applies to most of the Free Software\par +Foundation's software and to any other program whose authors commit to\par +using it. (Some other Free Software Foundation software is covered by\par +the GNU Library General Public License instead.) You can apply it to\par +your programs, too.\par +\par + When we speak of free software, we are referring to freedom, not\par +price. Our General Public Licenses are designed to make sure that you\par +have the freedom to distribute copies of free software (and charge for\par +this service if you wish), that you receive source code or can get it\par +if you want it, that you can change the software or use pieces of it\par +in new free programs; and that you know you can do these things.\par +\par + To protect your rights, we need to make restrictions that forbid\par +anyone to deny you these rights or to ask you to surrender the rights.\par +These restrictions translate to certain responsibilities for you if you\par +distribute copies of the software, or if you modify it.\par +\par + For example, if you distribute copies of such a program, whether\par +gratis or for a fee, you must give the recipients all the rights that\par +you have. You must make sure that they, too, receive or can get the\par +source code. And you must show them these terms so they know their\par +rights.\par +\par + We protect your rights with two steps: (1) copyright the software, and\par +(2) offer you this license which gives you legal permission to copy,\par +distribute and/or modify the software.\par +\par + Also, for each author's protection and ours, we want to make certain\par +that everyone understands that there is no warranty for this free\par +software. If the software is modified by someone else and passed on, we\par +want its recipients to know that what they have is not the original, so\par +that any problems introduced by others will not reflect on the original\par +authors' reputations.\par +\par + Finally, any free program is threatened constantly by software\par +patents. We wish to avoid the danger that redistributors of a free\par +program will individually obtain patent licenses, in effect making the\par +program proprietary. To prevent this, we have made it clear that any\par +patent must be licensed for everyone's free use or not licensed at all.\par +\par + The precise terms and conditions for copying, distribution and\par +modification follow.\par +\page\par +\tab\tab GNU GENERAL PUBLIC LICENSE\par + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\par +\par + 0. This License applies to any program or other work which contains\par +a notice placed by the copyright holder saying it may be distributed\par +under the terms of this General Public License. The "Program", below,\par +refers to any such program or work, and a "work based on the Program"\par +means either the Program or any derivative work under copyright law:\par +that is to say, a work containing the Program or a portion of it,\par +either verbatim or with modifications and/or translated into another\par +language. (Hereinafter, translation is included without limitation in\par +the term "modification".) Each licensee is addressed as "you".\par +\par +Activities other than copying, distribution and modification are not\par +covered by this License; they are outside its scope. The act of\par +running the Program is not restricted, and the output from the Program\par +is covered only if its contents constitute a work based on the\par +Program (independent of having been made by running the Program).\par +Whether that is true depends on what the Program does.\par +\par + 1. You may copy and distribute verbatim copies of the Program's\par +source code as you receive it, in any medium, provided that you\par +conspicuously and appropriately publish on each copy an appropriate\par +copyright notice and disclaimer of warranty; keep intact all the\par +notices that refer to this License and to the absence of any warranty;\par +and give any other recipients of the Program a copy of this License\par +along with the Program.\par +\par +You may charge a fee for the physical act of transferring a copy, and\par +you may at your option offer warranty protection in exchange for a fee.\par +\par + 2. You may modify your copy or copies of the Program or any portion\par +of it, thus forming a work based on the Program, and copy and\par +distribute such modifications or work under the terms of Section 1\par +above, provided that you also meet all of these conditions:\par +\par + a) You must cause the modified files to carry prominent notices\par + stating that you changed the files and the date of any change.\par +\par + b) You must cause any work that you distribute or publish, that in\par + whole or in part contains or is derived from the Program or any\par + part thereof, to be licensed as a whole at no charge to all third\par + parties under the terms of this License.\par +\par + c) If the modified program normally reads commands interactively\par + when run, you must cause it, when started running for such\par + interactive use in the most ordinary way, to print or display an\par + announcement including an appropriate copyright notice and a\par + notice that there is no warranty (or else, saying that you provide\par + a warranty) and that users may redistribute the program under\par + these conditions, and telling the user how to view a copy of this\par + License. (Exception: if the Program itself is interactive but\par + does not normally print such an announcement, your work based on\par + the Program is not required to print an announcement.)\par +\page\par +These requirements apply to the modified work as a whole. If\par +identifiable sections of that work are not derived from the Program,\par +and can be reasonably considered independent and separate works in\par +themselves, then this License, and its terms, do not apply to those\par +sections when you distribute them as separate works. But when you\par +distribute the same sections as part of a whole which is a work based\par +on the Program, the distribution of the whole must be on the terms of\par +this License, whose permissions for other licensees extend to the\par +entire whole, and thus to each and every part regardless of who wrote it.\par +\par +Thus, it is not the intent of this section to claim rights or contest\par +your rights to work written entirely by you; rather, the intent is to\par +exercise the right to control the distribution of derivative or\par +collective works based on the Program.\par +\par +In addition, mere aggregation of another work not based on the Program\par +with the Program (or with a work based on the Program) on a volume of\par +a storage or distribution medium does not bring the other work under\par +the scope of this License.\par +\par + 3. You may copy and distribute the Program (or a work based on it,\par +under Section 2) in object code or executable form under the terms of\par +Sections 1 and 2 above provided that you also do one of the following:\par +\par + a) Accompany it with the complete corresponding machine-readable\par + source code, which must be distributed under the terms of Sections\par + 1 and 2 above on a medium customarily used for software interchange; or,\par +\par + b) Accompany it with a written offer, valid for at least three\par + years, to give any third party, for a charge no more than your\par + cost of physically performing source distribution, a complete\par + machine-readable copy of the corresponding source code, to be\par + distributed under the terms of Sections 1 and 2 above on a medium\par + customarily used for software interchange; or,\par +\par + c) Accompany it with the information you received as to the offer\par + to distribute corresponding source code. (This alternative is\par + allowed only for noncommercial distribution and only if you\par + received the program in object code or executable form with such\par + an offer, in accord with Subsection b above.)\par +\par +The source code for a work means the preferred form of the work for\par +making modifications to it. For an executable work, complete source\par +code means all the source code for all modules it contains, plus any\par +associated interface definition files, plus the scripts used to\par +control compilation and installation of the executable. However, as a\par +special exception, the source code distributed need not include\par +anything that is normally distributed (in either source or binary\par +form) with the major components (compiler, kernel, and so on) of the\par +operating system on which the executable runs, unless that component\par +itself accompanies the executable.\par +\par +If distribution of executable or object code is made by offering\par +access to copy from a designated place, then offering equivalent\par +access to copy the source code from the same place counts as\par +distribution of the source code, even though third parties are not\par +compelled to copy the source along with the object code.\par +\page\par + 4. You may not copy, modify, sublicense, or distribute the Program\par +except as expressly provided under this License. Any attempt\par +otherwise to copy, modify, sublicense or distribute the Program is\par +void, and will automatically terminate your rights under this License.\par +However, parties who have received copies, or rights, from you under\par +this License will not have their licenses terminated so long as such\par +parties remain in full compliance.\par +\par + 5. You are not required to accept this License, since you have not\par +signed it. However, nothing else grants you permission to modify or\par +distribute the Program or its derivative works. These actions are\par +prohibited by law if you do not accept this License. Therefore, by\par +modifying or distributing the Program (or any work based on the\par +Program), you indicate your acceptance of this License to do so, and\par +all its terms and conditions for copying, distributing or modifying\par +the Program or works based on it.\par +\par + 6. Each time you redistribute the Program (or any work based on the\par +Program), the recipient automatically receives a license from the\par +original licensor to copy, distribute or modify the Program subject to\par +these terms and conditions. You may not impose any further\par +restrictions on the recipients' exercise of the rights granted herein.\par +You are not responsible for enforcing compliance by third parties to\par +this License.\par +\par + 7. If, as a consequence of a court judgment or allegation of patent\par +infringement or for any other reason (not limited to patent issues),\par +conditions are imposed on you (whether by court order, agreement or\par +otherwise) that contradict the conditions of this License, they do not\par +excuse you from the conditions of this License. If you cannot\par +distribute so as to satisfy simultaneously your obligations under this\par +License and any other pertinent obligations, then as a consequence you\par +may not distribute the Program at all. For example, if a patent\par +license would not permit royalty-free redistribution of the Program by\par +all those who receive copies directly or indirectly through you, then\par +the only way you could satisfy both it and this License would be to\par +refrain entirely from distribution of the Program.\par +\par +If any portion of this section is held invalid or unenforceable under\par +any particular circumstance, the balance of the section is intended to\par +apply and the section as a whole is intended to apply in other\par +circumstances.\par +\par +It is not the purpose of this section to induce you to infringe any\par +patents or other property right claims or to contest validity of any\par +such claims; this section has the sole purpose of protecting the\par +integrity of the free software distribution system, which is\par +implemented by public license practices. Many people have made\par +generous contributions to the wide range of software distributed\par +through that system in reliance on consistent application of that\par +system; it is up to the author/donor to decide if he or she is willing\par +to distribute software through any other system and a licensee cannot\par +impose that choice.\par +\par +This section is intended to make thoroughly clear what is believed to\par +be a consequence of the rest of this License.\par +\page\par + 8. If the distribution and/or use of the Program is restricted in\par +certain countries either by patents or by copyrighted interfaces, the\par +original copyright holder who places the Program under this License\par +may add an explicit geographical distribution limitation excluding\par +those countries, so that distribution is permitted only in or among\par +countries not thus excluded. In such case, this License incorporates\par +the limitation as if written in the body of this License.\par +\par + 9. The Free Software Foundation may publish revised and/or new versions\par +of the General Public License from time to time. Such new versions will\par +be similar in spirit to the present version, but may differ in detail to\par +address new problems or concerns.\par +\par +Each version is given a distinguishing version number. If the Program\par +specifies a version number of this License which applies to it and "any\par +later version", you have the option of following the terms and conditions\par +either of that version or of any later version published by the Free\par +Software Foundation. If the Program does not specify a version number of\par +this License, you may choose any version ever published by the Free Software\par +Foundation.\par +\par + 10. If you wish to incorporate parts of the Program into other free\par +programs whose distribution conditions are different, write to the author\par +to ask for permission. For software which is copyrighted by the Free\par +Software Foundation, write to the Free Software Foundation; we sometimes\par +make exceptions for this. Our decision will be guided by the two goals\par +of preserving the free status of all derivatives of our free software and\par +of promoting the sharing and reuse of software generally.\par +\par +\tab\tab\tab NO WARRANTY\par +\par + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\par +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\par +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\par +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\par +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\par +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\par +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\par +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\par +REPAIR OR CORRECTION.\par +\par + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\par +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\par +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\par +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\par +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\par +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\par +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\par +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\par +POSSIBILITY OF SUCH DAMAGES.\par +\par +\tab\tab END OF TERMS AND CONDITIONS\par +\page\par +\tab How to Apply These Terms to Your New Programs\par +\par + If you develop a new program, and you want it to be of the greatest\par +possible use to the public, the best way to achieve this is to make it\par +free software which everyone can redistribute and change under these terms.\par +\par + To do so, attach the following notices to the program. It is safest\par +to attach them to the start of each source file to most effectively\par +convey the exclusion of warranty; and each file should have at least\par +the "copyright" line and a pointer to where the full notice is found.\par +\par + \par + Copyright (C) 19yy \par +\par + This program is free software; you can redistribute it and/or modify\par + it under the terms of the GNU General Public License as published by\par + the Free Software Foundation; either version 2 of the License, or\par + (at your option) any later version.\par +\par + This program is distributed in the hope that it will be useful,\par + but WITHOUT ANY WARRANTY; without even the implied warranty of\par + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\par + GNU General Public License for more details.\par +\par + You should have received a copy of the GNU General Public License\par + along with this program; if not, write to the Free Software\par + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\par +\par +Also add information on how to contact you by electronic and paper mail.\par +\par +If the program is interactive, make it output a short notice like this\par +when it starts in an interactive mode:\par +\par + Gnomovision version 69, Copyright (C) 19yy name of author\par + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\par + This is free software, and you are welcome to redistribute it\par + under certain conditions; type `show c' for details.\par +\par +The hypothetical commands `show w' and `show c' should show the appropriate\par +parts of the General Public License. Of course, the commands you use may\par +be called something other than `show w' and `show c'; they could even be\par +mouse-clicks or menu items--whatever suits your program.\par +\par +You should also get your employer (if you work as a programmer) or your\par +school, if any, to sign a "copyright disclaimer" for the program, if\par +necessary. Here is a sample; alter the names:\par +\par + Yoyodyne, Inc., hereby disclaims all copyright interest in the program\par + `Gnomovision' (which makes passes at compilers) written by James Hacker.\par +\par + , 1 April 1989\par + Ty Coon, President of Vice\par +\par +This General Public License does not permit incorporating your program into\par +proprietary programs. If your program is a subroutine library, you may\par +consider it more useful to permit linking proprietary applications with the\par +library. If this is what you want to do, use the GNU Library General\par +Public License instead of this License.\par +\par +\f0\par +\par +\f1\par + GNU LESSER GENERAL PUBLIC LICENSE\par + Version 2.1, February 1999\par +\par + Copyright (C) 1991, 1999 Free Software Foundation, Inc.\par + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\par + Everyone is permitted to copy and distribute verbatim copies\par + of this license document, but changing it is not allowed.\par +\par +[This is the first released version of the Lesser GPL. It also counts\par + as the successor of the GNU Library Public License, version 2, hence\par + the version number 2.1.]\par +\par + Preamble\par +\par + The licenses for most software are designed to take away your\par +freedom to share and change it. By contrast, the GNU General Public\par +Licenses are intended to guarantee your freedom to share and change\par +free software--to make sure the software is free for all its users.\par +\par + This license, the Lesser General Public License, applies to some\par +specially designated software packages--typically libraries--of the\par +Free Software Foundation and other authors who decide to use it. You\par +can use it too, but we suggest you first think carefully about whether\par +this license or the ordinary General Public License is the better\par +strategy to use in any particular case, based on the explanations\par +below.\par +\par + When we speak of free software, we are referring to freedom of use,\par +not price. Our General Public Licenses are designed to make sure that\par +you have the freedom to distribute copies of free software (and charge\par +for this service if you wish); that you receive source code or can get\par +it if you want it; that you can change the software and use pieces of\par +it in new free programs; and that you are informed that you can do\par +these things.\par +\par + To protect your rights, we need to make restrictions that forbid\par +distributors to deny you these rights or to ask you to surrender these\par +rights. These restrictions translate to certain responsibilities for\par +you if you distribute copies of the library or if you modify it.\par +\par + For example, if you distribute copies of the library, whether gratis\par +or for a fee, you must give the recipients all the rights that we gave\par +you. You must make sure that they, too, receive or can get the source\par +code. If you link other code with the library, you must provide\par +complete object files to the recipients, so that they can relink them\par +with the library after making changes to the library and recompiling\par +it. And you must show them these terms so they know their rights.\par +\par + We protect your rights with a two-step method: (1) we copyright the\par +library, and (2) we offer you this license, which gives you legal\par +permission to copy, distribute and/or modify the library.\par +\par + To protect each distributor, we want to make it very clear that\par +there is no warranty for the free library. Also, if the library is\par +modified by someone else and passed on, the recipients should know\par +that what they have is not the original version, so that the original\par +author's reputation will not be affected by problems that might be\par +introduced by others.\par +^L\par + Finally, software patents pose a constant threat to the existence of\par +any free program. We wish to make sure that a company cannot\par +effectively restrict the users of a free program by obtaining a\par +restrictive license from a patent holder. Therefore, we insist that\par +any patent license obtained for a version of the library must be\par +consistent with the full freedom of use specified in this license.\par +\par + Most GNU software, including some libraries, is covered by the\par +ordinary GNU General Public License. This license, the GNU Lesser\par +General Public License, applies to certain designated libraries, and\par +is quite different from the ordinary General Public License. We use\par +this license for certain libraries in order to permit linking those\par +libraries into non-free programs.\par +\par + When a program is linked with a library, whether statically or using\par +a shared library, the combination of the two is legally speaking a\par +combined work, a derivative of the original library. The ordinary\par +General Public License therefore permits such linking only if the\par +entire combination fits its criteria of freedom. The Lesser General\par +Public License permits more lax criteria for linking other code with\par +the library.\par +\par + We call this license the "Lesser" General Public License because it\par +does Less to protect the user's freedom than the ordinary General\par +Public License. It also provides other free software developers Less\par +of an advantage over competing non-free programs. These disadvantages\par +are the reason we use the ordinary General Public License for many\par +libraries. However, the Lesser license provides advantages in certain\par +special circumstances.\par +\par + For example, on rare occasions, there may be a special need to\par +encourage the widest possible use of a certain library, so that it\par +becomes\par +a de-facto standard. To achieve this, non-free programs must be\par +allowed to use the library. A more frequent case is that a free\par +library does the same job as widely used non-free libraries. In this\par +case, there is little to gain by limiting the free library to free\par +software only, so we use the Lesser General Public License.\par +\par + In other cases, permission to use a particular library in non-free\par +programs enables a greater number of people to use a large body of\par +free software. For example, permission to use the GNU C Library in\par +non-free programs enables many more people to use the whole GNU\par +operating system, as well as its variant, the GNU/Linux operating\par +system.\par +\par + Although the Lesser General Public License is Less protective of the\par +users' freedom, it does ensure that the user of a program that is\par +linked with the Library has the freedom and the wherewithal to run\par +that program using a modified version of the Library.\par +\par + The precise terms and conditions for copying, distribution and\par +modification follow. Pay close attention to the difference between a\par +"work based on the library" and a "work that uses the library". The\par +former contains code derived from the library, whereas the latter must\par +be combined with the library in order to run.\par +^L\par + GNU LESSER GENERAL PUBLIC LICENSE\par + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\par +\par + 0. This License Agreement applies to any software library or other\par +program which contains a notice placed by the copyright holder or\par +other authorized party saying it may be distributed under the terms of\par +this Lesser General Public License (also called "this License").\par +Each licensee is addressed as "you".\par +\par + A "library" means a collection of software functions and/or data\par +prepared so as to be conveniently linked with application programs\par +(which use some of those functions and data) to form executables.\par +\par + The "Library", below, refers to any such software library or work\par +which has been distributed under these terms. A "work based on the\par +Library" means either the Library or any derivative work under\par +copyright law: that is to say, a work containing the Library or a\par +portion of it, either verbatim or with modifications and/or translated\par +straightforwardly into another language. (Hereinafter, translation is\par +included without limitation in the term "modification".)\par +\par + "Source code" for a work means the preferred form of the work for\par +making modifications to it. For a library, complete source code means\par +all the source code for all modules it contains, plus any associated\par +interface definition files, plus the scripts used to control\par +compilation\par +and installation of the library.\par +\par + Activities other than copying, distribution and modification are not\par +covered by this License; they are outside its scope. The act of\par +running a program using the Library is not restricted, and output from\par +such a program is covered only if its contents constitute a work based\par +on the Library (independent of the use of the Library in a tool for\par +writing it). Whether that is true depends on what the Library does\par +and what the program that uses the Library does.\par +\par + 1. You may copy and distribute verbatim copies of the Library's\par +complete source code as you receive it, in any medium, provided that\par +you conspicuously and appropriately publish on each copy an\par +appropriate copyright notice and disclaimer of warranty; keep intact\par +all the notices that refer to this License and to the absence of any\par +warranty; and distribute a copy of this License along with the\par +Library.\par +\par + You may charge a fee for the physical act of transferring a copy,\par +and you may at your option offer warranty protection in exchange for a\par +fee.\par +\page\par + 2. You may modify your copy or copies of the Library or any portion\par +of it, thus forming a work based on the Library, and copy and\par +distribute such modifications or work under the terms of Section 1\par +above, provided that you also meet all of these conditions:\par +\par + a) The modified work must itself be a software library.\par +\par + b) You must cause the files modified to carry prominent notices\par + stating that you changed the files and the date of any change.\par +\par + c) You must cause the whole of the work to be licensed at no\par + charge to all third parties under the terms of this License.\par +\par + d) If a facility in the modified Library refers to a function or a\par + table of data to be supplied by an application program that uses\par + the facility, other than as an argument passed when the facility\par + is invoked, then you must make a good faith effort to ensure that,\par + in the event an application does not supply such function or\par + table, the facility still operates, and performs whatever part of\par + its purpose remains meaningful.\par +\par + (For example, a function in a library to compute square roots has\par + a purpose that is entirely well-defined independent of the\par + application. Therefore, Subsection 2d requires that any\par + application-supplied function or table used by this function must\par + be optional: if the application does not supply it, the square\par + root function must still compute square roots.)\par +\par +These requirements apply to the modified work as a whole. If\par +identifiable sections of that work are not derived from the Library,\par +and can be reasonably considered independent and separate works in\par +themselves, then this License, and its terms, do not apply to those\par +sections when you distribute them as separate works. But when you\par +distribute the same sections as part of a whole which is a work based\par +on the Library, the distribution of the whole must be on the terms of\par +this License, whose permissions for other licensees extend to the\par +entire whole, and thus to each and every part regardless of who wrote\par +it.\par +\par +Thus, it is not the intent of this section to claim rights or contest\par +your rights to work written entirely by you; rather, the intent is to\par +exercise the right to control the distribution of derivative or\par +collective works based on the Library.\par +\par +In addition, mere aggregation of another work not based on the Library\par +with the Library (or with a work based on the Library) on a volume of\par +a storage or distribution medium does not bring the other work under\par +the scope of this License.\par +\par + 3. You may opt to apply the terms of the ordinary GNU General Public\par +License instead of this License to a given copy of the Library. To do\par +this, you must alter all the notices that refer to this License, so\par +that they refer to the ordinary GNU General Public License, version 2,\par +instead of to this License. (If a newer version than version 2 of the\par +ordinary GNU General Public License has appeared, then you can specify\par +that version instead if you wish.) Do not make any other change in\par +these notices.\par +^L\par + Once this change is made in a given copy, it is irreversible for\par +that copy, so the ordinary GNU General Public License applies to all\par +subsequent copies and derivative works made from that copy.\par +\par + This option is useful when you wish to copy part of the code of\par +the Library into a program that is not a library.\par +\par + 4. You may copy and distribute the Library (or a portion or\par +derivative of it, under Section 2) in object code or executable form\par +under the terms of Sections 1 and 2 above provided that you accompany\par +it with the complete corresponding machine-readable source code, which\par +must be distributed under the terms of Sections 1 and 2 above on a\par +medium customarily used for software interchange.\par +\par + If distribution of object code is made by offering access to copy\par +from a designated place, then offering equivalent access to copy the\par +source code from the same place satisfies the requirement to\par +distribute the source code, even though third parties are not\par +compelled to copy the source along with the object code.\par +\par + 5. A program that contains no derivative of any portion of the\par +Library, but is designed to work with the Library by being compiled or\par +linked with it, is called a "work that uses the Library". Such a\par +work, in isolation, is not a derivative work of the Library, and\par +therefore falls outside the scope of this License.\par +\par + However, linking a "work that uses the Library" with the Library\par +creates an executable that is a derivative of the Library (because it\par +contains portions of the Library), rather than a "work that uses the\par +library". The executable is therefore covered by this License.\par +Section 6 states terms for distribution of such executables.\par +\par + When a "work that uses the Library" uses material from a header file\par +that is part of the Library, the object code for the work may be a\par +derivative work of the Library even though the source code is not.\par +Whether this is true is especially significant if the work can be\par +linked without the Library, or if the work is itself a library. The\par +threshold for this to be true is not precisely defined by law.\par +\par + If such an object file uses only numerical parameters, data\par +structure layouts and accessors, and small macros and small inline\par +functions (ten lines or less in length), then the use of the object\par +file is unrestricted, regardless of whether it is legally a derivative\par +work. (Executables containing this object code plus portions of the\par +Library will still fall under Section 6.)\par +\par + Otherwise, if the work is a derivative of the Library, you may\par +distribute the object code for the work under the terms of Section 6.\par +Any executables containing that work also fall under Section 6,\par +whether or not they are linked directly with the Library itself.\par +^L\par + 6. As an exception to the Sections above, you may also combine or\par +link a "work that uses the Library" with the Library to produce a\par +work containing portions of the Library, and distribute that work\par +under terms of your choice, provided that the terms permit\par +modification of the work for the customer's own use and reverse\par +engineering for debugging such modifications.\par +\par + You must give prominent notice with each copy of the work that the\par +Library is used in it and that the Library and its use are covered by\par +this License. You must supply a copy of this License. If the work\par +during execution displays copyright notices, you must include the\par +copyright notice for the Library among them, as well as a reference\par +directing the user to the copy of this License. Also, you must do one\par +of these things:\par +\par + a) Accompany the work with the complete corresponding\par + machine-readable source code for the Library including whatever\par + changes were used in the work (which must be distributed under\par + Sections 1 and 2 above); and, if the work is an executable linked\par + with the Library, with the complete machine-readable "work that\par + uses the Library", as object code and/or source code, so that the\par + user can modify the Library and then relink to produce a modified\par + executable containing the modified Library. (It is understood\par + that the user who changes the contents of definitions files in the\par + Library will not necessarily be able to recompile the application\par + to use the modified definitions.)\par +\par + b) Use a suitable shared library mechanism for linking with the\par + Library. A suitable mechanism is one that (1) uses at run time a\par + copy of the library already present on the user's computer system,\par + rather than copying library functions into the executable, and (2)\par + will operate properly with a modified version of the library, if\par + the user installs one, as long as the modified version is\par + interface-compatible with the version that the work was made with.\par +\par + c) Accompany the work with a written offer, valid for at\par + least three years, to give the same user the materials\par + specified in Subsection 6a, above, for a charge no more\par + than the cost of performing this distribution.\par +\par + d) If distribution of the work is made by offering access to copy\par + from a designated place, offer equivalent access to copy the above\par + specified materials from the same place.\par +\par + e) Verify that the user has already received a copy of these\par + materials or that you have already sent this user a copy.\par +\par + For an executable, the required form of the "work that uses the\par +Library" must include any data and utility programs needed for\par +reproducing the executable from it. However, as a special exception,\par +the materials to be distributed need not include anything that is\par +normally distributed (in either source or binary form) with the major\par +components (compiler, kernel, and so on) of the operating system on\par +which the executable runs, unless that component itself accompanies\par +the executable.\par +\par + It may happen that this requirement contradicts the license\par +restrictions of other proprietary libraries that do not normally\par +accompany the operating system. Such a contradiction means you cannot\par +use both them and the Library together in an executable that you\par +distribute.\par +^L\par + 7. You may place library facilities that are a work based on the\par +Library side-by-side in a single library together with other library\par +facilities not covered by this License, and distribute such a combined\par +library, provided that the separate distribution of the work based on\par +the Library and of the other library facilities is otherwise\par +permitted, and provided that you do these two things:\par +\par + a) Accompany the combined library with a copy of the same work\par + based on the Library, uncombined with any other library\par + facilities. This must be distributed under the terms of the\par + Sections above.\par +\par + b) Give prominent notice with the combined library of the fact\par + that part of it is a work based on the Library, and explaining\par + where to find the accompanying uncombined form of the same work.\par +\par + 8. You may not copy, modify, sublicense, link with, or distribute\par +the Library except as expressly provided under this License. Any\par +attempt otherwise to copy, modify, sublicense, link with, or\par +distribute the Library is void, and will automatically terminate your\par +rights under this License. However, parties who have received copies,\par +or rights, from you under this License will not have their licenses\par +terminated so long as such parties remain in full compliance.\par +\par + 9. You are not required to accept this License, since you have not\par +signed it. However, nothing else grants you permission to modify or\par +distribute the Library or its derivative works. These actions are\par +prohibited by law if you do not accept this License. Therefore, by\par +modifying or distributing the Library (or any work based on the\par +Library), you indicate your acceptance of this License to do so, and\par +all its terms and conditions for copying, distributing or modifying\par +the Library or works based on it.\par +\par + 10. Each time you redistribute the Library (or any work based on the\par +Library), the recipient automatically receives a license from the\par +original licensor to copy, distribute, link with or modify the Library\par +subject to these terms and conditions. You may not impose any further\par +restrictions on the recipients' exercise of the rights granted herein.\par +You are not responsible for enforcing compliance by third parties with\par +this License.\par +^L\par + 11. If, as a consequence of a court judgment or allegation of patent\par +infringement or for any other reason (not limited to patent issues),\par +conditions are imposed on you (whether by court order, agreement or\par +otherwise) that contradict the conditions of this License, they do not\par +excuse you from the conditions of this License. If you cannot\par +distribute so as to satisfy simultaneously your obligations under this\par +License and any other pertinent obligations, then as a consequence you\par +may not distribute the Library at all. For example, if a patent\par +license would not permit royalty-free redistribution of the Library by\par +all those who receive copies directly or indirectly through you, then\par +the only way you could satisfy both it and this License would be to\par +refrain entirely from distribution of the Library.\par +\par +If any portion of this section is held invalid or unenforceable under\par +any particular circumstance, the balance of the section is intended to\par +apply, and the section as a whole is intended to apply in other\par +circumstances.\par +\par +It is not the purpose of this section to induce you to infringe any\par +patents or other property right claims or to contest validity of any\par +such claims; this section has the sole purpose of protecting the\par +integrity of the free software distribution system which is\par +implemented by public license practices. Many people have made\par +generous contributions to the wide range of software distributed\par +through that system in reliance on consistent application of that\par +system; it is up to the author/donor to decide if he or she is willing\par +to distribute software through any other system and a licensee cannot\par +impose that choice.\par +\par +This section is intended to make thoroughly clear what is believed to\par +be a consequence of the rest of this License.\par +\par + 12. If the distribution and/or use of the Library is restricted in\par +certain countries either by patents or by copyrighted interfaces, the\par +original copyright holder who places the Library under this License\par +may add an explicit geographical distribution limitation excluding those\par +countries, so that distribution is permitted only in or among\par +countries not thus excluded. In such case, this License incorporates\par +the limitation as if written in the body of this License.\par +\par + 13. The Free Software Foundation may publish revised and/or new\par +versions of the Lesser General Public License from time to time.\par +Such new versions will be similar in spirit to the present version,\par +but may differ in detail to address new problems or concerns.\par +\par +Each version is given a distinguishing version number. If the Library\par +specifies a version number of this License which applies to it and\par +"any later version", you have the option of following the terms and\par +conditions either of that version or of any later version published by\par +the Free Software Foundation. If the Library does not specify a\par +license version number, you may choose any version ever published by\par +the Free Software Foundation.\par +^L\par + 14. If you wish to incorporate parts of the Library into other free\par +programs whose distribution conditions are incompatible with these,\par +write to the author to ask for permission. For software which is\par +copyrighted by the Free Software Foundation, write to the Free\par +Software Foundation; we sometimes make exceptions for this. Our\par +decision will be guided by the two goals of preserving the free status\par +of all derivatives of our free software and of promoting the sharing\par +and reuse of software generally.\par +\par + NO WARRANTY\par +\par + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\par +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\par +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\par +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY\par +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\par +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\par +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\par +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\par +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\par +\par + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\par +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\par +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\par +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\par +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\par +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\par +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\par +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\par +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\par +DAMAGES.\par +\par + END OF TERMS AND CONDITIONS\par +^L\par + How to Apply These Terms to Your New Libraries\par +\par + If you develop a new library, and you want it to be of the greatest\par +possible use to the public, we recommend making it free software that\par +everyone can redistribute and change. You can do so by permitting\par +redistribution under these terms (or, alternatively, under the terms\par +of the ordinary General Public License).\par +\par + To apply these terms, attach the following notices to the library.\par +It is safest to attach them to the start of each source file to most\par +effectively convey the exclusion of warranty; and each file should\par +have at least the "copyright" line and a pointer to where the full\par +notice is found.\par +\par +\par + \par + Copyright (C) \par +\par + This library is free software; you can redistribute it and/or\par + modify it under the terms of the GNU Lesser General Public\par + License as published by the Free Software Foundation; either\par + version 2 of the License, or (at your option) any later version.\par +\par + This library is distributed in the hope that it will be useful,\par + but WITHOUT ANY WARRANTY; without even the implied warranty of\par + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\par + Lesser General Public License for more details.\par +\par + You should have received a copy of the GNU Lesser General Public\par + License along with this library; if not, write to the Free Software\par + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\par +\par +Also add information on how to contact you by electronic and paper\par +mail.\par +\par +You should also get your employer (if you work as a programmer) or\par +your\par +school, if any, to sign a "copyright disclaimer" for the library, if\par +necessary. Here is a sample; alter the names:\par +\par + Yoyodyne, Inc., hereby disclaims all copyright interest in the\par + library `Frob' (a library for tweaking knobs) written by James\par +Random Hacker.\par +\par + , 1 April 1990\par + Ty Coon, President of Vice\par +\par +That's all there is to it!\par +\par +\par +\par +\f0\par +} + \ No newline at end of file