Further work on storage API and autogenerating bindings.
authorRichard W.M. Jones <rjones@redhat.com>
Sat, 19 Jan 2008 14:03:15 +0000 (14:03 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Sat, 19 Jan 2008 14:03:15 +0000 (14:03 +0000)
configure.ac
libvirt/Makefile.in
libvirt/generator.pl
libvirt/libvirt.ml
libvirt/libvirt.mli
libvirt/libvirt_c.c
libvirt/libvirt_c_epilogue.c
libvirt/libvirt_c_oneoffs.c

index 9331243..e246934 100644 (file)
@@ -62,6 +62,11 @@ AC_CHECK_HEADER([libvirt/libvirt.h],
        [],
        AC_MSG_ERROR([You must install libvirt development package]))
 
        [],
        AC_MSG_ERROR([You must install libvirt development package]))
 
+dnl We also use <libvirt/virterror.h>
+AC_CHECK_HEADER([libvirt/virterror.h],
+       [],
+       AC_MSG_ERROR([You must install libvirt development package]))
+
 dnl Check for libvirt >= 0.2.1 (our minimum supported version).
 dnl See: http://libvirt.org/hvsupport.html
 AC_CHECK_FUNC(virConnectGetCapabilities,
 dnl Check for libvirt >= 0.2.1 (our minimum supported version).
 dnl See: http://libvirt.org/hvsupport.html
 AC_CHECK_FUNC(virConnectGetCapabilities,
@@ -133,12 +138,8 @@ AC_CHECK_FUNCS([virConnectGetHostname \
 ])
 
 dnl Check for optional types added since 0.2.1.
 ])
 
 dnl Check for optional types added since 0.2.1.
-AC_CHECK_TYPES([virJobPtr, virStoragePoolPtr, virStorageVolPtr])
-
-dnl We also use <libvirt/virterror.h>
-AC_CHECK_HEADER([libvirt/virterror.h],
-       [],
-       AC_MSG_ERROR([You must install libvirt development package]))
+AC_CHECK_TYPES([virJobPtr, virStoragePoolPtr, virStorageVolPtr],,,
+              [#include <libvirt/libvirt.h>])
 
 dnl Check for optional ncurses.
 AC_CHECK_LIB(ncurses,initscr)
 
 dnl Check for optional ncurses.
 AC_CHECK_LIB(ncurses,initscr)
index 3bc06ac..4b203fd 100644 (file)
@@ -100,14 +100,18 @@ endif
 
 # Automatically generate the C code from a Perl script 'generator.pl'.
 libvirt_c.c: generator.pl
 
 # Automatically generate the C code from a Perl script 'generator.pl'.
 libvirt_c.c: generator.pl
-       perl -w $< > $@
+       perl -w $<
 
 # Status of automatically generated bindings.
 
 # Status of automatically generated bindings.
-autostatus:
-       @echo -n "Functions which have manual bindings: "
+autostatus: libvirt_c.c
+       @echo -n "Functions which have manual bindings:    "
        @grep ^ocaml_libvirt_ libvirt_c_oneoffs.c  | wc -l
        @grep ^ocaml_libvirt_ libvirt_c_oneoffs.c  | wc -l
-       @echo -n "LOC in manual bindings: "
+       @echo -n "Functions which have automatic bindings: "
+       @grep ^ocaml_libvirt_ libvirt_c.c  | wc -l
+       @echo -n "LOC in manual bindings:    "
        @wc -l < libvirt_c_oneoffs.c
        @wc -l < libvirt_c_oneoffs.c
+       @echo -n "LOC in automatic bindings: "
+       @wc -l < libvirt_c.c
 
 libvirt.cmo: libvirt.cmi
 libvirt.cmi: libvirt.mli
 
 libvirt.cmo: libvirt.cmi
 libvirt.cmi: libvirt.mli
index 2c5ff1e..b389a1b 100755 (executable)
@@ -62,6 +62,8 @@ my @functions = (
     { name => "virDomainReboot", sig => "dom, 0 : unit" },
     { name => "virDomainUndefine", sig => "dom : unit" },
     { name => "virDomainCreate", sig => "dom : unit" },
     { name => "virDomainReboot", sig => "dom, 0 : unit" },
     { name => "virDomainUndefine", sig => "dom : unit" },
     { name => "virDomainCreate", sig => "dom : unit" },
+    { name => "virDomainGetAutostart", sig => "dom : bool" },
+    { name => "virDomainSetAutostart", sig => "dom, bool : unit" },
 
     { name => "virNetworkLookupByName", sig => "conn, string : net" },
     { name => "virNetworkLookupByUUIDString", sig => "conn, string : net" },
 
     { name => "virNetworkLookupByName", sig => "conn, string : net" },
     { name => "virNetworkLookupByUUIDString", sig => "conn, string : net" },
@@ -70,6 +72,8 @@ my @functions = (
     { name => "virNetworkGetBridgeName", sig => "net : string" },
     { name => "virNetworkUndefine", sig => "net : unit" },
     { name => "virNetworkCreate", sig => "net : unit" },
     { name => "virNetworkGetBridgeName", sig => "net : string" },
     { name => "virNetworkUndefine", sig => "net : unit" },
     { name => "virNetworkCreate", sig => "net : unit" },
+    { name => "virNetworkGetAutostart", sig => "net : bool" },
+    { name => "virNetworkSetAutostart", sig => "net, bool : unit" },
 
     { name => "virStoragePoolLookupByName",
       sig => "conn, string : pool", weak => 1 },
 
     { name => "virStoragePoolLookupByName",
       sig => "conn, string : pool", weak => 1 },
@@ -80,28 +84,32 @@ my @functions = (
     { name => "virStoragePoolGetXMLDesc",
       sig => "pool, 0 : string", weak => 1 },
     { name => "virStoragePoolUndefine",
     { name => "virStoragePoolGetXMLDesc",
       sig => "pool, 0 : string", weak => 1 },
     { name => "virStoragePoolUndefine",
-      sig => "pool : string", weak => 1 },
+      sig => "pool : unit", weak => 1 },
     { name => "virStoragePoolCreate",
     { name => "virStoragePoolCreate",
-      sig => "pool : string", weak => 1 },
+      sig => "pool : unit", weak => 1 },
     { name => "virStoragePoolShutdown",
     { name => "virStoragePoolShutdown",
-      sig => "pool : string", weak => 1 },
+      sig => "pool : unit", weak => 1 },
     { name => "virStoragePoolRefresh",
     { name => "virStoragePoolRefresh",
-      sig => "pool, 0 : string", weak => 1 },
-
-    { name => "virStorageVolLookupByName",
-      sig => "conn, string : vol", weak => 1 },
+      sig => "pool, 0U : unit", weak => 1 },
+    { name => "virStoragePoolGetAutostart",
+      sig => "pool : bool", weak => 1 },
+    { name => "virStoragePoolSetAutostart",
+      sig => "pool, bool : unit", weak => 1 },
+
+#    { name => "virStorageVolLookupByName", XXX see libvir-list posting
+#      sig => "pool, string : vol", weak => 1 },
     { name => "virStorageVolLookupByKey",
       sig => "conn, string : vol", weak => 1 },
     { name => "virStorageVolLookupByPath",
       sig => "conn, string : vol", weak => 1 },
     { name => "virStorageVolGetXMLDesc",
     { name => "virStorageVolLookupByKey",
       sig => "conn, string : vol", weak => 1 },
     { name => "virStorageVolLookupByPath",
       sig => "conn, string : vol", weak => 1 },
     { name => "virStorageVolGetXMLDesc",
-      sig => "pool, 0 : string", weak => 1 },
+      sig => "vol, 0 : string", weak => 1 },
     { name => "virStorageVolGetPath",
     { name => "virStorageVolGetPath",
-      sig => "pool : string", weak => 1 },
+      sig => "vol : string", weak => 1 },
     { name => "virStorageVolGetKey",
     { name => "virStorageVolGetKey",
-      sig => "pool : static string", weak => 1 },
+      sig => "vol : static string", weak => 1 },
     { name => "virStorageVolGetName",
     { name => "virStorageVolGetName",
-      sig => "pool : static string", weak => 1 },
+      sig => "vol : static string", weak => 1 },
 
     );
 
 
     );
 
@@ -117,8 +125,6 @@ my @unimplemented = (
     "ocaml_libvirt_connect_create_linux_job",
     "ocaml_libvirt_network_create_job",
     "ocaml_libvirt_network_create_xml_job",
     "ocaml_libvirt_connect_create_linux_job",
     "ocaml_libvirt_network_create_job",
     "ocaml_libvirt_network_create_xml_job",
-    "ocaml_libvirt_storage_pool_set_autostart", #?
-    "ocaml_libvirt_storage_pool_get_autostart", #?
     "ocaml_libvirt_storage_pool_get_info",
     "ocaml_libvirt_storage_pool_get_uuid_string", #?
     "ocaml_libvirt_storage_pool_get_uuid", #?
     "ocaml_libvirt_storage_pool_get_info",
     "ocaml_libvirt_storage_pool_get_uuid_string", #?
     "ocaml_libvirt_storage_pool_get_uuid", #?
@@ -127,6 +133,7 @@ my @unimplemented = (
     "ocaml_libvirt_storage_pool_define_xml",
     "ocaml_libvirt_storage_pool_create_xml",
     "ocaml_libvirt_storage_pool_lookup_by_uuid",
     "ocaml_libvirt_storage_pool_define_xml",
     "ocaml_libvirt_storage_pool_create_xml",
     "ocaml_libvirt_storage_pool_lookup_by_uuid",
+    "ocaml_libvirt_storage_vol_lookup_by_name", # XXX
     "ocaml_libvirt_storage_vol_free", #?
     "ocaml_libvirt_storage_vol_destroy", #?
     "ocaml_libvirt_storage_vol_create_xml",
     "ocaml_libvirt_storage_vol_free", #?
     "ocaml_libvirt_storage_vol_destroy", #?
     "ocaml_libvirt_storage_vol_create_xml",
@@ -148,7 +155,10 @@ open F, ">$filename" or die "$filename: $!";
 # Write the prologue.
 
 print F <<'END';
 # Write the prologue.
 
 print F <<'END';
-/* WARNING: THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'.
+/* !!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!!
+ *
+ * THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'.
+ *
  * Any changes you make to this file may be overwritten.
  */
 
  * Any changes you make to this file may be overwritten.
  */
 
@@ -238,23 +248,31 @@ sub gen_c_signature
     } elsif ($sig =~ /^(\w+) : int$/) {
        my $c_type = short_name_to_c_type ($1);
        "int $c_name ($c_type $1)"
     } elsif ($sig =~ /^(\w+) : int$/) {
        my $c_type = short_name_to_c_type ($1);
        "int $c_name ($c_type $1)"
+    } elsif ($sig =~ /^(\w+) : bool$/) {
+       my $c_type = short_name_to_c_type ($1);
+       "int $c_name ($c_type $1, int *r)"
+    } elsif ($sig =~ /^(\w+), bool : unit$/) {
+       my $c_type = short_name_to_c_type ($1);
+       "int $c_name ($c_type $1, int b)"
     } elsif ($sig eq "conn, int : int array") {
        "int $c_name (virConnectPtr conn, int *ids, int maxids)"
     } elsif ($sig eq "conn, int : string array") {
        "int $c_name (virConnectPtr conn, char **const names, int maxnames)"
     } elsif ($sig eq "conn, int : int array") {
        "int $c_name (virConnectPtr conn, int *ids, int maxids)"
     } elsif ($sig eq "conn, int : string array") {
        "int $c_name (virConnectPtr conn, char **const names, int maxnames)"
-    } elsif ($sig =~ /^(\w+), 0 : string$/) {
+    } elsif ($sig =~ /^(\w+), 0(U?) : string$/) {
        my $c_type = short_name_to_c_type ($1);
        my $c_type = short_name_to_c_type ($1);
-       "char *$c_name ($c_type $1, int flags)"
-    } elsif ($sig =~ /^(\w+), 0 : unit$/) {
+       my $unsigned = $2 eq "U" ? "unsigned " : "";
+       "char *$c_name ($c_type $1, $unsigned int flags)"
+    } elsif ($sig =~ /^(\w+), 0(U?) : unit$/) {
        my $c_type = short_name_to_c_type ($1);
        my $c_type = short_name_to_c_type ($1);
-       "int $c_name ($c_type $1, int flags)"
+       my $unsigned = $2 eq "U" ? "unsigned " : "";
+       "int $c_name ($c_type $1, $unsigned int flags)"
     } elsif ($sig =~ /^(\w+) : unit$/) {
        my $c_type = short_name_to_c_type ($1);
     } elsif ($sig =~ /^(\w+) : unit$/) {
        my $c_type = short_name_to_c_type ($1);
-       "int $c_name ($c_type $1 dom)"
+       "int $c_name ($c_type $1)"
     } elsif ($sig =~ /^(\w+), string : (\w+)$/) {
        my $c_type = short_name_to_c_type ($1);
        my $c_ret_type = short_name_to_c_type ($2);
     } elsif ($sig =~ /^(\w+), string : (\w+)$/) {
        my $c_type = short_name_to_c_type ($1);
        my $c_ret_type = short_name_to_c_type ($2);
-       "$c_ret_type $c_name ($c_type $1 dom)"
+       "$c_ret_type $c_name ($c_type $1, const char *str)"
     } else {
        die "unknown signature $sig"
     }
     } else {
        die "unknown signature $sig"
     }
@@ -270,13 +288,17 @@ sub gen_arg_names
        ( "$1v" )
     } elsif ($sig =~ /^(\w+) : int$/) {
        ( "$1v" )
        ( "$1v" )
     } elsif ($sig =~ /^(\w+) : int$/) {
        ( "$1v" )
+    } elsif ($sig =~ /^(\w+) : bool$/) {
+       ( "$1v" )
+    } elsif ($sig =~ /^(\w+), bool : unit$/) {
+       ( "$1v", "bv" )
     } elsif ($sig eq "conn, int : int array") {
        ( "connv", "iv" )
     } elsif ($sig eq "conn, int : string array") {
        ( "connv", "iv" )
     } elsif ($sig eq "conn, int : int array") {
        ( "connv", "iv" )
     } elsif ($sig eq "conn, int : string array") {
        ( "connv", "iv" )
-    } elsif ($sig =~ /^(\w+), 0 : string$/) {
+    } elsif ($sig =~ /^(\w+), 0U? : string$/) {
        ( "$1v" )
        ( "$1v" )
-    } elsif ($sig =~ /^(\w+), 0 : unit$/) {
+    } elsif ($sig =~ /^(\w+), 0U? : unit$/) {
        ( "$1v" )
     } elsif ($sig =~ /^(\w+) : unit$/) {
        ( "$1v" )
        ( "$1v" )
     } elsif ($sig =~ /^(\w+) : unit$/) {
        ( "$1v" )
@@ -365,6 +387,28 @@ sub gen_c_code
 
   CAMLreturn (Val_int (r));
 "
 
   CAMLreturn (Val_int (r));
 "
+    } elsif ($sig =~ /^(\w+) : bool$/) {
+       "\
+  " . gen_unpack_args ($1) . "
+  int r, b;
+
+  NONBLOCKING (r = $c_name ($1, &b));
+  CHECK_ERROR (r == -1, conn, \"$c_name\");
+
+  CAMLreturn (b ? Val_true : Val_false);
+"
+    } elsif ($sig =~ /^(\w+), bool : unit$/) {
+       "\
+  " . gen_unpack_args ($1) . "
+  int r, b;
+
+  b = bv == Val_true ? 1 : 0;
+
+  NONBLOCKING (r = $c_name ($1, b));
+  CHECK_ERROR (r == -1, conn, \"$c_name\");
+
+  CAMLreturn (Val_unit);
+"
     } elsif ($sig eq "conn, int : int array") {
        "\
   CAMLlocal1 (rv);
     } elsif ($sig eq "conn, int : int array") {
        "\
   CAMLlocal1 (rv);
@@ -401,7 +445,7 @@ sub gen_c_code
 
   CAMLreturn (rv);
 "
 
   CAMLreturn (rv);
 "
-    } elsif ($sig =~ /^(\w+), 0 : string$/) {
+    } elsif ($sig =~ /^(\w+), 0U? : string$/) {
        "\
   CAMLlocal1 (rv);
   " . gen_unpack_args ($1) . "
        "\
   CAMLlocal1 (rv);
   " . gen_unpack_args ($1) . "
@@ -424,7 +468,7 @@ sub gen_c_code
 
   CAMLreturn (Val_unit);
 "
 
   CAMLreturn (Val_unit);
 "
-    } elsif ($sig =~ /^(\w+), 0 : unit$/) {
+    } elsif ($sig =~ /^(\w+), 0U? : unit$/) {
        "\
   " . gen_unpack_args ($1) . "
   int r;
        "\
   " . gen_unpack_args ($1) . "
   int r;
index 598cd7d..5880fd2 100644 (file)
@@ -347,6 +347,12 @@ struct
     | VIR_ERR_NO_DOMAIN
     | VIR_ERR_NO_NETWORK
     | VIR_ERR_INVALID_MAC
     | VIR_ERR_NO_DOMAIN
     | VIR_ERR_NO_NETWORK
     | VIR_ERR_INVALID_MAC
+    | VIR_ERR_AUTH_FAILED
+    | VIR_ERR_INVALID_STORAGE_POOL
+    | VIR_ERR_INVALID_STORAGE_VOL
+    | VIR_WAR_NO_STORAGE
+    | VIR_ERR_NO_STORAGE_POOL
+    | VIR_ERR_NO_STORAGE_VOL
     | VIR_ERR_UNKNOWN of int
 
   let string_of_code = function
     | VIR_ERR_UNKNOWN of int
 
   let string_of_code = function
@@ -395,6 +401,12 @@ struct
     | VIR_ERR_NO_DOMAIN -> "VIR_ERR_NO_DOMAIN"
     | VIR_ERR_NO_NETWORK -> "VIR_ERR_NO_NETWORK"
     | VIR_ERR_INVALID_MAC -> "VIR_ERR_INVALID_MAC"
     | VIR_ERR_NO_DOMAIN -> "VIR_ERR_NO_DOMAIN"
     | VIR_ERR_NO_NETWORK -> "VIR_ERR_NO_NETWORK"
     | VIR_ERR_INVALID_MAC -> "VIR_ERR_INVALID_MAC"
+    | VIR_ERR_AUTH_FAILED -> "VIR_ERR_AUTH_FAILED"
+    | VIR_ERR_INVALID_STORAGE_POOL -> "VIR_ERR_INVALID_STORAGE_POOL"
+    | VIR_ERR_INVALID_STORAGE_VOL -> "VIR_ERR_INVALID_STORAGE_VOL"
+    | VIR_WAR_NO_STORAGE -> "VIR_WAR_NO_STORAGE"
+    | VIR_ERR_NO_STORAGE_POOL -> "VIR_ERR_NO_STORAGE_POOL"
+    | VIR_ERR_NO_STORAGE_VOL -> "VIR_ERR_NO_STORAGE_VOL"
     | VIR_ERR_UNKNOWN i -> "VIR_ERR_" ^ string_of_int i
 
   type domain =
     | VIR_ERR_UNKNOWN i -> "VIR_ERR_" ^ string_of_int i
 
   type domain =
@@ -415,6 +427,7 @@ struct
     | VIR_FROM_OPENVZ
     | VIR_FROM_XENXM
     | VIR_FROM_STATS_LINUX
     | VIR_FROM_OPENVZ
     | VIR_FROM_XENXM
     | VIR_FROM_STATS_LINUX
+    | VIR_FROM_STORAGE
     | VIR_FROM_UNKNOWN of int
 
   let string_of_domain = function
     | VIR_FROM_UNKNOWN of int
 
   let string_of_domain = function
@@ -435,6 +448,7 @@ struct
     | VIR_FROM_OPENVZ -> "VIR_FROM_OPENVZ"
     | VIR_FROM_XENXM -> "VIR_FROM_XENXM"
     | VIR_FROM_STATS_LINUX -> "VIR_FROM_STATS_LINUX"
     | VIR_FROM_OPENVZ -> "VIR_FROM_OPENVZ"
     | VIR_FROM_XENXM -> "VIR_FROM_XENXM"
     | VIR_FROM_STATS_LINUX -> "VIR_FROM_STATS_LINUX"
+    | VIR_FROM_STORAGE -> "VIR_FROM_STORAGE"
     | VIR_FROM_UNKNOWN i -> "VIR_FROM_" ^ string_of_int i
 
   type level =
     | VIR_FROM_UNKNOWN i -> "VIR_FROM_" ^ string_of_int i
 
   type level =
index 61beee5..642b845 100644 (file)
@@ -385,8 +385,7 @@ sig
       *)
 end
   (** Module dealing with connections.  [Connect.t] is the
       *)
 end
   (** Module dealing with connections.  [Connect.t] is the
-      connection object.
-  *)
+      connection object. *)
 
 (** {3 Domains} *)
 
 
 (** {3 Domains} *)
 
@@ -573,8 +572,7 @@ sig
       *)
 end
   (** Module dealing with domains.  [Domain.t] is the
       *)
 end
   (** Module dealing with domains.  [Domain.t] is the
-      domain object.
-  *)
+      domain object. *)
 
 (** {3 Networks} *)
 
 
 (** {3 Networks} *)
 
@@ -634,8 +632,7 @@ sig
       *)
 end
   (** Module dealing with networks.  [Network.t] is the
       *)
 end
   (** Module dealing with networks.  [Network.t] is the
-      network object.
-  *)
+      network object. *)
 
 (** {3 Storage pools} *)
 
 
 (** {3 Storage pools} *)
 
@@ -766,9 +763,9 @@ sig
        The possible types for a job are:
 
 {v
        The possible types for a job are:
 
 {v
-(`Domain, `W) Job.t            Job creating a r/w domain
+(`Domain, `W) Job.t            Job creating a new domain
 (`Domain_nocreate, `W) Job.t   Job acting on an existing domain
 (`Domain_nocreate, `W) Job.t   Job acting on an existing domain
-(`Network, `W) Job.t           Job creating a r/w network
+(`Network, `W) Job.t           Job creating a new network
 (`Network_nocreate, `W) Job.t  Job acting on an existing network
 v}
       *)
 (`Network_nocreate, `W) Job.t  Job acting on an existing network
 v}
       *)
@@ -780,8 +777,8 @@ v}
     (** State of the job. *)
 
   type job_info = {
     (** State of the job. *)
 
   type job_info = {
-    typ : job_type;                    (** Job type *)
-    state : job_state;                 (** Job state *)
+    typ : job_type;                    (** Job type (Bounded, Unbounded) *)
+    state : job_state;                 (** Job state (Running, etc.) *)
     running_time : int;                        (** Actual running time (seconds) *)
     (** The following fields are only available in Bounded jobs: *)
     remaining_time : int;              (** Estimated time left (seconds) *)
     running_time : int;                        (** Actual running time (seconds) *)
     (** The following fields are only available in Bounded jobs: *)
     remaining_time : int;              (** Estimated time left (seconds) *)
@@ -809,6 +806,7 @@ v}
        job.  Note that the opposite operation is impossible.
       *)
 end
        job.  Note that the opposite operation is impossible.
       *)
 end
+  (** Module dealing with asynchronous jobs. *)
 
 (** {3 Error handling and exceptions} *)
 
 
 (** {3 Error handling and exceptions} *)
 
@@ -860,7 +858,14 @@ sig
     | VIR_ERR_NO_DOMAIN
     | VIR_ERR_NO_NETWORK
     | VIR_ERR_INVALID_MAC
     | VIR_ERR_NO_DOMAIN
     | VIR_ERR_NO_NETWORK
     | VIR_ERR_INVALID_MAC
-       (* ^^ NB: If you add a variant you MUST edit libvirt_c.c:MAX_VIR_* *)
+    | VIR_ERR_AUTH_FAILED
+    | VIR_ERR_INVALID_STORAGE_POOL
+    | VIR_ERR_INVALID_STORAGE_VOL
+    | VIR_WAR_NO_STORAGE
+    | VIR_ERR_NO_STORAGE_POOL
+    | VIR_ERR_NO_STORAGE_VOL
+       (* ^^ NB: If you add a variant you MUST edit
+          libvirt_c_epilogue.c:MAX_VIR_* *)
     | VIR_ERR_UNKNOWN of int
        (** See [<libvirt/virterror.h>] for meaning of these codes. *)
 
     | VIR_ERR_UNKNOWN of int
        (** See [<libvirt/virterror.h>] for meaning of these codes. *)
 
@@ -884,7 +889,9 @@ sig
     | VIR_FROM_OPENVZ
     | VIR_FROM_XENXM
     | VIR_FROM_STATS_LINUX
     | VIR_FROM_OPENVZ
     | VIR_FROM_XENXM
     | VIR_FROM_STATS_LINUX
-       (* ^^ NB: If you add a variant you MUST edit libvirt_c.c: MAX_VIR_* *)
+    | VIR_FROM_STORAGE
+       (* ^^ NB: If you add a variant you MUST edit
+          libvirt_c_epilogue.c: MAX_VIR_* *)
     | VIR_FROM_UNKNOWN of int
        (** Subsystem / driver which produced the error. *)
 
     | VIR_FROM_UNKNOWN of int
        (** Subsystem / driver which produced the error. *)
 
index 0bb9442..0dc21e4 100644 (file)
@@ -1,4 +1,7 @@
-/* WARNING: THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'.
+/* !!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!!
+ *
+ * THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'.
+ *
  * Any changes you make to this file may be overwritten.
  */
 
  * Any changes you make to this file may be overwritten.
  */
 
@@ -617,6 +620,38 @@ ocaml_libvirt_domain_create (value domv)
 }
 
 CAMLprim value
 }
 
 CAMLprim value
+ocaml_libvirt_domain_get_autostart (value domv)
+{
+  CAMLparam1 (domv);
+
+  virDomainPtr dom = Domain_val (domv);
+  virConnectPtr conn = Connect_domv (domv);
+  int r, b;
+
+  NONBLOCKING (r = virDomainGetAutostart (dom, &b));
+  CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
+
+  CAMLreturn (b ? Val_true : Val_false);
+}
+
+CAMLprim value
+ocaml_libvirt_domain_set_autostart (value domv, value bv)
+{
+  CAMLparam2 (domv, bv);
+
+  virDomainPtr dom = Domain_val (domv);
+  virConnectPtr conn = Connect_domv (domv);
+  int r, b;
+
+  b = bv == Val_true ? 1 : 0;
+
+  NONBLOCKING (r = virDomainSetAutostart (dom, b));
+  CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
+
+  CAMLreturn (Val_unit);
+}
+
+CAMLprim value
 ocaml_libvirt_network_lookup_by_name (value connv, value strv)
 {
   CAMLparam2 (connv, strv);
 ocaml_libvirt_network_lookup_by_name (value connv, value strv)
 {
   CAMLparam2 (connv, strv);
@@ -735,9 +770,41 @@ ocaml_libvirt_network_create (value netv)
   CAMLreturn (Val_unit);
 }
 
   CAMLreturn (Val_unit);
 }
 
+CAMLprim value
+ocaml_libvirt_network_get_autostart (value netv)
+{
+  CAMLparam1 (netv);
+
+  virNetworkPtr net = Network_val (netv);
+  virConnectPtr conn = Connect_netv (netv);
+  int r, b;
+
+  NONBLOCKING (r = virNetworkGetAutostart (net, &b));
+  CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
+
+  CAMLreturn (b ? Val_true : Val_false);
+}
+
+CAMLprim value
+ocaml_libvirt_network_set_autostart (value netv, value bv)
+{
+  CAMLparam2 (netv, bv);
+
+  virNetworkPtr net = Network_val (netv);
+  virConnectPtr conn = Connect_netv (netv);
+  int r, b;
+
+  b = bv == Val_true ? 1 : 0;
+
+  NONBLOCKING (r = virNetworkSetAutostart (net, b));
+  CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
+
+  CAMLreturn (Val_unit);
+}
+
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
-extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn dom) __attribute__((weak));
+extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -772,7 +839,7 @@ ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
-extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn dom) __attribute__((weak));
+extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -841,7 +908,7 @@ ocaml_libvirt_storage_pool_get_name (value poolv)
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
-extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, int flags) __attribute__((weak));
+extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool,  int flags) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -876,7 +943,7 @@ ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
-extern char *virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
+extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -895,23 +962,20 @@ ocaml_libvirt_storage_pool_undefine (value poolv)
    */
   WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
 
    */
   WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
 
-  CAMLlocal1 (rv);
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
-  char *r;
+  int r;
 
   NONBLOCKING (r = virStoragePoolUndefine (pool));
 
   NONBLOCKING (r = virStoragePoolUndefine (pool));
-  CHECK_ERROR (!r, conn, "virStoragePoolUndefine");
+  CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
 
 
-  rv = caml_copy_string (r);
-  free (r);
-  CAMLreturn (rv);
+  CAMLreturn (Val_unit);
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLCREATE
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLCREATE
-extern char *virStoragePoolCreate (virStoragePoolPtr pool) __attribute__((weak));
+extern int virStoragePoolCreate (virStoragePoolPtr pool) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -930,23 +994,20 @@ ocaml_libvirt_storage_pool_create (value poolv)
    */
   WEAK_SYMBOL_CHECK (virStoragePoolCreate);
 
    */
   WEAK_SYMBOL_CHECK (virStoragePoolCreate);
 
-  CAMLlocal1 (rv);
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
-  char *r;
+  int r;
 
   NONBLOCKING (r = virStoragePoolCreate (pool));
 
   NONBLOCKING (r = virStoragePoolCreate (pool));
-  CHECK_ERROR (!r, conn, "virStoragePoolCreate");
+  CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
 
 
-  rv = caml_copy_string (r);
-  free (r);
-  CAMLreturn (rv);
+  CAMLreturn (Val_unit);
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLSHUTDOWN
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLSHUTDOWN
-extern char *virStoragePoolShutdown (virStoragePoolPtr pool) __attribute__((weak));
+extern int virStoragePoolShutdown (virStoragePoolPtr pool) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -965,23 +1026,20 @@ ocaml_libvirt_storage_pool_shutdown (value poolv)
    */
   WEAK_SYMBOL_CHECK (virStoragePoolShutdown);
 
    */
   WEAK_SYMBOL_CHECK (virStoragePoolShutdown);
 
-  CAMLlocal1 (rv);
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
-  char *r;
+  int r;
 
   NONBLOCKING (r = virStoragePoolShutdown (pool));
 
   NONBLOCKING (r = virStoragePoolShutdown (pool));
-  CHECK_ERROR (!r, conn, "virStoragePoolShutdown");
+  CHECK_ERROR (r == -1, conn, "virStoragePoolShutdown");
 
 
-  rv = caml_copy_string (r);
-  free (r);
-  CAMLreturn (rv);
+  CAMLreturn (Val_unit);
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
-extern char *virStoragePoolRefresh (virStoragePoolPtr pool, int flags) __attribute__((weak));
+extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned  int flags) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -1000,58 +1058,86 @@ ocaml_libvirt_storage_pool_refresh (value poolv)
    */
   WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
 
    */
   WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
 
-  CAMLlocal1 (rv);
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
-  char *r;
+  int r;
 
   NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
 
   NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
-  CHECK_ERROR (!r, conn, "virStoragePoolRefresh");
+  CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
 
 
-  rv = caml_copy_string (r);
-  free (r);
-  CAMLreturn (rv);
+  CAMLreturn (Val_unit);
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
-extern virStorageVolPtr virStorageVolLookupByName (virConnectPtr conn dom) __attribute__((weak));
+#ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
+extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
 #endif
 #endif
 
 CAMLprim value
 #endif
 #endif
 
 CAMLprim value
-ocaml_libvirt_storage_vol_lookup_by_name (value connv, value strv)
+ocaml_libvirt_storage_pool_get_autostart (value poolv)
 {
 {
-  CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
-  /* Symbol virStorageVolLookupByName not found at compile time. */
-  not_supported ("virStorageVolLookupByName");
+  CAMLparam1 (poolv);
+#ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
+  /* Symbol virStoragePoolGetAutostart not found at compile time. */
+  not_supported ("virStoragePoolGetAutostart");
   /* Suppresses a compiler warning. */
   (void) caml__frame;
 #else
   /* Suppresses a compiler warning. */
   (void) caml__frame;
 #else
-  /* Check that the symbol virStorageVolLookupByName
+  /* Check that the symbol virStoragePoolGetAutostart
    * is in runtime version of libvirt.
    */
    * is in runtime version of libvirt.
    */
-  WEAK_SYMBOL_CHECK (virStorageVolLookupByName);
+  WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
 
 
-  CAMLlocal1 (rv);
-  virConnectPtr conn = Connect_val (connv);
-  char *str = String_val (strv);
-  virStorageVolPtr r;
+  virStoragePoolPtr pool = Pool_val (poolv);
+  virConnectPtr conn = Connect_polv (poolv);
+  int r, b;
 
 
-  NONBLOCKING (r = virStorageVolLookupByName (conn, str));
-  CHECK_ERROR (!r, conn, "virStorageVolLookupByName");
+  NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
+  CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
 
 
-  rv = Val_volume (r, connv);
+  CAMLreturn (b ? Val_true : Val_false);
+#endif
+}
 
 
-  CAMLreturn (rv);
+#ifdef HAVE_WEAK_SYMBOLS
+#ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
+extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
+{
+  CAMLparam2 (poolv, bv);
+#ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
+  /* Symbol virStoragePoolSetAutostart not found at compile time. */
+  not_supported ("virStoragePoolSetAutostart");
+  /* Suppresses a compiler warning. */
+  (void) caml__frame;
+#else
+  /* Check that the symbol virStoragePoolSetAutostart
+   * is in runtime version of libvirt.
+   */
+  WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
+
+  virStoragePoolPtr pool = Pool_val (poolv);
+  virConnectPtr conn = Connect_polv (poolv);
+  int r, b;
+
+  b = bv == Val_true ? 1 : 0;
+
+  NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
+  CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
+
+  CAMLreturn (Val_unit);
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
 #endif
 }
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
-extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn dom) __attribute__((weak));
+extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -1086,7 +1172,7 @@ ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
-extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn dom) __attribute__((weak));
+extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
 #endif
 #endif
 
 #endif
 #endif
 
@@ -1121,14 +1207,14 @@ ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
-extern char *virStorageVolGetXMLDesc (virStoragePoolPtr pool, int flags) __attribute__((weak));
+extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol,  int flags) __attribute__((weak));
 #endif
 #endif
 
 CAMLprim value
 #endif
 #endif
 
 CAMLprim value
-ocaml_libvirt_storage_vol_get_xml_desc (value poolv)
+ocaml_libvirt_storage_vol_get_xml_desc (value volv)
 {
 {
-  CAMLparam1 (poolv);
+  CAMLparam1 (volv);
 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
   /* Symbol virStorageVolGetXMLDesc not found at compile time. */
   not_supported ("virStorageVolGetXMLDesc");
 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
   /* Symbol virStorageVolGetXMLDesc not found at compile time. */
   not_supported ("virStorageVolGetXMLDesc");
@@ -1141,11 +1227,11 @@ ocaml_libvirt_storage_vol_get_xml_desc (value poolv)
   WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
 
   CAMLlocal1 (rv);
   WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
 
   CAMLlocal1 (rv);
-  virStoragePoolPtr pool = Pool_val (poolv);
-  virConnectPtr conn = Connect_polv (poolv);
+  virStorageVolPtr vol = Volume_val (volv);
+  virConnectPtr conn = Connect_volv (volv);
   char *r;
 
   char *r;
 
-  NONBLOCKING (r = virStorageVolGetXMLDesc (pool, 0));
+  NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
   CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
 
   rv = caml_copy_string (r);
   CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
 
   rv = caml_copy_string (r);
@@ -1156,14 +1242,14 @@ ocaml_libvirt_storage_vol_get_xml_desc (value poolv)
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLGETPATH
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLGETPATH
-extern char *virStorageVolGetPath (virStoragePoolPtr pool) __attribute__((weak));
+extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
 #endif
 #endif
 
 CAMLprim value
 #endif
 #endif
 
 CAMLprim value
-ocaml_libvirt_storage_vol_get_path (value poolv)
+ocaml_libvirt_storage_vol_get_path (value volv)
 {
 {
-  CAMLparam1 (poolv);
+  CAMLparam1 (volv);
 #ifndef HAVE_VIRSTORAGEVOLGETPATH
   /* Symbol virStorageVolGetPath not found at compile time. */
   not_supported ("virStorageVolGetPath");
 #ifndef HAVE_VIRSTORAGEVOLGETPATH
   /* Symbol virStorageVolGetPath not found at compile time. */
   not_supported ("virStorageVolGetPath");
@@ -1176,11 +1262,11 @@ ocaml_libvirt_storage_vol_get_path (value poolv)
   WEAK_SYMBOL_CHECK (virStorageVolGetPath);
 
   CAMLlocal1 (rv);
   WEAK_SYMBOL_CHECK (virStorageVolGetPath);
 
   CAMLlocal1 (rv);
-  virStoragePoolPtr pool = Pool_val (poolv);
-  virConnectPtr conn = Connect_polv (poolv);
+  virStorageVolPtr vol = Volume_val (volv);
+  virConnectPtr conn = Connect_volv (volv);
   char *r;
 
   char *r;
 
-  NONBLOCKING (r = virStorageVolGetPath (pool));
+  NONBLOCKING (r = virStorageVolGetPath (vol));
   CHECK_ERROR (!r, conn, "virStorageVolGetPath");
 
   rv = caml_copy_string (r);
   CHECK_ERROR (!r, conn, "virStorageVolGetPath");
 
   rv = caml_copy_string (r);
@@ -1191,14 +1277,14 @@ ocaml_libvirt_storage_vol_get_path (value poolv)
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLGETKEY
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLGETKEY
-extern const char *virStorageVolGetKey (virStoragePoolPtr pool) __attribute__((weak));
+extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
 #endif
 #endif
 
 CAMLprim value
 #endif
 #endif
 
 CAMLprim value
-ocaml_libvirt_storage_vol_get_key (value poolv)
+ocaml_libvirt_storage_vol_get_key (value volv)
 {
 {
-  CAMLparam1 (poolv);
+  CAMLparam1 (volv);
 #ifndef HAVE_VIRSTORAGEVOLGETKEY
   /* Symbol virStorageVolGetKey not found at compile time. */
   not_supported ("virStorageVolGetKey");
 #ifndef HAVE_VIRSTORAGEVOLGETKEY
   /* Symbol virStorageVolGetKey not found at compile time. */
   not_supported ("virStorageVolGetKey");
@@ -1211,11 +1297,11 @@ ocaml_libvirt_storage_vol_get_key (value poolv)
   WEAK_SYMBOL_CHECK (virStorageVolGetKey);
 
   CAMLlocal1 (rv);
   WEAK_SYMBOL_CHECK (virStorageVolGetKey);
 
   CAMLlocal1 (rv);
-  virStoragePoolPtr pool = Pool_val (poolv);
-  virConnectPtr conn = Connect_polv (poolv);
+  virStorageVolPtr vol = Volume_val (volv);
+  virConnectPtr conn = Connect_volv (volv);
   const char *r;
 
   const char *r;
 
-  NONBLOCKING (r = virStorageVolGetKey (pool));
+  NONBLOCKING (r = virStorageVolGetKey (vol));
   CHECK_ERROR (!r, conn, "virStorageVolGetKey");
 
   rv = caml_copy_string (r);
   CHECK_ERROR (!r, conn, "virStorageVolGetKey");
 
   rv = caml_copy_string (r);
@@ -1225,14 +1311,14 @@ ocaml_libvirt_storage_vol_get_key (value poolv)
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLGETNAME
 
 #ifdef HAVE_WEAK_SYMBOLS
 #ifdef HAVE_VIRSTORAGEVOLGETNAME
-extern const char *virStorageVolGetName (virStoragePoolPtr pool) __attribute__((weak));
+extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
 #endif
 #endif
 
 CAMLprim value
 #endif
 #endif
 
 CAMLprim value
-ocaml_libvirt_storage_vol_get_name (value poolv)
+ocaml_libvirt_storage_vol_get_name (value volv)
 {
 {
-  CAMLparam1 (poolv);
+  CAMLparam1 (volv);
 #ifndef HAVE_VIRSTORAGEVOLGETNAME
   /* Symbol virStorageVolGetName not found at compile time. */
   not_supported ("virStorageVolGetName");
 #ifndef HAVE_VIRSTORAGEVOLGETNAME
   /* Symbol virStorageVolGetName not found at compile time. */
   not_supported ("virStorageVolGetName");
@@ -1245,11 +1331,11 @@ ocaml_libvirt_storage_vol_get_name (value poolv)
   WEAK_SYMBOL_CHECK (virStorageVolGetName);
 
   CAMLlocal1 (rv);
   WEAK_SYMBOL_CHECK (virStorageVolGetName);
 
   CAMLlocal1 (rv);
-  virStoragePoolPtr pool = Pool_val (poolv);
-  virConnectPtr conn = Connect_polv (poolv);
+  virStorageVolPtr vol = Volume_val (volv);
+  virConnectPtr conn = Connect_volv (volv);
   const char *r;
 
   const char *r;
 
-  NONBLOCKING (r = virStorageVolGetName (pool));
+  NONBLOCKING (r = virStorageVolGetName (vol));
   CHECK_ERROR (!r, conn, "virStorageVolGetName");
 
   rv = caml_copy_string (r);
   CHECK_ERROR (!r, conn, "virStorageVolGetName");
 
   rv = caml_copy_string (r);
@@ -1300,18 +1386,6 @@ ocaml_libvirt_network_create_xml_job ()
 }
 
 CAMLprim value
 }
 
 CAMLprim value
-ocaml_libvirt_storage_pool_set_autostart ()
-{
-  failwith ("ocaml_libvirt_storage_pool_set_autostart is unimplemented");
-}
-
-CAMLprim value
-ocaml_libvirt_storage_pool_get_autostart ()
-{
-  failwith ("ocaml_libvirt_storage_pool_get_autostart is unimplemented");
-}
-
-CAMLprim value
 ocaml_libvirt_storage_pool_get_info ()
 {
   failwith ("ocaml_libvirt_storage_pool_get_info is unimplemented");
 ocaml_libvirt_storage_pool_get_info ()
 {
   failwith ("ocaml_libvirt_storage_pool_get_info is unimplemented");
@@ -1360,6 +1434,12 @@ ocaml_libvirt_storage_pool_lookup_by_uuid ()
 }
 
 CAMLprim value
 }
 
 CAMLprim value
+ocaml_libvirt_storage_vol_lookup_by_name ()
+{
+  failwith ("ocaml_libvirt_storage_vol_lookup_by_name is unimplemented");
+}
+
+CAMLprim value
 ocaml_libvirt_storage_vol_free ()
 {
   failwith ("ocaml_libvirt_storage_vol_free is unimplemented");
 ocaml_libvirt_storage_vol_free ()
 {
   failwith ("ocaml_libvirt_storage_vol_free is unimplemented");
index fff76f9..a18749d 100644 (file)
@@ -111,8 +111,8 @@ not_supported (const char *fn)
  * to convert it into VIR_*_UNKNOWN (code).
  */
 
  * to convert it into VIR_*_UNKNOWN (code).
  */
 
-#define MAX_VIR_CODE 44 /* VIR_ERR_INVALID_MAC */
-#define MAX_VIR_DOMAIN 16 /* VIR_FROM_STATS_LINUX */
+#define MAX_VIR_CODE VIR_ERR_NO_STORAGE_VOL
+#define MAX_VIR_DOMAIN VIR_FROM_STORAGE
 #define MAX_VIR_LEVEL VIR_ERR_ERROR
 
 static inline value
 #define MAX_VIR_LEVEL VIR_ERR_ERROR
 
 static inline value
@@ -323,7 +323,7 @@ Val_pol (virStoragePoolPtr pol)
 
 #ifdef HAVE_VIRSTORAGEVOLPTR
 static value
 
 #ifdef HAVE_VIRSTORAGEVOLPTR
 static value
-Val_vol (virStorageVolPtr net)
+Val_vol (virStorageVolPtr vol)
 {
   CAMLparam0 ();
   CAMLlocal1 (rv);
 {
   CAMLparam0 ();
   CAMLlocal1 (rv);
index a9ed5b7..ecfdf9d 100644 (file)
@@ -648,34 +648,6 @@ ocaml_libvirt_domain_define_xml (value connv, value xmlv)
 }
 
 CAMLprim value
 }
 
 CAMLprim value
-ocaml_libvirt_domain_get_autostart (value domv)
-{
-  CAMLparam1 (domv);
-  virDomainPtr dom = Domain_val (domv);
-  virConnectPtr conn = Connect_domv (domv);
-  int r, autostart;
-
-  NONBLOCKING (r = virDomainGetAutostart (dom, &autostart));
-  CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
-
-  CAMLreturn (autostart ? Val_true : Val_false);
-}
-
-CAMLprim value
-ocaml_libvirt_domain_set_autostart (value domv, value autostartv)
-{
-  CAMLparam2 (domv, autostartv);
-  virDomainPtr dom = Domain_val (domv);
-  virConnectPtr conn = Connect_domv (domv);
-  int r, autostart = autostartv == Val_true ? 1 : 0;
-
-  NONBLOCKING (r = virDomainSetAutostart (dom, autostart));
-  CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
-
-  CAMLreturn (Val_unit);
-}
-
-CAMLprim value
 ocaml_libvirt_domain_set_vcpus (value domv, value nvcpusv)
 {
   CAMLparam2 (domv, nvcpusv);
 ocaml_libvirt_domain_set_vcpus (value domv, value nvcpusv)
 {
   CAMLparam2 (domv, nvcpusv);
@@ -1019,34 +991,6 @@ ocaml_libvirt_network_get_uuid_string (value netv)
   CAMLreturn (rv);
 }
 
   CAMLreturn (rv);
 }
 
-CAMLprim value
-ocaml_libvirt_network_get_autostart (value netv)
-{
-  CAMLparam1 (netv);
-  virNetworkPtr net = Network_val (netv);
-  virConnectPtr conn = Connect_netv (netv);
-  int r, autostart;
-
-  NONBLOCKING (r = virNetworkGetAutostart (net, &autostart));
-  CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
-
-  CAMLreturn (autostart ? Val_true : Val_false);
-}
-
-CAMLprim value
-ocaml_libvirt_network_set_autostart (value netv, value autostartv)
-{
-  CAMLparam2 (netv, autostartv);
-  virNetworkPtr net = Network_val (netv);
-  virConnectPtr conn = Connect_netv (netv);
-  int r, autostart = autostartv == Val_true ? 1 : 0;
-
-  NONBLOCKING (r = virNetworkSetAutostart (net, autostart));
-  CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
-
-  CAMLreturn (Val_unit);
-}
-
 /*----------------------------------------------------------------------*/
 
 CAMLprim value
 /*----------------------------------------------------------------------*/
 
 CAMLprim value