search for: rconststring

Displaying 20 results from an estimated 81 matches for "rconststring".

2019 Jul 25
2
[libnbd PATCH] generator: Let nbd_aio_get_direction return unsigned
...st be empty (any permitted state)" name + | name, { ret = RUInt; may_set_error = true } -> + failwithf "%s: if ret is RUInt, may_set_error must be false" name | _ -> () ) handle_calls @@ -3189,6 +3192,7 @@ let print_call name args ret = | RConstString -> pr "const char *" | RInt64 -> pr "int64_t " | RString -> pr "char *" + | RUInt -> pr "unsigned " ); pr "nbd_%s " name; print_arg_list ~handle:true args @@ -3329,10 +3333,11 @@ let generate_lib_api_c () = | RB...
2009 Sep 24
1
[PATCH libguestfs] maint: use spaces, not TABs for indentation
...#39;\\n');\n"; pr " }\n"; @@ -4759,16 +4759,16 @@ check_state (guestfs_h *g, const char *caller) pr " guestfs_message_header hdr;\n"; pr " guestfs_message_error err;\n"; let has_ret = - match fst style with - | RErr -> false - | RConstString _ | RConstOptString _ -> + match fst style with + | RErr -> false + | RConstString _ | RConstOptString _ -> failwithf "RConstString|RConstOptString cannot be used by daemon functions" - | RInt _ | RInt64 _ - | RBool _ | RString _ | RStringList _...
2017 Apr 25
0
[PATCH] daemon: Use CLEANUP_* functions to avoid an explicit free in stub functions.
...ed, 8 insertions(+), 13 deletions(-) diff --git a/generator/daemon.ml b/generator/daemon.ml index b00627063..9d5ba00b2 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -155,13 +155,13 @@ let generate_daemon_stubs actions () = | RBool _ -> pr " int 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 " g...
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...; + | _ -> () + ); + if optargs <> [] then + pr ", optarg: *const RawOptArgs%s" cname; + + pr ") -> "; + + (match ret with + | RErr | RInt _ | RBool _ -> 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...
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
2020 Jul 06
2
[PATCH] python: Add type hints
...let len_name = String.length f.name in + let ret_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]],...
2009 Aug 03
1
[PATCH 1/2] Convert all TABs-as-indentation to spaces.
...n = "argv" || n = "args" then + failwithf "%s has a param/ret called 'argv' or 'args', 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) ) al...
2019 Jul 07
2
[libnbd PATCH] RFC: Add bindings for Rust language
...s: u64,\n" n + ); + ) args; + pr_indent (indent - 1); pr ")" + +let generate_rust_sys_lib_rs () = + let print_extern (name, {args; ret; _ }) = + let ret_rs_type = + match ret with + | RBool + | RErr + | RFd + | RInt -> "c_int" + | RConstString -> "*const c_char" + | RInt64 -> "i64" + | RString -> "*mut c_char" + in + + (* TODO: print shortdesc and longdesc *) + pr " pub fn nbd_%s" name; + print_rust_ffi_arg_list ~handle:true 2 args; + pr " -> %s;\n"...
2009 Nov 19
1
[PATCH libguestfs] syntax-check: expand TABs in generator.ml
...e_malloc (g, 1);\n"; pr " *size_r = ret.%s.%s_len;\n" n n; 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...
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
2017 May 04
4
[PATCH 0/3] generator: Allow returned strings to be annotated as devices.
If we want to permit more than 255 drives to be added, then we will have to add the disks to the same virtio-scsi target using different unit (LUN) numbers. Unfortunately SCSI LUN enumeration in the Linux is not deterministic (eg. two disks with target=0, lun=[0,1] can be enumerated as /dev/sda or /dev/sdb randomly). Dealing with that will require some very complex device name translation on the
2010 Jul 05
5
[PATCH 0/3] RFC: Allow use of external QEMU process with libguestfs
This attempts to implement the idea proposed in https://www.redhat.com/archives/libguestfs/2010-April/msg00087.html The idea is that an externally managed QEMU (manual, or via libvirt) can boot the appliance kernel/initrd. libguestfs can then be just told of the UNIX domain socket associated with the guest daemon. An example based on guestfish. 1. Step one, find the appliance kernel/initrd
2019 Jun 03
3
[PATCH libnbd] api: nbd_get_version, nbd_supports_uri and nbd_get_package_name.
...rator/generator +++ b/generator/generator @@ -1823,6 +1823,49 @@ can be used for debugging or troubleshooting, but you should not rely on the state of connections since it may change in future versions."; }; + + "get_package_name", { + default_call with + args = []; ret = RConstString; is_locked = false; may_set_error = false; + shortdesc = "return the name of the library"; + longdesc = "\ +Returns the name of the library, always C<\"libnbd\"> unless +the library was modified with another name at compile time."; + }; + + "get_vers...
2012 Jul 14
6
[PATCH 0/6] Allow non-optargs functions to gain optional arguments.
This rather complex set of patches allow non-optargs functions to gain optional arguments, while preserving source and binary backwards compatibility. The problem is that we cannot add an optional argument to an existing function. For example, we might want to add flags to the 'lvresize' API which currently has no optional arguments.
2020 Jul 06
0
Re: [PATCH] python: Add type hints
...f.name in > + let ret_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 _ -> "Uni...
2019 Jun 28
3
[PATCH libnbd v2] python: Raise a custom exception containing error string and errno.
This kind of fixes the problems in v1. The exception still primarily lives in the libnbdmod and you could still refer to it using libnbdmod.Error (but don't do that). However when the exception is printed it now appears as nbd.Error, and you can catch it also using the same name. Other problems: - There is no "nice" interface to accessing the exception fields. You have to use
2019 May 22
0
[libnbd PATCH v3 3/7] commands: Expose FIFO ordering of server completions
...command is awaiting retirement. Any handle +returned by this function must still be passed to +C<aio_command_completed> to actually retire the command and learn +whether the command was successful."; + }; + "connection_state", { default_call with args = []; ret = RConstString; diff --git a/generator/states-reply.c b/generator/states-reply.c index 93f6cda..45362d4 100644 --- a/generator/states-reply.c +++ b/generator/states-reply.c @@ -103,13 +103,20 @@ } assert (cmd != NULL); - /* Move it to the cmds_done list. */ + /* Move it to the end of the cmds_done list....
2017 May 09
1
[PATCH v2] python: add simple wrappers for PyObject<->string functions
...n n; pr " if (!optargs_s.%s) goto out;\n" n; @@ -480,30 +456,18 @@ and generate_python_actions actions () = | RBool _ -> pr " py_r = PyLong_FromLong ((long) r);\n" | RInt64 _ -> pr " py_r = PyLong_FromLongLong (r);\n" | RConstString _ -> - pr "#ifdef HAVE_PYSTRING_ASSTRING\n"; - pr " py_r = PyString_FromString (r);\n"; - pr "#else\n"; - pr " py_r = PyUnicode_FromString (r);\n"; - pr "#endif\n"; + pr " py_r =...
2012 Jan 20
2
GObject bindings overview
...ns which can return an error have as their final argument a GError **. GI maps this to the appropriate error mechanism for each target language. RErr returns a gboolean, true = success, false = failure. The following types return the value from libguestfs unchanged: RInt RInt64 RBool RConstString (transfer none): gobject doesn't manage returned memory RConstOptString (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 with...
2016 Feb 15
1
[PATCH] Start adding return values tests for bindings
...est_rint64('1'); -v == 1 || eq_fail('internal_test_rint64', v); -check_error('internal_test_rint64err'); - -v = g.internal_test_rbool('true'); -v == 1 || eq_fail('internal_test_rbool', v); -check_error('internal_test_rboolerr'); - -v = g.internal_test_rconststring('1'); -v == 'static string' || eq_fail('internal_test_rconststring', v); -check_error('internal_test_rconststringerr'); - -v = g.internal_test_rconstoptstring('1'); -v == 'static string' || eq_fail('internal_test_rconstoptstring', v); -//check...