On Thu, Jun 08, 2023 at 09:17:37PM -0500, Eric Blake wrote:
> Upcoming patches to add extended headers want to share the common
> payload parser with structured replies.  Renaming the file and the
> associated states from "structured" to "chunk" makes it more obvious
> that we will be sharing the code independent from the header style
> parsed in the earlier REPLY portion of the state machine.
> 
> Signed-off-by: Eric Blake <ebl...@redhat.com>
> ---
>  generator/state_machine.ml                    | 26 +++++++++----------
>  generator/states-reply.c                      |  2 +-
>  ...eply-structured.c => states-reply-chunk.c} | 22 ++++++++--------
>  generator/Makefile.am                         |  2 +-
>  4 files changed, 26 insertions(+), 26 deletions(-)
>  rename generator/{states-reply-structured.c => states-reply-chunk.c} (97%)

I'm thinking of squashing in:

diff --git c/lib/internal.h w/lib/internal.h
index 1e8d02f1..4b0043b3 100644
--- c/lib/internal.h
+++ w/lib/internal.h
@@ -252,10 +252,10 @@ struct nbd_handle {
       } hdr;
       union {
         uint64_t align_; /* Start reply.payload on an 8-byte alignment */
-        struct nbd_structured_reply_offset_data offset_data;
-        struct nbd_structured_reply_offset_hole offset_hole;
+        struct nbd_chunk_offset_data offset_data;
+        struct nbd_chunk_offset_hole offset_hole;
         struct {
-          struct nbd_structured_reply_error error;
+          struct nbd_chunk_error error;
           char msg[NBD_MAX_STRING]; /* Common to all error types */
           uint64_t offset; /* Only used for NBD_REPLY_TYPE_ERROR_OFFSET */
         } NBD_ATTRIBUTE_PACKED error;
diff --git c/lib/nbd-protocol.h w/lib/nbd-protocol.h
index 50275dcd..fef19f2c 100644
--- c/lib/nbd-protocol.h
+++ w/lib/nbd-protocol.h
@@ -211,20 +211,20 @@ struct nbd_structured_reply {
   uint16_t flags;               /* NBD_REPLY_FLAG_* */
   uint16_t type;                /* NBD_REPLY_TYPE_* */
   uint64_t cookie;              /* Opaque handle. */
-  uint32_t length;              /* Length of payload which follows. */
+  uint32_t length;              /* Length of following nbd_chunk_* payload. */
 } NBD_ATTRIBUTE_PACKED;

-struct nbd_structured_reply_offset_data {
+struct nbd_chunk_offset_data {
   uint64_t offset;              /* offset */
   /* Followed by data. */
 } NBD_ATTRIBUTE_PACKED;

-struct nbd_structured_reply_offset_hole {
+struct nbd_chunk_offset_hole {
   uint64_t offset;
   uint32_t length;              /* Length of hole. */
 } NBD_ATTRIBUTE_PACKED;

-struct nbd_structured_reply_error {
+struct nbd_chunk_error {
   uint32_t error;               /* NBD_E* error number */
   uint16_t len;                 /* Length of human readable error. */
   /* Followed by human readable error string, and possibly more structure. */

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to