All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] tools/ocaml: Assorted improvements
@ 2018-10-04 11:43 Andrew Cooper
  2018-10-04 11:43 ` [PATCH 1/3] tools/ocaml: Strip all trailing whitespace Andrew Cooper
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-10-04 11:43 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Christian Lindig, Ian Jackson

I stumbled into the issuse fixed by patch 2 while investigating an unrelated
issue.  The other two patches are just cleanup.

Andrew Cooper (3):
  tools/ocaml: Strip all trailing whitespace
  oxenstored: Don't re-open a xenctrl handle for every domain introduction
  tools/ocaml: Delete the Xenctrl.with_intf wrapper

 tools/ocaml/LICENSE                      | 146 +++++++++++++++----------------
 tools/ocaml/libs/xc/xenctrl.ml           |   6 --
 tools/ocaml/libs/xc/xenctrl.mli          |   2 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c      |   2 +-
 tools/ocaml/libs/xl/genwrap.py           |  44 +++++-----
 tools/ocaml/libs/xs/xs.ml                |   4 +-
 tools/ocaml/libs/xs/xsraw.ml             |   4 +-
 tools/ocaml/test/send_debug_keys.ml      |   2 +-
 tools/ocaml/xenstored/connection.ml      |  26 +++---
 tools/ocaml/xenstored/connections.ml     |   8 +-
 tools/ocaml/xenstored/domains.ml         |   6 +-
 tools/ocaml/xenstored/logging.ml         |  10 +--
 tools/ocaml/xenstored/oxenstored.conf.in |   4 +-
 tools/ocaml/xenstored/process.ml         |  11 ++-
 tools/ocaml/xenstored/stdext.ml          |   6 +-
 tools/ocaml/xenstored/store.ml           |   4 +-
 tools/ocaml/xenstored/symbol.mli         |   4 +-
 tools/ocaml/xenstored/syslog_stubs.c     |   2 +-
 tools/ocaml/xenstored/transaction.ml     |   8 +-
 tools/ocaml/xenstored/trie.ml            |  32 +++----
 tools/ocaml/xenstored/trie.mli           |  12 +--
 tools/ocaml/xenstored/xenstored.ml       |  18 ++--
 22 files changed, 176 insertions(+), 185 deletions(-)

-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] tools/ocaml: Strip all trailing whitespace
  2018-10-04 11:43 [PATCH 0/3] tools/ocaml: Assorted improvements Andrew Cooper
@ 2018-10-04 11:43 ` Andrew Cooper
  2018-10-04 11:43 ` [PATCH 2/3] oxenstored: Don't re-open a xenctrl handle for every domain introduction Andrew Cooper
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-10-04 11:43 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Christian Lindig, Ian Jackson

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <Ian.Jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/LICENSE                      | 146 +++++++++++++++----------------
 tools/ocaml/libs/xc/xenctrl_stubs.c      |   2 +-
 tools/ocaml/libs/xl/genwrap.py           |  44 +++++-----
 tools/ocaml/libs/xs/xs.ml                |   4 +-
 tools/ocaml/libs/xs/xsraw.ml             |   4 +-
 tools/ocaml/test/send_debug_keys.ml      |   2 +-
 tools/ocaml/xenstored/connection.ml      |  26 +++---
 tools/ocaml/xenstored/connections.ml     |   8 +-
 tools/ocaml/xenstored/logging.ml         |  10 +--
 tools/ocaml/xenstored/oxenstored.conf.in |   4 +-
 tools/ocaml/xenstored/process.ml         |   8 +-
 tools/ocaml/xenstored/stdext.ml          |   6 +-
 tools/ocaml/xenstored/store.ml           |   4 +-
 tools/ocaml/xenstored/symbol.mli         |   4 +-
 tools/ocaml/xenstored/syslog_stubs.c     |   2 +-
 tools/ocaml/xenstored/transaction.ml     |   8 +-
 tools/ocaml/xenstored/trie.ml            |  32 +++----
 tools/ocaml/xenstored/trie.mli           |  12 +--
 tools/ocaml/xenstored/xenstored.ml       |   8 +-
 19 files changed, 167 insertions(+), 167 deletions(-)

diff --git a/tools/ocaml/LICENSE b/tools/ocaml/LICENSE
index b9e62cd..d4d1f17 100644
--- a/tools/ocaml/LICENSE
+++ b/tools/ocaml/LICENSE
@@ -18,7 +18,7 @@ Public License.
 ------------
 
 GNU LESSER GENERAL PUBLIC LICENSE
-Version 2.1, February 1999 
+Version 2.1, February 1999
 
 
 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
@@ -31,140 +31,140 @@ of this license document, but changing it is not allowed.
  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. 
+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. 
+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. 
+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. 
+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. 
+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. 
+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. 
+To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
 
-Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. 
+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. 
+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. 
+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. 
+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. 
+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. 
+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. 
+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. 
+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.
 
 
 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". 
+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. 
+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".) 
+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. 
+"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. 
+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. 
+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. 
+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: 
+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.) 
+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. 
+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. 
+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. 
+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. 
+3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
 
-Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. 
+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. 
+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. 
+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. 
+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. 
+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. 
+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. 
+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.) 
+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. 
+Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
 
-6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. 
+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: 
+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. 
+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. 
+It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
 
-7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: 
+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. 
+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. 
+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. 
+10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
 
-11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. 
+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. 
+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. 
+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. 
+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. 
+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. 
+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. 
+Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
 
-14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. 
+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 
+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. 
+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. 
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 
 
 END OF TERMS AND CONDITIONS
 How to Apply These Terms to Your New Libraries
-If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). 
+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. 
+To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
 
 
 one line to give the library's name and an idea of what it does.
@@ -183,9 +183,9 @@ 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, see <http://www.gnu.org/licenses/>.
 
-Also add information on how to contact you by electronic and paper mail. 
+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: 
+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
@@ -195,4 +195,4 @@ by James Random Hacker.
 signature of Ty Coon, 1 April 1990
 Ty Coon, President of Vice
 
-That's all there is to it! 
+That's all there is to it!
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 578a014..c4fdc58 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -680,7 +680,7 @@ CAMLprim value stub_xc_pcpu_info(value xch, value nr_cpus)
 
 	if (Int_val(nr_cpus) < 1)
 		caml_invalid_argument("nr_cpus");
-	
+
 	info = calloc(Int_val(nr_cpus) + 1, sizeof(*info));
 	if (!info)
 		caml_raise_out_of_memory();
diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py
index 9a65d73..815c1cb 100644
--- a/tools/ocaml/libs/xl/genwrap.py
+++ b/tools/ocaml/libs/xl/genwrap.py
@@ -13,7 +13,7 @@ builtins = {
     "libxl_devid":          ("devid",                  "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
     "libxl_defbool":        ("bool option",            "%(c)s = Defbool_val(%(o)s)",        "Val_defbool(%(c)s)" ),
     "libxl_uuid":           ("int array",              "Uuid_val(&%(c)s, %(o)s)",   "Val_uuid(&%(c)s)"),
-    "libxl_bitmap":         ("bool array",             "Bitmap_val(ctx, &%(c)s, %(o)s)",   "Val_bitmap(&%(c)s)"),    
+    "libxl_bitmap":         ("bool array",             "Bitmap_val(ctx, &%(c)s, %(o)s)",   "Val_bitmap(&%(c)s)"),
     "libxl_key_value_list": ("(string * string) list", "libxl_key_value_list_val(&%(c)s, %(o)s)", "Val_key_value_list(&%(c)s)"),
     "libxl_string_list":    ("string list",            "libxl_string_list_val(&%(c)s, %(o)s)", "Val_string_list(&%(c)s)"),
     "libxl_mac":            ("int array",              "Mac_val(&%(c)s, %(o)s)",    "Val_mac(&%(c)s)"),
@@ -59,7 +59,7 @@ functions = { # ( name , [type1,type2,....] )
 }
 def stub_fn_name(ty, name):
     return "stub_xl_%s_%s" % (ty.rawname,name)
-    
+
 def ocaml_type_of(ty):
     if ty.rawname in ["domid","devid"]:
         return ty.rawname
@@ -127,7 +127,7 @@ def gen_struct(ty, indent):
 def gen_ocaml_keyedunions(ty, interface, indent, parent = None):
     s = ""
     union_type = ""
-    
+
     if ty.rawname is not None:
         # Non-anonymous types need no special handling
         pass
@@ -162,7 +162,7 @@ def gen_ocaml_keyedunions(ty, interface, indent, parent = None):
                     u.append("%s" % (f.name.capitalize()))
             else:
                 raise NotImplementedError("Cannot handle KeyedUnion fields which are not Structs")
-            
+
         s += " | ".join(u) + "\n"
         ty.union_name = name
 
@@ -195,7 +195,7 @@ def gen_ocaml_ml(ty, interface, indent=""):
         s = ("""(* %s interface *)\n""" % ty.typename)
     else:
         s = ("""(* %s implementation *)\n""" % ty.typename)
-        
+
     if isinstance(ty, idl.Enumeration):
         s += "type %s = \n" % ty.rawname
         for v in ty.values:
@@ -210,7 +210,7 @@ def gen_ocaml_ml(ty, interface, indent=""):
 
     elif isinstance(ty, idl.Aggregate):
         s += ""
-        
+
         if ty.typename is None:
             raise NotImplementedError("%s has no typename" % type(ty))
         else:
@@ -221,7 +221,7 @@ def gen_ocaml_ml(ty, interface, indent=""):
                 s += "module %s : sig\n" % module_name
             else:
                 s += "module %s = struct\n" % module_name
-                
+
         # Handle KeyedUnions...
         union_types = []
         for f in ty.fields:
@@ -256,7 +256,7 @@ def gen_ocaml_ml(ty, interface, indent=""):
                 s += "\texternal %s : " % name
                 s += " -> ".join(args)
                 s += " = \"%s\"\n" % stub_fn_name(ty,name)
-        
+
         s += "end\n"
 
     else:
@@ -312,7 +312,7 @@ def c_val(ty, c, o, indent="", parent = None):
                                                     parent + ty.keyvar.name,
                                                     f.enumname)
                 n += 1
-        s += "\t\t    default: failwith_xl(ERROR_FAIL, \"variant handling bug %s%s (long)\"); break;\n" % (parent, ty.keyvar.name)        
+        s += "\t\t    default: failwith_xl(ERROR_FAIL, \"variant handling bug %s%s (long)\"); break;\n" % (parent, ty.keyvar.name)
         s += "\t\t}\n"
         s += "\t} else {\n"
         s += "\t\t/* Is block... */\n"
@@ -342,24 +342,24 @@ def c_val(ty, c, o, indent="", parent = None):
             n = n + 1
     else:
         s += "%s_val(ctx, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=idl.PASS_BY_REFERENCE), o)
-    
+
     return s.replace("\n", "\n%s" % indent)
 
 def gen_c_val(ty, indent=""):
     s = "/* Convert caml value to %s */\n" % ty.rawname
-    
+
     s += "static int %s_val (libxl_ctx *ctx, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=idl.PASS_BY_REFERENCE))
     s += "{\n"
     s += "\tCAMLparam1(v);\n"
     s += "\n"
 
     s += c_val(ty, "c_val", "v", indent="\t") + "\n"
-    
+
     s += "\tCAMLreturn(0);\n"
     s += "}\n"
-    
+
     return s.replace("\n", "\n%s" % indent)
-    
+
 def ocaml_Val(ty, o, c, indent="", parent = None):
     s = indent
     if isinstance(ty,idl.UInt):
@@ -437,7 +437,7 @@ def ocaml_Val(ty, o, c, indent="", parent = None):
         s += "\tCAMLlocal1(%s);\n" % fn
         s += "\n"
         s += "\t%s = caml_alloc_tuple(%d);\n" % (o, len(ty.fields))
-        
+
         n = 0
         for f in ty.fields:
             if f.type.private:
@@ -452,7 +452,7 @@ def ocaml_Val(ty, o, c, indent="", parent = None):
         s += "}"
     else:
         s += "%s = Val_%s(%s);" % (o, ty.rawname, ty.pass_arg(c, parent is None))
-    
+
     return s.replace("\n", "\n%s" % indent).rstrip(indent)
 
 def gen_Val_ocaml(ty, indent=""):
@@ -464,14 +464,14 @@ def gen_Val_ocaml(ty, indent=""):
     s += "\tCAMLlocal1(%s_ocaml);\n" % ty.rawname
 
     s += ocaml_Val(ty, "%s_ocaml" % ty.rawname, "%s_c" % ty.rawname, indent="\t") + "\n"
-    
+
     s += "\tCAMLreturn(%s_ocaml);\n" % ty.rawname
     s += "}\n"
     return s.replace("\n", "\n%s" % indent)
 
 def gen_c_stub_prototype(ty, fns):
     s = "/* Stubs for %s */\n" % ty.rawname
-    for name,args in fns:        
+    for name,args in fns:
         # For N args we return one value and take N-1 values as parameters
         s += "value %s(" % stub_fn_name(ty, name)
         s += ", ".join(["value v%d" % v for v in range(1,len(args))])
@@ -536,7 +536,7 @@ if __name__ == '__main__':
             print "unknown type %s in blacklist" % t
 
     types = [ty for ty in types if not ty.rawname in blacklist]
-    
+
     _ml = sys.argv[3]
     ml = open(_ml, 'w')
     ml.write(autogen_header("(*", "*)"))
@@ -544,7 +544,7 @@ if __name__ == '__main__':
     _mli = sys.argv[2]
     mli = open(_mli, 'w')
     mli.write(autogen_header("(*", "*)"))
-    
+
     _cinc = sys.argv[4]
     cinc = open(_cinc, 'w')
     cinc.write(autogen_header("/*", "*/"))
@@ -558,7 +558,7 @@ if __name__ == '__main__':
 
         mli.write(gen_ocaml_ml(ty, True))
         mli.write("\n")
-        
+
         if ty.marshal_in():
             cinc.write(gen_c_val(ty))
             cinc.write("\n")
@@ -571,7 +571,7 @@ if __name__ == '__main__':
             cinc.write(gen_c_defaults(ty))
             cinc.write("\n")
         #sys.stdout.write("\n")
-    
+
     ml.write("(* END OF AUTO-GENERATED CODE *)\n")
     ml.close()
     mli.write("(* END OF AUTO-GENERATED CODE *)\n")
diff --git a/tools/ocaml/libs/xs/xs.ml b/tools/ocaml/libs/xs/xs.ml
index db9959a..90bd68d 100644
--- a/tools/ocaml/libs/xs/xs.ml
+++ b/tools/ocaml/libs/xs/xs.ml
@@ -87,7 +87,7 @@ let read_watchevent_timeout xsh timeout callback =
 	let left = ref timeout in
 
 	(* Returns true if a watch event in the queue satisfied us *)
-	let process_queued_events () = 
+	let process_queued_events () =
 		let success = ref false in
 		while Xsraw.has_watchevents xsh.con && not(!success)
 		do
@@ -95,7 +95,7 @@ let read_watchevent_timeout xsh timeout callback =
 		done;
 		!success in
 	(* Returns true if a watch event read from the socket satisfied us *)
-	let process_incoming_event () = 
+	let process_incoming_event () =
 		let fd = get_fd xsh in
 		let r, _, _ = Unix.select [ fd ] [] [] (min max_blocking_time !left) in
 
diff --git a/tools/ocaml/libs/xs/xsraw.ml b/tools/ocaml/libs/xs/xsraw.ml
index 84336e1..d982fb2 100644
--- a/tools/ocaml/libs/xs/xsraw.ml
+++ b/tools/ocaml/libs/xs/xsraw.ml
@@ -69,8 +69,8 @@ let perms_of_string s =
 		           | 'w' -> PERM_WRITE | 'b' -> PERM_RDWR
 		           | c -> invalid_arg (Printf.sprintf "unknown permission type: %c" c) in
 	let perm_of_string s =
-		if String.length s < 2 
-		then invalid_arg (Printf.sprintf "perm of string: length = %d; contents=\"%s\"" (String.length s) s) 
+		if String.length s < 2
+		then invalid_arg (Printf.sprintf "perm of string: length = %d; contents=\"%s\"" (String.length s) s)
 		else
 		begin
 			int_of_string (String.sub s 1 (String.length s - 1)),
diff --git a/tools/ocaml/test/send_debug_keys.ml b/tools/ocaml/test/send_debug_keys.ml
index 0a42c3a..d05f208 100644
--- a/tools/ocaml/test/send_debug_keys.ml
+++ b/tools/ocaml/test/send_debug_keys.ml
@@ -6,7 +6,7 @@ let send_keys ctx s =
   printf "Sending debug key %s\n" s;
   Xenlight.Host.send_debug_keys ctx s;
   ()
-  
+
 let _ =
   let logger = Xtl.create_stdio_logger () in
   let ctx = Xenlight.ctx_alloc logger in
diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index be9c62f..24750ad 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -62,16 +62,16 @@ let reconnect con =
 let get_path con =
 Printf.sprintf "/local/domain/%i/" (match con.dom with None -> 0 | Some d -> Domain.get_id d)
 
-let watch_create ~con ~path ~token = { 
-	con = con; 
-	token = token; 
-	path = path; 
-	base = get_path con; 
+let watch_create ~con ~path ~token = {
+	con = con;
+	token = token;
+	path = path;
+	base = get_path con;
 	is_relative = path.[0] <> '/' && path.[0] <> '@'
 }
 
 let get_con w = w.con
- 
+
 let number_of_transactions con =
 	Hashtbl.length con.transactions
 
@@ -85,20 +85,20 @@ let get_domstr con =
 	| Some dom -> "D" ^ (string_of_int (Domain.get_id dom))
 
 let make_perm dom =
-	let domid = 
+	let domid =
 		match dom with
 		| None   -> 0
 		| Some d -> Domain.get_id d
-	in 
+	in
 	Perms.Connection.create ~perms:[Perms.READ; Perms.WRITE] domid
 
 let create xbcon dom =
 	let id =
 		match dom with
 		| None -> let old = !anon_id_next in incr anon_id_next; old
-		| Some _ -> 0  
+		| Some _ -> 0
 		in
-	let con = 
+	let con =
 	{
 	xb = xbcon;
 	dom = dom;
@@ -110,7 +110,7 @@ let create xbcon dom =
 	stat_nb_ops = 0;
 	perm = make_perm dom;
 	}
-	in 
+	in
 	Logging.new_connection ~tid:Transaction.none ~con:(get_domstr con);
 	con
 
@@ -191,7 +191,7 @@ let del_transactions con =
   Hashtbl.clear con.transactions
 
 let list_watches con =
-	let ll = Hashtbl.fold 
+	let ll = Hashtbl.fold
 		(fun _ watches acc -> List.map (fun watch -> watch.path, watch.token) watches :: acc)
 		con.watches [] in
 	List.concat ll
@@ -279,7 +279,7 @@ let stats con =
 
 let dump con chan =
 	match con.dom with
-	| Some dom -> 
+	| Some dom ->
 		let domid = Domain.get_id dom in
 		(* dump domain *)
 		Domain.dump dom chan;
diff --git a/tools/ocaml/xenstored/connections.ml b/tools/ocaml/xenstored/connections.ml
index ae76928..299826e 100644
--- a/tools/ocaml/xenstored/connections.ml
+++ b/tools/ocaml/xenstored/connections.ml
@@ -65,7 +65,7 @@ let find_domain_by_port cons port =
 let del_watches_of_con con watches =
 	match List.filter (fun w -> Connection.get_con w != con) watches with
 	| [] -> None
-	| ws -> Some ws 
+	| ws -> Some ws
 
 let del_anonymous cons con =
 	try
@@ -144,7 +144,7 @@ let fire_watches cons path recurse =
 	in
 	let fire_rec x = function
 		| None         -> ()
-		| Some watches -> 
+		| Some watches ->
 			  List.iter (fun w -> Connection.fire_single_watch w) watches
 	in
 	Trie.iter_path fire_watch cons.watches key;
@@ -161,14 +161,14 @@ let set_target cons domain target_domain =
 
 let number_of_transactions cons =
 	let res = ref 0 in
-	let aux con = 
+	let aux con =
 		res := Connection.number_of_transactions con + !res
 	in
 	iter cons aux;
 	!res
 
 let stats cons =
-	let nb_ops_anon = ref 0 
+	let nb_ops_anon = ref 0
 	and nb_watchs_anon = ref 0
 	and nb_ops_dom = ref 0
 	and nb_watchs_dom = ref 0 in
diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index ea60331..cc6f72d 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -57,7 +57,7 @@ type logger =
 		  rotate: unit -> unit;
 		  write: ?level:level -> string -> unit }
 
-let truncate_line nb_chars line = 
+let truncate_line nb_chars line =
 	if String.length line > nb_chars - 1 then
 		let len = max (nb_chars - 1) 2 in
 		let dst_line = Bytes.create len in
@@ -174,7 +174,7 @@ let init_xenstored_log () = match !xenstored_log_destination with
 	| File file ->
 		if !xenstored_log_level <> Null && !xenstored_log_nb_files > 0 then
 			let logger =
-				make_file_logger 
+				make_file_logger
 					file !xenstored_log_nb_files !xenstored_log_nb_lines
 					!xenstored_log_nb_chars ignore in
 			set_xenstored_logger logger
@@ -236,7 +236,7 @@ let string_of_access_type = function
 	| Xenbus.Xb.Op.Getdomainpath     -> "getdomain"
 	| Xenbus.Xb.Op.Isintroduced      -> "is introduced"
 	| Xenbus.Xb.Op.Resume            -> "resume   "
- 
+
 	| Xenbus.Xb.Op.Write             -> "write    "
 	| Xenbus.Xb.Op.Mkdir             -> "mkdir    "
 	| Xenbus.Xb.Op.Rm                -> "rm       "
@@ -315,11 +315,11 @@ let xb_op ~tid ~con ~ty data =
 		| _ -> true in
 	if print then access_logging ~tid ~con ~data (XbOp ty) ~level:Info
 
-let start_transaction ~tid ~con = 
+let start_transaction ~tid ~con =
 	if !access_log_transaction_ops && tid <> 0
 	then access_logging ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_start) ~level:Debug
 
-let end_transaction ~tid ~con = 
+let end_transaction ~tid ~con =
 	if !access_log_transaction_ops && tid <> 0
 	then access_logging ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_end) ~level:Debug
 
diff --git a/tools/ocaml/xenstored/oxenstored.conf.in b/tools/ocaml/xenstored/oxenstored.conf.in
index 6579b84..151b65b 100644
--- a/tools/ocaml/xenstored/oxenstored.conf.in
+++ b/tools/ocaml/xenstored/oxenstored.conf.in
@@ -28,14 +28,14 @@ conflict-max-history-seconds = 0.05
 # tick one point of conflict-credit is given to just one domain: the
 # one at the front of the queue. If false, then after each tick each
 # domain gets a point of conflict-credit.
-# 
+#
 # In environments where it is known that every transaction will
 # involve a set of nodes that is writable by at most one other domain,
 # then it is safe to set this aggregate-limit flag to false for better
 # performance. (This can be determined by considering the layout of
 # the xenstore tree and permissions, together with the content of the
 # transactions that require protection.)
-# 
+#
 # A transaction which involves a set of nodes which can be modified by
 # multiple other domains can suffer conflicts caused by any of those
 # domains, so the flag must be set to true.
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 7e51bcc..217a344 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -352,7 +352,7 @@ let transaction_replay c t doms cons =
 		)
 
 let do_watch con t domains cons data =
-	let (node, token) = 
+	let (node, token) =
 		match (split None '\000' data) with
 		| [node; token; ""]   -> node, token
 		| _                   -> raise Invalid_Cmd_Args
@@ -431,7 +431,7 @@ let do_release con t domains cons data =
 	let fire_spec_watches = Domains.exist domains domid in
 	Domains.del domains domid;
 	Connections.del_domain cons domid;
-	if fire_spec_watches 
+	if fire_spec_watches
 	then Connections.fire_spec_watches cons "@releaseDomain"
 	else raise Invalid_Cmd_Args
 
@@ -558,7 +558,7 @@ let do_input store cons doms con =
 		let tid, rid, ty, data = Xenbus.Xb.Packet.unpack packet in
 		let req = {Packet.tid=tid; Packet.rid=rid; Packet.ty=ty; Packet.data=data} in
 
-		(* As we don't log IO, do not call an unnecessary sanitize_data 
+		(* As we don't log IO, do not call an unnecessary sanitize_data
 		   info "[%s] -> [%d] %s \"%s\""
 		         (Connection.get_domstr con) tid
 		         (Xenbus.Xb.Op.to_string ty) (sanitize_data data); *)
@@ -572,7 +572,7 @@ let do_output store cons doms con =
 		if Connection.has_new_output con then (
 			let packet = Connection.peek_output con in
 			let tid, rid, ty, data = Xenbus.Xb.Packet.unpack packet in
-			(* As we don't log IO, do not call an unnecessary sanitize_data 
+			(* As we don't log IO, do not call an unnecessary sanitize_data
 			   info "[%s] <- %s \"%s\""
 			         (Connection.get_domstr con)
 			         (Xenbus.Xb.Op.to_string ty) (sanitize_data data);*)
diff --git a/tools/ocaml/xenstored/stdext.ml b/tools/ocaml/xenstored/stdext.ml
index 305a330..879565c 100644
--- a/tools/ocaml/xenstored/stdext.ml
+++ b/tools/ocaml/xenstored/stdext.ml
@@ -20,7 +20,7 @@ type ('a, 'b) either = Right of 'a | Left of 'b
 (** apply the clean_f function after fct function has been called.
  * Even if fct raises an exception, clean_f is applied
  *)
-let exnhook = ref None 
+let exnhook = ref None
 
 let finally fct clean_f =
 	let result = try
@@ -36,7 +36,7 @@ let finally fct clean_f =
 let may f v =
 	match v with Some x -> Some (f x) | None -> None
 
-(** default value to d if v is none. *) 
+(** default value to d if v is none. *)
 let default d v =
 	match v with Some x -> x | None -> d
 
@@ -85,7 +85,7 @@ let mkdir_safe dir perm =
 let mkdir_rec dir perm =
 	let rec p_mkdir dir =
 		let p_name = Filename.dirname dir in
-		if p_name <> "/" && p_name <> "." 
+		if p_name <> "/" && p_name <> "."
 		then p_mkdir p_name;
 		mkdir_safe dir perm in
 	p_mkdir dir
diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml
index 5a8c377..c6c8741 100644
--- a/tools/ocaml/xenstored/store.ml
+++ b/tools/ocaml/xenstored/store.ml
@@ -34,7 +34,7 @@ let get_value node = node.value
 let get_perms node = node.perms
 let get_name node = Symbol.to_string node.name
 
-let set_value node nvalue = 
+let set_value node nvalue =
 	if node.value = nvalue
 	then node
 	else { node with value = nvalue }
@@ -189,7 +189,7 @@ let get_node rnode path =
 let rec get_deepest_existing_node node = function
 	| [] -> node, true
 	| h :: t ->
-		try get_deepest_existing_node (Node.find node h) t 
+		try get_deepest_existing_node (Node.find node h) t
 		with Not_found -> node, false
 
 let set_node rnode path nnode =
diff --git a/tools/ocaml/xenstored/symbol.mli b/tools/ocaml/xenstored/symbol.mli
index 8ed709f..c3c9f6e 100644
--- a/tools/ocaml/xenstored/symbol.mli
+++ b/tools/ocaml/xenstored/symbol.mli
@@ -16,8 +16,8 @@
 
 (** Node names *)
 
-(** Xenstore nodes names are often the same, ie. "local", "domain", "device", ... so it is worth to 
-    manipulate them through the use of small identifiers that we call symbols. These symbols can be 
+(** Xenstore nodes names are often the same, ie. "local", "domain", "device", ... so it is worth to
+    manipulate them through the use of small identifiers that we call symbols. These symbols can be
     compared in constant time (as opposite to strings) and should help the ocaml GC. *)
 
 type t
diff --git a/tools/ocaml/xenstored/syslog_stubs.c b/tools/ocaml/xenstored/syslog_stubs.c
index dd8b9e9..875d48a 100644
--- a/tools/ocaml/xenstored/syslog_stubs.c
+++ b/tools/ocaml/xenstored/syslog_stubs.c
@@ -42,7 +42,7 @@ value stub_syslog(value facility, value level, value msg)
 	caml_enter_blocking_section();
 	syslog(c_facility, "%s", c_msg);
 	caml_leave_blocking_section();
-	
+
 	free((void*)c_msg);
 	CAMLreturn(Val_unit);
 }
diff --git a/tools/ocaml/xenstored/transaction.ml b/tools/ocaml/xenstored/transaction.ml
index 23e7ccf..96f56f0 100644
--- a/tools/ocaml/xenstored/transaction.ml
+++ b/tools/ocaml/xenstored/transaction.ml
@@ -46,7 +46,7 @@ let test_coalesce oldroot currentroot optpath =
 	| Some path ->
 		let oldnode = Store.Path.get_node oldroot path
 		and currentnode = Store.Path.get_node currentroot path in
-		
+
 		match oldnode, currentnode with
 		| (Some oldnode), (Some currentnode) ->
 			if oldnode == currentnode then (
@@ -175,7 +175,7 @@ let rm t perm path =
 	set_write_lowpath t (Store.Path.get_parent path);
 	add_wop t Xenbus.Xb.Op.Rm path
 
-let ls t perm path =	
+let ls t perm path =
 	let r = Store.ls t.store perm path in
 	set_read_lowpath t path;
 	r
@@ -243,8 +243,8 @@ let commit ~con t =
 		in
 	if has_commited && has_write_ops then
 		Disk.write t.store;
-	if not has_commited 
+	if not has_commited
 	then Logging.conflict ~tid:(get_id t) ~con
-	else if not !has_coalesced 
+	else if not !has_coalesced
 	then Logging.commit ~tid:(get_id t) ~con;
 	has_commited
diff --git a/tools/ocaml/xenstored/trie.ml b/tools/ocaml/xenstored/trie.ml
index bc9a903..d9c9c2c 100644
--- a/tools/ocaml/xenstored/trie.ml
+++ b/tools/ocaml/xenstored/trie.ml
@@ -34,7 +34,7 @@ struct
 	}
 
 	let get_key node = node.key
-	let get_value node = 
+	let get_value node =
 		match node.value with
 		| None       -> raise Not_found
 		| Some value -> value
@@ -46,7 +46,7 @@ struct
 	let set_children node children =
 		{ node with children = children }
 
-	let add_child node child = 
+	let add_child node child =
 		{ node with children = child :: node.children }
 end
 
@@ -65,7 +65,7 @@ let replace_node nodes key node =
 		| h :: tl                       -> h :: aux tl
 	in
 	aux nodes
-			
+
 let remove_node nodes key =
 	let rec aux = function
 		| []                            -> raise Not_found
@@ -76,16 +76,16 @@ let remove_node nodes key =
 
 let create () = []
 
-let rec iter f tree = 
+let rec iter f tree =
 	let rec aux node =
-		f node.Node.key node.Node.value; 
+		f node.Node.key node.Node.value;
 		iter f node.Node.children
 	in
 	List.iter aux tree
 
 let rec map f tree =
 	let rec aux node =
-		let value = 
+		let value =
 			match node.Node.value with
 			| None       -> None
 			| Some value -> f value
@@ -98,12 +98,12 @@ let rec fold f tree acc =
 	let rec aux accu node =
 		fold f node.Node.children (f node.Node.key node.Node.value accu)
 	in
-	List.fold_left aux acc tree 
+	List.fold_left aux acc tree
 
 (* return a sub-trie *)
 let rec sub_node tree = function
 	| []   -> raise Not_found
-	| h::t -> 
+	| h::t ->
 		  if mem_node tree h
 		  then begin
 			  let node = find_node tree h in
@@ -113,19 +113,19 @@ let rec sub_node tree = function
 		  end else
 			  raise Not_found
 
-let sub tree path = 
+let sub tree path =
 	try (sub_node tree path).Node.children
 	with Not_found -> []
 
-let find tree path = 
+let find tree path =
 	Node.get_value (sub_node tree path)
 
 (* return false if the node doesn't exists or if it is not associated to any value *)
 let rec mem tree = function
 	| []   -> false
-	| h::t -> 
+	| h::t ->
 		  mem_node tree h
-		  && (let node = find_node tree h in 
+		  && (let node = find_node tree h in
 			  if t = []
 			  then node.Node.value <> None
 			  else mem node.Node.children t)
@@ -133,7 +133,7 @@ let rec mem tree = function
 (* Iterate over the longest valid prefix *)
 let rec iter_path f tree = function
 	| []   -> ()
-	| h::l -> 
+	| h::l ->
 		  if mem_node tree h
 		  then begin
 			  let node = find_node tree h in
@@ -142,7 +142,7 @@ let rec iter_path f tree = function
 		  end
 
 let rec set_node node path value =
-	if path = [] 
+	if path = []
 	then Node.set_value node value
 	else begin
 		let children = set node.Node.children path value in
@@ -152,7 +152,7 @@ let rec set_node node path value =
 and set tree path value =
 	match path with
 		| []   -> raise Not_found
-		| h::t -> 
+		| h::t ->
 			  if mem_node tree h
 			  then begin
 				  let node = find_node tree h in
@@ -164,7 +164,7 @@ and set tree path value =
 
 let rec unset tree = function
 	| []   -> tree
-	| h::t -> 
+	| h::t ->
 		  if mem_node tree h
 		  then begin
 			  let node = find_node tree h in
diff --git a/tools/ocaml/xenstored/trie.mli b/tools/ocaml/xenstored/trie.mli
index 25db9d0..5dc53c1 100644
--- a/tools/ocaml/xenstored/trie.mli
+++ b/tools/ocaml/xenstored/trie.mli
@@ -24,7 +24,7 @@ val create : unit -> ('a,'b) t
 (** Creates an empty trie. *)
 
 val mem : ('a,'b) t -> 'a list -> bool
-(** [mem t k] returns true if a value is associated with the key [k] in the trie [t]. 
+(** [mem t k] returns true if a value is associated with the key [k] in the trie [t].
 	Otherwise, it returns false. *)
 
 val find : ('a, 'b) t -> 'a list -> 'b
@@ -35,20 +35,20 @@ val set : ('a, 'b) t -> 'a list -> 'b -> ('a, 'b) t
 (** [set t k v] associates the value [v] with the key [k] in the trie [t]. *)
 
 val unset : ('a, 'b) t -> 'a list -> ('a, 'b) t
-(** [unset k v] removes the association of value [v] with the key [k] in the trie [t]. 
-	Moreover, it automatically clean the trie, ie. it removes recursively 
+(** [unset k v] removes the association of value [v] with the key [k] in the trie [t].
+	Moreover, it automatically clean the trie, ie. it removes recursively
 	every nodes of [t] containing no values and having no chil. *)
 
 val iter : ('a -> 'b option -> unit) -> ('a, 'b) t -> unit
-(** [iter f t] applies the function [f] to every node of the trie [t]. 
+(** [iter f t] applies the function [f] to every node of the trie [t].
 	As nodes of the trie [t] do not necessary contains a value, the second argument of
 	[f] is an option type. *)
 
 val iter_path : ('a -> 'b option -> unit) -> ('a, 'b) t -> 'a list -> unit
-(** [iter_path f t p] iterates [f] over nodes associated with the path [p] in the trie [t]. 
+(** [iter_path f t p] iterates [f] over nodes associated with the path [p] in the trie [t].
 	If [p] is not a valid path of [t], it iterates on the longest valid prefix of [p]. *)
 
-val fold : ('a -> 'b option -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c 
+val fold : ('a -> 'b option -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c
 (** [fold f t x] fold [f] over every nodes of [t], with [x] as initial value. *)
 
 val map : ('b -> 'c option) -> ('a,'b) t -> ('a,'c) t
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 332a69b..40a05e9 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -188,7 +188,7 @@ let from_channel store cons doms chan =
 			in
 		Connections.add_domain cons ndom;
 		in
-	let watch_f domid path token = 
+	let watch_f domid path token =
 		let con = Connections.find_domain cons domid in
 		ignore (Connections.add_watch cons con path token)
 		in
@@ -238,7 +238,7 @@ let _ =
 			default_pidfile
 		in
 
-	(try 
+	(try
 		Unixext.mkdir_rec (Filename.dirname pidfile) 0o755
 	with _ ->
 		()
@@ -251,11 +251,11 @@ let _ =
 			Some (Unix.handle_unix_error Utils.create_unix_socket Define.xs_daemon_socket),
 			Some (Unix.handle_unix_error Utils.create_unix_socket Define.xs_daemon_socket_ro)
 		in
-	
+
 	if cf.daemonize then
 		Unixext.daemonize ()
 	else
-		printf "Xen Storage Daemon, version %d.%d\n%!" 
+		printf "Xen Storage Daemon, version %d.%d\n%!"
 			Define.xenstored_major Define.xenstored_minor;
 
 	(try Unixext.pidfile_write pidfile with _ -> ());
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] oxenstored: Don't re-open a xenctrl handle for every domain introduction
  2018-10-04 11:43 [PATCH 0/3] tools/ocaml: Assorted improvements Andrew Cooper
  2018-10-04 11:43 ` [PATCH 1/3] tools/ocaml: Strip all trailing whitespace Andrew Cooper
@ 2018-10-04 11:43 ` Andrew Cooper
  2018-10-04 11:43 ` [PATCH 3/3] tools/ocaml: Delete the Xenctrl.with_intf wrapper Andrew Cooper
  2018-10-04 12:35 ` [PATCH 0/3] tools/ocaml: Assorted improvements Christian Lindig
  3 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-10-04 11:43 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Christian Lindig, Ian Jackson

Currently, an xc handle is opened in main() which is used for cleanup
activities, and a new xc handle is temporarily opened every time a domain is
introduced.  This is inefficient, and amongst other things, requires full root
privileges for the lifetime of oxenstored.

All code using the Xenctrl handle is in domains.ml, so initialise xc as a
global (now happens just before main() is called) and drop it as a parameter
from Domains.create and Domains.cleanup.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <Ian.Jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/domains.ml   |  6 ++++--
 tools/ocaml/xenstored/process.ml   |  3 +--
 tools/ocaml/xenstored/xenstored.ml | 10 +++-------
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 4134630..71dde16 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -18,6 +18,8 @@ let debug fmt = Logging.debug "domains" fmt
 let error fmt = Logging.error "domains" fmt
 let warn fmt  = Logging.warn  "domains" fmt
 
+let xc = Xenctrl.interface_open ()
+
 type domains = {
 	eventchn: Event.t;
 	table: (Xenctrl.domid, Domain.t) Hashtbl.t;
@@ -86,7 +88,7 @@ let remove_from_queue dom queue =
 		| None -> ()
 		| Some x -> if x=dom then d := None) queue
 
-let cleanup xc doms =
+let cleanup doms =
 	let notify = ref false in
 	let dead_dom = ref [] in
 
@@ -120,7 +122,7 @@ let cleanup xc doms =
 let resume doms domid =
 	()
 
-let create xc doms domid mfn port =
+let create doms domid mfn port =
 	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
 	let dom = Domain.make domid mfn port interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 217a344..977e7c1 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -410,8 +410,7 @@ let do_introduce con t domains cons data =
 		if Domains.exist domains domid then
 			Domains.find domains domid
 		else try
-			let ndom = Xenctrl.with_intf (fun xc ->
-				Domains.create xc domains domid mfn port) in
+			let ndom = Domains.create domains domid mfn port in
 			Connections.add_domain cons ndom;
 			Connections.fire_spec_watches cons "@introduceDomain";
 			ndom
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 40a05e9..7df02ed 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -177,12 +177,11 @@ let from_channel_f chan domain_f watch_f store_f =
 let from_channel store cons doms chan =
 	(* don't let the permission get on our way, full perm ! *)
 	let op = Store.get_ops store Perms.Connection.full_rights in
-	let xc = Xenctrl.interface_open () in
 
 	let domain_f domid mfn port =
 		let ndom =
 			if domid > 0 then
-				Domains.create xc doms domid mfn port
+				Domains.create doms domid mfn port
 			else
 				Domains.create0 doms
 			in
@@ -196,8 +195,7 @@ let from_channel store cons doms chan =
 		op.Store.write path value;
 		op.Store.setperms path perms
 		in
-	finally (fun () -> from_channel_f chan domain_f watch_f store_f)
-	        (fun () -> Xenctrl.interface_close xc)
+	from_channel_f chan domain_f watch_f store_f
 
 let from_file store cons doms file =
 	let channel = open_in file in
@@ -328,8 +326,6 @@ let _ =
 		(if cf.domain_init then [ Event.fd eventchn ] else [])
 		in
 
-	let xc = Xenctrl.interface_open () in
-
 	let process_special_fds rset =
 		let accept_connection can_write fd =
 			let (cfd, addr) = Unix.accept fd in
@@ -340,7 +336,7 @@ let _ =
 			debug "pending port %d" (Xeneventchn.to_int port);
 			finally (fun () ->
 				if Some port = eventchn.Event.virq_port then (
-					let (notify, deaddom) = Domains.cleanup xc domains in
+					let (notify, deaddom) = Domains.cleanup domains in
 					List.iter (Connections.del_domain cons) deaddom;
 					if deaddom <> [] || notify then
 						Connections.fire_spec_watches cons "@releaseDomain"
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] tools/ocaml: Delete the Xenctrl.with_intf wrapper
  2018-10-04 11:43 [PATCH 0/3] tools/ocaml: Assorted improvements Andrew Cooper
  2018-10-04 11:43 ` [PATCH 1/3] tools/ocaml: Strip all trailing whitespace Andrew Cooper
  2018-10-04 11:43 ` [PATCH 2/3] oxenstored: Don't re-open a xenctrl handle for every domain introduction Andrew Cooper
@ 2018-10-04 11:43 ` Andrew Cooper
  2018-10-04 12:35 ` [PATCH 0/3] tools/ocaml: Assorted improvements Christian Lindig
  3 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-10-04 11:43 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Christian Lindig, Ian Jackson

This wrapper hides an opening and closing of the xenctrl handle, which amongst
other things opens and closes multiple device files.

A process should create one handle at the start of day and reuse that; indeed
there is no guarentee that the process will retain sufficient permissions to
re-open /dev/xen/privcmd at a later point.

With the final user of Xenctrl.with_intf removed, drop the wrapper entirely.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <Ian.Jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl.ml  | 6 ------
 tools/ocaml/libs/xc/xenctrl.mli | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 40fbd37..955dd92 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -141,12 +141,6 @@ type handle
 external interface_open: unit -> handle = "stub_xc_interface_open"
 external interface_close: handle -> unit = "stub_xc_interface_close"
 
-let with_intf f =
-	let xc = interface_open () in
-	let r = try f xc with exn -> interface_close xc; raise exn in
-	interface_close xc;
-	r
-
 external domain_create: handle -> domctl_create_config -> domid
        = "stub_xc_domain_create"
 
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 906ce94..eeed24f 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -108,7 +108,7 @@ exception Error of string
 type handle
 external interface_open : unit -> handle = "stub_xc_interface_open"
 external interface_close : handle -> unit = "stub_xc_interface_close"
-val with_intf : (handle -> 'a) -> 'a
+
 external domain_create : handle -> domctl_create_config -> domid
   = "stub_xc_domain_create"
 external domain_sethandle : handle -> domid -> string -> unit = "stub_xc_domain_sethandle"
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] tools/ocaml: Assorted improvements
  2018-10-04 11:43 [PATCH 0/3] tools/ocaml: Assorted improvements Andrew Cooper
                   ` (2 preceding siblings ...)
  2018-10-04 11:43 ` [PATCH 3/3] tools/ocaml: Delete the Xenctrl.with_intf wrapper Andrew Cooper
@ 2018-10-04 12:35 ` Christian Lindig
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Lindig @ 2018-10-04 12:35 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Ian Jackson, Wei Liu, Xen-devel



> On 4 Oct 2018, at 12:43, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
> 
> I stumbled into the issuse fixed by patch 2 while investigating an unrelated
> issue.  The other two patches are just cleanup.
> 
> Andrew Cooper (3):
>  tools/ocaml: Strip all trailing whitespace
>  oxenstored: Don't re-open a xenctrl handle for every domain introduction
>  tools/ocaml: Delete the Xenctrl.with_intf wrapper

Making xc a global handle that is opened once is IMHO an improvement rather than threading it as a parameter through the call hierarchy.

-- 
Acked-by: Christian Lindig <christian.lindig@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-04 12:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 11:43 [PATCH 0/3] tools/ocaml: Assorted improvements Andrew Cooper
2018-10-04 11:43 ` [PATCH 1/3] tools/ocaml: Strip all trailing whitespace Andrew Cooper
2018-10-04 11:43 ` [PATCH 2/3] oxenstored: Don't re-open a xenctrl handle for every domain introduction Andrew Cooper
2018-10-04 11:43 ` [PATCH 3/3] tools/ocaml: Delete the Xenctrl.with_intf wrapper Andrew Cooper
2018-10-04 12:35 ` [PATCH 0/3] tools/ocaml: Assorted improvements Christian Lindig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.