From: Petr Vorel <pvorel@suse.cz>
To: Jan Stancek <jstancek@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] lib: introduce safe_write() retry
Date: Tue, 4 Oct 2022 14:20:20 +0200 [thread overview]
Message-ID: <YzwlBEyDZHEvkMBy@pevik> (raw)
In-Reply-To: <938c864ee6bb82ffdee9371bd802642ffedc606c.1664872194.git.jstancek@redhat.com>
Hi Jan,
> Turn safe_write() len_strict parameter into 3-way switch, introducing
> one additional mode of operation "retry". On short writes, this
> resumes write() with remainder of the buffer.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
> ---
> include/safe_macros_fn.h | 11 ++++++++--
> lib/safe_macros.c | 42 ++++++++++++++++++++++++++++---------
> lib/tests/tst_safe_macros.c | 6 +++---
> 3 files changed, 44 insertions(+), 15 deletions(-)
LGTM. I just wonder if we need to add it to lib/safe_macros.c,
which implements it for the old API. Would it work to add it only to
tst_safe_macros.c and tst_safe_macros.h (instead of safe_macros_fn.h)?
Not a requirement, just if it makes sense to you.
...
> +++ b/include/safe_macros_fn.h
> @@ -24,6 +24,13 @@
> #include <unistd.h>
> #include <dirent.h>
> +/* supported values for safe_write() len_strict parameter */
> +enum safe_write_opts {
> + SAFE_WRITE_ANY = 0, // no length strictness, short writes are ok
> + SAFE_WRITE_ALL = 1, // strict length, short writes raise TBROK
> + SAFE_WRITE_RETRY = 2, // retry/resume after short write
> +};
Maybe use /* */ and for readability, maybe put into it's own line?
enum safe_write_opts {
/* no length strictness, short writes are ok */
SAFE_WRITE_ANY = 0,
/* strict length, short writes raise TBROK */
SAFE_WRITE_ALL = 1,
/* retry/resume after short write */
SAFE_WRITE_RETRY = 2, //
};
Also checkpatch.pl complains:
safe_macros_fn.h:29: ERROR: code indent should use tabs where possible
safe_macros_fn.h:29: WARNING: please, no spaces at the start of a line
safe_macros_fn.h:30: ERROR: code indent should use tabs where possible
safe_macros_fn.h:30: WARNING: please, no spaces at the start of a line
safe_macros_fn.h:31: ERROR: code indent should use tabs where possible
safe_macros_fn.h:31: WARNING: please, no spaces at the start of a line
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-10-04 12:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 12:48 [LTP] [PATCH 1/3] lib: introduce safe_write_fully() Jan Stancek
2022-10-03 12:48 ` [LTP] [PATCH 2/3] syscalls/preadv203: don't treat short write() as failure Jan Stancek
2022-10-03 12:48 ` [LTP] [PATCH 3/3] mmapstress04: use SAFE_WRITE_FULLY from LTP library Jan Stancek
2022-10-03 13:16 ` [LTP] [PATCH 1/3] lib: introduce safe_write_fully() Cyril Hrubis
2022-10-03 13:56 ` Jan Stancek
2022-10-03 14:00 ` Cyril Hrubis
2022-10-04 8:31 ` [LTP] [PATCH v2] lib: introduce safe_write() retry Jan Stancek
2022-10-04 12:20 ` Petr Vorel [this message]
2022-10-04 12:34 ` Jan Stancek
2022-10-04 18:45 ` Petr Vorel
2022-10-05 9:32 ` Cyril Hrubis
2022-10-05 12:02 ` Jan Stancek
2022-10-17 14:15 ` Richard Palethorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YzwlBEyDZHEvkMBy@pevik \
--to=pvorel@suse.cz \
--cc=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox