search for: nbd_

Displaying 20 results from an estimated 105 matches for "nbd_".

Did you mean: nbd
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 ‘local:’ label is needed....
2023 May 07
2
[PATCH libnbd] tests: Add a test of nbd_{set, get}_socket_activation_name
...e GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* Test nbd_{set,get}_socket_activation_name API. */ + +#undef NDEBUG + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <assert.h> + +#include <libnbd.h> + +#include "requ...
2019 Jun 29
0
[libnbd PATCH 5/6] api: Add new nbd_aio_FOO_notify functions
...hat structure to learn which commands are complete. It's also desirable when writing a server validation program (such as for checking structured reads for compliance) to be able to clean up the associated opaque data and have a final chance to change the overall command status. Introduce new nbd_aio_FOO_notify functions for each command. Rewire the existing nbd_aio_FOO to forward to the new command. (Perhaps the generator could reduce some of the boilerplate duplication, if a later patch wants to refactor this). --- docs/libnbd.pod | 22 +++- generator/generator | 278 +++++++++++++++...
2019 Aug 14
0
[PATCH libnbd 2/2] ocaml: Remove NBD.Buffer.free function, use the completion callback instead.
...be manually freed when it is no longer used. - An AIO completion callback is usually a good place. *) - val to_bytes : t -> bytes (** Copy buffer to an OCaml [bytes] object. *) @@ -4843,7 +4839,6 @@ let () = module Buffer = struct type t external alloc : int -> t = \"nbd_internal_ocaml_buffer_alloc\" - external free : t -> unit = \"nbd_internal_ocaml_buffer_free\" external to_bytes : t -> bytes = \"nbd_internal_ocaml_buffer_to_bytes\" external of_bytes : bytes -> t = \"nbd_internal_ocaml_buffer_of_bytes\" externa...
2019 Jul 24
2
[libnbd PATCH] docs: Mention that nbd_close is not thread-safe
Closing the handle in one thread while another thread is locked causes undefined behavior (as closing does not obtain a lock, and can cause use-after-free or other nasty problems to the thread that does own the lock). However, it is not sensible to try and obtain a lock in nbd_close, as POSIX says that it is also undefined for any other thread to wait on a mutex that has already been destroyed. Therefore, we don't need to change our code, but merely remind users that nbd_close is not safe until all other uses of the handle have ceased. --- generator/generator | 3 +...
2019 Aug 14
4
[PATCH libnbd 0/2] Use free callback to dereference NBD.Buffer.
...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 case for having the free callback run even if there is no registered callback: nbd_aio_pread (nbd, buf, sizeof buf, 0, (nbd_completion_callback) { .callback = NULL, .free = completion_free }, 0); but the semantics of that are a bit weird. Why would you need to "free" a callback which doesn...
2019 Jun 04
2
[PATCH libnbd] generator: Fix race condition when validating h->state.
The code for (eg) nbd_aio_pread starts by checking this outside the lock: if (!(nbd_aio_is_ready (h) || nbd_aio_is_processing (h))) { However there can still be a race condition even though h->state is atomic: Thread A Thread B (in a call that holds h->lock) (calling nbd_aio_pread...
2019 May 22
1
Re: [libnbd PATCH v2 2/5] commands: Allow for a command queue
...e event for > kicking the state machine into action when there is no previous > command being worked on, but otherwise, the state machine itself can > recognize when the command queue needs draining. I have a queued series which adds some new calls that may make this patch simpler: int nbd_[unlocked_]aio_is_created (conn) Returns true if the connection is in the START state int nbd_[unlocked_]aio_is_connecting (conn) Returns true if the connection is connecting or handshaking int nbd_[unlocked_]aio_is_processing (conn) Returns true if the connection is issuing or...
2019 Aug 14
5
[PATCH libnbd 0/3] Use free callback to hold ref to AIO buffer.
Basically the same as this patch series, but for Python: https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html plus adding the 590 asynch test at the end. Rich.
2019 Jul 29
0
Re: [PATCH libnbd] lib: Use symbol versions.
On Sat, Jul 27, 2019 at 02:19:47PM +0100, Richard W.M. Jones wrote: > 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; >...
2019 Sep 24
0
[PATCH nbdkit 0/4] common/protocol: Unify public <nbd-protocol.h>
...ike protocol message layouts, constants etc). We copied a header file from nbdkit which provided these. Over time this header file has diverged from nbdkit's copy. In fact the libnbd one has been generally enhanced over the nbdkit version: - All symbols in libnbd's copy are prefixed by NBD_ or nbd_. - More coverage of the protocol. It would be good, not just for nbdkit/libnbd but for other projects, if we could unify these two files again and publish a liberally licensed copy as /usr/include/nbd-protocol.h. This commit series does this for nbdkit. For libnbd there is an associate...
2023 Jul 17
1
[libnbd PATCH 1/2] api: Tighten rules on completion.callback
...> =back > > > > @@ -897,19 +904,25 @@ asynchronous commands are retired. > > > > =head2 Callbacks and locking > > > > -The callbacks are invoked at a point where the libnbd lock is held; as > > -such, it is unsafe for the callback to call any C<nbd_*> APIs on the > > -same nbd object, as it would cause deadlock. > > +The callbacks are invoked at a point where the libnbd lock is held, > > +typically during a call to C<nbd_aio_notify_read>, > > +C<nbd_aio_notify_write>, C<nbd_aio_poll>, or other call...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
The definition of functions that take a callback is changed so that the callback and user_data are combined into a single structure, eg: int64_t nbd_aio_pread (struct nbd_handle *h, void *buf, size_t count, uint64_t offset, - int (*completion_callback) (/*..*/), void *user_data, + nbd_completion_callback completion_callback, uint32_t flags); Several nbd_*_callback structures are defined. The one corr...
2020 Sep 08
2
[libnbd PATCH] python: Plug some memory leaks on error paths
...uot; Py_DECREF (py_%s_mod);\n" n; pr " if (!py_%s) { PyErr_PrintEx (0); return -1; }\n" n; | CBString _ | CBUInt _ @@ -263,7 +264,7 @@ let print_python_binding name { args; optargs; ret; may_set_error } = pr " PyObject *py_h;\n"; pr " struct nbd_handle *h;\n"; pr " %s ret;\n" (C.type_of_ret ret); - pr " PyObject *py_ret;\n"; + pr " PyObject *py_ret = NULL;\n"; List.iter ( function | Bool n -> pr " int %s;\n" n @@ -279,7 +280,7 @@ let print_python_binding name { args; opta...
2023 Jul 14
2
[libnbd PATCH 1/2] api: Tighten rules on completion.callback
On Fri, Jul 14, 2023 at 09:13:42AM +0200, Laszlo Ersek wrote: > On 7/13/23 21:29, Eric Blake wrote: > > The documentation has claimed since commit 6f4dcdab that any > > completion callback will be called exactly once; but this is not > > consistent with the code: if nbd_aio_* itself returns an error, then > > nothing is queued and the user does not need to wait for a completion > > callback to know how the command failed. We could tweak the generator > > to call completion.callback no matter what, but since the > > completion.free callback...
2019 Sep 24
2
Re: [PATCH nbdkit 0/4] common/protocol: Unify public <nbd-protocol.h>
...ants etc). We > copied a header file from nbdkit which provided these. Over time this > header file has diverged from nbdkit's copy. > > In fact the libnbd one has been generally enhanced over the nbdkit > version: > > - All symbols in libnbd's copy are prefixed by NBD_ or nbd_. > > - More coverage of the protocol. > > It would be good, not just for nbdkit/libnbd but for other projects, > if we could unify these two files again and publish a liberally > licensed copy as /usr/include/nbd-protocol.h. And nbdkit definitely has the more-permissiv...
2019 Aug 15
13
[PATCH libnbd v2 00/10] Callbacks and OCaml and Python persistent buffers.
This is a combination of these two earlier series: https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html https://www.redhat.com/archives/libguestfs/2019-August/msg00240.html plus changes to allow .callback = NULL / .free != NULL, and to reduce the complexity of freeing callbacks. Although it's rather long there's nothing complex here. We might consider squashing some
2023 Jul 16
1
[libnbd PATCH 1/2] api: Tighten rules on completion.callback
...n Fri, Jul 14, 2023 at 09:13:42AM +0200, Laszlo Ersek wrote: >> On 7/13/23 21:29, Eric Blake wrote: >>> The documentation has claimed since commit 6f4dcdab that any >>> completion callback will be called exactly once; but this is not >>> consistent with the code: if nbd_aio_* itself returns an error, then >>> nothing is queued and the user does not need to wait for a completion >>> callback to know how the command failed. We could tweak the generator >>> to call completion.callback no matter what, but since the >>> completion.fr...
2019 Jul 25
2
[libnbd PATCH] generator: Let nbd_aio_get_direction return unsigned
...quot; 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 () = | RBool | RErr | RFd - | RInt -> "int", "-1" - | RConstString -> "const char *", "NULL" - | RInt64 -> "int...
2019 Aug 13
1
Re: [PATCH libnbd v2 3/3] api: Add nbd_clear_debug_callback.
...ons(-) > > diff --git a/generator/generator b/generator/generator > index 6ccfc5f..d76eeea 100755 > --- a/generator/generator > +++ b/generator/generator > @@ -1013,6 +1013,17 @@ a handle then messages are printed on C<stderr>. > > The callback should not call C<nbd_*> APIs on the same handle since it can > be called while holding the handle lock and will cause a deadlock."; > +}; > + > + "clear_debug_callback", { > + default_call with > + args = []; > + ret = RErr; Is RErr the right type, or can we make this a...