public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH 1/6] Add safe macros for stream testing suite
Date: Thu, 19 Feb 2026 13:31:40 +0100	[thread overview]
Message-ID: <aZcCrH2i_KFhonAG@yuki.lan> (raw)
In-Reply-To: <20260123-stream_refactoring-v1-1-281b85f6ab02@suse.com>

Hi!
> Introduce the following SAFE_* macros for stream file testing:
> 
> - SAFE_FREAD
> - SAFE_FWRITE
> - SAFE_FREOPEN
> - SAFE_FSEEK
> - SAFE_FTELL
> - SAFE_FILENO
> 
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
>  include/safe_stdio_fn.h  | 18 ++++++++++
>  include/tst_safe_stdio.h | 18 ++++++++++
>  lib/safe_stdio.c         | 87 ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 123 insertions(+)
> 
> diff --git a/include/safe_stdio_fn.h b/include/safe_stdio_fn.h
> index 3818a86571a6d9bc63fcf432c93683bb3298e5b2..79c08080fd16489ea5bd1606083ae900ba3b294f 100644
> --- a/include/safe_stdio_fn.h
> +++ b/include/safe_stdio_fn.h
> @@ -32,4 +32,22 @@ int safe_asprintf(const char *file, const int lineno, void (cleanup_fn)(void),
>  FILE *safe_popen(const char *file, const int lineno, void (cleanup_fn)(void),
>  		 const char *command, const char *type);
>  
> +size_t safe_fread(const char *file, const int lineno, void (cleanup_fn)(void),
> +		  void *ptr, size_t size, size_t n, FILE *stream);
> +
> +size_t safe_fwrite(const char *file, const int lineno, void (cleanup_fn)(void),
> +		   const void *ptr, size_t size, size_t n, FILE *stream);
> +
> +FILE *safe_freopen(const char *file, const int lineno, void (cleanup_fn)(void),
> +		   const char *path, const char *mode, FILE *stream);
> +
> +int safe_fseek(const char *file, const int lineno, void (cleanup_fn)(void),
> +	       FILE *f, long offset, int whence);
> +
> +long safe_ftell(const char *file, const int lineno, void (cleanup_fn)(void),
> +		FILE *f);
> +
> +int safe_fileno(const char *file, const int lineno, void (cleanup_fn)(void),
> +		FILE *stream);

Newly added safe macros shouldn't add the cleanup_fn parameter, that is
kept only in the legacy macros that are stil used in the old library
tests.

Otherwise: Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-02-19 12:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 16:18 [LTP] [PATCH 0/6] Rewrite fs stream testing suite Andrea Cervesato
2026-01-23 16:18 ` [LTP] [PATCH 1/6] Add safe macros for " Andrea Cervesato
2026-02-19 12:31   ` Cyril Hrubis [this message]
2026-03-04  9:49     ` Andrea Cervesato via ltp
2026-03-04 10:06       ` Cyril Hrubis
2026-03-04 10:11         ` Andrea Cervesato via ltp
2026-03-04 10:30           ` Cyril Hrubis
2026-03-04 12:20     ` Andrea Cervesato via ltp
2026-01-23 16:18 ` [LTP] [PATCH 2/6] fs: rewrite stream01 test using new API Andrea Cervesato
2026-02-19 13:05   ` Cyril Hrubis
2026-01-23 16:18 ` [LTP] [PATCH 3/6] fs: rewrite stream02 " Andrea Cervesato
2026-03-02 12:01   ` Cyril Hrubis
2026-01-23 16:18 ` [LTP] [PATCH 4/6] fs: rewrite stream03 " Andrea Cervesato
2026-03-02 13:02   ` Cyril Hrubis
2026-01-23 16:18 ` [LTP] [PATCH 5/6] fs: rewrite stream04 " Andrea Cervesato
2026-03-02 13:14   ` Cyril Hrubis
2026-01-23 16:18 ` [LTP] [PATCH 6/6] fs: rewrite stream05 " Andrea Cervesato
2026-03-02 13:52   ` Cyril Hrubis

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=aZcCrH2i_KFhonAG@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --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