search for: free_error

Displaying 5 results from an estimated 5 matches for "free_error".

2020 Mar 17
5
[PATCH libnbd v2 0/3] Unfinished golang bindings.
These bindings get as far as running very simple connections. However there are many missing parts still: * No callbacks. * No functions which handle buffers (pread/pwrite!) This is posted just for general early interest, not even for review. Rich.
2020 Mar 17
0
[PATCH libnbd v2 3/3] golang: Add straightforward bindings, without callbacks.
...optargs; + pr ")\n"; + let errcode = go_ret_c_errcode ret in + (match errcode with + | None -> () + | Some errcode -> + pr " if ret == %s {\n" errcode; + pr " err := get_error (\"%s\", c_err)\n" name; + pr " C.free_error (&c_err)\n"; + pr " return %s, err\n" (go_ret_error ret); + pr " }\n"; + ); + (match ret with + | RBool -> + pr " r := int (ret)\n"; + pr " if r != 0 { return true, nil } else { return false, nil }\n" + |...
2020 Mar 17
0
[PATCH libnbd v2 2/3] Add outline framework for Go language bindings (golang).
...> +#include <stdlib.h> +#include <string.h> + +#include \"libnbd.h\" + +struct error { + char *error; + int errnum; +}; + +static void +save_error (struct error *err) +{ + err->error = strdup (nbd_get_error ()); + err->errnum = nbd_get_errno (); +} + +static void +free_error (struct error *err) +{ + free (err->error); +} + +static struct nbd_handle * +_nbd_create_wrapper (struct error *err) +{ + struct nbd_handle *r; + + r = nbd_create (); + if (r == NULL) + save_error (err); + return r; +} + +// There must be no blank line between end comment and import! +/...
2020 Mar 24
1
[PATCH libnbd v3] Add Go language bindings (golang) (RHBZ#1814538).
This feature is roughly finished now, although it needs a few more tests and some examples. It's pretty much up to par with all the other bindings, but it lacks a completely safe AIO buffer. It won't stop you from freeing the buffer too early) because golang's GC inexplicably lacks a way to declare a root from C. I can probably do it with a global variable and ref counting on the
2020 Mar 25
3
[PATCH libnbd v4] Add Go language bindings (golang) (RHBZ#1814538).
Now runs a complete set of tests, notably including the AIO test. File descriptors are passed in and out as plain ints (instead of *os.File) for a couple of reasons: (1) We have to pass the plain int to syscall.Select. (2) Turning an fd into an os.File causes golang to set the blocking flag which is deeply unhelpful. Rich.