[Libguestfs] [libnbd PATCH 3/6] state_machine_generator: wrap state comments in lib/states.{h, c}
Laszlo Ersek
lersek at redhat.com
Wed May 10 11:48:11 UTC 2023
Wrap those comments in "lib/states.h" and "lib/states.c" that describe the
automaton's states.
Example changes from "lib/states.h":
> /* CONNECT_TCP.CONNECT: Initial call to connect(2) on a TCP socket */
> STATE_CONNECT_TCP_CONNECT,
>
> - /* CONNECT_TCP.CONNECTING: Connecting to the remote server over a TCP socket */
> + /* CONNECT_TCP.CONNECTING: Connecting to the remote server over a TCP socket
> + */
> STATE_CONNECT_TCP_CONNECTING,
>
and
> STATE_NEWSTYLE_OPT_META_CONTEXT_SEND_QUERY,
>
> - /* NEWSTYLE.OPT_META_CONTEXT.PREPARE_FOR_REPLY: Prepare to receive newstyle NBD_OPT_SET_META_CONTEXT option reply */
> + /* NEWSTYLE.OPT_META_CONTEXT.PREPARE_FOR_REPLY: Prepare to receive newstyle
> + * NBD_OPT_SET_META_CONTEXT option reply
> + */
> STATE_NEWSTYLE_OPT_META_CONTEXT_PREPARE_FOR_REPLY,
>
Example changes from "lib/states.c":
> @@ -2085,7 +2087,8 @@ nbd_internal_enter_STATE_NEWSTYLE_OPT_ST
> return r;
> }
>
> -/* NEWSTYLE.OPT_STARTTLS.SEND: Send newstyle NBD_OPT_STARTTLS to upgrade to TLS */
> +/* NEWSTYLE.OPT_STARTTLS.SEND: Send newstyle NBD_OPT_STARTTLS to upgrade to TLS
> + */
> static int
> enter_STATE_NEWSTYLE_OPT_STARTTLS_SEND (struct nbd_handle *h,
> enum state *next_state,
and
> @@ -2992,7 +3021,9 @@ nbd_internal_enter_STATE_NEWSTYLE_OPT_ME
> return r;
> }
>
> -/* NEWSTYLE.OPT_META_CONTEXT.PREPARE_FOR_REPLY: Prepare to receive newstyle NBD_OPT_SET_META_CONTEXT option reply */
> +/* NEWSTYLE.OPT_META_CONTEXT.PREPARE_FOR_REPLY: Prepare to receive newstyle
> + * NBD_OPT_SET_META_CONTEXT option reply
> + */
> static int
> enter_STATE_NEWSTYLE_OPT_META_CONTEXT_PREPARE_FOR_REPLY (struct nbd_handle *h,
> enum state *next_state,
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
generator/state_machine_generator.ml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/generator/state_machine_generator.ml b/generator/state_machine_generator.ml
index 3df706f91ccd..74a009a33598 100644
--- a/generator/state_machine_generator.ml
+++ b/generator/state_machine_generator.ml
@@ -298,7 +298,9 @@ let
pr "enum state {\n";
List.iter (
fun ({ comment; parsed = { display_name; state_enum } }) ->
- pr " /* %s: %s */\n" display_name comment;
+ pr " ";
+ pr_wrap_c_comment (fun () -> pr "%s: %s" display_name comment);
+ pr "\n";
pr " %s,\n" state_enum;
pr "\n";
) states;
@@ -346,7 +348,8 @@ let
List.iter (
fun { comment; parsed = { display_name; state_enum; loc; code } } ->
pr "\n";
- pr "/* %s: %s */\n" display_name comment;
+ pr_wrap_c_comment (fun () -> pr "%s: %s" display_name comment);
+ pr "\n";
pr "static int\n";
pr "enter_%s (struct nbd_handle *h,\n" state_enum;
pr " enum state *next_state,\n";
More information about the Libguestfs
mailing list