[Libguestfs] [PATCH nbdkit 1/3] server: Rename global backend pointer to "top".

Eric Blake eblake at redhat.com
Wed Feb 12 13:42:31 UTC 2020


On 2/12/20 7:40 AM, Richard W.M. Jones wrote:
> It's confusing to use the same terminology for a single backend as for
> the linked list of backends.  In particular it's often not clear if
> we're calling the next backend or the whole chain of backends.

Yes, that has caught me, too.  I like the rename.

ACK


> +++ b/server/internal.h
> @@ -118,8 +118,18 @@ extern char *unixsocket;
>   extern const char *user, *group;
>   extern bool verbose;
>   
> -extern struct backend *backend;
> -#define for_each_backend(b) for (b = backend; b != NULL; b = b->next)
> +/* Linked list of backends.  Each backend struct is followed by either
> + * a filter or plugin struct.  "top" points to the first one.  They
> + * are linked through the backend->next field.
> + *
> + *         ┌──────────┐    ┌──────────┐    ┌──────────┐
> + * top ───▶│ backend  │───▶│ backend  │───▶│ backend  │
> + *         │ b->i = 2 │    │ b->i = 1 │    │ b->i = 0 │
> + *         │ filter   │    │ filter   │    │ plugin   │
> + *         └──────────┘    └──────────┘    └──────────┘
> + */

And the graphic helps, too.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list