search for: rbufferout

Displaying 20 results from an estimated 99 matches for "rbufferout".

2019 Jan 22
0
[PATCH 2/2] python: change return type for RBufferOut with Python 3 (RHBZ#1661871)
So far RBufferOut return values are 'str' on all the versions of Python. Python 3 distinguishes between 'str' (unicode strings), and 'bytes', with 'str' no more able to hold arbitrary data. For this reason, switch the return value of RBufferOut functions to bytes on Python 3: while t...
2009 Nov 18
1
[PATCH] generator: Fix API of functions that return RBufferOut
...ttp://et.redhat.com/~rjones/virt-df/ -------------- next part -------------- >From f5a3da14837fe65eab1df41df33f2bafeddcd9ce Mon Sep 17 00:00:00 2001 From: Richard Jones <rjones at redhat.com> Date: Wed, 18 Nov 2009 10:37:10 +0000 Subject: [PATCH] generator: Fix API of functions that return RBufferOut (NB: The API / ABI doesn't actually change here - it's just made much simpler to use). The API for RBufferOut functions was unexpectedly hard to use in the case where a zero-length buffer might be returned. For discussion on this see: https://www.redhat.com/archives/libguestfs/2009-Nove...
2019 Jan 22
3
[PATCH 0/2] python: fixes for Python 3
A couple of fixes for Python 3 to the Python binding. Unfortunately a behaviour change is needed, although it fixes broken types used. Pino Toscano (2): python: fix call of Python handlers of events python: change return type for RBufferOut with Python 3 (RHBZ#1661871) generator/python.ml | 4 ++++ python/handle.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) -- 2.20.1
2019 Jan 22
0
[PATCH v2 2/2] python: change types for RBufferOut/FBuffer with Python 3 (RHBZ#1661871)
So far RBufferOut return values, and FBuffer struct fields are 'str' on all the versions of Python. Python 3 distinguishes between 'str' (unicode strings), and 'bytes', with 'str' no more able to hold arbitrary data. For this reason, switch the return value of RBufferOut functions,...
2009 Nov 19
1
[PATCH libguestfs] syntax-check: expand TABs in generator.ml
...2317541..c261ea2 100644 --- a/src/generator.ml +++ b/src/generator.ml @@ -5398,20 +5398,20 @@ check_state (guestfs_h *g, const char *caller) pr " /* caller will free this */\n"; pr " return safe_memdup (g, &ret.%s, sizeof (ret.%s));\n" n n | RBufferOut n -> - pr " /* RBufferOut is tricky: If the buffer is zero-length, then\n"; - pr " * _val might be NULL here. To make the API saner for\n"; - pr " * callers, we turn this case into a unique pointer (using\n"; - pr " * malloc(1)).\n"; -...
2019 Jan 22
3
[PATCH v2 0/2] python: fixes for Python 3
A couple of fixes for Python 3 to the Python binding. Unfortunately a behaviour change is needed, although it fixes broken types used. Changes from v1: - handle also FBuffer in structs Pino Toscano (2): python: fix call of Python handlers of events python: change types for RBufferOut/FBuffer with Python 3 (RHBZ#1661871) generator/python.ml | 9 +++++++++ python/handle.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) -- 2.20.1
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
2019 Jun 27
0
[PATCH 6/9] Rust bindings: Add generator of function signatures
...n) -> + let sn = camel_name_of_struct sn in + pr "%s" sn + | RStructList (_, sn) -> + let sn = camel_name_of_struct sn in + pr "Vec<%s>" sn + | RHashtable _ -> pr "collections::HashMap<String, String>" + | RBufferOut _ -> pr "Vec<u8>"); + pr ", Error> {\n"; + + let _pr = pr in + let pr fs = indent 2; pr fs in + List.iter ( + function + | Bool n -> + pr "let c_%s = if %s { 1 } else { 0 };\n" n n + | String (_, n) ->...
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...;%s: i64" n + | Pointer (_, n) -> pr "%s: *const ffi::c_void" n + | StringList (_, n) -> pr "%s: *const *const c_char" n + | BufferIn n -> pr "%s: *const c_char, %s_len: usize" n n + ) args; + (match ret with + | RBufferOut _ -> pr ", size: *const usize" + | _ -> () + ); + if optargs <> [] then + pr ", optarg: *const RawOptArgs%s" cname; + + pr ") -> "; + + (match ret with + | RErr | RInt _ | RBool _ -> pr "c_int" + |...
2012 Jan 20
2
GObject bindings overview
...<struct>(). RStructList is converted as an array of structs, which are individually converted the same way as RStruct, i.e. everything is copied. The returned array is a newly allocated NULL-terminated array. The originally returned value is freed with guestfs_free_<struct>_list(). RBufferOut is returned as a guint8 array, whose length is specified by a size_r field. GObject uses both these fields to construct a single array object where language bindings allow. The value returned by RBufferOut is not copied. Structs: ******** A parallel struct is created for each libguestfs struct...
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
2020 Jul 06
2
[PATCH] python: Add type hints
...type_hint = + match ret with + | RErr -> "None" + | RInt _ | RInt64 _ -> "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 = +...
2020 Feb 19
1
[PATCH] golang: make API idiomatic so that functions return (<val>, error)
..._, sn) -> let sn = camel_name_of_struct sn in - pr " (*[]%s, *GuestfsError)" sn; + pr " (*[]%s, error)" sn; "nil, " - | RHashtable _ -> pr " (map[string]string, *GuestfsError)"; "nil, " - | RBufferOut _ -> pr " ([]byte, *GuestfsError)"; "nil, " in + | RHashtable _ -> pr " (map[string]string, error)"; "nil, " + | RBufferOut _ -> pr " ([]byte, error)"; "nil, " in (* Body of the function. *) pr "...
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
...; n ) args; if optargs <> [] then ( if !comma then pr ", "; comma := true; - pr "optargs: OptArgs%s" cname + pr "optargs: %sOptArgs" cname ); pr ")"; @@ -532,45 +663,37 @@ impl UUID { | RBufferOut _ -> pr "Vec<u8>"); pr ", Error> {\n"; + let _pr = pr in let pr fs = indent 2; pr fs in List.iter ( function | Bool n -> - pr "let c_%s = if %s { 1 } else { 0 };\n" n n + pr "let %s =...
2009 Sep 24
1
[PATCH libguestfs] maint: use spaces, not TABs for indentation
...tyle 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 + true in pr " int serial;\n";...
2017 May 21
3
[PATCH 0/2] python: improved UTF8 decoding error handling
...is changed to 'surrogateescape', non UTF8 characters will be escaped in a similar manner as for Python 2. See PEP383 for reference. This series fixes also a bug introduced in commit 9d25b4e56471f9c33ea6229a8b620fc800c240f8. Matteo Cafasso (2): python: return bytes when return value is RBufferOut python: unicode decode handler error scheme setter generator/python.ml | 19 ++++++++++++++++++- python/handle.c | 28 ++++++++++++++++++++++++++-- python/t/test830RHBZ1406906.py | 6 ++++++ 3 files changed, 50 insertions(+), 3 deletions(-) -- 2.11.0
2009 Aug 03
1
[PATCH 1/2] Convert all TABs-as-indentation to spaces.
...9;, which will cause some conflicts in the generated code" name in (match fst style with @@ -3820,7 +3820,7 @@ let check_functions () = | RConstString n | RConstOptString n | RString n | RStringList n | RStruct (n, _) | RStructList (n, _) | RHashtable n | RBufferOut n -> - check_arg_ret_name n + check_arg_ret_name n ); List.iter (fun arg -> check_arg_ret_name (name_of_argt arg)) (snd style) ) all_functions; @@ -3829,30 +3829,30 @@ let check_functions () = List.iter ( fun (name, _, _, _, _, shortdesc, _) ->...
2012 Jan 20
11
[PATCH 01/10] Revert "Revert "generator: Add CamelName flag""
This reverts commit 3f6ca541c7b24d4c86688a509582cb41a7e0078c. The original commit was reverted prematurely. --- generator/generator_actions.ml | 10 +++++----- generator/generator_checks.ml | 5 +++++ generator/generator_types.ml | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index
2019 Jun 27
16
[PATCH 1/9] Rust bindings: Add Rust bindings
From: Hiroyuki_Katsura <hiroyuki.katsura.0513@gmail.com> --- Makefile.am | 4 ++++ configure.ac | 3 +++ generator/Makefile.am | 3 +++ generator/bindtests.ml | 3 +++ generator/bindtests.mli | 1 + generator/main.ml | 5 +++++ generator/rust.ml | 34 ++++++++++++++++++++++++++++++++++ generator/rust.mli | 19 +++++++++++++++++++
2010 Aug 26
1
[PATCH] New APIs: hopen-device hopen-file hread hwrite hseek hclose hclose-all
...} + + memcpy(msg + msglen, error, len); + msglen += len; + free(error); + } + } + + if (failed) { + msg[msglen] = '\0'; + reply_with_error("%s", msg); + return -1; + } + + return 0; +} + +char * /* RBufferOut */ +do_hread (int handle, int64_t size, size_t *size_r) +{ + char *buf = malloc(size); + if (NULL == buf) { + reply_with_error("malloc"); + return NULL; + } + + ssize_t in = read(handle, buf, size); + if (in < 0) { + reply_with_perror_errno(errno, &q...