search for: caml_copy_string

Displaying 20 results from an estimated 148 matches for "caml_copy_string".

2014 Jan 21
3
[PATCH] builder: proper consider subkeys in index files
...er/index-parser-c.c +++ b/builder/index-parser-c.c @@ -83,11 +83,13 @@ virt_builder_parse_index (value filenamev) for (j = 0, fields = sections->fields; fields != NULL; j++, fields = fields->next) { - v = caml_alloc_tuple (2); + v = caml_alloc_tuple (3); sv = caml_copy_string (fields->key); - Store_field (v, 0, sv); /* (key, value) */ - sv = caml_copy_string (fields->value); + Store_field (v, 0, sv); /* (key, subkey, value) */ + sv = caml_copy_string (fields->subkey ? fields->subkey : ""); Store_field (v, 1, sv); +...
2016 Jan 22
1
[supermin] [PATCH] ext2: check for needed block size
...; struct stat statbuf; struct statvfs statvfsbuf; + size_t blocks; if (data->debug >= 3) printf ("supermin: ext2: copy_file %s -> %s\n", src, dest); @@ -649,6 +653,20 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest) caml_copy_string (data->fs->device_name)); } + /* Check that we have enough free blocks to store the resulting blocks + * for this file. The file might need more than that in the filesystem, + * but at least this provides a quick check to avoid failing later on. + */ + blocks = ROUND_UP (statbuf...
2014 Jan 21
2
Re: [PATCH] builder: proper consider subkeys in index files
On Tuesday 21 January 2014 16:37:20 Richard W.M. Jones wrote: > On Tue, Jan 21, 2014 at 05:18:27PM +0100, Pino Toscano wrote: > > + sv = caml_copy_string (fields->subkey ? fields->subkey : ""); > > > > Store_field (v, 1, sv); > > Heh, sure would be nice if this was an option type :-) > > I believe the following should work: > > (1) Change CAMLlocal4 (..) at the top of the function to: > &g...
2016 Jul 06
0
[PATCH] ext2: Don't load whole files into memory when copying to the appliance (RHBZ#1113065).
...ext2_error_to_exception ("ext2fs_file_open2", err, filename); + if ((ssize_t) written != r) + caml_failwith ("ext2fs_file_write: requested write size != bytes written"); + size += written; + } + + if (r == -1) + unix_error (errno, (char *) "read", caml_copy_string (filename)); + + if (close (fd) == -1) + unix_error (errno, (char *) "close", caml_copy_string (filename)); + + /* Flush out the ext2 file. */ + err = ext2fs_file_flush (file); + if (err != 0) + ext2_error_to_exception ("ext2fs_file_flush", err, filename); + err = ext...
2014 Jan 21
0
[PATCH] builder: proper consider subkeys in index files
...uct section *sections; size_t i, nr_sections; @@ -83,11 +83,18 @@ virt_builder_parse_index (value filenamev) for (j = 0, fields = sections->fields; fields != NULL; j++, fields = fields->next) { - v = caml_alloc_tuple (2); + v = caml_alloc_tuple (3); sv = caml_copy_string (fields->key); - Store_field (v, 0, sv); /* (key, value) */ - sv = caml_copy_string (fields->value); + Store_field (v, 0, sv); /* (key, Some subkey, value) */ + if (fields->subkey) { + sv2 = caml_copy_string (fields->subkey); + sv = caml_alloc (1, 0...
2018 Aug 22
3
Re: [PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
...iously we had a special JSON_parser_null value we could > + * use here, making the returned type (sort of) an option. > + * This is a best effort which is better than crashing / > + * throwing an error. > + */ > + rv = caml_alloc (1, JSON_STRING_TAG); > + v = caml_copy_string (""); > + Store_field (rv, 0, v); > + } NACK, this is not correct. null is a proper type of value in JSON, and thus JSON.json_t must represent it as well. This is even used in other parts, for example the check of backing files of disks (see guestfs_impl_disk_has_backing_file...
2017 Jul 14
0
[PATCH 04/27] daemon: Reimplement ‘vfs_type’ API in OCaml.
...aram0 (); + CAMLlocal4 (r, typev, devicev, volumev); + + switch (mountable->type) { + case MOUNTABLE_DEVICE: + typev = Val_int (0); /* MountableDevice */ + break; + case MOUNTABLE_PATH: + typev = Val_int (1); /* MountablePath */ + break; + case MOUNTABLE_BTRFSVOL: + volumev = caml_copy_string (mountable->volume); + typev = caml_alloc (1, 0); /* MountableBtrfsVol */ + Store_field (typev, 0, volumev); + } + + devicev = caml_copy_string (mountable->device); + + r = caml_alloc_tuple (2); + Store_field (r, 0, typev); + Store_field (r, 1, devicev); + + CAMLreturn (r); +} +...
2019 May 30
5
[PATCH 0/5] RFC: switch augeas APIs to OCaml
This synchronizes the embedded ocaml-augeas copy, and reimplements the augeas APIs using it (dropping all the C code). The behaviour seems unchanged, although I may have not tested all the various corner cases. Pino Toscano (5): common/mlaugeas: Synchronize with latest ocaml-augeas daemon: fix/enhance error reporting of Augeas exceptions Revert "Revert "daemon: implement
2015 May 15
3
[PATCH v2 0/2] customize: Allow --selinux-relabel flag to work on cross-architecture builds.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1212807 Since v1: - Combine the virt-builder detection code into virt-customize. - Enables us to delete Architecture and Uname modules completely. Rich.
2018 Jan 29
1
[PATCH] customize: Correctly handle crypt(3) returning NULL.
...a GCC diagnostic ignored "-Wmissing-prototypes" @@ -44,6 +46,8 @@ virt_customize_crypt (value keyv, value saltv) * is not thread safe. */ r = crypt (String_val (keyv), String_val (saltv)); + if (r == NULL) + unix_error (errno, (char *) "crypt", Nothing); rv = caml_copy_string (r); CAMLreturn (rv); -- 2.13.2
2014 Jan 21
0
Re: [PATCH] builder: proper consider subkeys in index files
On Tue, Jan 21, 2014 at 05:18:27PM +0100, Pino Toscano wrote: > + sv = caml_copy_string (fields->subkey ? fields->subkey : ""); > Store_field (v, 1, sv); Heh, sure would be nice if this was an option type :-) I believe the following should work: (1) Change CAMLlocal4 (..) at the top of the function to: CAMLlocal5 (rv, v, sv, sv2, fv); (2) Then the new...
2016 Apr 14
1
[PATCH supermin] ext2: fix printf formatters
...Iu64 " bytes, available only %llu\n", + src, blocks, data->fs->blocksize, (uint64_t) statbuf.st_size, ext2fs_free_blocks_count (data->fs->super)); unix_error (ENOSPC, (char *) "block size", data->fs->device_name ? caml_copy_string (data->fs->device_name) : Val_none); -- 2.5.5
2019 Apr 08
0
[PATCH v4 2/7] common: Bundle the libvirt-ocaml library for use by virt-v2v
...s of function). + +sub gen_c_code +{ + my $sig = shift; + my $c_name = shift; + + if ($sig =~ /^(\w+) : string$/) { + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + char *r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (!r, \"$c_name\"); + + rv = caml_copy_string (r); + free (r); + CAMLreturn (rv); +" + } elsif ($sig =~ /^(\w+) : static string$/) { + "\ + CAMLlocal1 (rv); + " . gen_unpack_args ($1) . " + const char *r; + + NONBLOCKING (r = $c_name ($1)); + CHECK_ERROR (!r, \"$c_name\"); + + rv = caml_copy_string (r);...
2014 Sep 17
4
[PATCH 0/2] supermin: use librpm for rpm support
Hi, this work makes supermin use the rpm library instead of invoking rpm directly. This, together with a needed refactoring of the dependency resolution, should help in make supermin faster on rpm-based systems. Surely the patches will still need polishing, especially for behaviours of newly added stuff, but at least it's a good starting point. Noting that you need rpm-devel on most of rpm
2019 Dec 16
3
[v2v PATCH 0/2] Move libvirt-ocaml copy to v2v repo
libvirt-ocaml is used only by virt-v2v, so move it to this repository, instead of having it around in the common submodule. The removal from common will happen later. Pino Toscano (2): common: Bundle the libvirt-ocaml library for use by virt-v2v build: switch embedded copy of libvirt-ocaml .gitignore | 2 + 3rdparty/libvirt-ocaml/Makefile.am |
2014 Jul 30
2
[PATCH 1/3] ext2: create a struct for the OCaml 't' type
...p;& statvfs (data->fs->device_name, &statvfsbuf) == 0) { uint64_t space = statvfsbuf.f_bavail * statvfsbuf.f_bsize; uint64_t estimate = 128*1024 + 2 * statbuf.st_size; if (space < estimate) unix_error (ENOSPC, (char *) "statvfs", - caml_copy_string (fs->device_name)); + caml_copy_string (data->fs->device_name)); } #if 0 @@ -638,7 +643,7 @@ ext2_copy_file (ext2_filsys fs, const char *src, const char *dest) cont: /* Look up the parent directory. */ - err = ext2fs_namei (fs, EXT2_ROOT_INO, EXT2_ROOT_I...
2016 Feb 04
0
[PATCH] aarch64: Use a common table of AAVMF paths.
...t (r)); } + +value +v2v_utils_aavmf_firmware (value unitv) +{ + CAMLparam1 (unitv); + CAMLlocal5 (rv, v, v1, v2, cons); + /* Initialize the list backwards. */ + size_t i = guestfs_int_count_strings ((char **) guestfs_int_aavmf_firmware); + + rv = Val_int (0); + + while (i > 0) { + v1 = caml_copy_string (guestfs_int_aavmf_firmware[i-2]); + v2 = caml_copy_string (guestfs_int_aavmf_firmware[i-1]); + v = caml_alloc (2, 0); + Store_field (v, 0, v1); + Store_field (v, 1, v2); + cons = caml_alloc (2, 0); + Store_field (cons, 1, rv); + rv = cons; + Store_field (cons, 0, v); + +...
2018 Aug 30
8
[PATCH 0/7] RFC: switch v2v to ocaml-libvirt
Hi, this is a mostly done attempt to switch to ocaml-libvirt, embedding the latest version of it from git. This way, it is possible to improve the way v2v connects to libvirt for both input, and output modules, and interacts with libvirt (e.g. no more virsh calls needed in virt-v2v). As side effect, virt-v2v now requires libvirt, as keeping it optional would create too much burden. I could not
2019 May 20
8
[PATCH v5 0/7] v2v: switch to ocaml-libvirt
Hi, this series switches virt-2v to ocaml-libvirt, embedding the latest version of it from git. This way, it is possible to improve the way v2v connects to libvirt for both input, and output modules, and interacts with libvirt (e.g. no more virsh calls needed in virt-v2v). As side effect, virt-v2v now requires libvirt, as keeping it optional would create too much burden. I could not test all
2018 Nov 27
8
[PATCH v2 0/7] RFC: switch v2v to ocaml-libvirt
Hi, this is a mostly done attempt to switch to ocaml-libvirt, embedding the latest version of it from git. This way, it is possible to improve the way v2v connects to libvirt for both input, and output modules, and interacts with libvirt (e.g. no more virsh calls needed in virt-v2v). As side effect, virt-v2v now requires libvirt, as keeping it optional would create too much burden. I could not