search for: nbd_get_errno

Displaying 20 results from an estimated 72 matches for "nbd_get_errno".

2019 Aug 11
3
[PATCH libnbd proposal] api: Add semi-private function for freeing persistent data.
..._syms () = pr "LIBNBD_%d.%d {\n" major minor; pr " global:\n"; if (major, minor) = (1, 0) then ( + pr " nbd_add_free_callback;\n"; pr " nbd_create;\n"; pr " nbd_close;\n"; pr " nbd_get_errno;\n"; @@ -3581,6 +3582,12 @@ let generate_include_libnbd_h () = pr "extern int nbd_get_errno (void);\n"; pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; pr "\n"; + pr "typedef void (*nbd_free_callback) (void *ptr);\n"; + pr "extern int nbd_add...
2019 Jul 01
3
[nbdkit PATCH 0/2] Use new libnbd _notify functions
I'm not observing any noticeable performance differences, but I'm liking the diffstat. I can't push this patch until we release a new libnbd version with the _notify API addition, but am posting it now for playing with things. Eric Blake (2): nbd: Move transaction info from heap to stack nbd: Use nbdkit aio_*_notify variants plugins/nbd/nbd.c | 217
2019 Aug 12
0
Re: [PATCH libnbd proposal] api: Add semi-private function for freeing persistent data.
...NBD_%d.%d {\n" major minor; > pr " global:\n"; > if (major, minor) = (1, 0) then ( > + pr " nbd_add_free_callback;\n"; > pr " nbd_create;\n"; > pr " nbd_close;\n"; > pr " nbd_get_errno;\n"; > @@ -3581,6 +3582,12 @@ let generate_include_libnbd_h () = > pr "extern int nbd_get_errno (void);\n"; > pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; > pr "\n"; > + pr "typedef void (*nbd_free_callback) (void *ptr);\n"; >...
2019 Jul 01
0
[nbdkit PATCH 2/2] nbd: Use nbdkit aio_*_notify variants
...ev = &h->trans; - while (trans) { - r = nbd_aio_command_completed (h->nbd, trans->cookie); - if (r == -1) { - nbdkit_debug ("transaction %" PRId64 " failed: %s", trans->cookie, - nbd_get_error ()); - trans->err = nbd_get_errno (); - if (!trans->err) - trans->err = EIO; - } - if (r) { - nbdkit_debug ("cookie %" PRId64 " completed state machine, status %d", - trans->cookie, trans->err); - *prev = trans->next; - if (sem_po...
2019 Jun 28
3
[PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
Following Eric's suggestions from v2, this adds .string, .errno and .__str__ properties. The .string property returns the error string. The .errno property returns the errno (from the errno module), or None. The __str__ property makes the exception nicely printable. Rich.
2019 Jul 25
0
[PATCH libnbd v3 2/2] lib: Remove nbd_add_close_callback.
...- a/generator/generator +++ b/generator/generator @@ -3055,7 +3055,6 @@ let generate_lib_libnbd_syms () = pr "{\n"; pr " global:\n"; - pr " nbd_add_close_callback;\n"; pr " nbd_create;\n"; pr " nbd_close;\n"; pr " nbd_get_errno;\n"; @@ -3255,11 +3254,6 @@ let generate_include_libnbd_h () = pr "extern int nbd_get_errno (void);\n"; pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; pr "\n"; - pr "extern int nbd_add_close_callback (struct nbd_handle *h,\n"; - pr "...
2019 Jun 03
1
[libnbd PATCH] generator: Add #define witnesses for all API
..."extern void nbd_close (struct nbd_handle *h);\n"; + pr "#define LIBNBD_HAVE_NBD_CLOSE 1\n"; + pr "\n"; pr "extern const char *nbd_get_error (void);\n"; + pr "#define LIBNBD_HAVE_NBD_GET_ERROR 1\n"; + pr "\n"; pr "extern int nbd_get_errno (void);\n"; + pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; + pr "\n"; pr "extern int nbd_add_close_callback (struct nbd_handle *h,\n"; pr " nbd_close_callback cb, void *data);\n"; + pr "#define LIBNBD_HAVE_N...
2019 Sep 12
2
[PATCH libnbd 1/2] nbd_connect_tcp: Try to return errno from underlying connect(2) call.
When we make a TCP connection we have to make multiple underlying connect(2) calls, once for each address returned by getaddrinfo. Unfortunately this meant that we lost the errno from any of these calls: $ nbdsh -c 'h.connect_tcp ("localhost", "nbd")' nbd.Error: nbd_connect_tcp: connect: localhost:nbd: could not connect to remote host This commit saves the errno from
2019 Jul 27
3
[PATCH libnbd] lib: Use symbol versions.
This patch adds support for symbol versions. It is based on what libvirt does. The generated syms file looks like: LIBNBD_1.0 { global: nbd_...; nbd_...; local: *; }; In a future stable 1.2 release, new symbols would go into a new section which would look like this: LIBNBD_1.2 { global: nbd_new_symbol; nbd_another_new_symbol; local: *; } LIBNBD_1.0; In my testing the
2019 Aug 12
0
[PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
..._syms () = pr "LIBNBD_%d.%d {\n" major minor; pr " global:\n"; if (major, minor) = (1, 0) then ( + pr " nbd_add_free_callback;\n"; pr " nbd_create;\n"; pr " nbd_close;\n"; pr " nbd_get_errno;\n"; @@ -3581,6 +3582,13 @@ let generate_include_libnbd_h () = pr "extern int nbd_get_errno (void);\n"; pr "#define LIBNBD_HAVE_NBD_GET_ERRNO 1\n"; pr "\n"; + pr "typedef void (*nbd_free_callback) (void *ptr, void *user_data);\n"; + pr "e...
2019 Aug 31
1
[PATCH libnbd] Add bindings for Rust language
Still not working, but I took the latest patch and: - rebased it against libnbd 1.0 - fixed it so it handles new args and cbargs The generator now runs without warnings. This patch doesn't handle optargs at all. In C these are converted to non-optional parameter. Rust doesn't (AFAIK) have optional or labelled arguments unfortunately. Rich.
2019 Jun 28
3
[libnbd PATCH] tests: Enhance errors test
...c +++ b/tests/errors.c @@ -27,12 +27,40 @@ #include <libnbd.h> +#define MAXSIZE (65 * 1024 * 1024) /* Oversize on purpose */ + +static char *progname; +static char buf[MAXSIZE]; + +static void +check (int experr, const char *prefix) +{ + const char *msg = nbd_get_error (); + int errnum = nbd_get_errno (); + + printf ("error: \"%s\"\n", msg); + printf ("errno: %d (%s)\n", errnum, strerror (errnum)); + if (strncmp (msg, prefix, strlen (prefix)) != 0) { + fprintf (stderr, "%s: test failed: missing context prefix: %s\n", + progname, msg); +...
2019 Sep 12
0
[PATCH libnbd 2/2] interop: Retry TCP connections to qemu-nbd.
...-1) { - fprintf (stderr, "%s\n", nbd_get_error ()); - goto out; + for (retry = 0; retry < 5; ++retry) { + sleep (1 << retry); + if (nbd_connect_tcp (nbd, "localhost", port_str) == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + if (nbd_get_errno () != ECONNREFUSED) + goto out; + } + else break; } + if (retry == 5) + goto out; #else /* !SERVE_OVER_TCP */ -- 2.23.0
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 Jul 07
2
[libnbd PATCH] RFC: Add bindings for Rust language
...t; handle: *mut nbd_handle,\n"; + pr " callback: Option<unsafe extern \"C\" fn(*mut c_void)>,\n"; + pr " ) -> c_int;\n"; + pr ""; + pr " pub fn nbd_get_error() -> *const c_char;\n"; + pr " pub fn nbd_get_errno() -> c_int;\n"; + pr "\n"; + List.iter print_extern handle_calls; + pr "}\n"; + pr "\n"; + pr "#[repr(C)]\n"; + pr "#[derive(Debug, Copy, Clone)]\n"; + pr "pub struct nbd_handle {\n"; + pr " _unused: [u8; 0],\n&quot...
2019 Jul 25
4
[PATCH libnbd] api: New nbd_kill_command API for sending a signal to the command subprocess.
Reverts commit 387cbe67c3db27e8a61117fedb6e7fad76e409ef. --- generator/generator | 18 +++++++++++++++++- lib/handle.c | 28 +++++++++++++++++++++++++++- tests/closure-lifetimes.c | 4 +++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/generator/generator b/generator/generator index 2cd83f1..25e4aa5 100755 --- a/generator/generator +++ b/generator/generator
2019 Jun 28
0
[PATCH libnbd v2] python: Raise a custom exception containing error string and errno.
...quot;nbd_handle\"); } +/* nbd.Error exception. */ +extern PyObject *nbd_internal_py_Error; + +static inline void +raise_exception () +{ + PyObject *args = PyTuple_New (2); + + PyTuple_SetItem (args, 0, PyUnicode_FromString (nbd_get_error ())); + PyTuple_SetItem (args, 1, PyLong_FromLong (nbd_get_errno ())); + PyErr_SetObject (nbd_internal_py_Error, args); +} + "; List.iter ( @@ -3390,6 +3403,9 @@ static struct PyModuleDef moduledef = { NULL, /* m_free */ }; +/* nbd.Error exception. */ +PyObject *nbd_internal_py_Error; + extern PyMODINIT_FUNC PyInit_libnbdmod (...
2020 Aug 14
0
[libnbd PATCH v2 12/13] wip: api: Give aio_opt_go a completion callback
...len = be32toh (h->sbuf.or.option_reply.replylen); @@ -241,15 +242,21 @@ STATE_MACHINE { reply); } nbd_internal_reset_size_and_flags (h); - if (h->opt_mode) - SET_NEXT_STATE (%.NEGOTIATING); - else - SET_NEXT_STATE (%^PREPARE_OPT_ABORT); + err = nbd_get_errno (); break; case NBD_REP_ACK: + err = 0; + break; + } + + CALL_CALLBACK (h->opt_cb.completion, &err); + nbd_internal_free_option (h); + if (err == 0) SET_NEXT_STATE (%^FINISHED); - break; - } + else if (h->opt_mode) + SET_NEXT_STATE (%.NEGOTIATING); + else +...
2019 Jun 28
1
[PATCH libnbd] python: Raise a custom exception containing error string and errno.
I spent a good few hours this morning trying to make this work and came up with the following patch. It's not quite right though. The exception I've created exists in the libnbdmod module (ie. the underlying C module that we use for the Python bindings). Ideally we'd define and throw an exception from the normal nbd module, but I couldn't work out how to do that. Probably
2019 Jun 25
1
[libnbd PATCH] pread_structured: Change callback type to use Mutable error
...ething NBD servers can't send */ + *error = ECONNREFUSED; /* Something NBD servers can't send */ return -1; } @@ -143,7 +143,7 @@ main (int argc, char *argv[]) fprintf (stderr, "%s: expected failure from callback\n", argv[0]); exit (EXIT_FAILURE); } - if (nbd_get_errno () != EPROTO) { + if (nbd_get_errno () != ECONNREFUSED) { fprintf (stderr, "%s: wrong errno value after failed callback\n", argv[0]); exit (EXIT_FAILURE); } -- 2.20.1