CAMLreturn (optv);
}
+static value
+Val_opt_const (const void *ptr, Val_const_ptr_t Val_ptr)
+{
+ CAMLparam0 ();
+ CAMLlocal2 (optv, ptrv);
+
+ if (ptr) { /* Some ptr */
+ optv = caml_alloc (1, 0);
+ ptrv = Val_ptr (ptr);
+ Store_field (optv, 0, ptrv);
+ } else /* None */
+ optv = Val_int (0);
+
+ CAMLreturn (optv);
+}
+
#if 0
static value
option_default (value option, value deflt)
(void) caml__frame;
}
+static int
+_list_length (value listv)
+{
+ CAMLparam1 (listv);
+ int len = 0;
+
+ for (; listv != Val_emptylist; listv = Field (listv, 1), ++len) {}
+
+ CAMLreturnT (int, len);
+}
+
+static value
+Val_virconnectcredential (const virConnectCredentialPtr cred)
+{
+ CAMLparam0 ();
+ CAMLlocal1 (rv);
+
+ rv = caml_alloc (4, 0);
+ Store_field (rv, 0, Val_int (cred->type - 1));
+ Store_field (rv, 1, caml_copy_string (cred->prompt));
+ Store_field (rv, 2,
+ Val_opt_const (cred->challenge,
+ (Val_const_ptr_t) caml_copy_string));
+ Store_field (rv, 3,
+ Val_opt_const (cred->defresult,
+ (Val_const_ptr_t) caml_copy_string));
+
+ CAMLreturn (rv);
+}
+
/* Convert the virErrorNumber, virErrorDomain and virErrorLevel enums
* into values (longs because they are variants in OCaml).
*
* to convert it into VIR_*_UNKNOWN (code).
*/
-#define MAX_VIR_CODE 50 /* VIR_ERR_NO_STORAGE_VOL */
-#define MAX_VIR_DOMAIN 17 /* VIR_FROM_STORAGE */
+#define MAX_VIR_CODE 101 /* VIR_ERR_NO_NWFILTER_BINDING */
+#define MAX_VIR_DOMAIN 67 /* VIR_FROM_RESCTRL */
#define MAX_VIR_LEVEL VIR_ERR_ERROR
static inline value
static void vol_finalize (value);
static struct custom_operations conn_custom_operations = {
- "conn_custom_operations",
+ (char *) "conn_custom_operations",
conn_finalize,
custom_compare_default,
custom_hash_default,
};
static struct custom_operations dom_custom_operations = {
- "dom_custom_operations",
+ (char *) "dom_custom_operations",
dom_finalize,
custom_compare_default,
custom_hash_default,
};
static struct custom_operations net_custom_operations = {
- "net_custom_operations",
+ (char *) "net_custom_operations",
net_finalize,
custom_compare_default,
custom_hash_default,
};
static struct custom_operations pol_custom_operations = {
- "pol_custom_operations",
+ (char *) "pol_custom_operations",
pol_finalize,
custom_compare_default,
custom_hash_default,
};
static struct custom_operations vol_custom_operations = {
- "vol_custom_operations",
+ (char *) "vol_custom_operations",
vol_finalize,
custom_compare_default,
custom_hash_default,