Re: [Libguestfs] [libnbd PATCH 0/6] finish wrapping generated C code harder

2023-05-10 Thread Eric Blake
On Wed, May 10, 2023 at 01:48:08PM +0200, Laszlo Ersek wrote: > This is the last wave (wave 5). Line length maxima: > > file before after > -- - > lib/states-run.c 102 98 > lib/states.c 116 80 > lib/states.h 123 86

Re: [Libguestfs] [libnbd PATCH 3/6] state_machine_generator: wrap state comments in lib/states.{h, c}

2023-05-10 Thread Eric Blake
On Wed, May 10, 2023 at 01:48:11PM +0200, Laszlo Ersek wrote: > 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 */ > >

Re: [Libguestfs] [libnbd PATCH 2/6] generator/utils: add "pr_wrap_c_comment"

2023-05-10 Thread Eric Blake
On Wed, May 10, 2023 at 01:48:10PM +0200, Laszlo Ersek wrote: > Add the "pr_wrap_c_comment" function, for wrapping C comments. > > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516 > Signed-off-by: Laszlo Ersek > --- > generator/utils.mli | 1 + > generator/utils.ml | 87

[Libguestfs] [libnbd PATCH 6/6] state_machine_generator: rename, and break up the init. of, "next_state"

2023-05-10 Thread Laszlo Ersek
We can shave off 17 characters by renaming "next_state" to "next", and replacing its initialization with a standalone assignment. Most impactful effect [lib/states.c]: > int > nbd_internal_enter_STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD ( >struct nbd_handle *h, bool *blocked >

[Libguestfs] [libnbd PATCH 3/6] state_machine_generator: wrap state comments in lib/states.{h, c}

2023-05-10 Thread Laszlo Ersek
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

[Libguestfs] [libnbd PATCH 4/6] state_machine_generator: wrap nbd_internal_enter_* prototypes

2023-05-10 Thread Laszlo Ersek
Similarly to commit bfef979aa372 ("generator: wrap "python/methods.h" at 80 characters", 2023-05-02), just break the fixed (and in itself, short) parameter list to a new line. Example effect in "lib/states.h": > -extern int >

[Libguestfs] [libnbd PATCH 5/6] state_machine_generator: wrap enter_*() calls and prototypes

2023-05-10 Thread Laszlo Ersek
More of the same. Regarding the enter_*() calls, most impactful change is [lib/states.c]: > @@ -2635,7 +2695,9 @@ nbd_internal_enter_STATE_NEWSTYLE_OPT_ST >int r; >enum state next_state = > STATE_NEWSTYLE_OPT_STRUCTURED_REPLY_RECV_REPLY_PAYLOAD; > > - r =

[Libguestfs] [libnbd PATCH 1/6] state_machine_generator: wrap debug() calls in nbd_internal_run()

2023-05-10 Thread Laszlo Ersek
The longest line in "lib/states-run.c" is folded as follows: > @@ -513,8 +515,9 @@ nbd_internal_run (struct nbd_handle *h, >goto ok; > case notify_read: >set_next_state (h, STATE_ISSUE_COMMAND_PAUSE_WRITE_SHUTDOWN); > - debug (h, "event %s: %s -> %s", > -

[Libguestfs] [libnbd PATCH 0/6] finish wrapping generated C code harder

2023-05-10 Thread Laszlo Ersek
This is the last wave (wave 5). Line length maxima: file before after -- - lib/states-run.c 102 98 lib/states.c 116 80 lib/states.h 123 86 The longest line in "lib/states.h" becomes: > extern int >

[Libguestfs] [libnbd PATCH 2/6] generator/utils: add "pr_wrap_c_comment"

2023-05-10 Thread Laszlo Ersek
Add the "pr_wrap_c_comment" function, for wrapping C comments. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516 Signed-off-by: Laszlo Ersek --- generator/utils.mli | 1 + generator/utils.ml | 87 2 files changed, 88 insertions(+) diff --git

Re: [Libguestfs] [PATCH nbdkit v3 3/6] common/utils: Add C string quoting function

2023-05-10 Thread Laszlo Ersek
On 5/9/23 16:51, Richard W.M. Jones wrote: > eg. { '\r', '\n' } -> { '\\', 'n', '\\', 'r' } > --- > common/utils/utils.h | 1 + > common/utils/quote.c | 58 > 2 files changed, 59 insertions(+) > > diff --git a/common/utils/utils.h

Re: [Libguestfs] [PATCH nbdkit v3 6/6] server: debug: Escape debug strings

2023-05-10 Thread Laszlo Ersek
On 5/9/23 22:28, Richard W.M. Jones wrote: > > Thanks for everyone's feedback. I pushed this series with several > enhancements as: > > 5fbf93a92..2f7ca818f Thankfully, this time I *did* pull before continuing with the review, and so I noticed the commits, and then read the rest of the thread