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 <eblake(a)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%)
diff --git a/generator/state_machine.ml b/generator/state_machine.ml
index b5485aec..3a912508 100644
--- a/generator/state_machine.ml
+++ b/generator/state_machine.ml
@@ -782,7 +782,7 @@ and
};
Group ("SIMPLE_REPLY", simple_reply_state_machine);
- Group ("STRUCTURED_REPLY", structured_reply_state_machine);
+ Group ("CHUNK_REPLY", chunk_reply_state_machine);
State {
default_state with
@@ -812,76 +812,76 @@ and
]
(* Receiving a structured reply payload from the server.
- * Implementation: generator/states-reply-structured.c
+ * Implementation: generator/states-reply-chunk.c
*)
-and structured_reply_state_machine = [
+and chunk_reply_state_machine = [
State {
default_state with
name = "START";
- comment = "Start parsing a structured reply payload from the server";
+ comment = "Start parsing a chunk reply payload from the server";
external_events = [];
};
State {
default_state with
name = "RECV_ERROR";
- comment = "Receive a structured reply error header";
+ comment = "Receive a chunk reply error header";
external_events = []
};
State {
default_state with
name = "RECV_ERROR_MESSAGE";
- comment = "Receive a structured reply error message";
+ comment = "Receive a chunk reply error message";
external_events = [];
};
State {
default_state with
name = "RECV_ERROR_TAIL";
- comment = "Receive a structured reply error tail";
+ comment = "Receive a chunk reply error tail";
external_events = [];
};
State {
default_state with
name = "RECV_OFFSET_DATA";
- comment = "Receive a structured reply offset-data header";
+ comment = "Receive a chunk reply offset-data header";
external_events = [];
};
State {
default_state with
name = "RECV_OFFSET_DATA_DATA";
- comment = "Receive a structured reply offset-data block of data";
+ comment = "Receive a chunk reply offset-data block of data";
external_events = [];
};
State {
default_state with
name = "RECV_OFFSET_HOLE";
- comment = "Receive a structured reply offset-hole header";
+ comment = "Receive a chunk reply offset-hole header";
external_events = [];
};
State {
default_state with
name = "RECV_BS_ENTRIES";
- comment = "Receive a structured reply block-status payload";
+ comment = "Receive a chunk reply block-status payload";
external_events = [];
};
State {
default_state with
name = "RESYNC";
- comment = "Ignore payload of an unexpected structured reply";
+ comment = "Ignore payload of an unexpected chunk reply";
external_events = [];
};
State {
default_state with
name = "FINISH";
- comment = "Finish receiving a structured reply";
+ comment = "Finish receiving a chunk reply";
external_events = [];
};
]
diff --git a/generator/states-reply.c b/generator/states-reply.c
index 87f17bae..bd6336a8 100644
--- a/generator/states-reply.c
+++ b/generator/states-reply.c
@@ -176,7 +176,7 @@ REPLY.RECV_STRUCTURED_REMAINING:
save_reply_state (h);
SET_NEXT_STATE (%.READY);
return 0;
- case 0: SET_NEXT_STATE (%STRUCTURED_REPLY.START);
+ case 0: SET_NEXT_STATE (%CHUNK_REPLY.START);
}
return 0;
diff --git a/generator/states-reply-structured.c b/generator/states-reply-chunk.c
similarity index 97%
rename from generator/states-reply-structured.c
rename to generator/states-reply-chunk.c
index 3a7a03fd..94f3a8ae 100644
--- a/generator/states-reply-structured.c
+++ b/generator/states-reply-chunk.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/* State machine for parsing structured replies from the server. */
+/* State machine for parsing structured reply chunk payloads from the server. */
#include <stdbool.h>
#include <stddef.h>
@@ -45,7 +45,7 @@ structured_reply_in_bounds (uint64_t offset, uint32_t length,
}
STATE_MACHINE {
- REPLY.STRUCTURED_REPLY.START:
+ REPLY.CHUNK_REPLY.START:
struct command *cmd = h->reply_cmd;
uint16_t flags, type;
uint32_t length;
@@ -145,7 +145,7 @@ REPLY.STRUCTURED_REPLY.START:
SET_NEXT_STATE (%RESYNC);
return 0;
- REPLY.STRUCTURED_REPLY.RECV_ERROR:
+ REPLY.CHUNK_REPLY.RECV_ERROR:
struct command *cmd = h->reply_cmd;
uint32_t length, msglen, error;
@@ -184,7 +184,7 @@ REPLY.STRUCTURED_REPLY.RECV_ERROR:
SET_NEXT_STATE (%RESYNC);
return 0;
- REPLY.STRUCTURED_REPLY.RECV_ERROR_MESSAGE:
+ REPLY.CHUNK_REPLY.RECV_ERROR_MESSAGE:
uint32_t length, msglen;
uint16_t type;
@@ -226,7 +226,7 @@ REPLY.STRUCTURED_REPLY.RECV_ERROR_MESSAGE:
}
return 0;
- REPLY.STRUCTURED_REPLY.RECV_ERROR_TAIL:
+ REPLY.CHUNK_REPLY.RECV_ERROR_TAIL:
struct command *cmd = h->reply_cmd;
uint32_t error;
uint16_t type;
@@ -283,7 +283,7 @@ REPLY.STRUCTURED_REPLY.RECV_ERROR_TAIL:
}
return 0;
- REPLY.STRUCTURED_REPLY.RECV_OFFSET_DATA:
+ REPLY.CHUNK_REPLY.RECV_OFFSET_DATA:
struct command *cmd = h->reply_cmd;
uint64_t offset;
uint32_t length;
@@ -322,7 +322,7 @@ REPLY.STRUCTURED_REPLY.RECV_OFFSET_DATA:
}
return 0;
- REPLY.STRUCTURED_REPLY.RECV_OFFSET_DATA_DATA:
+ REPLY.CHUNK_REPLY.RECV_OFFSET_DATA_DATA:
struct command *cmd = h->reply_cmd;
uint64_t offset;
uint32_t length;
@@ -353,7 +353,7 @@ REPLY.STRUCTURED_REPLY.RECV_OFFSET_DATA_DATA:
}
return 0;
- REPLY.STRUCTURED_REPLY.RECV_OFFSET_HOLE:
+ REPLY.CHUNK_REPLY.RECV_OFFSET_HOLE:
struct command *cmd = h->reply_cmd;
uint64_t offset;
uint32_t length;
@@ -403,7 +403,7 @@ REPLY.STRUCTURED_REPLY.RECV_OFFSET_HOLE:
}
return 0;
- REPLY.STRUCTURED_REPLY.RECV_BS_ENTRIES:
+ REPLY.CHUNK_REPLY.RECV_BS_ENTRIES:
struct command *cmd = h->reply_cmd;
uint32_t length;
size_t i;
@@ -457,7 +457,7 @@ REPLY.STRUCTURED_REPLY.RECV_BS_ENTRIES:
}
return 0;
- REPLY.STRUCTURED_REPLY.RESYNC:
+ REPLY.CHUNK_REPLY.RESYNC:
struct command *cmd = h->reply_cmd;
uint16_t type;
uint32_t length;
@@ -491,7 +491,7 @@ REPLY.STRUCTURED_REPLY.RESYNC:
}
return 0;
- REPLY.STRUCTURED_REPLY.FINISH:
+ REPLY.CHUNK_REPLY.FINISH:
uint16_t flags;
flags = be16toh (h->sbuf.sr.structured_reply.flags);
diff --git a/generator/Makefile.am b/generator/Makefile.am
index 91dbde5c..39285e82 100644
--- a/generator/Makefile.am
+++ b/generator/Makefile.am
@@ -37,8 +37,8 @@ states_code = \
states-newstyle-opt-structured-reply.c \
states-newstyle.c \
states-oldstyle.c \
+ states-reply-chunk.c \
states-reply-simple.c \
- states-reply-structured.c \
states-reply.c \
$(NULL)
--
2.40.1