search for: rstruct

Displaying 20 results from an estimated 115 matches for "rstruct".

2009 Aug 14
1
Code snippet to work out which RStruct/RStructList structs are used and how
...hines into Xen guests. http://et.redhat.com/~rjones/virt-p2v -------------- next part -------------- >From 9efa77d717bd9bba5f61965eb6920429b7ae5d8e Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones <rjones at redhat.com> Date: Fri, 14 Aug 2009 16:54:55 +0100 Subject: [PATCH] Work out which RStruct/RStructList structs are really used, and how. --- src/generator.ml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 58 insertions(+), 0 deletions(-) diff --git a/src/generator.ml b/src/generator.ml index b8f9ace..b76f502 100755 --- a/src/generator.ml +++ b/src/gene...
2016 Dec 12
2
[PATCH] java: fix memory leak in RStruct actions
The return value struct was freed using a simple free() instead of the own cleanup function of each struct: this meant dynamically allocated values (such as strings) were leaked. Use the proper cleanup functions instead. --- generator/java.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/java.ml b/generator/java.ml index a68054c..3c1e611 100644 ---
2016 Dec 12
0
[PATCH] perl: fix memory leak in RStruct actions
The return value struct was freed using a simple free() instead of the own cleanup function of each struct: this meant dynamically allocated values (such as strings) were leaked. Use the proper cleanup functions instead. --- generator/perl.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/perl.ml b/generator/perl.ml index 290b687..4c7f805 100644 ---
2017 Apr 25
0
[PATCH] daemon: Use CLEANUP_* functions to avoid an explicit free in stub functions.
...t r;\n" | RConstString _ | RConstOptString _ -> failwithf "RConstString|RConstOptString cannot be used by daemon functions" - | RString _ -> pr " char *r;\n" - | RStringList _ | RHashtable _ -> pr " char **r;\n" - | RStruct (_, typ) -> pr " guestfs_int_%s *r;\n" typ - | RStructList (_, typ) -> pr " guestfs_int_%s_list *r;\n" typ + | RString _ -> pr " CLEANUP_FREE char *r = NULL;\n" + | RStringList _ | RHashtable _ -> pr " CLEANUP_FREE_STRING_LIST cha...
2017 Mar 02
1
[PATCH] generator: Move some deprecated functions to actions_core_deprecated.ml.
...enerator/actions_core.ml +++ b/generator/actions_core.ml @@ -1595,38 +1595,6 @@ Note that this call does not add the new disk to the handle. You may need to call C<guestfs_add_drive_opts> separately." }; { defaults with - name = "stat"; added = (1, 9, 2); - style = RStruct ("statbuf", "stat"), [Pathname "path"], []; - deprecated_by = Some "statns"; - tests = [ - InitISOFS, Always, TestResult ( - [["stat"; "/empty"]], "ret->size == 0"), [] - ]; - shortdesc = "get file...
2012 Jul 24
3
[PATCH V4 1/3] umount: add force umount and lazy umount
Add the option force and lazy for force and lazy umount. Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com> --- daemon/mount.c | 25 +++++++++++++++++++++++-- generator/generator_actions.ml | 23 ++++++++++++----------- gobject/Makefile.inc | 2 ++ po/POTFILES | 1 + 4 files changed, 38 insertions(+), 13 deletions(-) diff --git
2012 Jan 25
2
[PATCH 1/2] gobject: Allow RConstOptString to return an error
RConstOptString cannot return an error in the C api. This makes it a special case for the GObject api, as all other return types have a corresponding GError **err argument to return an error. This change removes this special case, and includes the possibility of an error return in the API. An error is indicated by setting *err to a non-NULL value. This change is in preparation for adding a close
2012 Jan 20
2
GObject bindings overview
...ConstOptString (transfer none). Methods don't return an error (no GError**) RString RStringList RHashtable is converted to a GHashTable. The keys and values from libguestfs are inserted directly into the GHashTable without copying. The top level array returned by libguestfs is freed. RStruct is converted to GObject boxed type for the target struct. It returns a copy of the struct, which is copied field by field. Memory for the returned struct is allocated using glib's slice allocator. The original struct is freed with guestfs_free_<struct>(). RStructList is converted as a...
2020 Jul 06
2
[PATCH] python: Add type hints
..._ -> "int" + | RBool _ -> "bool" + | RConstOptString _ -> "Optional[str]" + | RConstString _ | RString _ -> "str" + | RBufferOut _ -> "bytes" + | RStringList _ -> "List[str]" + | RStruct _ -> "dict" + | RStructList _ -> "List[dict]" + | RHashtable _ -> "Union[List[Tuple[str, str]], dict]" in + let type_hint_of_argt arg = + match arg with + | String _ -> ": str" + | OptString _ -> ":...
2009 Sep 24
1
[PATCH libguestfs] maint: use spaces, not TABs for indentation
...RConstOptString _ -> + match fst style with + | RErr -> false + | RConstString _ | RConstOptString _ -> failwithf "RConstString|RConstOptString cannot be used by daemon functions" - | RInt _ | RInt64 _ - | RBool _ | RString _ | RStringList _ - | RStruct _ | RStructList _ - | RHashtable _ | RBufferOut _ -> + | RInt _ | RInt64 _ + | RBool _ | RString _ | RStringList _ + | RStruct _ | RStructList _ + | RHashtable _ | RBufferOut _ -> pr " struct %s_ret ret;\n" name; - true in + t...
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...t; pr "c_int" + | RInt64 _ -> pr "i64" + | RConstString _ | RString _ | RConstOptString _ -> pr "*const c_char" + | RBufferOut _ -> pr "*const u8" + | RStringList _ | RHashtable _-> pr "*const *const c_char" + | RStruct (_, n) -> + let n = camel_name_of_struct n in + pr "*const Raw%s" n + | RStructList (_, n) -> + let n = camel_name_of_struct n in + pr "*const *const Raw%s" n + ); + pr ";\n"; + + ) (actions |> external_functions |&g...
2009 Nov 19
1
[PATCH libguestfs] syntax-check: expand TABs in generator.ml
...pr " return p;\n"; - pr " }\n"; + pr " }\n"; ); pr "}\n\n" @@ -5592,18 +5592,18 @@ and generate_daemon_actions () = | RConstString _ | RConstOptString _ | RString _ | RStringList _ | RHashtable _ | RStruct (_, _) | RStructList (_, _) -> - pr " if (r == %s)\n" error_code; - pr " /* do_%s has already called reply_with_error */\n" name; - pr " goto done;\n"; - pr "\n" + pr " if (r == %s)\n" error_code; + pr &quo...
2012 Jul 23
1
[PATCH V3 1/2] umount: add force umount and lazy umount
Add the option force and lazy for force and lazy umount. Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com> --- daemon/mount.c | 25 +++++++++++++++++++++++-- generator/generator_actions.ml | 23 ++++++++++++----------- gobject/Makefile.inc | 2 ++ po/POTFILES | 1 + 4 files changed, 38 insertions(+), 13 deletions(-) diff --git
2012 Jan 17
3
GObject bindings
This is the first iteration of the GObject bindings. I have 'kicked the tyres' on these, meaning I have ensured that a bunch of basic manual tests work as expected. I'm in the process of adding more comprehensive tests. Here's an example simple javascript program which uses these bindings: === const Guestfs = imports.gi.Guestfs; print('Starting'); var g = new
2009 Aug 03
1
[PATCH 1/2] Convert all TABs-as-indentation to spaces.
...ads"; Int "sectors"; + StringList "lines"]), 43, [DangerWillRobinson], [], "create partitions on a block device", "\ @@ -1620,7 +1620,7 @@ This is the same as the C<lstat(2)> system call."); ("statvfs", (RStruct ("statbuf", "statvfs"), [String "path"]), 54, [], [InitSquashFS, Always, TestOutputStruct ( [["statvfs"; "/"]], [CompareWithInt ("namemax", 256); - CompareWithInt ("bsize", 131072)])], +...
2014 Sep 22
2
[PATCH] New APIs: Implement stat calls that return nanosecond timestamps (RHBZ#1144891).
.../show_bug.cgi?id=1144766 */ diff --git a/generator/actions.ml b/generator/actions.ml index 73dcd33..7782198 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -2605,6 +2605,7 @@ See also C<guestfs_write>." }; { defaults with name = "lstatlist"; style = RStructList ("statbufs", "stat"), [Pathname "path"; StringList "names"], []; + deprecated_by = Some "lstatnslist"; shortdesc = "lstat on multiple files"; longdesc = "\ This call allows you to perform the C<guestfs_lstat> o...
2018 May 03
1
[PATCH] daemon: fix memory allocation and leaks in OCaml stubs
...++ b/generator/daemon.ml @@ -605,16 +605,18 @@ let generate_daemon_caml_stubs () = (* Implement code for returning structs and struct lists. *) let emit_return_struct typ = let struc = Structs.lookup_struct typ in + let uc_typ = String.uppercase_ascii typ in pr "/* Implement RStruct (%S, _). */\n" typ; pr "static guestfs_int_%s *\n" typ; pr "return_%s (value retv)\n" typ; pr "{\n"; - pr " guestfs_int_%s *ret;\n" typ; + pr " CLEANUP_FREE_%s guestfs_int_%s *ret = NULL;\n" uc_typ typ; + pr " gu...
2012 Jul 31
1
[PATCH] xfs: add new api xfs-growfs
...tor_actions.ml @@ -9051,6 +9051,21 @@ This returns the kernel version of the appliance, where this is available. This information is only useful for debugging. Nothing in the returned structure is defined by the API." }; + { defaults with + name = "xfs_growfs"; + style = RStruct ("info", "xfsinfo"), [Pathname "path"], [OBool "datasec"; OBool "logsec"; OBool "rtsec"; OInt64 "datasize"; OInt64 "logsize"; OInt64 "rtsize"; OInt64 "rtextsize"; OInt "maxpct"]; + proc_...
2017 Apr 21
0
[PATCH 1/2] generator: Simplify the handling of string parameters.
...riable"; longdesc = "\ Defines an Augeas variable C<name> whose value is the result @@ -111,7 +111,7 @@ C<0> if C<expr> evaluates to something which is not a nodeset." }; { defaults with name = "aug_defnode"; added = (0, 0, 7); - style = RStruct ("nrnodescreated", "int_bool"), [String "name"; String "expr"; String "val"], []; + style = RStruct ("nrnodescreated", "int_bool"), [String (PlainString, "name"); String (PlainString, "expr"); String (Plain...
2012 Jul 23
3
[PATCH V2 1/4] mount: add a macro to resolve path or device
Add a macro STRDUP_RESOLVE_DEVICE_OR_PATH to resolve path or device. Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com> --- daemon/daemon.h | 16 ++++++++++++++++ daemon/mount.c | 13 ++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/daemon/daemon.h b/daemon/daemon.h index 85eec45..f7d0c75 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -336,6