Displaying 20 results from an estimated 42 matches for "s_val".
Did you mean:
_val
2009 Nov 19
1
[PATCH libguestfs] syntax-check: expand TABs in generator.ml
...n this case into a unique pointer (using\n";
+ pr " * malloc(1)).\n";
+ pr " */\n";
+ pr " if (ret.%s.%s_len > 0) {\n" n n;
pr " *size_r = ret.%s.%s_len;\n" n n;
pr " return ret.%s.%s_val; /* caller will free */\n" n n;
- pr " } else {\n";
- pr " free (ret.%s.%s_val);\n" n n;
- pr " char *p = safe_malloc (g, 1);\n";
+ pr " } else {\n";
+ pr " free (ret.%s.%s_val);\n" n n;
+ pr &q...
2009 Aug 12
1
factorization would be nice
...RE_ROOT_OR_RESOLVE_DEVICE (%s, goto done);" n;
| String n -> pr " char *%s = args.%s;\n" n n
| OptString n -> pr " %s = args.%s ? *args.%s : NULL;\n" n n n
| StringList n ->
pr " %s = realloc (args.%s.%s_val,\n" n n n;
pr " sizeof (char *) * (args.%s.%s_len+1));\n" n n;
pr " if (%s == NULL) {\n" n;
pr " reply_with_perror (\"realloc\");\n";
pr " goto done;\n";...
2009 Nov 18
1
[PATCH] generator: Fix API of functions that return RBufferOut
...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 " *size_r = ret.%s.%s_len;\n" n n;
- pr " return ret.%s.%s_val; /* caller will free */\n" n 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 "...
2017 Apr 25
0
[PATCH] daemon: Use CLEANUP_* functions to avoid an explicit free in stub functions.
...;
- name;
- pr " free (r);\n"
+ name
| RStringList n | RHashtable n ->
pr " struct guestfs_%s_ret ret;\n" name;
pr " ret.%s.%s_len = count_strings (r);\n" n n;
pr " ret.%s.%s_val = r;\n" n n;
pr " reply ((xdrproc_t) &xdr_guestfs_%s_ret, (char *) &ret);\n"
- name;
- pr " free_strings (r);\n"
+ name
| RStruct (n, _) ->
pr " struct guestfs_%s_ret ret;\n" nam...
2017 Apr 20
6
[PATCH 0/5] generator: daemon: Various simplifications to stubs code.
This is a series of simplifications to the stubs code.
It's all refactoring, there is no functional change.
Rich.
2017 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...ashtable (RPlainString, RPlainString, n) ->
pr " struct guestfs_%s_ret ret;\n" name;
- pr " ret.%s.%s_len = count_strings (r);\n" n n;
+ pr " ret.%s.%s_len = guestfs_int_count_strings (r);\n" n n;
pr " ret.%s.%s_val = r;\n" n n;
pr " reply ((xdrproc_t) &xdr_guestfs_%s_ret, (char *) &ret);\n"
name
@@ -413,7 +413,7 @@ let generate_daemon_stubs actions () =
pr " free (r[i]);\n";
pr " r[i] = rr;\n";...
2019 Aug 10
0
[PATCH libnbd 6/9] generator: Add non-optional Flags type.
...gt; n
| Int n -> n
| Int64 n -> n
| Path n -> n
@@ -5212,6 +5231,8 @@ let print_ocaml_binding (name, { args; optargs; ret }) =
pr " const void *%s_callback = %s_%s_wrapper;\n" cbname name cbname
| Enum (n, { enum_prefix }) ->
pr " int %s = %s_val (%sv);\n" n enum_prefix n
+ | Flags (n, { flag_prefix }) ->
+ pr " uint32_t %s = %s_val (%sv);\n" n flag_prefix n
| Int n ->
pr " int %s = Int_val (%sv);\n" n n
| Int64 n ->
@@ -5270,6 +5291,7 @@ let print_ocaml_binding (name, { args; o...
2019 Oct 04
0
[PATCH libnbd 3/4] api: Add nbd_connect_socket.
...+ | Fd n -> n
| Flags (n, _) -> n
| Int n -> n
| Int64 n -> n
@@ -5945,6 +5985,9 @@ let print_ocaml_binding (name, { args; optargs; ret }) =
pr " %s_callback.free = free_user_data;\n" cbname
| Enum (n, { enum_prefix }) ->
pr " int %s = %s_val (%sv);\n" n enum_prefix n
+ | Fd n ->
+ pr " /* OCaml Unix.file_descr is just an int, at least on Unix. */\n";
+ pr " int %s = Int_val (%sv);\n" n n
| Flags (n, { flag_prefix }) ->
pr " uint32_t %s = %s_val (%sv);\n" n flag_pre...
2019 Aug 10
0
[PATCH libnbd 3/9] generator: Add Enum type for enumerated types / unions.
...nit = \"nbd_internal_ocaml_nbd_close\"
pr "\"nbd_internal_ocaml_nbd_%s\"\n" name
) handle_calls
+let print_ocaml_enum_val { enum_prefix; enums } =
+ pr "/* Convert OCaml %s.t to int. */\n" enum_prefix;
+ pr "static int\n";
+ pr "%s_val (value v)\n" enum_prefix;
+ pr "{\n";
+ pr " CAMLparam1 (v);\n";
+ pr " int i, r = 0;\n";
+ pr "\n";
+ pr " i = Int_val (Field (v, 0));\n";
+ pr " /* i is the index of the enum in the type\n";
+ pr " * (eg. i = 0 =&g...
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.
2019 Aug 12
0
[PATCH libnbd 5/7] ocaml: Use free callback to free closure root, instead of valid_flag == FREE.
...r " if (nbd_add_free_callback (h, %s_user_data,\n" cbname;
+ pr " free_root, %s_user_data) == -1)\n"
+ cbname;
+ pr " caml_raise_out_of_memory ();\n"
| Enum (n, { enum_prefix }) ->
pr " int %s = %s_val (%sv);\n" n enum_prefix n
| Flags (n, { flag_prefix }) ->
--
2.22.0
2015 Oct 20
3
[PATCH 1/2] generator: add a RelativePathnameList parameter type
...pr " args.%s = (char *) %s;\n" n n
| OptString n ->
pr " args.%s = %s ? (char **) &%s : NULL;\n" n n n
- | StringList n | DeviceList n ->
+ | StringList n | DeviceList n | RelativePathnameList n ->
pr " args.%s.%s_val = (char **) %s;\n" n n n;
pr " for (args.%s.%s_len = 0; %s[args.%s.%s_len]; args.%s.%s_len++) ;\n" n n n n n n n;
| Bool n ->
diff --git a/generator/csharp.ml b/generator/csharp.ml
index e2bd25b..59f7be9 100644
--- a/generator/csharp.ml
+++ b/generator/csharp....
2015 Oct 21
2
[PATCH 1/2] generator: add a FilenameList parameter type
...pr " args.%s = (char *) %s;\n" n n
| OptString n ->
pr " args.%s = %s ? (char **) &%s : NULL;\n" n n n
- | StringList n | DeviceList n ->
+ | StringList n | DeviceList n | FilenameList n ->
pr " args.%s.%s_val = (char **) %s;\n" n n n;
pr " for (args.%s.%s_len = 0; %s[args.%s.%s_len]; args.%s.%s_len++) ;\n" n n n n n n n;
| Bool n ->
diff --git a/generator/csharp.ml b/generator/csharp.ml
index e2bd25b..6022af1 100644
--- a/generator/csharp.ml
+++ b/generator/csharp....
2009 Aug 17
13
total warning-removal for daemon/
The warnings in daemon were aggravating and risky
for development (too easy to miss new ones) so I spent some
time last week and today working on removing them.
The first patch gets us down to almost no warnings with
the original -Wall setting. That was by far the hardest part.
Once I'd done that, I enabled nearly all of gcc's warnings via
gnulib's warnings and manywarnings modules
2019 Aug 14
4
[PATCH libnbd 0/2] Use free callback to dereference NBD.Buffer.
In this patch series we use the newly introduced free callback
on the completion function to dererence the OCaml NBD.Buffer.
I will make the same kind of change for Python later in a
separate series.
The completion function is always called at the C level, even
if the OCaml program didn't use the optional argument. That's
because the free callback doesn't run otherwise.
There is a
2019 Aug 10
17
[PATCH libnbd 0/9] Add Enum and Flags types.
This largish series adds several new features to the generator.
Enum maps to enumerated types (like enum in C). The only current use
for this is replacing the nbd_set_tls (nbd, 0/1/2) parameter with
LIBNBD_TLS_DISABLE, LIBNBD_TLS_ALLOW, LIBNBD_TLS_REQUIRE (and natural
equivalents in other programming languages).
Flags maps to any uint32_t bitmask. It is basically a non-optional,
generalized
2019 Aug 10
0
[PATCH libnbd 2/9] generator: Generalize OFlags.
...al_ocaml_nbd_close\"
pr "\"nbd_internal_ocaml_nbd_%s\"\n" name
) handle_calls
+let print_ocaml_flag_val { flag_prefix; flags } =
+ pr "/* Convert OCaml %s.t list to uint32_t bitmask. */\n" flag_prefix;
+ pr "static uint32_t\n";
+ pr "%s_val (value v)\n" flag_prefix;
+ pr "{\n";
+ pr " CAMLparam1 (v);\n";
+ pr " int i;\n";
+ pr " uint32_t r = 0;\n";
+ pr "\n";
+ pr " for (; v != Val_emptylist; v = Field (v, 1)) {\n";
+ pr " i = Int_val (Field (v, 0));\n...
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
2019 Oct 04
4
[PATCH libnbd 1/4] generator: Allow long ‘name - shortdesc’ in man pages.
For commands with long names and/or short descriptors, you can end up
going over 72 characters in the first line of the man page (causing
podwrapper to complain). Wrap these lines.
---
generator/generator | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/generator/generator b/generator/generator
index 7d3f656..ad1cb6b 100755
--- a/generator/generator
+++ b/generator/generator
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...name cbname;
- pr " %s_callback.user_data = user_data;\n" cbname;
+ pr " %s_callback.user_data = %s_user_data;\n" cbname cbname;
pr " %s_callback.free = free_user_data;\n" cbname
| Enum (n, { enum_prefix }) ->
pr " int %s = %s_val (%sv);\n" n enum_prefix n
@@ -5154,6 +5156,19 @@ let print_ocaml_binding (name, { args; optargs; ret }) =
pr " uint64_t %s = Int64_val (%sv);\n" n n
) args;
+ (* If there is a BytesPersistIn/Out parameter then we need to
+ * register it as a global root and save that...