27aa4c0719593dafea759b8e9866b2331d9a4943
[virt-top.git] / libvirt / libvirt_c.c
1 /* WARNING: THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'.
2  * Any changes you make to this file may be overwritten.
3  */
4
5 /* OCaml bindings for libvirt.
6  * (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc.
7  * http://libvirt.org/
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
22  */
23
24 #include "config.h"
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29
30 #include <libvirt/libvirt.h>
31 #include <libvirt/virterror.h>
32
33 #include <caml/config.h>
34 #include <caml/alloc.h>
35 #include <caml/callback.h>
36 #include <caml/custom.h>
37 #include <caml/fail.h>
38 #include <caml/memory.h>
39 #include <caml/misc.h>
40 #include <caml/mlvalues.h>
41 #include <caml/signals.h>
42
43 #include "libvirt_c_prologue.c"
44
45 #include "libvirt_c_oneoffs.c"
46
47 #ifdef HAVE_WEAK_SYMBOLS
48 #ifdef HAVE_VIRCONNECTGETHOSTNAME
49 extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak));
50 #endif
51 #endif
52
53 CAMLprim value
54 ocaml_libvirt_connect_get_hostname (value connv)
55 {
56   CAMLparam1 (connv);
57 #ifndef HAVE_VIRCONNECTGETHOSTNAME
58   /* Symbol virConnectGetHostname not found at compile time. */
59   not_supported ("virConnectGetHostname");
60   /* Suppresses a compiler warning. */
61   (void) caml__frame;
62 #else
63   /* Check that the symbol virConnectGetHostname
64    * is in runtime version of libvirt.
65    */
66   WEAK_SYMBOL_CHECK (virConnectGetHostname);
67
68   CAMLlocal1 (rv);
69   virConnectPtr conn = Connect_val (connv);
70   char *r;
71
72   NONBLOCKING (r = virConnectGetHostname (conn));
73   CHECK_ERROR (!r, conn, "virConnectGetHostname");
74
75   rv = caml_copy_string (r);
76   free (r);
77   CAMLreturn (rv);
78 #endif
79 }
80
81 #ifdef HAVE_WEAK_SYMBOLS
82 #ifdef HAVE_VIRCONNECTGETURI
83 extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak));
84 #endif
85 #endif
86
87 CAMLprim value
88 ocaml_libvirt_connect_get_uri (value connv)
89 {
90   CAMLparam1 (connv);
91 #ifndef HAVE_VIRCONNECTGETURI
92   /* Symbol virConnectGetURI not found at compile time. */
93   not_supported ("virConnectGetURI");
94   /* Suppresses a compiler warning. */
95   (void) caml__frame;
96 #else
97   /* Check that the symbol virConnectGetURI
98    * is in runtime version of libvirt.
99    */
100   WEAK_SYMBOL_CHECK (virConnectGetURI);
101
102   CAMLlocal1 (rv);
103   virConnectPtr conn = Connect_val (connv);
104   char *r;
105
106   NONBLOCKING (r = virConnectGetURI (conn));
107   CHECK_ERROR (!r, conn, "virConnectGetURI");
108
109   rv = caml_copy_string (r);
110   free (r);
111   CAMLreturn (rv);
112 #endif
113 }
114
115 CAMLprim value
116 ocaml_libvirt_connect_get_type (value connv)
117 {
118   CAMLparam1 (connv);
119
120   CAMLlocal1 (rv);
121   virConnectPtr conn = Connect_val (connv);
122   const char *r;
123
124   NONBLOCKING (r = virConnectGetType (conn));
125   CHECK_ERROR (!r, conn, "virConnectGetType");
126
127   rv = caml_copy_string (r);
128   CAMLreturn (rv);
129 }
130
131 CAMLprim value
132 ocaml_libvirt_connect_num_of_domains (value connv)
133 {
134   CAMLparam1 (connv);
135
136   virConnectPtr conn = Connect_val (connv);
137   int r;
138
139   NONBLOCKING (r = virConnectNumOfDomains (conn));
140   CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains");
141
142   CAMLreturn (Val_int (r));
143 }
144
145 CAMLprim value
146 ocaml_libvirt_connect_list_domains (value connv, value iv)
147 {
148   CAMLparam2 (connv, iv);
149
150   CAMLlocal1 (rv);
151   virConnectPtr conn = Connect_val (connv);
152   int i = Int_val (iv);
153   int ids[i], r;
154
155   NONBLOCKING (r = virConnectListDomains (conn, ids, i));
156   CHECK_ERROR (r == -1, conn, "virConnectListDomains");
157
158   rv = caml_alloc (r, 0);
159   for (i = 0; i < r; ++i)
160     Store_field (rv, i, Val_int (ids[i]));
161
162   CAMLreturn (rv);
163 }
164
165 CAMLprim value
166 ocaml_libvirt_connect_num_of_defined_domains (value connv)
167 {
168   CAMLparam1 (connv);
169
170   virConnectPtr conn = Connect_val (connv);
171   int r;
172
173   NONBLOCKING (r = virConnectNumOfDefinedDomains (conn));
174   CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains");
175
176   CAMLreturn (Val_int (r));
177 }
178
179 CAMLprim value
180 ocaml_libvirt_connect_list_defined_domains (value connv, value iv)
181 {
182   CAMLparam2 (connv, iv);
183
184   CAMLlocal2 (rv, strv);
185   virConnectPtr conn = Connect_val (connv);
186   int i = Int_val (iv);
187   char *names[i];
188   int r;
189
190   NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
191   CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
192
193   rv = caml_alloc (r, 0);
194   for (i = 0; i < r; ++i) {
195     strv = caml_copy_string (names[i]);
196     Store_field (rv, i, strv);
197     free (names[i]);
198   }
199
200   CAMLreturn (rv);
201 }
202
203 CAMLprim value
204 ocaml_libvirt_connect_num_of_networks (value connv)
205 {
206   CAMLparam1 (connv);
207
208   virConnectPtr conn = Connect_val (connv);
209   int r;
210
211   NONBLOCKING (r = virConnectNumOfNetworks (conn));
212   CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks");
213
214   CAMLreturn (Val_int (r));
215 }
216
217 CAMLprim value
218 ocaml_libvirt_connect_list_networks (value connv, value iv)
219 {
220   CAMLparam2 (connv, iv);
221
222   CAMLlocal2 (rv, strv);
223   virConnectPtr conn = Connect_val (connv);
224   int i = Int_val (iv);
225   char *names[i];
226   int r;
227
228   NONBLOCKING (r = virConnectListNetworks (conn, names, i));
229   CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
230
231   rv = caml_alloc (r, 0);
232   for (i = 0; i < r; ++i) {
233     strv = caml_copy_string (names[i]);
234     Store_field (rv, i, strv);
235     free (names[i]);
236   }
237
238   CAMLreturn (rv);
239 }
240
241 CAMLprim value
242 ocaml_libvirt_connect_num_of_defined_networks (value connv)
243 {
244   CAMLparam1 (connv);
245
246   virConnectPtr conn = Connect_val (connv);
247   int r;
248
249   NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn));
250   CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks");
251
252   CAMLreturn (Val_int (r));
253 }
254
255 CAMLprim value
256 ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
257 {
258   CAMLparam2 (connv, iv);
259
260   CAMLlocal2 (rv, strv);
261   virConnectPtr conn = Connect_val (connv);
262   int i = Int_val (iv);
263   char *names[i];
264   int r;
265
266   NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
267   CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
268
269   rv = caml_alloc (r, 0);
270   for (i = 0; i < r; ++i) {
271     strv = caml_copy_string (names[i]);
272     Store_field (rv, i, strv);
273     free (names[i]);
274   }
275
276   CAMLreturn (rv);
277 }
278
279 #ifdef HAVE_WEAK_SYMBOLS
280 #ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
281 extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak));
282 #endif
283 #endif
284
285 CAMLprim value
286 ocaml_libvirt_connect_num_of_storage_pools (value connv)
287 {
288   CAMLparam1 (connv);
289 #ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
290   /* Symbol virConnectNumOfStoragePools not found at compile time. */
291   not_supported ("virConnectNumOfStoragePools");
292   /* Suppresses a compiler warning. */
293   (void) caml__frame;
294 #else
295   /* Check that the symbol virConnectNumOfStoragePools
296    * is in runtime version of libvirt.
297    */
298   WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools);
299
300   virConnectPtr conn = Connect_val (connv);
301   int r;
302
303   NONBLOCKING (r = virConnectNumOfStoragePools (conn));
304   CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
305
306   CAMLreturn (Val_int (r));
307 #endif
308 }
309
310 #ifdef HAVE_WEAK_SYMBOLS
311 #ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS
312 extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
313 #endif
314 #endif
315
316 CAMLprim value
317 ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
318 {
319   CAMLparam2 (connv, iv);
320 #ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS
321   /* Symbol virConnectListStoragePools not found at compile time. */
322   not_supported ("virConnectListStoragePools");
323   /* Suppresses a compiler warning. */
324   (void) caml__frame;
325 #else
326   /* Check that the symbol virConnectListStoragePools
327    * is in runtime version of libvirt.
328    */
329   WEAK_SYMBOL_CHECK (virConnectListStoragePools);
330
331   CAMLlocal2 (rv, strv);
332   virConnectPtr conn = Connect_val (connv);
333   int i = Int_val (iv);
334   char *names[i];
335   int r;
336
337   NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
338   CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
339
340   rv = caml_alloc (r, 0);
341   for (i = 0; i < r; ++i) {
342     strv = caml_copy_string (names[i]);
343     Store_field (rv, i, strv);
344     free (names[i]);
345   }
346
347   CAMLreturn (rv);
348 #endif
349 }
350
351 #ifdef HAVE_WEAK_SYMBOLS
352 #ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
353 extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak));
354 #endif
355 #endif
356
357 CAMLprim value
358 ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
359 {
360   CAMLparam1 (connv);
361 #ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
362   /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */
363   not_supported ("virConnectNumOfDefinedStoragePools");
364   /* Suppresses a compiler warning. */
365   (void) caml__frame;
366 #else
367   /* Check that the symbol virConnectNumOfDefinedStoragePools
368    * is in runtime version of libvirt.
369    */
370   WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools);
371
372   virConnectPtr conn = Connect_val (connv);
373   int r;
374
375   NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn));
376   CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
377
378   CAMLreturn (Val_int (r));
379 #endif
380 }
381
382 #ifdef HAVE_WEAK_SYMBOLS
383 #ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
384 extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
385 #endif
386 #endif
387
388 CAMLprim value
389 ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
390 {
391   CAMLparam2 (connv, iv);
392 #ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
393   /* Symbol virConnectListDefinedStoragePools not found at compile time. */
394   not_supported ("virConnectListDefinedStoragePools");
395   /* Suppresses a compiler warning. */
396   (void) caml__frame;
397 #else
398   /* Check that the symbol virConnectListDefinedStoragePools
399    * is in runtime version of libvirt.
400    */
401   WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools);
402
403   CAMLlocal2 (rv, strv);
404   virConnectPtr conn = Connect_val (connv);
405   int i = Int_val (iv);
406   char *names[i];
407   int r;
408
409   NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
410   CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
411
412   rv = caml_alloc (r, 0);
413   for (i = 0; i < r; ++i) {
414     strv = caml_copy_string (names[i]);
415     Store_field (rv, i, strv);
416     free (names[i]);
417   }
418
419   CAMLreturn (rv);
420 #endif
421 }
422
423 CAMLprim value
424 ocaml_libvirt_connect_get_capabilities (value connv)
425 {
426   CAMLparam1 (connv);
427
428   CAMLlocal1 (rv);
429   virConnectPtr conn = Connect_val (connv);
430   char *r;
431
432   NONBLOCKING (r = virConnectGetCapabilities (conn));
433   CHECK_ERROR (!r, conn, "virConnectGetCapabilities");
434
435   rv = caml_copy_string (r);
436   free (r);
437   CAMLreturn (rv);
438 }
439
440 CAMLprim value
441 ocaml_libvirt_domain_get_name (value domv)
442 {
443   CAMLparam1 (domv);
444
445   CAMLlocal1 (rv);
446   virDomainPtr dom = Domain_val (domv);
447   virConnectPtr conn = Connect_domv (domv);
448   const char *r;
449
450   NONBLOCKING (r = virDomainGetName (dom));
451   CHECK_ERROR (!r, conn, "virDomainGetName");
452
453   rv = caml_copy_string (r);
454   CAMLreturn (rv);
455 }
456
457 CAMLprim value
458 ocaml_libvirt_domain_get_os_type (value domv)
459 {
460   CAMLparam1 (domv);
461
462   CAMLlocal1 (rv);
463   virDomainPtr dom = Domain_val (domv);
464   virConnectPtr conn = Connect_domv (domv);
465   char *r;
466
467   NONBLOCKING (r = virDomainGetOSType (dom));
468   CHECK_ERROR (!r, conn, "virDomainGetOSType");
469
470   rv = caml_copy_string (r);
471   free (r);
472   CAMLreturn (rv);
473 }
474
475 CAMLprim value
476 ocaml_libvirt_domain_get_xml_desc (value domv)
477 {
478   CAMLparam1 (domv);
479
480   CAMLlocal1 (rv);
481   virDomainPtr dom = Domain_val (domv);
482   virConnectPtr conn = Connect_domv (domv);
483   char *r;
484
485   NONBLOCKING (r = virDomainGetXMLDesc (dom, 0));
486   CHECK_ERROR (!r, conn, "virDomainGetXMLDesc");
487
488   rv = caml_copy_string (r);
489   free (r);
490   CAMLreturn (rv);
491 }
492
493 CAMLprim value
494 ocaml_libvirt_domain_suspend (value domv)
495 {
496   CAMLparam1 (domv);
497
498   virDomainPtr dom = Domain_val (domv);
499   virConnectPtr conn = Connect_domv (domv);
500   int r;
501
502   NONBLOCKING (r = virDomainSuspend (dom));
503   CHECK_ERROR (r == -1, conn, "virDomainSuspend");
504
505   CAMLreturn (Val_unit);
506 }
507
508 CAMLprim value
509 ocaml_libvirt_domain_resume (value domv)
510 {
511   CAMLparam1 (domv);
512
513   virDomainPtr dom = Domain_val (domv);
514   virConnectPtr conn = Connect_domv (domv);
515   int r;
516
517   NONBLOCKING (r = virDomainResume (dom));
518   CHECK_ERROR (r == -1, conn, "virDomainResume");
519
520   CAMLreturn (Val_unit);
521 }
522
523 CAMLprim value
524 ocaml_libvirt_domain_shutdown (value domv)
525 {
526   CAMLparam1 (domv);
527
528   virDomainPtr dom = Domain_val (domv);
529   virConnectPtr conn = Connect_domv (domv);
530   int r;
531
532   NONBLOCKING (r = virDomainShutdown (dom));
533   CHECK_ERROR (r == -1, conn, "virDomainShutdown");
534
535   CAMLreturn (Val_unit);
536 }
537
538 CAMLprim value
539 ocaml_libvirt_domain_reboot (value domv)
540 {
541   CAMLparam1 (domv);
542
543   virDomainPtr dom = Domain_val (domv);
544   virConnectPtr conn = Connect_domv (domv);
545   int r;
546
547   NONBLOCKING (r = virDomainReboot (dom, 0));
548   CHECK_ERROR (r == -1, conn, "virDomainReboot");
549
550   CAMLreturn (Val_unit);
551 }
552
553 CAMLprim value
554 ocaml_libvirt_domain_undefine (value domv)
555 {
556   CAMLparam1 (domv);
557
558   virDomainPtr dom = Domain_val (domv);
559   virConnectPtr conn = Connect_domv (domv);
560   int r;
561
562   NONBLOCKING (r = virDomainUndefine (dom));
563   CHECK_ERROR (r == -1, conn, "virDomainUndefine");
564
565   CAMLreturn (Val_unit);
566 }
567
568 CAMLprim value
569 ocaml_libvirt_domain_create (value domv)
570 {
571   CAMLparam1 (domv);
572
573   virDomainPtr dom = Domain_val (domv);
574   virConnectPtr conn = Connect_domv (domv);
575   int r;
576
577   NONBLOCKING (r = virDomainCreate (dom));
578   CHECK_ERROR (r == -1, conn, "virDomainCreate");
579
580   CAMLreturn (Val_unit);
581 }
582
583 CAMLprim value
584 ocaml_libvirt_network_get_name (value netv)
585 {
586   CAMLparam1 (netv);
587
588   CAMLlocal1 (rv);
589   virNetworkPtr net = Network_val (netv);
590   virConnectPtr conn = Connect_netv (netv);
591   const char *r;
592
593   NONBLOCKING (r = virNetworkGetName (net));
594   CHECK_ERROR (!r, conn, "virNetworkGetName");
595
596   rv = caml_copy_string (r);
597   CAMLreturn (rv);
598 }
599
600 CAMLprim value
601 ocaml_libvirt_network_get_xml_desc (value netv)
602 {
603   CAMLparam1 (netv);
604
605   CAMLlocal1 (rv);
606   virNetworkPtr net = Network_val (netv);
607   virConnectPtr conn = Connect_netv (netv);
608   char *r;
609
610   NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
611   CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
612
613   rv = caml_copy_string (r);
614   free (r);
615   CAMLreturn (rv);
616 }
617
618 CAMLprim value
619 ocaml_libvirt_network_get_bridge_name (value netv)
620 {
621   CAMLparam1 (netv);
622
623   CAMLlocal1 (rv);
624   virNetworkPtr net = Network_val (netv);
625   virConnectPtr conn = Connect_netv (netv);
626   char *r;
627
628   NONBLOCKING (r = virNetworkGetBridgeName (net));
629   CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
630
631   rv = caml_copy_string (r);
632   free (r);
633   CAMLreturn (rv);
634 }
635
636 CAMLprim value
637 ocaml_libvirt_network_undefine (value netv)
638 {
639   CAMLparam1 (netv);
640
641   virNetworkPtr net = Network_val (netv);
642   virConnectPtr conn = Connect_netv (netv);
643   int r;
644
645   NONBLOCKING (r = virNetworkUndefine (net));
646   CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
647
648   CAMLreturn (Val_unit);
649 }
650
651 CAMLprim value
652 ocaml_libvirt_network_create (value netv)
653 {
654   CAMLparam1 (netv);
655
656   virNetworkPtr net = Network_val (netv);
657   virConnectPtr conn = Connect_netv (netv);
658   int r;
659
660   NONBLOCKING (r = virNetworkCreate (net));
661   CHECK_ERROR (r == -1, conn, "virNetworkCreate");
662
663   CAMLreturn (Val_unit);
664 }
665
666 #ifdef HAVE_WEAK_SYMBOLS
667 #ifdef HAVE_VIRSTORAGEPOOLGETNAME
668 extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
669 #endif
670 #endif
671
672 CAMLprim value
673 ocaml_libvirt_storage_pool_get_name (value poolv)
674 {
675   CAMLparam1 (poolv);
676 #ifndef HAVE_VIRSTORAGEPOOLGETNAME
677   /* Symbol virStoragePoolGetName not found at compile time. */
678   not_supported ("virStoragePoolGetName");
679   /* Suppresses a compiler warning. */
680   (void) caml__frame;
681 #else
682   /* Check that the symbol virStoragePoolGetName
683    * is in runtime version of libvirt.
684    */
685   WEAK_SYMBOL_CHECK (virStoragePoolGetName);
686
687   CAMLlocal1 (rv);
688   virStoragePoolPtr pool = Pool_val (poolv);
689   virConnectPtr conn = Connect_polv (poolv);
690   const char *r;
691
692   NONBLOCKING (r = virStoragePoolGetName (pool));
693   CHECK_ERROR (!r, conn, "virStoragePoolGetName");
694
695   rv = caml_copy_string (r);
696   CAMLreturn (rv);
697 #endif
698 }
699
700 #ifdef HAVE_WEAK_SYMBOLS
701 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
702 extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, int flags) __attribute__((weak));
703 #endif
704 #endif
705
706 CAMLprim value
707 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
708 {
709   CAMLparam1 (poolv);
710 #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
711   /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
712   not_supported ("virStoragePoolGetXMLDesc");
713   /* Suppresses a compiler warning. */
714   (void) caml__frame;
715 #else
716   /* Check that the symbol virStoragePoolGetXMLDesc
717    * is in runtime version of libvirt.
718    */
719   WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
720
721   CAMLlocal1 (rv);
722   virStoragePoolPtr pool = Pool_val (poolv);
723   virConnectPtr conn = Connect_polv (poolv);
724   char *r;
725
726   NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
727   CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
728
729   rv = caml_copy_string (r);
730   free (r);
731   CAMLreturn (rv);
732 #endif
733 }
734
735 #ifdef HAVE_WEAK_SYMBOLS
736 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
737 extern char *virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
738 #endif
739 #endif
740
741 CAMLprim value
742 ocaml_libvirt_storage_pool_undefine (value poolv)
743 {
744   CAMLparam1 (poolv);
745 #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
746   /* Symbol virStoragePoolUndefine not found at compile time. */
747   not_supported ("virStoragePoolUndefine");
748   /* Suppresses a compiler warning. */
749   (void) caml__frame;
750 #else
751   /* Check that the symbol virStoragePoolUndefine
752    * is in runtime version of libvirt.
753    */
754   WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
755
756   CAMLlocal1 (rv);
757   virStoragePoolPtr pool = Pool_val (poolv);
758   virConnectPtr conn = Connect_polv (poolv);
759   char *r;
760
761   NONBLOCKING (r = virStoragePoolUndefine (pool));
762   CHECK_ERROR (!r, conn, "virStoragePoolUndefine");
763
764   rv = caml_copy_string (r);
765   free (r);
766   CAMLreturn (rv);
767 #endif
768 }
769
770 #ifdef HAVE_WEAK_SYMBOLS
771 #ifdef HAVE_VIRSTORAGEPOOLCREATE
772 extern char *virStoragePoolCreate (virStoragePoolPtr pool) __attribute__((weak));
773 #endif
774 #endif
775
776 CAMLprim value
777 ocaml_libvirt_storage_pool_create (value poolv)
778 {
779   CAMLparam1 (poolv);
780 #ifndef HAVE_VIRSTORAGEPOOLCREATE
781   /* Symbol virStoragePoolCreate not found at compile time. */
782   not_supported ("virStoragePoolCreate");
783   /* Suppresses a compiler warning. */
784   (void) caml__frame;
785 #else
786   /* Check that the symbol virStoragePoolCreate
787    * is in runtime version of libvirt.
788    */
789   WEAK_SYMBOL_CHECK (virStoragePoolCreate);
790
791   CAMLlocal1 (rv);
792   virStoragePoolPtr pool = Pool_val (poolv);
793   virConnectPtr conn = Connect_polv (poolv);
794   char *r;
795
796   NONBLOCKING (r = virStoragePoolCreate (pool));
797   CHECK_ERROR (!r, conn, "virStoragePoolCreate");
798
799   rv = caml_copy_string (r);
800   free (r);
801   CAMLreturn (rv);
802 #endif
803 }
804
805 #ifdef HAVE_WEAK_SYMBOLS
806 #ifdef HAVE_VIRSTORAGEPOOLSHUTDOWN
807 extern char *virStoragePoolShutdown (virStoragePoolPtr pool) __attribute__((weak));
808 #endif
809 #endif
810
811 CAMLprim value
812 ocaml_libvirt_storage_pool_shutdown (value poolv)
813 {
814   CAMLparam1 (poolv);
815 #ifndef HAVE_VIRSTORAGEPOOLSHUTDOWN
816   /* Symbol virStoragePoolShutdown not found at compile time. */
817   not_supported ("virStoragePoolShutdown");
818   /* Suppresses a compiler warning. */
819   (void) caml__frame;
820 #else
821   /* Check that the symbol virStoragePoolShutdown
822    * is in runtime version of libvirt.
823    */
824   WEAK_SYMBOL_CHECK (virStoragePoolShutdown);
825
826   CAMLlocal1 (rv);
827   virStoragePoolPtr pool = Pool_val (poolv);
828   virConnectPtr conn = Connect_polv (poolv);
829   char *r;
830
831   NONBLOCKING (r = virStoragePoolShutdown (pool));
832   CHECK_ERROR (!r, conn, "virStoragePoolShutdown");
833
834   rv = caml_copy_string (r);
835   free (r);
836   CAMLreturn (rv);
837 #endif
838 }
839
840 #ifdef HAVE_WEAK_SYMBOLS
841 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
842 extern char *virStoragePoolRefresh (virStoragePoolPtr pool, int flags) __attribute__((weak));
843 #endif
844 #endif
845
846 CAMLprim value
847 ocaml_libvirt_storage_pool_refresh (value poolv)
848 {
849   CAMLparam1 (poolv);
850 #ifndef HAVE_VIRSTORAGEPOOLREFRESH
851   /* Symbol virStoragePoolRefresh not found at compile time. */
852   not_supported ("virStoragePoolRefresh");
853   /* Suppresses a compiler warning. */
854   (void) caml__frame;
855 #else
856   /* Check that the symbol virStoragePoolRefresh
857    * is in runtime version of libvirt.
858    */
859   WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
860
861   CAMLlocal1 (rv);
862   virStoragePoolPtr pool = Pool_val (poolv);
863   virConnectPtr conn = Connect_polv (poolv);
864   char *r;
865
866   NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
867   CHECK_ERROR (!r, conn, "virStoragePoolRefresh");
868
869   rv = caml_copy_string (r);
870   free (r);
871   CAMLreturn (rv);
872 #endif
873 }
874
875 #ifdef HAVE_WEAK_SYMBOLS
876 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
877 extern char *virStorageVolGetXMLDesc (virStoragePoolPtr pool, int flags) __attribute__((weak));
878 #endif
879 #endif
880
881 CAMLprim value
882 ocaml_libvirt_storage_vol_get_xml_desc (value poolv)
883 {
884   CAMLparam1 (poolv);
885 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
886   /* Symbol virStorageVolGetXMLDesc not found at compile time. */
887   not_supported ("virStorageVolGetXMLDesc");
888   /* Suppresses a compiler warning. */
889   (void) caml__frame;
890 #else
891   /* Check that the symbol virStorageVolGetXMLDesc
892    * is in runtime version of libvirt.
893    */
894   WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
895
896   CAMLlocal1 (rv);
897   virStoragePoolPtr pool = Pool_val (poolv);
898   virConnectPtr conn = Connect_polv (poolv);
899   char *r;
900
901   NONBLOCKING (r = virStorageVolGetXMLDesc (pool, 0));
902   CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
903
904   rv = caml_copy_string (r);
905   free (r);
906   CAMLreturn (rv);
907 #endif
908 }
909
910 #ifdef HAVE_WEAK_SYMBOLS
911 #ifdef HAVE_VIRSTORAGEVOLGETPATH
912 extern char *virStorageVolGetPath (virStoragePoolPtr pool) __attribute__((weak));
913 #endif
914 #endif
915
916 CAMLprim value
917 ocaml_libvirt_storage_vol_get_path (value poolv)
918 {
919   CAMLparam1 (poolv);
920 #ifndef HAVE_VIRSTORAGEVOLGETPATH
921   /* Symbol virStorageVolGetPath not found at compile time. */
922   not_supported ("virStorageVolGetPath");
923   /* Suppresses a compiler warning. */
924   (void) caml__frame;
925 #else
926   /* Check that the symbol virStorageVolGetPath
927    * is in runtime version of libvirt.
928    */
929   WEAK_SYMBOL_CHECK (virStorageVolGetPath);
930
931   CAMLlocal1 (rv);
932   virStoragePoolPtr pool = Pool_val (poolv);
933   virConnectPtr conn = Connect_polv (poolv);
934   char *r;
935
936   NONBLOCKING (r = virStorageVolGetPath (pool));
937   CHECK_ERROR (!r, conn, "virStorageVolGetPath");
938
939   rv = caml_copy_string (r);
940   free (r);
941   CAMLreturn (rv);
942 #endif
943 }
944
945 #ifdef HAVE_WEAK_SYMBOLS
946 #ifdef HAVE_VIRSTORAGEVOLGETKEY
947 extern const char *virStorageVolGetKey (virStoragePoolPtr pool) __attribute__((weak));
948 #endif
949 #endif
950
951 CAMLprim value
952 ocaml_libvirt_storage_vol_get_key (value poolv)
953 {
954   CAMLparam1 (poolv);
955 #ifndef HAVE_VIRSTORAGEVOLGETKEY
956   /* Symbol virStorageVolGetKey not found at compile time. */
957   not_supported ("virStorageVolGetKey");
958   /* Suppresses a compiler warning. */
959   (void) caml__frame;
960 #else
961   /* Check that the symbol virStorageVolGetKey
962    * is in runtime version of libvirt.
963    */
964   WEAK_SYMBOL_CHECK (virStorageVolGetKey);
965
966   CAMLlocal1 (rv);
967   virStoragePoolPtr pool = Pool_val (poolv);
968   virConnectPtr conn = Connect_polv (poolv);
969   const char *r;
970
971   NONBLOCKING (r = virStorageVolGetKey (pool));
972   CHECK_ERROR (!r, conn, "virStorageVolGetKey");
973
974   rv = caml_copy_string (r);
975   CAMLreturn (rv);
976 #endif
977 }
978
979 #ifdef HAVE_WEAK_SYMBOLS
980 #ifdef HAVE_VIRSTORAGEVOLGETNAME
981 extern const char *virStorageVolGetName (virStoragePoolPtr pool) __attribute__((weak));
982 #endif
983 #endif
984
985 CAMLprim value
986 ocaml_libvirt_storage_vol_get_name (value poolv)
987 {
988   CAMLparam1 (poolv);
989 #ifndef HAVE_VIRSTORAGEVOLGETNAME
990   /* Symbol virStorageVolGetName not found at compile time. */
991   not_supported ("virStorageVolGetName");
992   /* Suppresses a compiler warning. */
993   (void) caml__frame;
994 #else
995   /* Check that the symbol virStorageVolGetName
996    * is in runtime version of libvirt.
997    */
998   WEAK_SYMBOL_CHECK (virStorageVolGetName);
999
1000   CAMLlocal1 (rv);
1001   virStoragePoolPtr pool = Pool_val (poolv);
1002   virConnectPtr conn = Connect_polv (poolv);
1003   const char *r;
1004
1005   NONBLOCKING (r = virStorageVolGetName (pool));
1006   CHECK_ERROR (!r, conn, "virStorageVolGetName");
1007
1008   rv = caml_copy_string (r);
1009   CAMLreturn (rv);
1010 #endif
1011 }
1012
1013 CAMLprim value
1014 ocaml_libvirt_domain_create_job ()
1015 {
1016   failwith ("ocaml_libvirt_domain_create_job is unimplemented");
1017 }
1018
1019 CAMLprim value
1020 ocaml_libvirt_domain_core_dump_job ()
1021 {
1022   failwith ("ocaml_libvirt_domain_core_dump_job is unimplemented");
1023 }
1024
1025 CAMLprim value
1026 ocaml_libvirt_domain_restore_job ()
1027 {
1028   failwith ("ocaml_libvirt_domain_restore_job is unimplemented");
1029 }
1030
1031 CAMLprim value
1032 ocaml_libvirt_domain_save_job ()
1033 {
1034   failwith ("ocaml_libvirt_domain_save_job is unimplemented");
1035 }
1036
1037 CAMLprim value
1038 ocaml_libvirt_connect_create_linux_job ()
1039 {
1040   failwith ("ocaml_libvirt_connect_create_linux_job is unimplemented");
1041 }
1042
1043 CAMLprim value
1044 ocaml_libvirt_network_create_job ()
1045 {
1046   failwith ("ocaml_libvirt_network_create_job is unimplemented");
1047 }
1048
1049 CAMLprim value
1050 ocaml_libvirt_network_create_xml_job ()
1051 {
1052   failwith ("ocaml_libvirt_network_create_xml_job is unimplemented");
1053 }
1054
1055 CAMLprim value
1056 ocaml_libvirt_storage_pool_set_autostart ()
1057 {
1058   failwith ("ocaml_libvirt_storage_pool_set_autostart is unimplemented");
1059 }
1060
1061 CAMLprim value
1062 ocaml_libvirt_storage_pool_get_autostart ()
1063 {
1064   failwith ("ocaml_libvirt_storage_pool_get_autostart is unimplemented");
1065 }
1066
1067 CAMLprim value
1068 ocaml_libvirt_storage_pool_get_info ()
1069 {
1070   failwith ("ocaml_libvirt_storage_pool_get_info is unimplemented");
1071 }
1072
1073 CAMLprim value
1074 ocaml_libvirt_storage_pool_get_uuid_string ()
1075 {
1076   failwith ("ocaml_libvirt_storage_pool_get_uuid_string is unimplemented");
1077 }
1078
1079 CAMLprim value
1080 ocaml_libvirt_storage_pool_get_uuid ()
1081 {
1082   failwith ("ocaml_libvirt_storage_pool_get_uuid is unimplemented");
1083 }
1084
1085 CAMLprim value
1086 ocaml_libvirt_storage_pool_free ()
1087 {
1088   failwith ("ocaml_libvirt_storage_pool_free is unimplemented");
1089 }
1090
1091 CAMLprim value
1092 ocaml_libvirt_storage_pool_destroy ()
1093 {
1094   failwith ("ocaml_libvirt_storage_pool_destroy is unimplemented");
1095 }
1096
1097 CAMLprim value
1098 ocaml_libvirt_storage_pool_define_xml ()
1099 {
1100   failwith ("ocaml_libvirt_storage_pool_define_xml is unimplemented");
1101 }
1102
1103 CAMLprim value
1104 ocaml_libvirt_storage_pool_create_xml ()
1105 {
1106   failwith ("ocaml_libvirt_storage_pool_create_xml is unimplemented");
1107 }
1108
1109 CAMLprim value
1110 ocaml_libvirt_storage_pool_lookup_by_uuid_string ()
1111 {
1112   failwith ("ocaml_libvirt_storage_pool_lookup_by_uuid_string is unimplemented");
1113 }
1114
1115 CAMLprim value
1116 ocaml_libvirt_storage_pool_lookup_by_uuid ()
1117 {
1118   failwith ("ocaml_libvirt_storage_pool_lookup_by_uuid is unimplemented");
1119 }
1120
1121 CAMLprim value
1122 ocaml_libvirt_storage_pool_lookup_by_name ()
1123 {
1124   failwith ("ocaml_libvirt_storage_pool_lookup_by_name is unimplemented");
1125 }
1126
1127 CAMLprim value
1128 ocaml_libvirt_storage_vol_free ()
1129 {
1130   failwith ("ocaml_libvirt_storage_vol_free is unimplemented");
1131 }
1132
1133 CAMLprim value
1134 ocaml_libvirt_storage_vol_destroy ()
1135 {
1136   failwith ("ocaml_libvirt_storage_vol_destroy is unimplemented");
1137 }
1138
1139 CAMLprim value
1140 ocaml_libvirt_storage_vol_create_xml ()
1141 {
1142   failwith ("ocaml_libvirt_storage_vol_create_xml is unimplemented");
1143 }
1144
1145 CAMLprim value
1146 ocaml_libvirt_storage_vol_get_info ()
1147 {
1148   failwith ("ocaml_libvirt_storage_vol_get_info is unimplemented");
1149 }
1150
1151 CAMLprim value
1152 ocaml_libvirt_pool_of_volume ()
1153 {
1154   failwith ("ocaml_libvirt_pool_of_volume is unimplemented");
1155 }
1156
1157 CAMLprim value
1158 ocaml_libvirt_storage_vol_lookup_by_path ()
1159 {
1160   failwith ("ocaml_libvirt_storage_vol_lookup_by_path is unimplemented");
1161 }
1162
1163 CAMLprim value
1164 ocaml_libvirt_storage_vol_lookup_by_key ()
1165 {
1166   failwith ("ocaml_libvirt_storage_vol_lookup_by_key is unimplemented");
1167 }
1168
1169 CAMLprim value
1170 ocaml_libvirt_storage_vol_lookup_by_name ()
1171 {
1172   failwith ("ocaml_libvirt_storage_vol_lookup_by_name is unimplemented");
1173 }
1174
1175 CAMLprim value
1176 ocaml_libvirt_job_cancel ()
1177 {
1178   failwith ("ocaml_libvirt_job_cancel is unimplemented");
1179 }
1180
1181 CAMLprim value
1182 ocaml_libvirt_job_get_network ()
1183 {
1184   failwith ("ocaml_libvirt_job_get_network is unimplemented");
1185 }
1186
1187 CAMLprim value
1188 ocaml_libvirt_job_get_domain ()
1189 {
1190   failwith ("ocaml_libvirt_job_get_domain is unimplemented");
1191 }
1192
1193 CAMLprim value
1194 ocaml_libvirt_job_get_info ()
1195 {
1196   failwith ("ocaml_libvirt_job_get_info is unimplemented");
1197 }
1198
1199 #include "libvirt_c_epilogue.c"
1200
1201 /* EOF */