[Libguestfs] [nbdkit PATCH v3 11/16] filters: Use context rather than connection to track c_next
Eric Blake
eblake at redhat.com
Tue Mar 9 17:23:40 UTC 2021
On 3/5/21 5:31 PM, Eric Blake wrote:
> This is another API/ABI change to filters, but that doesn't matter.
> Instead of having a 1:1 correspondence of automatic backend context to
> the current connection (which means filters.c has to consult GET_CONN
> on every action), switch things so that a given context tracks the
> next context. This requires another signature change to the internal
> backend_open and backend_reopen functions, as well as a public change
> to the type of the argument handed to filter .open calls. A given
> connection now only needs to track the top_context, and we no longer
> need get_context()/set_context(). Internally, nbdkit_context and
> nbdkit_next are the same type, but the public interface for filters
> keeps them separate for type-safety reasons (assigning a backend
> handle to the current filter's context is different than calling into
> the backend via next_ops/nxdata as the backend's context).
>
> @@ -471,7 +471,7 @@ outer filter to the plugin will be in reverse. Skipping a call to
> C<next> is acceptable if the filter will not access C<next_ops>
> during any of the remaining callbacks reached on the same connection.
>
> -The value of C<backend> in this call has a lifetime that lasts until
> +The value of C<context> in this call has a lifetime that lasts until
> the counterpart C<.close>, and it is this value (and not the distinct
> C<nxdata> of C<.pread> and friends) that must be passed as the first
> parameter to C<nbdkit_backend_reopen> by a filter attempting to retry
> @@ -481,14 +481,14 @@ a connection into the backend.
>
> Filters have access to a function for reopening the backend:
>
> - int (nbdkit_backend *backend, int readonly, const char *exportname,
> + int (nbdkit_context *context, int readonly, const char *exportname,
> void **nxdata);
This goes away in a later patch, but I might as well spell it correctly
in the earlier patches: s/int /int nbdkit_backend_reopen)/
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the Libguestfs
mailing list