Re: [Libguestfs] [PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.

Eric Blake
Wed, 15 Apr 2020 19:46:58 -0000

On 4/15/20 11:16 AM, Richard W.M. Jones wrote:
> These plugins have in common that they store either a list of
> allocated strings or a list of constant strings.  Define either
> string_vector or const_string_vector as appropriate and use it to
> store these lists.
> ---

The commit message mentions strings...


> +++ b/plugins/floppy/virtual-floppy.h
> @@ -37,6 +37,7 @@
>   #include <sys/stat.h>
>
>   #include "regions.h"
> +#include "vector.h"
>
>   struct partition_entry {
>     uint8_t bootable;             /* 0x00 or 0x80 if bootable */
> @@ -130,6 +131,9 @@ struct dir_entry {
>     uint32_t size;                /* 0x1C - file size */
>   } __attribute__((packed));
>
> +/* Appendable list of struct dir_entry. */
> +DEFINE_VECTOR_TYPE(dir_entries, struct dir_entry);
> +

...but the very first usage is a struct.

The code changes look reasonable.

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