Implemented virStorageVolLookupByName & virStorageVolCreateXML.
[virt-top.git] / libvirt / libvirt_c.c
1 /* !!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!!
2  *
3  * THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'.
4  *
5  * Any changes you make to this file may be overwritten.
6  */
7
8 /* OCaml bindings for libvirt.
9  * (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc.
10  * http://libvirt.org/
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
25  */
26
27 #include "config.h"
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32
33 #include <libvirt/libvirt.h>
34 #include <libvirt/virterror.h>
35
36 #include <caml/config.h>
37 #include <caml/alloc.h>
38 #include <caml/callback.h>
39 #include <caml/custom.h>
40 #include <caml/fail.h>
41 #include <caml/memory.h>
42 #include <caml/misc.h>
43 #include <caml/mlvalues.h>
44 #include <caml/signals.h>
45
46 #include "libvirt_c_prologue.c"
47
48 #include "libvirt_c_oneoffs.c"
49
50 /* Automatically generated binding for virConnectClose.
51  * In generator.pl this function has signature "conn : free".
52  */
53
54 CAMLprim value
55 ocaml_libvirt_connect_close (value connv)
56 {
57   CAMLparam1 (connv);
58
59   virConnectPtr conn = Connect_val (connv);
60   int r;
61
62   NONBLOCKING (r = virConnectClose (conn));
63   CHECK_ERROR (r == -1, conn, "virConnectClose");
64
65   /* So that we don't double-free in the finalizer: */
66   Connect_val (connv) = NULL;
67
68   CAMLreturn (Val_unit);
69 }
70
71 /* Automatically generated binding for virConnectGetHostname.
72  * In generator.pl this function has signature "conn : string".
73  */
74
75 #ifdef HAVE_WEAK_SYMBOLS
76 #ifdef HAVE_VIRCONNECTGETHOSTNAME
77 extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak));
78 #endif
79 #endif
80
81 CAMLprim value
82 ocaml_libvirt_connect_get_hostname (value connv)
83 {
84   CAMLparam1 (connv);
85 #ifndef HAVE_VIRCONNECTGETHOSTNAME
86   /* Symbol virConnectGetHostname not found at compile time. */
87   not_supported ("virConnectGetHostname");
88   /* Suppresses a compiler warning. */
89   (void) caml__frame;
90 #else
91   /* Check that the symbol virConnectGetHostname
92    * is in runtime version of libvirt.
93    */
94   WEAK_SYMBOL_CHECK (virConnectGetHostname);
95
96   CAMLlocal1 (rv);
97   virConnectPtr conn = Connect_val (connv);
98   char *r;
99
100   NONBLOCKING (r = virConnectGetHostname (conn));
101   CHECK_ERROR (!r, conn, "virConnectGetHostname");
102
103   rv = caml_copy_string (r);
104   free (r);
105   CAMLreturn (rv);
106 #endif
107 }
108
109 /* Automatically generated binding for virConnectGetURI.
110  * In generator.pl this function has signature "conn : string".
111  */
112
113 #ifdef HAVE_WEAK_SYMBOLS
114 #ifdef HAVE_VIRCONNECTGETURI
115 extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak));
116 #endif
117 #endif
118
119 CAMLprim value
120 ocaml_libvirt_connect_get_uri (value connv)
121 {
122   CAMLparam1 (connv);
123 #ifndef HAVE_VIRCONNECTGETURI
124   /* Symbol virConnectGetURI not found at compile time. */
125   not_supported ("virConnectGetURI");
126   /* Suppresses a compiler warning. */
127   (void) caml__frame;
128 #else
129   /* Check that the symbol virConnectGetURI
130    * is in runtime version of libvirt.
131    */
132   WEAK_SYMBOL_CHECK (virConnectGetURI);
133
134   CAMLlocal1 (rv);
135   virConnectPtr conn = Connect_val (connv);
136   char *r;
137
138   NONBLOCKING (r = virConnectGetURI (conn));
139   CHECK_ERROR (!r, conn, "virConnectGetURI");
140
141   rv = caml_copy_string (r);
142   free (r);
143   CAMLreturn (rv);
144 #endif
145 }
146
147 /* Automatically generated binding for virConnectGetType.
148  * In generator.pl this function has signature "conn : static string".
149  */
150
151 CAMLprim value
152 ocaml_libvirt_connect_get_type (value connv)
153 {
154   CAMLparam1 (connv);
155
156   CAMLlocal1 (rv);
157   virConnectPtr conn = Connect_val (connv);
158   const char *r;
159
160   NONBLOCKING (r = virConnectGetType (conn));
161   CHECK_ERROR (!r, conn, "virConnectGetType");
162
163   rv = caml_copy_string (r);
164   CAMLreturn (rv);
165 }
166
167 /* Automatically generated binding for virConnectNumOfDomains.
168  * In generator.pl this function has signature "conn : int".
169  */
170
171 CAMLprim value
172 ocaml_libvirt_connect_num_of_domains (value connv)
173 {
174   CAMLparam1 (connv);
175
176   virConnectPtr conn = Connect_val (connv);
177   int r;
178
179   NONBLOCKING (r = virConnectNumOfDomains (conn));
180   CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains");
181
182   CAMLreturn (Val_int (r));
183 }
184
185 /* Automatically generated binding for virConnectListDomains.
186  * In generator.pl this function has signature "conn, int : int array".
187  */
188
189 CAMLprim value
190 ocaml_libvirt_connect_list_domains (value connv, value iv)
191 {
192   CAMLparam2 (connv, iv);
193
194   CAMLlocal1 (rv);
195   virConnectPtr conn = Connect_val (connv);
196   int i = Int_val (iv);
197   int ids[i], r;
198
199   NONBLOCKING (r = virConnectListDomains (conn, ids, i));
200   CHECK_ERROR (r == -1, conn, "virConnectListDomains");
201
202   rv = caml_alloc (r, 0);
203   for (i = 0; i < r; ++i)
204     Store_field (rv, i, Val_int (ids[i]));
205
206   CAMLreturn (rv);
207 }
208
209 /* Automatically generated binding for virConnectNumOfDefinedDomains.
210  * In generator.pl this function has signature "conn : int".
211  */
212
213 CAMLprim value
214 ocaml_libvirt_connect_num_of_defined_domains (value connv)
215 {
216   CAMLparam1 (connv);
217
218   virConnectPtr conn = Connect_val (connv);
219   int r;
220
221   NONBLOCKING (r = virConnectNumOfDefinedDomains (conn));
222   CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains");
223
224   CAMLreturn (Val_int (r));
225 }
226
227 /* Automatically generated binding for virConnectListDefinedDomains.
228  * In generator.pl this function has signature "conn, int : string array".
229  */
230
231 CAMLprim value
232 ocaml_libvirt_connect_list_defined_domains (value connv, value iv)
233 {
234   CAMLparam2 (connv, iv);
235
236   CAMLlocal2 (rv, strv);
237   virConnectPtr conn = Connect_val (connv);
238   int i = Int_val (iv);
239   char *names[i];
240   int r;
241
242   NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
243   CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
244
245   rv = caml_alloc (r, 0);
246   for (i = 0; i < r; ++i) {
247     strv = caml_copy_string (names[i]);
248     Store_field (rv, i, strv);
249     free (names[i]);
250   }
251
252   CAMLreturn (rv);
253 }
254
255 /* Automatically generated binding for virConnectNumOfNetworks.
256  * In generator.pl this function has signature "conn : int".
257  */
258
259 CAMLprim value
260 ocaml_libvirt_connect_num_of_networks (value connv)
261 {
262   CAMLparam1 (connv);
263
264   virConnectPtr conn = Connect_val (connv);
265   int r;
266
267   NONBLOCKING (r = virConnectNumOfNetworks (conn));
268   CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks");
269
270   CAMLreturn (Val_int (r));
271 }
272
273 /* Automatically generated binding for virConnectListNetworks.
274  * In generator.pl this function has signature "conn, int : string array".
275  */
276
277 CAMLprim value
278 ocaml_libvirt_connect_list_networks (value connv, value iv)
279 {
280   CAMLparam2 (connv, iv);
281
282   CAMLlocal2 (rv, strv);
283   virConnectPtr conn = Connect_val (connv);
284   int i = Int_val (iv);
285   char *names[i];
286   int r;
287
288   NONBLOCKING (r = virConnectListNetworks (conn, names, i));
289   CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
290
291   rv = caml_alloc (r, 0);
292   for (i = 0; i < r; ++i) {
293     strv = caml_copy_string (names[i]);
294     Store_field (rv, i, strv);
295     free (names[i]);
296   }
297
298   CAMLreturn (rv);
299 }
300
301 /* Automatically generated binding for virConnectNumOfDefinedNetworks.
302  * In generator.pl this function has signature "conn : int".
303  */
304
305 CAMLprim value
306 ocaml_libvirt_connect_num_of_defined_networks (value connv)
307 {
308   CAMLparam1 (connv);
309
310   virConnectPtr conn = Connect_val (connv);
311   int r;
312
313   NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn));
314   CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks");
315
316   CAMLreturn (Val_int (r));
317 }
318
319 /* Automatically generated binding for virConnectListDefinedNetworks.
320  * In generator.pl this function has signature "conn, int : string array".
321  */
322
323 CAMLprim value
324 ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
325 {
326   CAMLparam2 (connv, iv);
327
328   CAMLlocal2 (rv, strv);
329   virConnectPtr conn = Connect_val (connv);
330   int i = Int_val (iv);
331   char *names[i];
332   int r;
333
334   NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
335   CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
336
337   rv = caml_alloc (r, 0);
338   for (i = 0; i < r; ++i) {
339     strv = caml_copy_string (names[i]);
340     Store_field (rv, i, strv);
341     free (names[i]);
342   }
343
344   CAMLreturn (rv);
345 }
346
347 /* Automatically generated binding for virConnectNumOfStoragePools.
348  * In generator.pl this function has signature "conn : int".
349  */
350
351 #ifdef HAVE_WEAK_SYMBOLS
352 #ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
353 extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak));
354 #endif
355 #endif
356
357 CAMLprim value
358 ocaml_libvirt_connect_num_of_storage_pools (value connv)
359 {
360   CAMLparam1 (connv);
361 #ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
362   /* Symbol virConnectNumOfStoragePools not found at compile time. */
363   not_supported ("virConnectNumOfStoragePools");
364   /* Suppresses a compiler warning. */
365   (void) caml__frame;
366 #else
367   /* Check that the symbol virConnectNumOfStoragePools
368    * is in runtime version of libvirt.
369    */
370   WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools);
371
372   virConnectPtr conn = Connect_val (connv);
373   int r;
374
375   NONBLOCKING (r = virConnectNumOfStoragePools (conn));
376   CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
377
378   CAMLreturn (Val_int (r));
379 #endif
380 }
381
382 /* Automatically generated binding for virConnectListStoragePools.
383  * In generator.pl this function has signature "conn, int : string array".
384  */
385
386 #ifdef HAVE_WEAK_SYMBOLS
387 #ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS
388 extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
389 #endif
390 #endif
391
392 CAMLprim value
393 ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
394 {
395   CAMLparam2 (connv, iv);
396 #ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS
397   /* Symbol virConnectListStoragePools not found at compile time. */
398   not_supported ("virConnectListStoragePools");
399   /* Suppresses a compiler warning. */
400   (void) caml__frame;
401 #else
402   /* Check that the symbol virConnectListStoragePools
403    * is in runtime version of libvirt.
404    */
405   WEAK_SYMBOL_CHECK (virConnectListStoragePools);
406
407   CAMLlocal2 (rv, strv);
408   virConnectPtr conn = Connect_val (connv);
409   int i = Int_val (iv);
410   char *names[i];
411   int r;
412
413   NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
414   CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
415
416   rv = caml_alloc (r, 0);
417   for (i = 0; i < r; ++i) {
418     strv = caml_copy_string (names[i]);
419     Store_field (rv, i, strv);
420     free (names[i]);
421   }
422
423   CAMLreturn (rv);
424 #endif
425 }
426
427 /* Automatically generated binding for virConnectNumOfDefinedStoragePools.
428  * In generator.pl this function has signature "conn : int".
429  */
430
431 #ifdef HAVE_WEAK_SYMBOLS
432 #ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
433 extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak));
434 #endif
435 #endif
436
437 CAMLprim value
438 ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
439 {
440   CAMLparam1 (connv);
441 #ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
442   /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */
443   not_supported ("virConnectNumOfDefinedStoragePools");
444   /* Suppresses a compiler warning. */
445   (void) caml__frame;
446 #else
447   /* Check that the symbol virConnectNumOfDefinedStoragePools
448    * is in runtime version of libvirt.
449    */
450   WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools);
451
452   virConnectPtr conn = Connect_val (connv);
453   int r;
454
455   NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn));
456   CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
457
458   CAMLreturn (Val_int (r));
459 #endif
460 }
461
462 /* Automatically generated binding for virConnectListDefinedStoragePools.
463  * In generator.pl this function has signature "conn, int : string array".
464  */
465
466 #ifdef HAVE_WEAK_SYMBOLS
467 #ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
468 extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
469 #endif
470 #endif
471
472 CAMLprim value
473 ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
474 {
475   CAMLparam2 (connv, iv);
476 #ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
477   /* Symbol virConnectListDefinedStoragePools not found at compile time. */
478   not_supported ("virConnectListDefinedStoragePools");
479   /* Suppresses a compiler warning. */
480   (void) caml__frame;
481 #else
482   /* Check that the symbol virConnectListDefinedStoragePools
483    * is in runtime version of libvirt.
484    */
485   WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools);
486
487   CAMLlocal2 (rv, strv);
488   virConnectPtr conn = Connect_val (connv);
489   int i = Int_val (iv);
490   char *names[i];
491   int r;
492
493   NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
494   CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
495
496   rv = caml_alloc (r, 0);
497   for (i = 0; i < r; ++i) {
498     strv = caml_copy_string (names[i]);
499     Store_field (rv, i, strv);
500     free (names[i]);
501   }
502
503   CAMLreturn (rv);
504 #endif
505 }
506
507 /* Automatically generated binding for virConnectGetCapabilities.
508  * In generator.pl this function has signature "conn : string".
509  */
510
511 CAMLprim value
512 ocaml_libvirt_connect_get_capabilities (value connv)
513 {
514   CAMLparam1 (connv);
515
516   CAMLlocal1 (rv);
517   virConnectPtr conn = Connect_val (connv);
518   char *r;
519
520   NONBLOCKING (r = virConnectGetCapabilities (conn));
521   CHECK_ERROR (!r, conn, "virConnectGetCapabilities");
522
523   rv = caml_copy_string (r);
524   free (r);
525   CAMLreturn (rv);
526 }
527
528 /* Automatically generated binding for virDomainCreateLinux.
529  * In generator.pl this function has signature "conn, string, 0U : dom".
530  */
531
532 CAMLprim value
533 ocaml_libvirt_domain_create_linux (value connv, value strv)
534 {
535   CAMLparam2 (connv, strv);
536
537   CAMLlocal1 (rv);
538   virConnectPtr conn = Connect_val (connv);
539   char *str = String_val (strv);
540   virDomainPtr r;
541
542   NONBLOCKING (r = virDomainCreateLinux (conn, str, 0));
543   CHECK_ERROR (!r, conn, "virDomainCreateLinux");
544
545   rv = Val_domain (r, connv);
546
547   CAMLreturn (rv);
548 }
549
550 /* Automatically generated binding for virDomainCreateLinuxJob.
551  * In generator.pl this function has signature "conn, string, 0U : job".
552  */
553
554 #ifdef HAVE_WEAK_SYMBOLS
555 #ifdef HAVE_VIRDOMAINCREATELINUXJOB
556 extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned  int flags) __attribute__((weak));
557 #endif
558 #endif
559
560 CAMLprim value
561 ocaml_libvirt_domain_create_linux_job (value connv, value strv)
562 {
563   CAMLparam2 (connv, strv);
564 #ifndef HAVE_VIRDOMAINCREATELINUXJOB
565   /* Symbol virDomainCreateLinuxJob not found at compile time. */
566   not_supported ("virDomainCreateLinuxJob");
567   /* Suppresses a compiler warning. */
568   (void) caml__frame;
569 #else
570   /* Check that the symbol virDomainCreateLinuxJob
571    * is in runtime version of libvirt.
572    */
573   WEAK_SYMBOL_CHECK (virDomainCreateLinuxJob);
574
575   CAMLlocal1 (rv);
576   virConnectPtr conn = Connect_val (connv);
577   char *str = String_val (strv);
578   virJobPtr r;
579
580   NONBLOCKING (r = virDomainCreateLinuxJob (conn, str, 0));
581   CHECK_ERROR (!r, conn, "virDomainCreateLinuxJob");
582
583   rv = Val_job (r, connv);
584
585   CAMLreturn (rv);
586 #endif
587 }
588
589 /* Automatically generated binding for virDomainFree.
590  * In generator.pl this function has signature "dom : free".
591  */
592
593 CAMLprim value
594 ocaml_libvirt_domain_free (value domv)
595 {
596   CAMLparam1 (domv);
597
598   virDomainPtr dom = Domain_val (domv);
599   virConnectPtr conn = Connect_domv (domv);
600   int r;
601
602   NONBLOCKING (r = virDomainFree (dom));
603   CHECK_ERROR (r == -1, conn, "virDomainFree");
604
605   /* So that we don't double-free in the finalizer: */
606   Domain_val (domv) = NULL;
607
608   CAMLreturn (Val_unit);
609 }
610
611 /* Automatically generated binding for virDomainDestroy.
612  * In generator.pl this function has signature "dom : free".
613  */
614
615 CAMLprim value
616 ocaml_libvirt_domain_destroy (value domv)
617 {
618   CAMLparam1 (domv);
619
620   virDomainPtr dom = Domain_val (domv);
621   virConnectPtr conn = Connect_domv (domv);
622   int r;
623
624   NONBLOCKING (r = virDomainDestroy (dom));
625   CHECK_ERROR (r == -1, conn, "virDomainDestroy");
626
627   /* So that we don't double-free in the finalizer: */
628   Domain_val (domv) = NULL;
629
630   CAMLreturn (Val_unit);
631 }
632
633 /* Automatically generated binding for virDomainLookupByName.
634  * In generator.pl this function has signature "conn, string : dom".
635  */
636
637 CAMLprim value
638 ocaml_libvirt_domain_lookup_by_name (value connv, value strv)
639 {
640   CAMLparam2 (connv, strv);
641
642   CAMLlocal1 (rv);
643   virConnectPtr conn = Connect_val (connv);
644   char *str = String_val (strv);
645   virDomainPtr r;
646
647   NONBLOCKING (r = virDomainLookupByName (conn, str));
648   CHECK_ERROR (!r, conn, "virDomainLookupByName");
649
650   rv = Val_domain (r, connv);
651
652   CAMLreturn (rv);
653 }
654
655 /* Automatically generated binding for virDomainLookupByID.
656  * In generator.pl this function has signature "conn, int : dom".
657  */
658
659 CAMLprim value
660 ocaml_libvirt_domain_lookup_by_id (value connv, value iv)
661 {
662   CAMLparam2 (connv, iv);
663
664   CAMLlocal1 (rv);
665   virConnectPtr conn = Connect_val (connv);
666   int i = Int_val (iv);
667   virDomainPtr r;
668
669   NONBLOCKING (r = virDomainLookupByID (conn, i));
670   CHECK_ERROR (!r, conn, "virDomainLookupByID");
671
672   rv = Val_domain (r, connv);
673
674   CAMLreturn (rv);
675 }
676
677 /* Automatically generated binding for virDomainLookupByUUID.
678  * In generator.pl this function has signature "conn, uuid : dom".
679  */
680
681 CAMLprim value
682 ocaml_libvirt_domain_lookup_by_uuid (value connv, value uuidv)
683 {
684   CAMLparam2 (connv, uuidv);
685
686   CAMLlocal1 (rv);
687   virConnectPtr conn = Connect_val (connv);
688   unsigned char *uuid = (unsigned char *) String_val (uuidv);
689   virDomainPtr r;
690
691   NONBLOCKING (r = virDomainLookupByUUID (conn, uuid));
692   CHECK_ERROR (!r, conn, "virDomainLookupByUUID");
693
694   rv = Val_domain (r, connv);
695
696   CAMLreturn (rv);
697 }
698
699 /* Automatically generated binding for virDomainLookupByUUIDString.
700  * In generator.pl this function has signature "conn, string : dom".
701  */
702
703 CAMLprim value
704 ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv)
705 {
706   CAMLparam2 (connv, strv);
707
708   CAMLlocal1 (rv);
709   virConnectPtr conn = Connect_val (connv);
710   char *str = String_val (strv);
711   virDomainPtr r;
712
713   NONBLOCKING (r = virDomainLookupByUUIDString (conn, str));
714   CHECK_ERROR (!r, conn, "virDomainLookupByUUIDString");
715
716   rv = Val_domain (r, connv);
717
718   CAMLreturn (rv);
719 }
720
721 /* Automatically generated binding for virDomainGetName.
722  * In generator.pl this function has signature "dom : static string".
723  */
724
725 CAMLprim value
726 ocaml_libvirt_domain_get_name (value domv)
727 {
728   CAMLparam1 (domv);
729
730   CAMLlocal1 (rv);
731   virDomainPtr dom = Domain_val (domv);
732   virConnectPtr conn = Connect_domv (domv);
733   const char *r;
734
735   NONBLOCKING (r = virDomainGetName (dom));
736   CHECK_ERROR (!r, conn, "virDomainGetName");
737
738   rv = caml_copy_string (r);
739   CAMLreturn (rv);
740 }
741
742 /* Automatically generated binding for virDomainGetOSType.
743  * In generator.pl this function has signature "dom : string".
744  */
745
746 CAMLprim value
747 ocaml_libvirt_domain_get_os_type (value domv)
748 {
749   CAMLparam1 (domv);
750
751   CAMLlocal1 (rv);
752   virDomainPtr dom = Domain_val (domv);
753   virConnectPtr conn = Connect_domv (domv);
754   char *r;
755
756   NONBLOCKING (r = virDomainGetOSType (dom));
757   CHECK_ERROR (!r, conn, "virDomainGetOSType");
758
759   rv = caml_copy_string (r);
760   free (r);
761   CAMLreturn (rv);
762 }
763
764 /* Automatically generated binding for virDomainGetXMLDesc.
765  * In generator.pl this function has signature "dom, 0 : string".
766  */
767
768 CAMLprim value
769 ocaml_libvirt_domain_get_xml_desc (value domv)
770 {
771   CAMLparam1 (domv);
772
773   CAMLlocal1 (rv);
774   virDomainPtr dom = Domain_val (domv);
775   virConnectPtr conn = Connect_domv (domv);
776   char *r;
777
778   NONBLOCKING (r = virDomainGetXMLDesc (dom, 0));
779   CHECK_ERROR (!r, conn, "virDomainGetXMLDesc");
780
781   rv = caml_copy_string (r);
782   free (r);
783   CAMLreturn (rv);
784 }
785
786 /* Automatically generated binding for virDomainGetUUID.
787  * In generator.pl this function has signature "dom : uuid".
788  */
789
790 CAMLprim value
791 ocaml_libvirt_domain_get_uuid (value domv)
792 {
793   CAMLparam1 (domv);
794
795   CAMLlocal1 (rv);
796   virDomainPtr dom = Domain_val (domv);
797   virConnectPtr conn = Connect_domv (domv);
798   unsigned char uuid[VIR_UUID_BUFLEN];
799   int r;
800
801   NONBLOCKING (r = virDomainGetUUID (dom, uuid));
802   CHECK_ERROR (r == -1, conn, "virDomainGetUUID");
803
804   /* UUIDs are byte arrays with a fixed length. */
805   rv = caml_alloc_string (VIR_UUID_BUFLEN);
806   memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
807   CAMLreturn (rv);
808 }
809
810 /* Automatically generated binding for virDomainGetUUIDString.
811  * In generator.pl this function has signature "dom : uuid string".
812  */
813
814 CAMLprim value
815 ocaml_libvirt_domain_get_uuid_string (value domv)
816 {
817   CAMLparam1 (domv);
818
819   CAMLlocal1 (rv);
820   virDomainPtr dom = Domain_val (domv);
821   virConnectPtr conn = Connect_domv (domv);
822   char uuid[VIR_UUID_STRING_BUFLEN];
823   int r;
824
825   NONBLOCKING (r = virDomainGetUUIDString (dom, uuid));
826   CHECK_ERROR (r == -1, conn, "virDomainGetUUIDString");
827
828   rv = caml_copy_string (uuid);
829   CAMLreturn (rv);
830 }
831
832 /* Automatically generated binding for virDomainGetMaxVcpus.
833  * In generator.pl this function has signature "dom : int".
834  */
835
836 CAMLprim value
837 ocaml_libvirt_domain_get_max_vcpus (value domv)
838 {
839   CAMLparam1 (domv);
840
841   virDomainPtr dom = Domain_val (domv);
842   virConnectPtr conn = Connect_domv (domv);
843   int r;
844
845   NONBLOCKING (r = virDomainGetMaxVcpus (dom));
846   CHECK_ERROR (r == -1, conn, "virDomainGetMaxVcpus");
847
848   CAMLreturn (Val_int (r));
849 }
850
851 /* Automatically generated binding for virDomainSave.
852  * In generator.pl this function has signature "dom, string : unit".
853  */
854
855 CAMLprim value
856 ocaml_libvirt_domain_save (value domv, value strv)
857 {
858   CAMLparam2 (domv, strv);
859
860   CAMLlocal1 (rv);
861   virDomainPtr dom = Domain_val (domv);
862   virConnectPtr conn = Connect_domv (domv);
863   char *str = String_val (strv);
864   int r;
865
866   NONBLOCKING (r = virDomainSave (dom, str));
867   CHECK_ERROR (r == -1, conn, "virDomainSave");
868
869   CAMLreturn (Val_unit);
870 }
871
872 /* Automatically generated binding for virDomainSaveJob.
873  * In generator.pl this function has signature "dom, string : job from dom".
874  */
875
876 #ifdef HAVE_WEAK_SYMBOLS
877 #ifdef HAVE_VIRDOMAINSAVEJOB
878 extern virJobPtr virDomainSaveJob (virDomainPtr dom, const char *str) __attribute__((weak));
879 #endif
880 #endif
881
882 CAMLprim value
883 ocaml_libvirt_domain_save_job (value domv, value strv)
884 {
885   CAMLparam2 (domv, strv);
886 #ifndef HAVE_VIRDOMAINSAVEJOB
887   /* Symbol virDomainSaveJob not found at compile time. */
888   not_supported ("virDomainSaveJob");
889   /* Suppresses a compiler warning. */
890   (void) caml__frame;
891 #else
892   /* Check that the symbol virDomainSaveJob
893    * is in runtime version of libvirt.
894    */
895   WEAK_SYMBOL_CHECK (virDomainSaveJob);
896
897   CAMLlocal2 (rv, connv);
898   virDomainPtr dom = Domain_val (domv);
899   virConnectPtr conn = Connect_domv (domv);
900   char *str = String_val (strv);
901   virJobPtr r;
902
903   NONBLOCKING (r = virDomainSaveJob (dom, str));
904   CHECK_ERROR (!r, conn, "virDomainSaveJob");
905
906   connv = Field (domv, 1);
907   rv = Val_job (r, connv);
908
909   CAMLreturn (rv);
910 #endif
911 }
912
913 /* Automatically generated binding for virDomainRestore.
914  * In generator.pl this function has signature "conn, string : unit".
915  */
916
917 CAMLprim value
918 ocaml_libvirt_domain_restore (value connv, value strv)
919 {
920   CAMLparam2 (connv, strv);
921
922   CAMLlocal1 (rv);
923   virConnectPtr conn = Connect_val (connv);
924   char *str = String_val (strv);
925   int r;
926
927   NONBLOCKING (r = virDomainRestore (conn, str));
928   CHECK_ERROR (r == -1, conn, "virDomainRestore");
929
930   CAMLreturn (Val_unit);
931 }
932
933 /* Automatically generated binding for virDomainRestoreJob.
934  * In generator.pl this function has signature "conn, string : job".
935  */
936
937 #ifdef HAVE_WEAK_SYMBOLS
938 #ifdef HAVE_VIRDOMAINRESTOREJOB
939 extern virJobPtr virDomainRestoreJob (virConnectPtr conn, const char *str) __attribute__((weak));
940 #endif
941 #endif
942
943 CAMLprim value
944 ocaml_libvirt_domain_restore_job (value connv, value strv)
945 {
946   CAMLparam2 (connv, strv);
947 #ifndef HAVE_VIRDOMAINRESTOREJOB
948   /* Symbol virDomainRestoreJob not found at compile time. */
949   not_supported ("virDomainRestoreJob");
950   /* Suppresses a compiler warning. */
951   (void) caml__frame;
952 #else
953   /* Check that the symbol virDomainRestoreJob
954    * is in runtime version of libvirt.
955    */
956   WEAK_SYMBOL_CHECK (virDomainRestoreJob);
957
958   CAMLlocal1 (rv);
959   virConnectPtr conn = Connect_val (connv);
960   char *str = String_val (strv);
961   virJobPtr r;
962
963   NONBLOCKING (r = virDomainRestoreJob (conn, str));
964   CHECK_ERROR (!r, conn, "virDomainRestoreJob");
965
966   rv = Val_job (r, connv);
967
968   CAMLreturn (rv);
969 #endif
970 }
971
972 /* Automatically generated binding for virDomainCoreDump.
973  * In generator.pl this function has signature "dom, string, 0 : unit".
974  */
975
976 CAMLprim value
977 ocaml_libvirt_domain_core_dump (value domv, value strv)
978 {
979   CAMLparam2 (domv, strv);
980
981   CAMLlocal1 (rv);
982   virDomainPtr dom = Domain_val (domv);
983   virConnectPtr conn = Connect_domv (domv);
984   char *str = String_val (strv);
985   int r;
986
987   NONBLOCKING (r = virDomainCoreDump (dom, str, 0));
988   CHECK_ERROR (!r, conn, "virDomainCoreDump");
989
990   CAMLreturn (Val_unit);
991 }
992
993 /* Automatically generated binding for virDomainCoreDumpJob.
994  * In generator.pl this function has signature "dom, string, 0 : job from dom".
995  */
996
997 #ifdef HAVE_WEAK_SYMBOLS
998 #ifdef HAVE_VIRDOMAINCOREDUMPJOB
999 extern virJobPtr virDomainCoreDumpJob (virDomainPtr dom, const char *str,  int flags) __attribute__((weak));
1000 #endif
1001 #endif
1002
1003 CAMLprim value
1004 ocaml_libvirt_domain_core_dump_job (value domv, value strv)
1005 {
1006   CAMLparam2 (domv, strv);
1007 #ifndef HAVE_VIRDOMAINCOREDUMPJOB
1008   /* Symbol virDomainCoreDumpJob not found at compile time. */
1009   not_supported ("virDomainCoreDumpJob");
1010   /* Suppresses a compiler warning. */
1011   (void) caml__frame;
1012 #else
1013   /* Check that the symbol virDomainCoreDumpJob
1014    * is in runtime version of libvirt.
1015    */
1016   WEAK_SYMBOL_CHECK (virDomainCoreDumpJob);
1017
1018   CAMLlocal2 (rv, connv);
1019   virDomainPtr dom = Domain_val (domv);
1020   virConnectPtr conn = Connect_domv (domv);
1021   char *str = String_val (strv);
1022   virJobPtr r;
1023
1024   NONBLOCKING (r = virDomainCoreDumpJob (dom, str, 0));
1025   CHECK_ERROR (!r, conn, "virDomainCoreDumpJob");
1026
1027   connv = Field (domv, 1);
1028   rv = Val_job (r, connv);
1029
1030   CAMLreturn (rv);
1031 #endif
1032 }
1033
1034 /* Automatically generated binding for virDomainSuspend.
1035  * In generator.pl this function has signature "dom : unit".
1036  */
1037
1038 CAMLprim value
1039 ocaml_libvirt_domain_suspend (value domv)
1040 {
1041   CAMLparam1 (domv);
1042
1043   virDomainPtr dom = Domain_val (domv);
1044   virConnectPtr conn = Connect_domv (domv);
1045   int r;
1046
1047   NONBLOCKING (r = virDomainSuspend (dom));
1048   CHECK_ERROR (r == -1, conn, "virDomainSuspend");
1049
1050   CAMLreturn (Val_unit);
1051 }
1052
1053 /* Automatically generated binding for virDomainResume.
1054  * In generator.pl this function has signature "dom : unit".
1055  */
1056
1057 CAMLprim value
1058 ocaml_libvirt_domain_resume (value domv)
1059 {
1060   CAMLparam1 (domv);
1061
1062   virDomainPtr dom = Domain_val (domv);
1063   virConnectPtr conn = Connect_domv (domv);
1064   int r;
1065
1066   NONBLOCKING (r = virDomainResume (dom));
1067   CHECK_ERROR (r == -1, conn, "virDomainResume");
1068
1069   CAMLreturn (Val_unit);
1070 }
1071
1072 /* Automatically generated binding for virDomainShutdown.
1073  * In generator.pl this function has signature "dom : unit".
1074  */
1075
1076 CAMLprim value
1077 ocaml_libvirt_domain_shutdown (value domv)
1078 {
1079   CAMLparam1 (domv);
1080
1081   virDomainPtr dom = Domain_val (domv);
1082   virConnectPtr conn = Connect_domv (domv);
1083   int r;
1084
1085   NONBLOCKING (r = virDomainShutdown (dom));
1086   CHECK_ERROR (r == -1, conn, "virDomainShutdown");
1087
1088   CAMLreturn (Val_unit);
1089 }
1090
1091 /* Automatically generated binding for virDomainReboot.
1092  * In generator.pl this function has signature "dom, 0 : unit".
1093  */
1094
1095 CAMLprim value
1096 ocaml_libvirt_domain_reboot (value domv)
1097 {
1098   CAMLparam1 (domv);
1099
1100   virDomainPtr dom = Domain_val (domv);
1101   virConnectPtr conn = Connect_domv (domv);
1102   int r;
1103
1104   NONBLOCKING (r = virDomainReboot (dom, 0));
1105   CHECK_ERROR (r == -1, conn, "virDomainReboot");
1106
1107   CAMLreturn (Val_unit);
1108 }
1109
1110 /* Automatically generated binding for virDomainDefineXML.
1111  * In generator.pl this function has signature "conn, string : dom".
1112  */
1113
1114 CAMLprim value
1115 ocaml_libvirt_domain_define_xml (value connv, value strv)
1116 {
1117   CAMLparam2 (connv, strv);
1118
1119   CAMLlocal1 (rv);
1120   virConnectPtr conn = Connect_val (connv);
1121   char *str = String_val (strv);
1122   virDomainPtr r;
1123
1124   NONBLOCKING (r = virDomainDefineXML (conn, str));
1125   CHECK_ERROR (!r, conn, "virDomainDefineXML");
1126
1127   rv = Val_domain (r, connv);
1128
1129   CAMLreturn (rv);
1130 }
1131
1132 /* Automatically generated binding for virDomainUndefine.
1133  * In generator.pl this function has signature "dom : unit".
1134  */
1135
1136 CAMLprim value
1137 ocaml_libvirt_domain_undefine (value domv)
1138 {
1139   CAMLparam1 (domv);
1140
1141   virDomainPtr dom = Domain_val (domv);
1142   virConnectPtr conn = Connect_domv (domv);
1143   int r;
1144
1145   NONBLOCKING (r = virDomainUndefine (dom));
1146   CHECK_ERROR (r == -1, conn, "virDomainUndefine");
1147
1148   CAMLreturn (Val_unit);
1149 }
1150
1151 /* Automatically generated binding for virDomainCreate.
1152  * In generator.pl this function has signature "dom : unit".
1153  */
1154
1155 CAMLprim value
1156 ocaml_libvirt_domain_create (value domv)
1157 {
1158   CAMLparam1 (domv);
1159
1160   virDomainPtr dom = Domain_val (domv);
1161   virConnectPtr conn = Connect_domv (domv);
1162   int r;
1163
1164   NONBLOCKING (r = virDomainCreate (dom));
1165   CHECK_ERROR (r == -1, conn, "virDomainCreate");
1166
1167   CAMLreturn (Val_unit);
1168 }
1169
1170 /* Automatically generated binding for virDomainCreateJob.
1171  * In generator.pl this function has signature "dom, 0U : job from dom".
1172  */
1173
1174 #ifdef HAVE_WEAK_SYMBOLS
1175 #ifdef HAVE_VIRDOMAINCREATEJOB
1176 extern virJobPtr virDomainCreateJob (virDomainPtr dom, unsigned  int flags) __attribute__((weak));
1177 #endif
1178 #endif
1179
1180 CAMLprim value
1181 ocaml_libvirt_domain_create_job (value domv)
1182 {
1183   CAMLparam1 (domv);
1184 #ifndef HAVE_VIRDOMAINCREATEJOB
1185   /* Symbol virDomainCreateJob not found at compile time. */
1186   not_supported ("virDomainCreateJob");
1187   /* Suppresses a compiler warning. */
1188   (void) caml__frame;
1189 #else
1190   /* Check that the symbol virDomainCreateJob
1191    * is in runtime version of libvirt.
1192    */
1193   WEAK_SYMBOL_CHECK (virDomainCreateJob);
1194
1195   CAMLlocal2 (rv, connv);
1196   virDomainPtr dom = Domain_val (domv);
1197   virConnectPtr conn = Connect_domv (domv);
1198   virJobPtr r;
1199
1200   NONBLOCKING (r = virDomainCreateJob (dom, 0));
1201   CHECK_ERROR (!r, conn, "virDomainCreateJob");
1202
1203   connv = Field (domv, 1);
1204   rv = Val_job (r, connv);
1205
1206   CAMLreturn (rv);
1207 #endif
1208 }
1209
1210 /* Automatically generated binding for virDomainAttachDevice.
1211  * In generator.pl this function has signature "dom, string : unit".
1212  */
1213
1214 CAMLprim value
1215 ocaml_libvirt_domain_attach_device (value domv, value strv)
1216 {
1217   CAMLparam2 (domv, strv);
1218
1219   CAMLlocal1 (rv);
1220   virDomainPtr dom = Domain_val (domv);
1221   virConnectPtr conn = Connect_domv (domv);
1222   char *str = String_val (strv);
1223   int r;
1224
1225   NONBLOCKING (r = virDomainAttachDevice (dom, str));
1226   CHECK_ERROR (r == -1, conn, "virDomainAttachDevice");
1227
1228   CAMLreturn (Val_unit);
1229 }
1230
1231 /* Automatically generated binding for virDomainDetachDevice.
1232  * In generator.pl this function has signature "dom, string : unit".
1233  */
1234
1235 CAMLprim value
1236 ocaml_libvirt_domain_detach_device (value domv, value strv)
1237 {
1238   CAMLparam2 (domv, strv);
1239
1240   CAMLlocal1 (rv);
1241   virDomainPtr dom = Domain_val (domv);
1242   virConnectPtr conn = Connect_domv (domv);
1243   char *str = String_val (strv);
1244   int r;
1245
1246   NONBLOCKING (r = virDomainDetachDevice (dom, str));
1247   CHECK_ERROR (r == -1, conn, "virDomainDetachDevice");
1248
1249   CAMLreturn (Val_unit);
1250 }
1251
1252 /* Automatically generated binding for virDomainGetAutostart.
1253  * In generator.pl this function has signature "dom : bool".
1254  */
1255
1256 CAMLprim value
1257 ocaml_libvirt_domain_get_autostart (value domv)
1258 {
1259   CAMLparam1 (domv);
1260
1261   virDomainPtr dom = Domain_val (domv);
1262   virConnectPtr conn = Connect_domv (domv);
1263   int r, b;
1264
1265   NONBLOCKING (r = virDomainGetAutostart (dom, &b));
1266   CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
1267
1268   CAMLreturn (b ? Val_true : Val_false);
1269 }
1270
1271 /* Automatically generated binding for virDomainSetAutostart.
1272  * In generator.pl this function has signature "dom, bool : unit".
1273  */
1274
1275 CAMLprim value
1276 ocaml_libvirt_domain_set_autostart (value domv, value bv)
1277 {
1278   CAMLparam2 (domv, bv);
1279
1280   virDomainPtr dom = Domain_val (domv);
1281   virConnectPtr conn = Connect_domv (domv);
1282   int r, b;
1283
1284   b = bv == Val_true ? 1 : 0;
1285
1286   NONBLOCKING (r = virDomainSetAutostart (dom, b));
1287   CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
1288
1289   CAMLreturn (Val_unit);
1290 }
1291
1292 /* Automatically generated binding for virNetworkFree.
1293  * In generator.pl this function has signature "net : free".
1294  */
1295
1296 CAMLprim value
1297 ocaml_libvirt_network_free (value netv)
1298 {
1299   CAMLparam1 (netv);
1300
1301   virNetworkPtr net = Network_val (netv);
1302   virConnectPtr conn = Connect_netv (netv);
1303   int r;
1304
1305   NONBLOCKING (r = virNetworkFree (net));
1306   CHECK_ERROR (r == -1, conn, "virNetworkFree");
1307
1308   /* So that we don't double-free in the finalizer: */
1309   Network_val (netv) = NULL;
1310
1311   CAMLreturn (Val_unit);
1312 }
1313
1314 /* Automatically generated binding for virNetworkDestroy.
1315  * In generator.pl this function has signature "net : free".
1316  */
1317
1318 CAMLprim value
1319 ocaml_libvirt_network_destroy (value netv)
1320 {
1321   CAMLparam1 (netv);
1322
1323   virNetworkPtr net = Network_val (netv);
1324   virConnectPtr conn = Connect_netv (netv);
1325   int r;
1326
1327   NONBLOCKING (r = virNetworkDestroy (net));
1328   CHECK_ERROR (r == -1, conn, "virNetworkDestroy");
1329
1330   /* So that we don't double-free in the finalizer: */
1331   Network_val (netv) = NULL;
1332
1333   CAMLreturn (Val_unit);
1334 }
1335
1336 /* Automatically generated binding for virNetworkLookupByName.
1337  * In generator.pl this function has signature "conn, string : net".
1338  */
1339
1340 CAMLprim value
1341 ocaml_libvirt_network_lookup_by_name (value connv, value strv)
1342 {
1343   CAMLparam2 (connv, strv);
1344
1345   CAMLlocal1 (rv);
1346   virConnectPtr conn = Connect_val (connv);
1347   char *str = String_val (strv);
1348   virNetworkPtr r;
1349
1350   NONBLOCKING (r = virNetworkLookupByName (conn, str));
1351   CHECK_ERROR (!r, conn, "virNetworkLookupByName");
1352
1353   rv = Val_network (r, connv);
1354
1355   CAMLreturn (rv);
1356 }
1357
1358 /* Automatically generated binding for virNetworkLookupByUUID.
1359  * In generator.pl this function has signature "conn, uuid : net".
1360  */
1361
1362 CAMLprim value
1363 ocaml_libvirt_network_lookup_by_uuid (value connv, value uuidv)
1364 {
1365   CAMLparam2 (connv, uuidv);
1366
1367   CAMLlocal1 (rv);
1368   virConnectPtr conn = Connect_val (connv);
1369   unsigned char *uuid = (unsigned char *) String_val (uuidv);
1370   virNetworkPtr r;
1371
1372   NONBLOCKING (r = virNetworkLookupByUUID (conn, uuid));
1373   CHECK_ERROR (!r, conn, "virNetworkLookupByUUID");
1374
1375   rv = Val_network (r, connv);
1376
1377   CAMLreturn (rv);
1378 }
1379
1380 /* Automatically generated binding for virNetworkLookupByUUIDString.
1381  * In generator.pl this function has signature "conn, string : net".
1382  */
1383
1384 CAMLprim value
1385 ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv)
1386 {
1387   CAMLparam2 (connv, strv);
1388
1389   CAMLlocal1 (rv);
1390   virConnectPtr conn = Connect_val (connv);
1391   char *str = String_val (strv);
1392   virNetworkPtr r;
1393
1394   NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str));
1395   CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString");
1396
1397   rv = Val_network (r, connv);
1398
1399   CAMLreturn (rv);
1400 }
1401
1402 /* Automatically generated binding for virNetworkGetName.
1403  * In generator.pl this function has signature "net : static string".
1404  */
1405
1406 CAMLprim value
1407 ocaml_libvirt_network_get_name (value netv)
1408 {
1409   CAMLparam1 (netv);
1410
1411   CAMLlocal1 (rv);
1412   virNetworkPtr net = Network_val (netv);
1413   virConnectPtr conn = Connect_netv (netv);
1414   const char *r;
1415
1416   NONBLOCKING (r = virNetworkGetName (net));
1417   CHECK_ERROR (!r, conn, "virNetworkGetName");
1418
1419   rv = caml_copy_string (r);
1420   CAMLreturn (rv);
1421 }
1422
1423 /* Automatically generated binding for virNetworkGetXMLDesc.
1424  * In generator.pl this function has signature "net, 0 : string".
1425  */
1426
1427 CAMLprim value
1428 ocaml_libvirt_network_get_xml_desc (value netv)
1429 {
1430   CAMLparam1 (netv);
1431
1432   CAMLlocal1 (rv);
1433   virNetworkPtr net = Network_val (netv);
1434   virConnectPtr conn = Connect_netv (netv);
1435   char *r;
1436
1437   NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
1438   CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
1439
1440   rv = caml_copy_string (r);
1441   free (r);
1442   CAMLreturn (rv);
1443 }
1444
1445 /* Automatically generated binding for virNetworkGetBridgeName.
1446  * In generator.pl this function has signature "net : string".
1447  */
1448
1449 CAMLprim value
1450 ocaml_libvirt_network_get_bridge_name (value netv)
1451 {
1452   CAMLparam1 (netv);
1453
1454   CAMLlocal1 (rv);
1455   virNetworkPtr net = Network_val (netv);
1456   virConnectPtr conn = Connect_netv (netv);
1457   char *r;
1458
1459   NONBLOCKING (r = virNetworkGetBridgeName (net));
1460   CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
1461
1462   rv = caml_copy_string (r);
1463   free (r);
1464   CAMLreturn (rv);
1465 }
1466
1467 /* Automatically generated binding for virNetworkGetUUID.
1468  * In generator.pl this function has signature "net : uuid".
1469  */
1470
1471 CAMLprim value
1472 ocaml_libvirt_network_get_uuid (value netv)
1473 {
1474   CAMLparam1 (netv);
1475
1476   CAMLlocal1 (rv);
1477   virNetworkPtr net = Network_val (netv);
1478   virConnectPtr conn = Connect_netv (netv);
1479   unsigned char uuid[VIR_UUID_BUFLEN];
1480   int r;
1481
1482   NONBLOCKING (r = virNetworkGetUUID (net, uuid));
1483   CHECK_ERROR (r == -1, conn, "virNetworkGetUUID");
1484
1485   /* UUIDs are byte arrays with a fixed length. */
1486   rv = caml_alloc_string (VIR_UUID_BUFLEN);
1487   memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
1488   CAMLreturn (rv);
1489 }
1490
1491 /* Automatically generated binding for virNetworkGetUUIDString.
1492  * In generator.pl this function has signature "net : uuid string".
1493  */
1494
1495 CAMLprim value
1496 ocaml_libvirt_network_get_uuid_string (value netv)
1497 {
1498   CAMLparam1 (netv);
1499
1500   CAMLlocal1 (rv);
1501   virNetworkPtr net = Network_val (netv);
1502   virConnectPtr conn = Connect_netv (netv);
1503   char uuid[VIR_UUID_STRING_BUFLEN];
1504   int r;
1505
1506   NONBLOCKING (r = virNetworkGetUUIDString (net, uuid));
1507   CHECK_ERROR (r == -1, conn, "virNetworkGetUUIDString");
1508
1509   rv = caml_copy_string (uuid);
1510   CAMLreturn (rv);
1511 }
1512
1513 /* Automatically generated binding for virNetworkUndefine.
1514  * In generator.pl this function has signature "net : unit".
1515  */
1516
1517 CAMLprim value
1518 ocaml_libvirt_network_undefine (value netv)
1519 {
1520   CAMLparam1 (netv);
1521
1522   virNetworkPtr net = Network_val (netv);
1523   virConnectPtr conn = Connect_netv (netv);
1524   int r;
1525
1526   NONBLOCKING (r = virNetworkUndefine (net));
1527   CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
1528
1529   CAMLreturn (Val_unit);
1530 }
1531
1532 /* Automatically generated binding for virNetworkCreateXML.
1533  * In generator.pl this function has signature "conn, string : net".
1534  */
1535
1536 CAMLprim value
1537 ocaml_libvirt_network_create_xml (value connv, value strv)
1538 {
1539   CAMLparam2 (connv, strv);
1540
1541   CAMLlocal1 (rv);
1542   virConnectPtr conn = Connect_val (connv);
1543   char *str = String_val (strv);
1544   virNetworkPtr r;
1545
1546   NONBLOCKING (r = virNetworkCreateXML (conn, str));
1547   CHECK_ERROR (!r, conn, "virNetworkCreateXML");
1548
1549   rv = Val_network (r, connv);
1550
1551   CAMLreturn (rv);
1552 }
1553
1554 /* Automatically generated binding for virNetworkCreateXMLJob.
1555  * In generator.pl this function has signature "conn, string : job".
1556  */
1557
1558 #ifdef HAVE_WEAK_SYMBOLS
1559 #ifdef HAVE_VIRNETWORKCREATEXMLJOB
1560 extern virJobPtr virNetworkCreateXMLJob (virConnectPtr conn, const char *str) __attribute__((weak));
1561 #endif
1562 #endif
1563
1564 CAMLprim value
1565 ocaml_libvirt_network_create_xml_job (value connv, value strv)
1566 {
1567   CAMLparam2 (connv, strv);
1568 #ifndef HAVE_VIRNETWORKCREATEXMLJOB
1569   /* Symbol virNetworkCreateXMLJob not found at compile time. */
1570   not_supported ("virNetworkCreateXMLJob");
1571   /* Suppresses a compiler warning. */
1572   (void) caml__frame;
1573 #else
1574   /* Check that the symbol virNetworkCreateXMLJob
1575    * is in runtime version of libvirt.
1576    */
1577   WEAK_SYMBOL_CHECK (virNetworkCreateXMLJob);
1578
1579   CAMLlocal1 (rv);
1580   virConnectPtr conn = Connect_val (connv);
1581   char *str = String_val (strv);
1582   virJobPtr r;
1583
1584   NONBLOCKING (r = virNetworkCreateXMLJob (conn, str));
1585   CHECK_ERROR (!r, conn, "virNetworkCreateXMLJob");
1586
1587   rv = Val_job (r, connv);
1588
1589   CAMLreturn (rv);
1590 #endif
1591 }
1592
1593 /* Automatically generated binding for virNetworkDefineXML.
1594  * In generator.pl this function has signature "conn, string : net".
1595  */
1596
1597 CAMLprim value
1598 ocaml_libvirt_network_define_xml (value connv, value strv)
1599 {
1600   CAMLparam2 (connv, strv);
1601
1602   CAMLlocal1 (rv);
1603   virConnectPtr conn = Connect_val (connv);
1604   char *str = String_val (strv);
1605   virNetworkPtr r;
1606
1607   NONBLOCKING (r = virNetworkDefineXML (conn, str));
1608   CHECK_ERROR (!r, conn, "virNetworkDefineXML");
1609
1610   rv = Val_network (r, connv);
1611
1612   CAMLreturn (rv);
1613 }
1614
1615 /* Automatically generated binding for virNetworkCreate.
1616  * In generator.pl this function has signature "net : unit".
1617  */
1618
1619 CAMLprim value
1620 ocaml_libvirt_network_create (value netv)
1621 {
1622   CAMLparam1 (netv);
1623
1624   virNetworkPtr net = Network_val (netv);
1625   virConnectPtr conn = Connect_netv (netv);
1626   int r;
1627
1628   NONBLOCKING (r = virNetworkCreate (net));
1629   CHECK_ERROR (r == -1, conn, "virNetworkCreate");
1630
1631   CAMLreturn (Val_unit);
1632 }
1633
1634 /* Automatically generated binding for virNetworkCreateJob.
1635  * In generator.pl this function has signature "net : job from net".
1636  */
1637
1638 #ifdef HAVE_WEAK_SYMBOLS
1639 #ifdef HAVE_VIRNETWORKCREATEJOB
1640 extern virJobPtr virNetworkCreateJob (virNetworkPtr net) __attribute__((weak));
1641 #endif
1642 #endif
1643
1644 CAMLprim value
1645 ocaml_libvirt_network_create_job (value netv)
1646 {
1647   CAMLparam1 (netv);
1648 #ifndef HAVE_VIRNETWORKCREATEJOB
1649   /* Symbol virNetworkCreateJob not found at compile time. */
1650   not_supported ("virNetworkCreateJob");
1651   /* Suppresses a compiler warning. */
1652   (void) caml__frame;
1653 #else
1654   /* Check that the symbol virNetworkCreateJob
1655    * is in runtime version of libvirt.
1656    */
1657   WEAK_SYMBOL_CHECK (virNetworkCreateJob);
1658
1659   CAMLlocal2 (rv, connv);
1660   virNetworkPtr net = Network_val (netv);
1661   virConnectPtr conn = Connect_netv (netv);
1662   virJobPtr r;
1663
1664   NONBLOCKING (r = virNetworkCreateJob (net));
1665   CHECK_ERROR (!r, conn, "virNetworkCreateJob");
1666
1667   connv = Field (netv, 1);
1668   rv = Val_job (r, connv);
1669
1670   CAMLreturn (rv);
1671 #endif
1672 }
1673
1674 /* Automatically generated binding for virNetworkGetAutostart.
1675  * In generator.pl this function has signature "net : bool".
1676  */
1677
1678 CAMLprim value
1679 ocaml_libvirt_network_get_autostart (value netv)
1680 {
1681   CAMLparam1 (netv);
1682
1683   virNetworkPtr net = Network_val (netv);
1684   virConnectPtr conn = Connect_netv (netv);
1685   int r, b;
1686
1687   NONBLOCKING (r = virNetworkGetAutostart (net, &b));
1688   CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
1689
1690   CAMLreturn (b ? Val_true : Val_false);
1691 }
1692
1693 /* Automatically generated binding for virNetworkSetAutostart.
1694  * In generator.pl this function has signature "net, bool : unit".
1695  */
1696
1697 CAMLprim value
1698 ocaml_libvirt_network_set_autostart (value netv, value bv)
1699 {
1700   CAMLparam2 (netv, bv);
1701
1702   virNetworkPtr net = Network_val (netv);
1703   virConnectPtr conn = Connect_netv (netv);
1704   int r, b;
1705
1706   b = bv == Val_true ? 1 : 0;
1707
1708   NONBLOCKING (r = virNetworkSetAutostart (net, b));
1709   CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
1710
1711   CAMLreturn (Val_unit);
1712 }
1713
1714 /* Automatically generated binding for virStoragePoolFree.
1715  * In generator.pl this function has signature "pool : free".
1716  */
1717
1718 #ifdef HAVE_WEAK_SYMBOLS
1719 #ifdef HAVE_VIRSTORAGEPOOLFREE
1720 extern int virStoragePoolFree (virStoragePoolPtr pool) __attribute__((weak));
1721 #endif
1722 #endif
1723
1724 CAMLprim value
1725 ocaml_libvirt_storage_pool_free (value poolv)
1726 {
1727   CAMLparam1 (poolv);
1728 #ifndef HAVE_VIRSTORAGEPOOLFREE
1729   /* Symbol virStoragePoolFree not found at compile time. */
1730   not_supported ("virStoragePoolFree");
1731   /* Suppresses a compiler warning. */
1732   (void) caml__frame;
1733 #else
1734   /* Check that the symbol virStoragePoolFree
1735    * is in runtime version of libvirt.
1736    */
1737   WEAK_SYMBOL_CHECK (virStoragePoolFree);
1738
1739   virStoragePoolPtr pool = Pool_val (poolv);
1740   virConnectPtr conn = Connect_polv (poolv);
1741   int r;
1742
1743   NONBLOCKING (r = virStoragePoolFree (pool));
1744   CHECK_ERROR (r == -1, conn, "virStoragePoolFree");
1745
1746   /* So that we don't double-free in the finalizer: */
1747   Pool_val (poolv) = NULL;
1748
1749   CAMLreturn (Val_unit);
1750 #endif
1751 }
1752
1753 /* Automatically generated binding for virStoragePoolDestroy.
1754  * In generator.pl this function has signature "pool : free".
1755  */
1756
1757 #ifdef HAVE_WEAK_SYMBOLS
1758 #ifdef HAVE_VIRSTORAGEPOOLDESTROY
1759 extern int virStoragePoolDestroy (virStoragePoolPtr pool) __attribute__((weak));
1760 #endif
1761 #endif
1762
1763 CAMLprim value
1764 ocaml_libvirt_storage_pool_destroy (value poolv)
1765 {
1766   CAMLparam1 (poolv);
1767 #ifndef HAVE_VIRSTORAGEPOOLDESTROY
1768   /* Symbol virStoragePoolDestroy not found at compile time. */
1769   not_supported ("virStoragePoolDestroy");
1770   /* Suppresses a compiler warning. */
1771   (void) caml__frame;
1772 #else
1773   /* Check that the symbol virStoragePoolDestroy
1774    * is in runtime version of libvirt.
1775    */
1776   WEAK_SYMBOL_CHECK (virStoragePoolDestroy);
1777
1778   virStoragePoolPtr pool = Pool_val (poolv);
1779   virConnectPtr conn = Connect_polv (poolv);
1780   int r;
1781
1782   NONBLOCKING (r = virStoragePoolDestroy (pool));
1783   CHECK_ERROR (r == -1, conn, "virStoragePoolDestroy");
1784
1785   /* So that we don't double-free in the finalizer: */
1786   Pool_val (poolv) = NULL;
1787
1788   CAMLreturn (Val_unit);
1789 #endif
1790 }
1791
1792 /* Automatically generated binding for virStoragePoolLookupByName.
1793  * In generator.pl this function has signature "conn, string : pool".
1794  */
1795
1796 #ifdef HAVE_WEAK_SYMBOLS
1797 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1798 extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
1799 #endif
1800 #endif
1801
1802 CAMLprim value
1803 ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
1804 {
1805   CAMLparam2 (connv, strv);
1806 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1807   /* Symbol virStoragePoolLookupByName not found at compile time. */
1808   not_supported ("virStoragePoolLookupByName");
1809   /* Suppresses a compiler warning. */
1810   (void) caml__frame;
1811 #else
1812   /* Check that the symbol virStoragePoolLookupByName
1813    * is in runtime version of libvirt.
1814    */
1815   WEAK_SYMBOL_CHECK (virStoragePoolLookupByName);
1816
1817   CAMLlocal1 (rv);
1818   virConnectPtr conn = Connect_val (connv);
1819   char *str = String_val (strv);
1820   virStoragePoolPtr r;
1821
1822   NONBLOCKING (r = virStoragePoolLookupByName (conn, str));
1823   CHECK_ERROR (!r, conn, "virStoragePoolLookupByName");
1824
1825   rv = Val_pool (r, connv);
1826
1827   CAMLreturn (rv);
1828 #endif
1829 }
1830
1831 /* Automatically generated binding for virStoragePoolLookupByUUID.
1832  * In generator.pl this function has signature "conn, uuid : pool".
1833  */
1834
1835 #ifdef HAVE_WEAK_SYMBOLS
1836 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1837 extern virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char *str) __attribute__((weak));
1838 #endif
1839 #endif
1840
1841 CAMLprim value
1842 ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv)
1843 {
1844   CAMLparam2 (connv, uuidv);
1845 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1846   /* Symbol virStoragePoolLookupByUUID not found at compile time. */
1847   not_supported ("virStoragePoolLookupByUUID");
1848   /* Suppresses a compiler warning. */
1849   (void) caml__frame;
1850 #else
1851   /* Check that the symbol virStoragePoolLookupByUUID
1852    * is in runtime version of libvirt.
1853    */
1854   WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUID);
1855
1856   CAMLlocal1 (rv);
1857   virConnectPtr conn = Connect_val (connv);
1858   unsigned char *uuid = (unsigned char *) String_val (uuidv);
1859   virStoragePoolPtr r;
1860
1861   NONBLOCKING (r = virStoragePoolLookupByUUID (conn, uuid));
1862   CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUID");
1863
1864   rv = Val_pool (r, connv);
1865
1866   CAMLreturn (rv);
1867 #endif
1868 }
1869
1870 /* Automatically generated binding for virStoragePoolLookupByUUIDString.
1871  * In generator.pl this function has signature "conn, string : pool".
1872  */
1873
1874 #ifdef HAVE_WEAK_SYMBOLS
1875 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1876 extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
1877 #endif
1878 #endif
1879
1880 CAMLprim value
1881 ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
1882 {
1883   CAMLparam2 (connv, strv);
1884 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1885   /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */
1886   not_supported ("virStoragePoolLookupByUUIDString");
1887   /* Suppresses a compiler warning. */
1888   (void) caml__frame;
1889 #else
1890   /* Check that the symbol virStoragePoolLookupByUUIDString
1891    * is in runtime version of libvirt.
1892    */
1893   WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString);
1894
1895   CAMLlocal1 (rv);
1896   virConnectPtr conn = Connect_val (connv);
1897   char *str = String_val (strv);
1898   virStoragePoolPtr r;
1899
1900   NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str));
1901   CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString");
1902
1903   rv = Val_pool (r, connv);
1904
1905   CAMLreturn (rv);
1906 #endif
1907 }
1908
1909 /* Automatically generated binding for virStoragePoolGetName.
1910  * In generator.pl this function has signature "pool : static string".
1911  */
1912
1913 #ifdef HAVE_WEAK_SYMBOLS
1914 #ifdef HAVE_VIRSTORAGEPOOLGETNAME
1915 extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
1916 #endif
1917 #endif
1918
1919 CAMLprim value
1920 ocaml_libvirt_storage_pool_get_name (value poolv)
1921 {
1922   CAMLparam1 (poolv);
1923 #ifndef HAVE_VIRSTORAGEPOOLGETNAME
1924   /* Symbol virStoragePoolGetName not found at compile time. */
1925   not_supported ("virStoragePoolGetName");
1926   /* Suppresses a compiler warning. */
1927   (void) caml__frame;
1928 #else
1929   /* Check that the symbol virStoragePoolGetName
1930    * is in runtime version of libvirt.
1931    */
1932   WEAK_SYMBOL_CHECK (virStoragePoolGetName);
1933
1934   CAMLlocal1 (rv);
1935   virStoragePoolPtr pool = Pool_val (poolv);
1936   virConnectPtr conn = Connect_polv (poolv);
1937   const char *r;
1938
1939   NONBLOCKING (r = virStoragePoolGetName (pool));
1940   CHECK_ERROR (!r, conn, "virStoragePoolGetName");
1941
1942   rv = caml_copy_string (r);
1943   CAMLreturn (rv);
1944 #endif
1945 }
1946
1947 /* Automatically generated binding for virStoragePoolGetXMLDesc.
1948  * In generator.pl this function has signature "pool, 0 : string".
1949  */
1950
1951 #ifdef HAVE_WEAK_SYMBOLS
1952 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
1953 extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool,  int flags) __attribute__((weak));
1954 #endif
1955 #endif
1956
1957 CAMLprim value
1958 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
1959 {
1960   CAMLparam1 (poolv);
1961 #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
1962   /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
1963   not_supported ("virStoragePoolGetXMLDesc");
1964   /* Suppresses a compiler warning. */
1965   (void) caml__frame;
1966 #else
1967   /* Check that the symbol virStoragePoolGetXMLDesc
1968    * is in runtime version of libvirt.
1969    */
1970   WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
1971
1972   CAMLlocal1 (rv);
1973   virStoragePoolPtr pool = Pool_val (poolv);
1974   virConnectPtr conn = Connect_polv (poolv);
1975   char *r;
1976
1977   NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
1978   CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
1979
1980   rv = caml_copy_string (r);
1981   free (r);
1982   CAMLreturn (rv);
1983 #endif
1984 }
1985
1986 /* Automatically generated binding for virStoragePoolGetUUID.
1987  * In generator.pl this function has signature "pool : uuid".
1988  */
1989
1990 #ifdef HAVE_WEAK_SYMBOLS
1991 #ifdef HAVE_VIRSTORAGEPOOLGETUUID
1992 extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak));
1993 #endif
1994 #endif
1995
1996 CAMLprim value
1997 ocaml_libvirt_storage_pool_get_uuid (value poolv)
1998 {
1999   CAMLparam1 (poolv);
2000 #ifndef HAVE_VIRSTORAGEPOOLGETUUID
2001   /* Symbol virStoragePoolGetUUID not found at compile time. */
2002   not_supported ("virStoragePoolGetUUID");
2003   /* Suppresses a compiler warning. */
2004   (void) caml__frame;
2005 #else
2006   /* Check that the symbol virStoragePoolGetUUID
2007    * is in runtime version of libvirt.
2008    */
2009   WEAK_SYMBOL_CHECK (virStoragePoolGetUUID);
2010
2011   CAMLlocal1 (rv);
2012   virStoragePoolPtr pool = Pool_val (poolv);
2013   virConnectPtr conn = Connect_polv (poolv);
2014   unsigned char uuid[VIR_UUID_BUFLEN];
2015   int r;
2016
2017   NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid));
2018   CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID");
2019
2020   /* UUIDs are byte arrays with a fixed length. */
2021   rv = caml_alloc_string (VIR_UUID_BUFLEN);
2022   memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
2023   CAMLreturn (rv);
2024 #endif
2025 }
2026
2027 /* Automatically generated binding for virStoragePoolGetUUIDString.
2028  * In generator.pl this function has signature "pool : uuid string".
2029  */
2030
2031 #ifdef HAVE_WEAK_SYMBOLS
2032 #ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2033 extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak));
2034 #endif
2035 #endif
2036
2037 CAMLprim value
2038 ocaml_libvirt_storage_pool_get_uuid_string (value poolv)
2039 {
2040   CAMLparam1 (poolv);
2041 #ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2042   /* Symbol virStoragePoolGetUUIDString not found at compile time. */
2043   not_supported ("virStoragePoolGetUUIDString");
2044   /* Suppresses a compiler warning. */
2045   (void) caml__frame;
2046 #else
2047   /* Check that the symbol virStoragePoolGetUUIDString
2048    * is in runtime version of libvirt.
2049    */
2050   WEAK_SYMBOL_CHECK (virStoragePoolGetUUIDString);
2051
2052   CAMLlocal1 (rv);
2053   virStoragePoolPtr pool = Pool_val (poolv);
2054   virConnectPtr conn = Connect_polv (poolv);
2055   char uuid[VIR_UUID_STRING_BUFLEN];
2056   int r;
2057
2058   NONBLOCKING (r = virStoragePoolGetUUIDString (pool, uuid));
2059   CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUIDString");
2060
2061   rv = caml_copy_string (uuid);
2062   CAMLreturn (rv);
2063 #endif
2064 }
2065
2066 /* Automatically generated binding for virStoragePoolCreateXML.
2067  * In generator.pl this function has signature "conn, string : pool".
2068  */
2069
2070 #ifdef HAVE_WEAK_SYMBOLS
2071 #ifdef HAVE_VIRSTORAGEPOOLCREATEXML
2072 extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str) __attribute__((weak));
2073 #endif
2074 #endif
2075
2076 CAMLprim value
2077 ocaml_libvirt_storage_pool_create_xml (value connv, value strv)
2078 {
2079   CAMLparam2 (connv, strv);
2080 #ifndef HAVE_VIRSTORAGEPOOLCREATEXML
2081   /* Symbol virStoragePoolCreateXML not found at compile time. */
2082   not_supported ("virStoragePoolCreateXML");
2083   /* Suppresses a compiler warning. */
2084   (void) caml__frame;
2085 #else
2086   /* Check that the symbol virStoragePoolCreateXML
2087    * is in runtime version of libvirt.
2088    */
2089   WEAK_SYMBOL_CHECK (virStoragePoolCreateXML);
2090
2091   CAMLlocal1 (rv);
2092   virConnectPtr conn = Connect_val (connv);
2093   char *str = String_val (strv);
2094   virStoragePoolPtr r;
2095
2096   NONBLOCKING (r = virStoragePoolCreateXML (conn, str));
2097   CHECK_ERROR (!r, conn, "virStoragePoolCreateXML");
2098
2099   rv = Val_pool (r, connv);
2100
2101   CAMLreturn (rv);
2102 #endif
2103 }
2104
2105 /* Automatically generated binding for virStoragePoolDefineXML.
2106  * In generator.pl this function has signature "conn, string : pool".
2107  */
2108
2109 #ifdef HAVE_WEAK_SYMBOLS
2110 #ifdef HAVE_VIRSTORAGEPOOLDEFINEXML
2111 extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str) __attribute__((weak));
2112 #endif
2113 #endif
2114
2115 CAMLprim value
2116 ocaml_libvirt_storage_pool_define_xml (value connv, value strv)
2117 {
2118   CAMLparam2 (connv, strv);
2119 #ifndef HAVE_VIRSTORAGEPOOLDEFINEXML
2120   /* Symbol virStoragePoolDefineXML not found at compile time. */
2121   not_supported ("virStoragePoolDefineXML");
2122   /* Suppresses a compiler warning. */
2123   (void) caml__frame;
2124 #else
2125   /* Check that the symbol virStoragePoolDefineXML
2126    * is in runtime version of libvirt.
2127    */
2128   WEAK_SYMBOL_CHECK (virStoragePoolDefineXML);
2129
2130   CAMLlocal1 (rv);
2131   virConnectPtr conn = Connect_val (connv);
2132   char *str = String_val (strv);
2133   virStoragePoolPtr r;
2134
2135   NONBLOCKING (r = virStoragePoolDefineXML (conn, str));
2136   CHECK_ERROR (!r, conn, "virStoragePoolDefineXML");
2137
2138   rv = Val_pool (r, connv);
2139
2140   CAMLreturn (rv);
2141 #endif
2142 }
2143
2144 /* Automatically generated binding for virStoragePoolUndefine.
2145  * In generator.pl this function has signature "pool : unit".
2146  */
2147
2148 #ifdef HAVE_WEAK_SYMBOLS
2149 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
2150 extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
2151 #endif
2152 #endif
2153
2154 CAMLprim value
2155 ocaml_libvirt_storage_pool_undefine (value poolv)
2156 {
2157   CAMLparam1 (poolv);
2158 #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
2159   /* Symbol virStoragePoolUndefine not found at compile time. */
2160   not_supported ("virStoragePoolUndefine");
2161   /* Suppresses a compiler warning. */
2162   (void) caml__frame;
2163 #else
2164   /* Check that the symbol virStoragePoolUndefine
2165    * is in runtime version of libvirt.
2166    */
2167   WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
2168
2169   virStoragePoolPtr pool = Pool_val (poolv);
2170   virConnectPtr conn = Connect_polv (poolv);
2171   int r;
2172
2173   NONBLOCKING (r = virStoragePoolUndefine (pool));
2174   CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
2175
2176   CAMLreturn (Val_unit);
2177 #endif
2178 }
2179
2180 /* Automatically generated binding for virStoragePoolCreate.
2181  * In generator.pl this function has signature "pool : unit".
2182  */
2183
2184 #ifdef HAVE_WEAK_SYMBOLS
2185 #ifdef HAVE_VIRSTORAGEPOOLCREATE
2186 extern int virStoragePoolCreate (virStoragePoolPtr pool) __attribute__((weak));
2187 #endif
2188 #endif
2189
2190 CAMLprim value
2191 ocaml_libvirt_storage_pool_create (value poolv)
2192 {
2193   CAMLparam1 (poolv);
2194 #ifndef HAVE_VIRSTORAGEPOOLCREATE
2195   /* Symbol virStoragePoolCreate not found at compile time. */
2196   not_supported ("virStoragePoolCreate");
2197   /* Suppresses a compiler warning. */
2198   (void) caml__frame;
2199 #else
2200   /* Check that the symbol virStoragePoolCreate
2201    * is in runtime version of libvirt.
2202    */
2203   WEAK_SYMBOL_CHECK (virStoragePoolCreate);
2204
2205   virStoragePoolPtr pool = Pool_val (poolv);
2206   virConnectPtr conn = Connect_polv (poolv);
2207   int r;
2208
2209   NONBLOCKING (r = virStoragePoolCreate (pool));
2210   CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
2211
2212   CAMLreturn (Val_unit);
2213 #endif
2214 }
2215
2216 /* Automatically generated binding for virStoragePoolShutdown.
2217  * In generator.pl this function has signature "pool : unit".
2218  */
2219
2220 #ifdef HAVE_WEAK_SYMBOLS
2221 #ifdef HAVE_VIRSTORAGEPOOLSHUTDOWN
2222 extern int virStoragePoolShutdown (virStoragePoolPtr pool) __attribute__((weak));
2223 #endif
2224 #endif
2225
2226 CAMLprim value
2227 ocaml_libvirt_storage_pool_shutdown (value poolv)
2228 {
2229   CAMLparam1 (poolv);
2230 #ifndef HAVE_VIRSTORAGEPOOLSHUTDOWN
2231   /* Symbol virStoragePoolShutdown not found at compile time. */
2232   not_supported ("virStoragePoolShutdown");
2233   /* Suppresses a compiler warning. */
2234   (void) caml__frame;
2235 #else
2236   /* Check that the symbol virStoragePoolShutdown
2237    * is in runtime version of libvirt.
2238    */
2239   WEAK_SYMBOL_CHECK (virStoragePoolShutdown);
2240
2241   virStoragePoolPtr pool = Pool_val (poolv);
2242   virConnectPtr conn = Connect_polv (poolv);
2243   int r;
2244
2245   NONBLOCKING (r = virStoragePoolShutdown (pool));
2246   CHECK_ERROR (r == -1, conn, "virStoragePoolShutdown");
2247
2248   CAMLreturn (Val_unit);
2249 #endif
2250 }
2251
2252 /* Automatically generated binding for virStoragePoolRefresh.
2253  * In generator.pl this function has signature "pool, 0U : unit".
2254  */
2255
2256 #ifdef HAVE_WEAK_SYMBOLS
2257 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
2258 extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned  int flags) __attribute__((weak));
2259 #endif
2260 #endif
2261
2262 CAMLprim value
2263 ocaml_libvirt_storage_pool_refresh (value poolv)
2264 {
2265   CAMLparam1 (poolv);
2266 #ifndef HAVE_VIRSTORAGEPOOLREFRESH
2267   /* Symbol virStoragePoolRefresh not found at compile time. */
2268   not_supported ("virStoragePoolRefresh");
2269   /* Suppresses a compiler warning. */
2270   (void) caml__frame;
2271 #else
2272   /* Check that the symbol virStoragePoolRefresh
2273    * is in runtime version of libvirt.
2274    */
2275   WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
2276
2277   virStoragePoolPtr pool = Pool_val (poolv);
2278   virConnectPtr conn = Connect_polv (poolv);
2279   int r;
2280
2281   NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
2282   CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
2283
2284   CAMLreturn (Val_unit);
2285 #endif
2286 }
2287
2288 /* Automatically generated binding for virStoragePoolGetAutostart.
2289  * In generator.pl this function has signature "pool : bool".
2290  */
2291
2292 #ifdef HAVE_WEAK_SYMBOLS
2293 #ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2294 extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
2295 #endif
2296 #endif
2297
2298 CAMLprim value
2299 ocaml_libvirt_storage_pool_get_autostart (value poolv)
2300 {
2301   CAMLparam1 (poolv);
2302 #ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2303   /* Symbol virStoragePoolGetAutostart not found at compile time. */
2304   not_supported ("virStoragePoolGetAutostart");
2305   /* Suppresses a compiler warning. */
2306   (void) caml__frame;
2307 #else
2308   /* Check that the symbol virStoragePoolGetAutostart
2309    * is in runtime version of libvirt.
2310    */
2311   WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
2312
2313   virStoragePoolPtr pool = Pool_val (poolv);
2314   virConnectPtr conn = Connect_polv (poolv);
2315   int r, b;
2316
2317   NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
2318   CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
2319
2320   CAMLreturn (b ? Val_true : Val_false);
2321 #endif
2322 }
2323
2324 /* Automatically generated binding for virStoragePoolSetAutostart.
2325  * In generator.pl this function has signature "pool, bool : unit".
2326  */
2327
2328 #ifdef HAVE_WEAK_SYMBOLS
2329 #ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2330 extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
2331 #endif
2332 #endif
2333
2334 CAMLprim value
2335 ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
2336 {
2337   CAMLparam2 (poolv, bv);
2338 #ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2339   /* Symbol virStoragePoolSetAutostart not found at compile time. */
2340   not_supported ("virStoragePoolSetAutostart");
2341   /* Suppresses a compiler warning. */
2342   (void) caml__frame;
2343 #else
2344   /* Check that the symbol virStoragePoolSetAutostart
2345    * is in runtime version of libvirt.
2346    */
2347   WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
2348
2349   virStoragePoolPtr pool = Pool_val (poolv);
2350   virConnectPtr conn = Connect_polv (poolv);
2351   int r, b;
2352
2353   b = bv == Val_true ? 1 : 0;
2354
2355   NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
2356   CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
2357
2358   CAMLreturn (Val_unit);
2359 #endif
2360 }
2361
2362 /* Automatically generated binding for virStorageVolFree.
2363  * In generator.pl this function has signature "vol : free".
2364  */
2365
2366 #ifdef HAVE_WEAK_SYMBOLS
2367 #ifdef HAVE_VIRSTORAGEVOLFREE
2368 extern int virStorageVolFree (virStorageVolPtr vol) __attribute__((weak));
2369 #endif
2370 #endif
2371
2372 CAMLprim value
2373 ocaml_libvirt_storage_vol_free (value volv)
2374 {
2375   CAMLparam1 (volv);
2376 #ifndef HAVE_VIRSTORAGEVOLFREE
2377   /* Symbol virStorageVolFree not found at compile time. */
2378   not_supported ("virStorageVolFree");
2379   /* Suppresses a compiler warning. */
2380   (void) caml__frame;
2381 #else
2382   /* Check that the symbol virStorageVolFree
2383    * is in runtime version of libvirt.
2384    */
2385   WEAK_SYMBOL_CHECK (virStorageVolFree);
2386
2387   virStorageVolPtr vol = Volume_val (volv);
2388   virConnectPtr conn = Connect_volv (volv);
2389   int r;
2390
2391   NONBLOCKING (r = virStorageVolFree (vol));
2392   CHECK_ERROR (r == -1, conn, "virStorageVolFree");
2393
2394   /* So that we don't double-free in the finalizer: */
2395   Volume_val (volv) = NULL;
2396
2397   CAMLreturn (Val_unit);
2398 #endif
2399 }
2400
2401 /* Automatically generated binding for virStorageVolDestroy.
2402  * In generator.pl this function has signature "vol : free".
2403  */
2404
2405 #ifdef HAVE_WEAK_SYMBOLS
2406 #ifdef HAVE_VIRSTORAGEVOLDESTROY
2407 extern int virStorageVolDestroy (virStorageVolPtr vol) __attribute__((weak));
2408 #endif
2409 #endif
2410
2411 CAMLprim value
2412 ocaml_libvirt_storage_vol_destroy (value volv)
2413 {
2414   CAMLparam1 (volv);
2415 #ifndef HAVE_VIRSTORAGEVOLDESTROY
2416   /* Symbol virStorageVolDestroy not found at compile time. */
2417   not_supported ("virStorageVolDestroy");
2418   /* Suppresses a compiler warning. */
2419   (void) caml__frame;
2420 #else
2421   /* Check that the symbol virStorageVolDestroy
2422    * is in runtime version of libvirt.
2423    */
2424   WEAK_SYMBOL_CHECK (virStorageVolDestroy);
2425
2426   virStorageVolPtr vol = Volume_val (volv);
2427   virConnectPtr conn = Connect_volv (volv);
2428   int r;
2429
2430   NONBLOCKING (r = virStorageVolDestroy (vol));
2431   CHECK_ERROR (r == -1, conn, "virStorageVolDestroy");
2432
2433   /* So that we don't double-free in the finalizer: */
2434   Volume_val (volv) = NULL;
2435
2436   CAMLreturn (Val_unit);
2437 #endif
2438 }
2439
2440 /* Automatically generated binding for virStorageVolLookupByName.
2441  * In generator.pl this function has signature "pool, string : vol from pool".
2442  */
2443
2444 #ifdef HAVE_WEAK_SYMBOLS
2445 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2446 extern virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char *str) __attribute__((weak));
2447 #endif
2448 #endif
2449
2450 CAMLprim value
2451 ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv)
2452 {
2453   CAMLparam2 (poolv, strv);
2454 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2455   /* Symbol virStorageVolLookupByName not found at compile time. */
2456   not_supported ("virStorageVolLookupByName");
2457   /* Suppresses a compiler warning. */
2458   (void) caml__frame;
2459 #else
2460   /* Check that the symbol virStorageVolLookupByName
2461    * is in runtime version of libvirt.
2462    */
2463   WEAK_SYMBOL_CHECK (virStorageVolLookupByName);
2464
2465   CAMLlocal2 (rv, connv);
2466   virStoragePoolPtr pool = Pool_val (poolv);
2467   virConnectPtr conn = Connect_polv (poolv);
2468   char *str = String_val (strv);
2469   virStorageVolPtr r;
2470
2471   NONBLOCKING (r = virStorageVolLookupByName (pool, str));
2472   CHECK_ERROR (!r, conn, "virStorageVolLookupByName");
2473
2474   connv = Field (poolv, 1);
2475   rv = Val_volume (r, connv);
2476
2477   CAMLreturn (rv);
2478 #endif
2479 }
2480
2481 /* Automatically generated binding for virStorageVolLookupByKey.
2482  * In generator.pl this function has signature "conn, string : vol".
2483  */
2484
2485 #ifdef HAVE_WEAK_SYMBOLS
2486 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2487 extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
2488 #endif
2489 #endif
2490
2491 CAMLprim value
2492 ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
2493 {
2494   CAMLparam2 (connv, strv);
2495 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2496   /* Symbol virStorageVolLookupByKey not found at compile time. */
2497   not_supported ("virStorageVolLookupByKey");
2498   /* Suppresses a compiler warning. */
2499   (void) caml__frame;
2500 #else
2501   /* Check that the symbol virStorageVolLookupByKey
2502    * is in runtime version of libvirt.
2503    */
2504   WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
2505
2506   CAMLlocal1 (rv);
2507   virConnectPtr conn = Connect_val (connv);
2508   char *str = String_val (strv);
2509   virStorageVolPtr r;
2510
2511   NONBLOCKING (r = virStorageVolLookupByKey (conn, str));
2512   CHECK_ERROR (!r, conn, "virStorageVolLookupByKey");
2513
2514   rv = Val_volume (r, connv);
2515
2516   CAMLreturn (rv);
2517 #endif
2518 }
2519
2520 /* Automatically generated binding for virStorageVolLookupByPath.
2521  * In generator.pl this function has signature "conn, string : vol".
2522  */
2523
2524 #ifdef HAVE_WEAK_SYMBOLS
2525 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2526 extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
2527 #endif
2528 #endif
2529
2530 CAMLprim value
2531 ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
2532 {
2533   CAMLparam2 (connv, strv);
2534 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2535   /* Symbol virStorageVolLookupByPath not found at compile time. */
2536   not_supported ("virStorageVolLookupByPath");
2537   /* Suppresses a compiler warning. */
2538   (void) caml__frame;
2539 #else
2540   /* Check that the symbol virStorageVolLookupByPath
2541    * is in runtime version of libvirt.
2542    */
2543   WEAK_SYMBOL_CHECK (virStorageVolLookupByPath);
2544
2545   CAMLlocal1 (rv);
2546   virConnectPtr conn = Connect_val (connv);
2547   char *str = String_val (strv);
2548   virStorageVolPtr r;
2549
2550   NONBLOCKING (r = virStorageVolLookupByPath (conn, str));
2551   CHECK_ERROR (!r, conn, "virStorageVolLookupByPath");
2552
2553   rv = Val_volume (r, connv);
2554
2555   CAMLreturn (rv);
2556 #endif
2557 }
2558
2559 /* Automatically generated binding for virStorageVolCreateXML.
2560  * In generator.pl this function has signature "pool, string, 0 : vol from pool".
2561  */
2562
2563 #ifdef HAVE_WEAK_SYMBOLS
2564 #ifdef HAVE_VIRSTORAGEVOLCREATEXML
2565 extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str,  int flags) __attribute__((weak));
2566 #endif
2567 #endif
2568
2569 CAMLprim value
2570 ocaml_libvirt_storage_vol_create_xml (value poolv, value strv)
2571 {
2572   CAMLparam2 (poolv, strv);
2573 #ifndef HAVE_VIRSTORAGEVOLCREATEXML
2574   /* Symbol virStorageVolCreateXML not found at compile time. */
2575   not_supported ("virStorageVolCreateXML");
2576   /* Suppresses a compiler warning. */
2577   (void) caml__frame;
2578 #else
2579   /* Check that the symbol virStorageVolCreateXML
2580    * is in runtime version of libvirt.
2581    */
2582   WEAK_SYMBOL_CHECK (virStorageVolCreateXML);
2583
2584   CAMLlocal2 (rv, connv);
2585   virStoragePoolPtr pool = Pool_val (poolv);
2586   virConnectPtr conn = Connect_polv (poolv);
2587   char *str = String_val (strv);
2588   virStorageVolPtr r;
2589
2590   NONBLOCKING (r = virStorageVolCreateXML (pool, str, 0));
2591   CHECK_ERROR (!r, conn, "virStorageVolCreateXML");
2592
2593   connv = Field (poolv, 1);
2594   rv = Val_volume (r, connv);
2595
2596   CAMLreturn (rv);
2597 #endif
2598 }
2599
2600 /* Automatically generated binding for virStorageVolGetXMLDesc.
2601  * In generator.pl this function has signature "vol, 0 : string".
2602  */
2603
2604 #ifdef HAVE_WEAK_SYMBOLS
2605 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
2606 extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol,  int flags) __attribute__((weak));
2607 #endif
2608 #endif
2609
2610 CAMLprim value
2611 ocaml_libvirt_storage_vol_get_xml_desc (value volv)
2612 {
2613   CAMLparam1 (volv);
2614 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
2615   /* Symbol virStorageVolGetXMLDesc not found at compile time. */
2616   not_supported ("virStorageVolGetXMLDesc");
2617   /* Suppresses a compiler warning. */
2618   (void) caml__frame;
2619 #else
2620   /* Check that the symbol virStorageVolGetXMLDesc
2621    * is in runtime version of libvirt.
2622    */
2623   WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
2624
2625   CAMLlocal1 (rv);
2626   virStorageVolPtr vol = Volume_val (volv);
2627   virConnectPtr conn = Connect_volv (volv);
2628   char *r;
2629
2630   NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
2631   CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
2632
2633   rv = caml_copy_string (r);
2634   free (r);
2635   CAMLreturn (rv);
2636 #endif
2637 }
2638
2639 /* Automatically generated binding for virStorageVolGetPath.
2640  * In generator.pl this function has signature "vol : string".
2641  */
2642
2643 #ifdef HAVE_WEAK_SYMBOLS
2644 #ifdef HAVE_VIRSTORAGEVOLGETPATH
2645 extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
2646 #endif
2647 #endif
2648
2649 CAMLprim value
2650 ocaml_libvirt_storage_vol_get_path (value volv)
2651 {
2652   CAMLparam1 (volv);
2653 #ifndef HAVE_VIRSTORAGEVOLGETPATH
2654   /* Symbol virStorageVolGetPath not found at compile time. */
2655   not_supported ("virStorageVolGetPath");
2656   /* Suppresses a compiler warning. */
2657   (void) caml__frame;
2658 #else
2659   /* Check that the symbol virStorageVolGetPath
2660    * is in runtime version of libvirt.
2661    */
2662   WEAK_SYMBOL_CHECK (virStorageVolGetPath);
2663
2664   CAMLlocal1 (rv);
2665   virStorageVolPtr vol = Volume_val (volv);
2666   virConnectPtr conn = Connect_volv (volv);
2667   char *r;
2668
2669   NONBLOCKING (r = virStorageVolGetPath (vol));
2670   CHECK_ERROR (!r, conn, "virStorageVolGetPath");
2671
2672   rv = caml_copy_string (r);
2673   free (r);
2674   CAMLreturn (rv);
2675 #endif
2676 }
2677
2678 /* Automatically generated binding for virStorageVolGetKey.
2679  * In generator.pl this function has signature "vol : static string".
2680  */
2681
2682 #ifdef HAVE_WEAK_SYMBOLS
2683 #ifdef HAVE_VIRSTORAGEVOLGETKEY
2684 extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
2685 #endif
2686 #endif
2687
2688 CAMLprim value
2689 ocaml_libvirt_storage_vol_get_key (value volv)
2690 {
2691   CAMLparam1 (volv);
2692 #ifndef HAVE_VIRSTORAGEVOLGETKEY
2693   /* Symbol virStorageVolGetKey not found at compile time. */
2694   not_supported ("virStorageVolGetKey");
2695   /* Suppresses a compiler warning. */
2696   (void) caml__frame;
2697 #else
2698   /* Check that the symbol virStorageVolGetKey
2699    * is in runtime version of libvirt.
2700    */
2701   WEAK_SYMBOL_CHECK (virStorageVolGetKey);
2702
2703   CAMLlocal1 (rv);
2704   virStorageVolPtr vol = Volume_val (volv);
2705   virConnectPtr conn = Connect_volv (volv);
2706   const char *r;
2707
2708   NONBLOCKING (r = virStorageVolGetKey (vol));
2709   CHECK_ERROR (!r, conn, "virStorageVolGetKey");
2710
2711   rv = caml_copy_string (r);
2712   CAMLreturn (rv);
2713 #endif
2714 }
2715
2716 /* Automatically generated binding for virStorageVolGetName.
2717  * In generator.pl this function has signature "vol : static string".
2718  */
2719
2720 #ifdef HAVE_WEAK_SYMBOLS
2721 #ifdef HAVE_VIRSTORAGEVOLGETNAME
2722 extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
2723 #endif
2724 #endif
2725
2726 CAMLprim value
2727 ocaml_libvirt_storage_vol_get_name (value volv)
2728 {
2729   CAMLparam1 (volv);
2730 #ifndef HAVE_VIRSTORAGEVOLGETNAME
2731   /* Symbol virStorageVolGetName not found at compile time. */
2732   not_supported ("virStorageVolGetName");
2733   /* Suppresses a compiler warning. */
2734   (void) caml__frame;
2735 #else
2736   /* Check that the symbol virStorageVolGetName
2737    * is in runtime version of libvirt.
2738    */
2739   WEAK_SYMBOL_CHECK (virStorageVolGetName);
2740
2741   CAMLlocal1 (rv);
2742   virStorageVolPtr vol = Volume_val (volv);
2743   virConnectPtr conn = Connect_volv (volv);
2744   const char *r;
2745
2746   NONBLOCKING (r = virStorageVolGetName (vol));
2747   CHECK_ERROR (!r, conn, "virStorageVolGetName");
2748
2749   rv = caml_copy_string (r);
2750   CAMLreturn (rv);
2751 #endif
2752 }
2753
2754 /* Automatically generated binding for virStoragePoolLookupByVolume.
2755  * In generator.pl this function has signature "vol : pool from vol".
2756  */
2757
2758 #ifdef HAVE_WEAK_SYMBOLS
2759 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2760 extern virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) __attribute__((weak));
2761 #endif
2762 #endif
2763
2764 CAMLprim value
2765 ocaml_libvirt_storage_pool_lookup_by_volume (value volv)
2766 {
2767   CAMLparam1 (volv);
2768 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2769   /* Symbol virStoragePoolLookupByVolume not found at compile time. */
2770   not_supported ("virStoragePoolLookupByVolume");
2771   /* Suppresses a compiler warning. */
2772   (void) caml__frame;
2773 #else
2774   /* Check that the symbol virStoragePoolLookupByVolume
2775    * is in runtime version of libvirt.
2776    */
2777   WEAK_SYMBOL_CHECK (virStoragePoolLookupByVolume);
2778
2779   CAMLlocal2 (rv, connv);
2780   virStorageVolPtr vol = Volume_val (volv);
2781   virConnectPtr conn = Connect_volv (volv);
2782   virStoragePoolPtr r;
2783
2784   NONBLOCKING (r = virStoragePoolLookupByVolume (vol));
2785   CHECK_ERROR (!r, conn, "virStoragePoolLookupByVolume");
2786
2787   connv = Field (volv, 1);
2788   rv = Val_pool (r, connv);
2789
2790   CAMLreturn (rv);
2791 #endif
2792 }
2793
2794 /* Automatically generated binding for virJobFree.
2795  * In generator.pl this function has signature "job : free".
2796  */
2797
2798 #ifdef HAVE_WEAK_SYMBOLS
2799 #ifdef HAVE_VIRJOBFREE
2800 extern int virJobFree (virJobPtr job) __attribute__((weak));
2801 #endif
2802 #endif
2803
2804 CAMLprim value
2805 ocaml_libvirt_job_free (value jobv)
2806 {
2807   CAMLparam1 (jobv);
2808 #ifndef HAVE_VIRJOBFREE
2809   /* Symbol virJobFree not found at compile time. */
2810   not_supported ("virJobFree");
2811   /* Suppresses a compiler warning. */
2812   (void) caml__frame;
2813 #else
2814   /* Check that the symbol virJobFree
2815    * is in runtime version of libvirt.
2816    */
2817   WEAK_SYMBOL_CHECK (virJobFree);
2818
2819   virJobPtr job = Job_val (jobv);
2820   virConnectPtr conn = Connect_jobv (jobv);
2821   int r;
2822
2823   NONBLOCKING (r = virJobFree (job));
2824   CHECK_ERROR (r == -1, conn, "virJobFree");
2825
2826   /* So that we don't double-free in the finalizer: */
2827   Job_val (jobv) = NULL;
2828
2829   CAMLreturn (Val_unit);
2830 #endif
2831 }
2832
2833 /* Automatically generated binding for virJobCancel.
2834  * In generator.pl this function has signature "job : unit".
2835  */
2836
2837 #ifdef HAVE_WEAK_SYMBOLS
2838 #ifdef HAVE_VIRJOBCANCEL
2839 extern int virJobCancel (virJobPtr job) __attribute__((weak));
2840 #endif
2841 #endif
2842
2843 CAMLprim value
2844 ocaml_libvirt_job_cancel (value jobv)
2845 {
2846   CAMLparam1 (jobv);
2847 #ifndef HAVE_VIRJOBCANCEL
2848   /* Symbol virJobCancel not found at compile time. */
2849   not_supported ("virJobCancel");
2850   /* Suppresses a compiler warning. */
2851   (void) caml__frame;
2852 #else
2853   /* Check that the symbol virJobCancel
2854    * is in runtime version of libvirt.
2855    */
2856   WEAK_SYMBOL_CHECK (virJobCancel);
2857
2858   virJobPtr job = Job_val (jobv);
2859   virConnectPtr conn = Connect_jobv (jobv);
2860   int r;
2861
2862   NONBLOCKING (r = virJobCancel (job));
2863   CHECK_ERROR (r == -1, conn, "virJobCancel");
2864
2865   CAMLreturn (Val_unit);
2866 #endif
2867 }
2868
2869 /* Automatically generated binding for virJobGetNetwork.
2870  * In generator.pl this function has signature "job : net from job".
2871  */
2872
2873 #ifdef HAVE_WEAK_SYMBOLS
2874 #ifdef HAVE_VIRJOBGETNETWORK
2875 extern virNetworkPtr virJobGetNetwork (virJobPtr job) __attribute__((weak));
2876 #endif
2877 #endif
2878
2879 CAMLprim value
2880 ocaml_libvirt_job_get_network (value jobv)
2881 {
2882   CAMLparam1 (jobv);
2883 #ifndef HAVE_VIRJOBGETNETWORK
2884   /* Symbol virJobGetNetwork not found at compile time. */
2885   not_supported ("virJobGetNetwork");
2886   /* Suppresses a compiler warning. */
2887   (void) caml__frame;
2888 #else
2889   /* Check that the symbol virJobGetNetwork
2890    * is in runtime version of libvirt.
2891    */
2892   WEAK_SYMBOL_CHECK (virJobGetNetwork);
2893
2894   CAMLlocal2 (rv, connv);
2895   virJobPtr job = Job_val (jobv);
2896   virConnectPtr conn = Connect_jobv (jobv);
2897   virNetworkPtr r;
2898
2899   NONBLOCKING (r = virJobGetNetwork (job));
2900   CHECK_ERROR (!r, conn, "virJobGetNetwork");
2901
2902   connv = Field (jobv, 1);
2903   rv = Val_network (r, connv);
2904
2905   CAMLreturn (rv);
2906 #endif
2907 }
2908
2909 /* Automatically generated binding for virJobGetDomain.
2910  * In generator.pl this function has signature "job : dom from job".
2911  */
2912
2913 #ifdef HAVE_WEAK_SYMBOLS
2914 #ifdef HAVE_VIRJOBGETDOMAIN
2915 extern virDomainPtr virJobGetDomain (virJobPtr job) __attribute__((weak));
2916 #endif
2917 #endif
2918
2919 CAMLprim value
2920 ocaml_libvirt_job_get_domain (value jobv)
2921 {
2922   CAMLparam1 (jobv);
2923 #ifndef HAVE_VIRJOBGETDOMAIN
2924   /* Symbol virJobGetDomain not found at compile time. */
2925   not_supported ("virJobGetDomain");
2926   /* Suppresses a compiler warning. */
2927   (void) caml__frame;
2928 #else
2929   /* Check that the symbol virJobGetDomain
2930    * is in runtime version of libvirt.
2931    */
2932   WEAK_SYMBOL_CHECK (virJobGetDomain);
2933
2934   CAMLlocal2 (rv, connv);
2935   virJobPtr job = Job_val (jobv);
2936   virConnectPtr conn = Connect_jobv (jobv);
2937   virDomainPtr r;
2938
2939   NONBLOCKING (r = virJobGetDomain (job));
2940   CHECK_ERROR (!r, conn, "virJobGetDomain");
2941
2942   connv = Field (jobv, 1);
2943   rv = Val_domain (r, connv);
2944
2945   CAMLreturn (rv);
2946 #endif
2947 }
2948
2949 #include "libvirt_c_epilogue.c"
2950
2951 /* EOF */