Displaying 20 results from an estimated 62 matches for "val_bool".
2017 Oct 11
1
[PATCH] common/mlutils: fix f_type comparisons
...mmon/mlutils/unix_utils-c.c b/common/mlutils/unix_utils-c.c
index f8c4f8abe..2afdc9e5f 100644
--- a/common/mlutils/unix_utils-c.c
+++ b/common/mlutils/unix_utils-c.c
@@ -357,9 +357,9 @@ guestfs_int_mllib_statvfs_is_network_filesystem (value pathv)
#define SMB_SUPER_MAGIC 0x517b
#endif
- return Val_bool (buf.f_type == CIFS_MAGIC_NUMBER ||
- buf.f_type == NFS_SUPER_MAGIC ||
- buf.f_type == SMB_SUPER_MAGIC);
+ return Val_bool ((unsigned int) buf.f_type == CIFS_MAGIC_NUMBER ||
+ (unsigned int) buf.f_type == NFS_SUPER_MAGIC ||
+...
2017 Oct 04
2
Re: [PATCH v2 2/2] builder: Choose better weights in the planner.
...all. */
> +value
> +guestfs_int_mllib_statvfs_filesystem_is_remote (value pathv)
> +{
> +#ifdef HAVE_STATFS
> + struct statfs buf;
> +
> + if (statfs (String_val (pathv), &buf) == -1)
> + unix_error (errno, (char *) "statvfs", pathv);
> +
> + return Val_bool (buf.f_type == 0xff534d42 /* CIFS_MAGIC_NUMBER */ ||
> + buf.f_type == 0x6969 /* NFS_SUPER_MAGIC */ ||
> + buf.f_type == 0x517b /* SMB_SUPER_MAGIC */);
Using linux/magic.h + the constants from it should avoid the hardcoded
numbers, and possibly allow more...
2020 Sep 01
0
[nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends
...11,6 +314,64 @@ preconnect_wrapper (int readonly)
CAMLreturnT (int, 0);
}
+static int
+list_exports_wrapper (int readonly, int is_tls, struct nbdkit_exports *exports)
+{
+ CAMLparam0 ();
+ CAMLlocal2 (rv, v);
+
+ caml_leave_blocking_section ();
+
+ rv = caml_callback2_exn (list_exports_fn, Val_bool (readonly),
+ Val_bool (is_tls));
+ if (Is_exception_result (rv)) {
+ nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
+ caml_enter_blocking_section ();
+ CAMLreturnT (int, -1);
+ }
+
+ /* Convert exports list into calls to nbdkit_...
2020 Sep 21
0
[nbdkit PATCH v3 14/14] ocaml: Implement .list_exports and friends
...11,6 +314,65 @@ preconnect_wrapper (int readonly)
CAMLreturnT (int, 0);
}
+static int
+list_exports_wrapper (int readonly, int is_tls, struct nbdkit_exports *exports)
+{
+ CAMLparam0 ();
+ CAMLlocal2 (rv, v);
+
+ caml_leave_blocking_section ();
+
+ rv = caml_callback2_exn (list_exports_fn, Val_bool (readonly),
+ Val_bool (is_tls));
+ if (Is_exception_result (rv)) {
+ nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
+ caml_enter_blocking_section ();
+ CAMLreturnT (int, -1);
+ }
+
+ /* Convert exports list into calls to nbdkit_...
2020 Feb 10
1
[nbdkit PATCH] ocaml: Support .preconnect callback
...ls from C (ie. nbdkit) to OCaml. */
@@ -726,6 +728,25 @@ can_fast_zero_wrapper (void *h)
CAMLreturnT (int, Bool_val (rv));
}
+static int
+preconnect_wrapper (int readonly)
+{
+ CAMLparam0 ();
+ CAMLlocal1 (rv);
+
+ caml_leave_blocking_section ();
+
+ rv = caml_callback_exn (preconnect_fn, Val_bool (readonly));
+ if (Is_exception_result (rv)) {
+ nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
+ caml_enter_blocking_section ();
+ CAMLreturnT (int, -1);
+ }
+
+ caml_enter_blocking_section ();
+ CAMLreturnT (int, 1);
+}
+
/*---------------------------...
2017 Oct 03
0
[PATCH v2 2/2] builder: Choose better weights in the planner.
...(rv);
}
+
+/* NB: This is a "noalloc" call. */
+value
+guestfs_int_mllib_statvfs_filesystem_is_remote (value pathv)
+{
+#ifdef HAVE_STATFS
+ struct statfs buf;
+
+ if (statfs (String_val (pathv), &buf) == -1)
+ unix_error (errno, (char *) "statvfs", pathv);
+
+ return Val_bool (buf.f_type == 0xff534d42 /* CIFS_MAGIC_NUMBER */ ||
+ buf.f_type == 0x6969 /* NFS_SUPER_MAGIC */ ||
+ buf.f_type == 0x517b /* SMB_SUPER_MAGIC */);
+#else
+ return Val_bool (0);
+#endif
+}
diff --git a/common/mlutils/unix_utils.ml b/common/mlutils/unix_utils.ml...
2020 Sep 01
4
[nbdkit PATCH 0/2] More language bindings for .list_exports
This picks up python and ocaml. Some of our languages are lacking a
number of bindings (for example, lua and perl lack .extents, so I
didn't have anything to copy from), and I felt less comfortable with
golang and rust. But for python and ocaml, I was able to test a
working implementation.
Eric Blake (2):
python: Implement .list_exports and friends
ocaml: Implement .list_exports and
2017 Aug 03
0
[PATCH 3/6] daemon: Refine check for Device and Dev_or_Path parameters (RHBZ#1477623).
...ils-c.c b/daemon/utils-c.c
index 22b0d57c6..d3a8f330b 100644
--- a/daemon/utils-c.c
+++ b/daemon/utils-c.c
@@ -46,6 +46,13 @@ guestfs_int_daemon_get_verbose_flag (value unitv)
/* NB: This is a "noalloc" call. */
value
+guestfs_int_daemon_is_device_parameter (value device)
+{
+ return Val_bool (is_device_parameter (String_val (device)));
+}
+
+/* NB: This is a "noalloc" call. */
+value
guestfs_int_daemon_is_root_device (value device)
{
return Val_bool (is_root_device (String_val (device)));
diff --git a/daemon/utils.c b/daemon/utils.c
index 6ec232252..6d6aad218 100644
---...
2017 Jul 14
0
[PATCH 16/27] daemon: Generate OCaml wrappers for optgroup_*_available functions.
...+ group;
+ pr "\n";
+ pr "/* NB: This is a \"noalloc\" call. */\n";
+ pr "value\n";
+ pr "guestfs_int_daemon_optgroup_%s_available (value unitv)\n" group;
+ pr "{\n";
+ pr " return Val_bool (optgroup_%s_available ());\n" group;
+ pr "}\n";
+ pr "\n"
+ )
+ ) optgroups_names_all
let generate_daemon_optgroups_h () =
generate_header CStyle GPLv2plus;
--
2.13.2
2017 Oct 04
0
Re: [PATCH v2 2/2] builder: Choose better weights in the planner.
On Wed, Oct 04, 2017 at 03:20:53PM +0200, Pino Toscano wrote:
> > + return Val_bool (buf.f_type == 0xff534d42 /* CIFS_MAGIC_NUMBER */ ||
> > + buf.f_type == 0x6969 /* NFS_SUPER_MAGIC */ ||
> > + buf.f_type == 0x517b /* SMB_SUPER_MAGIC */);
>
> Using linux/magic.h + the constants from it should avoid the hardcoded
> numbers,...
2020 Sep 18
0
[PATCH common] mlutils: Simple wrapper around sysconf (_SC_NPROCESSORS_ONLN).
...xtern value guestfs_int_mllib_statvfs_is_network_filesystem (value pathv);
+extern value guestfs_int_mllib_sysconf_nr_processors_online (value unitv);
/* NB: This is a "noalloc" call. */
value
@@ -368,3 +369,17 @@ guestfs_int_mllib_statvfs_is_network_filesystem (value pathv)
return Val_bool (0);
#endif
}
+
+/* NB: This is a "noalloc" call. */
+value
+guestfs_int_mllib_sysconf_nr_processors_online (value unitv)
+{
+#ifdef _SC_NPROCESSORS_ONLN
+ long n;
+
+ n = sysconf (_SC_NPROCESSORS_ONLN);
+ if (n > 0) return Val_int (n);
+#endif
+ /* Return a safe value so that ca...
2017 Oct 03
4
[PATCH v2 0/2] builder: Choose better weights in the planner.
v1 -> v2:
- Removed the f_type field from StatVFS.statvfs structure.
- New function StatVFS.filesystem_is_remote, written in C.
[Thinking about it, this should probably be called
?is_network_filesystem?, but I can change that before
pushing].
- Use statvfs instead of fstatvfs, and statfs instead of fstatfs.
- Rejigged the comments in builder/builder.ml to make them simpler
2020 Jan 22
4
[v2v PATCH 0/3] Use libosinfo for query device drivers
This patch series integrates libosinfo in virt-v2v to get the list of
files for Windows from libosinfo, if possible. The actual data is still
from virtio-win, just unpacked.
Pino Toscano (3):
build: require libosinfo
v2v: add a minimal libosinfo interface
v2v: try to get windows driver files from libosinfo
m4/guestfs-v2v.m4 | 3 +
v2v/Makefile.am | 9 +-
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...if (i) abort ();\n";
+ pr "\n";
+ pr " CAMLreturn (rv);\n";
+ pr "}\n";
pr "\n"
let print_ocaml_closure_wrapper { cbname; cbargs } =
@@ -619,8 +670,8 @@ let print_ocaml_binding (name, { args; optargs; ret }) =
| RBool -> pr " rv = Val_bool (r);\n"
| RErr -> pr " rv = Val_unit;\n"
| RFd | RInt | RUInt -> pr " rv = Val_int (r);\n"
- | REnum (_) -> pr " rv = Val_int (r);\n" (* XXX Use Val_enum_prefix() *)
- | RFlags (_) -> pr " rv = Val_int (r);\n" (* XXX Use Val_f...
2020 Mar 30
0
[PATCH 1/7] New APIs: cryptsetup-open and cryptsetup-close.
...>) and I<not> the name
+of the underlying block device." };
+
]
diff --git a/generator/daemon.ml b/generator/daemon.ml
index 9edef462c..b1047427b 100644
--- a/generator/daemon.ml
+++ b/generator/daemon.ml
@@ -776,7 +776,8 @@ let generate_daemon_caml_stubs () =
pr "Val_bool (%s)" n;
| OInt _ -> assert false
| OInt64 _ -> assert false
- | OString _ -> assert false
+ | OString _ ->
+ pr "caml_copy_string (%s)" n
| OStringList _ -> assert false
);
pr &...
2020 Sep 07
0
[PATCH v2 1/7] New APIs: cryptsetup-open and cryptsetup-close.
...>) and I<not> the name
+of the underlying block device." };
+
]
diff --git a/generator/daemon.ml b/generator/daemon.ml
index 9edef462c..b1047427b 100644
--- a/generator/daemon.ml
+++ b/generator/daemon.ml
@@ -776,7 +776,8 @@ let generate_daemon_caml_stubs () =
pr "Val_bool (%s)" n;
| OInt _ -> assert false
| OInt64 _ -> assert false
- | OString _ -> assert false
+ | OString _ ->
+ pr "caml_copy_string (%s)" n
| OStringList _ -> assert false
);
pr &...
2020 Jan 28
4
[v2v PATCH v2 0/3] Use libosinfo for query device drivers
This patch series integrates libosinfo in virt-v2v to get the list of
files for Windows from libosinfo, if possible. The actual data is still
from virtio-win, just unpacked.
Changes from v1:
- adapt to use the priority in libosinfo 1.7.0+
- filter out non-pre-installable drivers
- collect all the drivers matching the requirements, not just the first,
sorting them by priority like libosinfo does
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...pr "\n";
+ pr " CAMLreturn (rv);\n";
+ pr "}\n";
+ pr "\n"
+ )
let print_ocaml_closure_wrapper { cbname; cbargs } =
let argnames =
@@ -639,8 +704,8 @@ let print_ocaml_binding (name, { args; optargs; ret }) =
| RBool -> pr " rv = Val_bool (r);\n"
| RErr -> pr " rv = Val_unit;\n"
| RFd | RInt | RUInt -> pr " rv = Val_int (r);\n"
- | REnum _ -> pr " rv = Val_int (r);\n" (* XXX Use Val_enum_prefix() *)
- | RFlags _ -> pr " rv = Val_int (r);\n" (* XXX Use Val_flag_...
2017 Jul 14
0
[PATCH 07/27] daemon: Reimplement ‘is_dir’, ‘is_file’ and ‘is_symlink’ APIs in OCaml.
...; GUESTFS_%s_%s_BITMASK) == 0)\n"
+ uc_name uc_n;
pr " args[%d] = Val_int (0); /* None */\n" !i;
pr " else {\n";
pr " v = ";
@@ -651,7 +652,7 @@ return_string_list (value retv)
| Bool n -> pr "Val_bool (%s)" n
| Int n -> pr "Val_int (%s)" n
| Int64 n -> pr "caml_copy_int64 (%s)" n
- | String ((PlainString|Device|Dev_or_Path), n) ->
+ | String ((PlainString|Device|Pathname|Dev_or_Path), n) ->
pr "c...
2017 Jul 21
0
[PATCH v2 01/23] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...: %s", String_val (Field (exn, 1)));
+ else
+ reply_with_error ("internal error: %s: unhandled exception thrown: %s",
+ func, exn_name);
+}
+
+/* NB: This is a "noalloc" call. */
+value
+guestfs_int_daemon_get_verbose_flag (value unitv)
+{
+ return Val_bool (verbose);
+}
+
+/* Implement String (Mountable, _) parameter. */
+value
+guestfs_int_daemon_copy_mountable (const mountable_t *mountable)
+{
+ CAMLparam0 ();
+ CAMLlocal4 (r, typev, devicev, volumev);
+
+ switch (mountable->type) {
+ case MOUNTABLE_DEVICE:
+ typev = Val_int (0); /* Mount...