libxl.h: document the paradigm of using libxl types
authorWei Liu <wei.liu2@citrix.com>
Tue, 13 May 2014 21:53:49 +0000 (22:53 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 21 May 2014 09:59:53 +0000 (10:59 +0100)
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.h

index c7aa8177622294bf4a1ff8d045e50b6afa7f10a5..896ecabdf31c0794ed636a1d0a51b38b6962d260 100644 (file)
  * libxl_types.idl). The library provides a common set of methods for
  * initialising and freeing these types.
  *
+ * IDL-generated libxl types should be used as follows: the user must
+ * always call the "init" function before using a type, even if the
+ * variable is simply being passed by reference as an out parameter
+ * to a libxl function.  The user must always calls "dispose" exactly
+ * once afterwards, to clean up, regardless of whether operations on
+ * this object succeeded or failed.  See the xl code for examples.
+ *
+ * "init" is idempotent.  We intend that "dispose" will become
+ * idempotent, but this is not currently the case.
+ *
  * void libxl_<type>_init(<type> *p):
  *
  *    Initialises the members of "p" to all defaults. These may either