From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v5 1/2] tst_safe_macros.h: Add SAFE_STATVFS
Date: Thu, 27 Feb 2025 17:27:17 +0100 [thread overview]
Message-ID: <20250227162717.GF3130282@pevik> (raw)
In-Reply-To: <20241212085058.29551-2-wegao@suse.com>
Hi Wei,
> +++ b/include/tst_safe_macros.h
> @@ -429,6 +429,27 @@ static inline int safe_statfs(const char *file, const int lineno,
> #define SAFE_STATFS(path, buf) \
> safe_statfs(__FILE__, __LINE__, (path), (buf))
> +static inline int safe_statvfs(const char *file, const int lineno,
> + const char *path, struct statvfs *buf)
> +{
> + int rval;
> +
> + rval = statvfs(path, buf);
> +
> + if (rval == -1) {
> + tst_brk_(file, lineno, TBROK | TERRNO,
> + "statvfs(%s,%p) failed", path, buf);
> + } else if (rval) {
> + tst_brk_(file, lineno, TBROK | TERRNO,
> + "Invalid statvfs(%s,%p) return value %d", path, buf,
> + rval);
> + }
@Wei We usually add only function signature to headers, the rest goes into
lib/tst_safe_macros.c. The only exception are functions in
include/tst_safe_macros_inline.h due off_t or structs which contain it, which is
not this case.
Besides following ioctl_fiemap01.c it could be used also in libs/swap/libswap.c
and lib/tst_fill_fs.c, where we don't even check return code. Not that many
cases but probably useful.
FYI fstatvfs() with TBROK is used in fsync02.c not sure if to add it as well.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-02-27 16:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 5:43 [LTP] [PATCH v1] ioctl_fiemap01: New test for fiemap ioctl() Wei Gao via ltp
2024-01-15 15:23 ` Cyril Hrubis
2024-01-18 7:32 ` [LTP] [PATCH v2] " Wei Gao via ltp
2024-02-28 17:07 ` Petr Vorel
2024-03-29 8:28 ` Wei Gao via ltp
2024-03-29 21:32 ` Petr Vorel
2024-03-31 2:15 ` Wei Gao via ltp
2024-03-31 2:17 ` [LTP] [PATCH v3] " Wei Gao via ltp
2024-04-03 9:28 ` Petr Vorel
2024-04-15 10:17 ` Wei Gao via ltp
2024-04-15 12:17 ` Petr Vorel
2024-04-15 11:46 ` [LTP] [PATCH v4] " Wei Gao via ltp
2024-11-06 10:34 ` Cyril Hrubis
2024-12-12 8:50 ` [LTP] [PATCH v5 0/2] " Wei Gao via ltp
2024-12-12 8:50 ` [LTP] [PATCH v5 1/2] tst_safe_macros.h: Add SAFE_STATVFS Wei Gao via ltp
2025-02-27 16:27 ` Petr Vorel [this message]
2025-04-10 5:39 ` Wei Gao via ltp
2024-12-12 8:50 ` [LTP] [PATCH v5 2/2] ioctl_fiemap01: New test for fiemap ioctl() Wei Gao via ltp
2025-02-27 16:43 ` Petr Vorel
2025-04-10 5:31 ` Wei Gao via ltp
2025-04-10 5:49 ` [LTP] [PATCH v6 0/2] " Wei Gao via ltp
2025-04-10 5:49 ` [LTP] [PATCH v6 1/2] tst_safe_macros.h: Add SAFE_STATVFS Wei Gao via ltp
2025-04-11 13:38 ` Petr Vorel
2025-04-10 5:49 ` [LTP] [PATCH v6 2/2] ioctl_fiemap01: New test for fiemap ioctl() Wei Gao via ltp
2025-04-11 15:40 ` Cyril Hrubis
2025-04-15 1:39 ` [LTP] [PATCH v7 0/2] " Wei Gao via ltp
2025-04-15 1:39 ` [LTP] [PATCH v7 1/2] tst_safe_macros.h: Add SAFE_STATVFS Wei Gao via ltp
2025-04-15 1:39 ` [LTP] [PATCH v7 2/2] ioctl_fiemap01: New test for fiemap ioctl() Wei Gao via ltp
2025-04-14 16:02 ` 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=20250227162717.GF3130282@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=wegao@suse.com \
/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