public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Wei Gao via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v6 1/2] tst_safe_macros.h: Add SAFE_STATVFS
Date: Thu, 10 Apr 2025 01:49:55 -0400	[thread overview]
Message-ID: <20250410054956.5071-2-wegao@suse.com> (raw)
In-Reply-To: <20250410054956.5071-1-wegao@suse.com>

Signed-off-by: Wei Gao <wegao@suse.com>
---
 include/tst_safe_macros.h |  6 ++++++
 lib/tst_safe_macros.c     | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index 3b02f86c7..19504beb5 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -12,6 +12,7 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
+#include <sys/statvfs.h>
 #include <sys/vfs.h>
 #include <sys/sysinfo.h>
 #include <sys/uio.h>
@@ -503,4 +504,9 @@ char *safe_ptsname(const char *const file, const int lineno, int masterfd);
 #define SAFE_PTSNAME(masterfd) \
 	safe_ptsname(__FILE__, __LINE__, (masterfd))
 
+int safe_statvfs(const char *file, const int lineno,
+                              const char *path, struct statvfs *buf);
+#define SAFE_STATVFS(path, buf) \
+	safe_statvfs(__FILE__, __LINE__, (path), (buf))
+
 #endif /* TST_SAFE_MACROS_H__ */
diff --git a/lib/tst_safe_macros.c b/lib/tst_safe_macros.c
index ba095a621..cdc8c7dd3 100644
--- a/lib/tst_safe_macros.c
+++ b/lib/tst_safe_macros.c
@@ -810,3 +810,22 @@ char *safe_ptsname(const char *const file, const int lineno, int masterfd)
 
 	return name;
 }
+
+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);
+	}
+
+	return rval;
+}
-- 
2.35.3


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

  reply	other threads:[~2025-04-10  5:50 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
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           ` Wei Gao via ltp [this message]
2025-04-11 13:38             ` [LTP] [PATCH v6 1/2] tst_safe_macros.h: Add SAFE_STATVFS 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=20250410054956.5071-2-wegao@suse.com \
    --to=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