($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Andrea Cervesato <andrea.cervesato@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1 01/10] Add SAFE_STATX macro
Date: Wed, 15 May 2024 11:33:40 +0200	[thread overview]
Message-ID: <20240515093349.7347-2-andrea.cervesato@suse.de> (raw)
In-Reply-To: <20240515093349.7347-1-andrea.cervesato@suse.de>

From: Andrea Cervesato <andrea.cervesato@suse.com>

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 include/tst_safe_macros.h |  7 +++++++
 lib/tst_safe_macros.c     | 21 +++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index 8de8ef106..43ff50a33 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -503,4 +503,11 @@ int safe_sscanf(const char *file, const int lineno, const char *restrict buffer,
 #define SAFE_SSCANF(buffer, format, ...) \
 	safe_sscanf(__FILE__, __LINE__, (buffer), (format),	##__VA_ARGS__)
 
+struct statx;
+int safe_statx(const char *file, const int lineno,
+	int dirfd, const char *pathname, int flags, unsigned int mask,
+	struct statx *buf);
+#define SAFE_STATX(dirfd, pathname, flags, mask, buf) \
+	safe_statx(__FILE__, __LINE__, (dirfd), (pathname), (flags), (mask), (buf))
+
 #endif /* TST_SAFE_MACROS_H__ */
diff --git a/lib/tst_safe_macros.c b/lib/tst_safe_macros.c
index 39b8cc924..bf2f3c0d8 100644
--- a/lib/tst_safe_macros.c
+++ b/lib/tst_safe_macros.c
@@ -710,3 +710,24 @@ int safe_mprotect(const char *file, const int lineno,
 
 	return rval;
 }
+
+int safe_statx(const char *file, const int lineno,
+	int dirfd, const char *pathname, int flags, unsigned int mask,
+	struct statx *buf)
+{
+	int rval;
+
+	rval = statx(dirfd, pathname, flags, mask, buf);
+
+	if (rval == -1) {
+		tst_brk_(file, lineno, TBROK | TERRNO,
+			"statx(%d,%s,%d,%u,%p) failed", dirfd, pathname, flags, mask, buf);
+	} else if (rval) {
+		tst_brk_(file, lineno, TBROK | TERRNO,
+			"Invalid statx(%d,%s,%d,%u,%p) return value %d",
+			dirfd, pathname, flags, mask, buf,
+			rval);
+	}
+
+	return rval;
+}
-- 
2.35.3


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

  reply	other threads:[~2024-05-15  9:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15  9:33 [LTP] [PATCH v1 00/10] statmount/listmount testing suites Andrea Cervesato
2024-05-15  9:33 ` Andrea Cervesato [this message]
2024-05-16  1:30   ` [LTP] [PATCH v1 01/10] Add SAFE_STATX macro Petr Vorel
2024-05-16 11:50     ` Andrea Cervesato via ltp
2024-05-16 14:49       ` Petr Vorel
2024-05-16 14:59         ` Andrea Cervesato via ltp
2024-05-16 16:27           ` Petr Vorel
2024-05-15  9:33 ` [LTP] [PATCH v1 02/10] Add listmount/statmount fallback declarations Andrea Cervesato
2024-05-16  1:22   ` Petr Vorel
2024-05-15  9:33 ` [LTP] [PATCH v1 03/10] Add listmount01 test Andrea Cervesato
2024-05-15  9:33 ` [LTP] [PATCH v1 04/10] Add listmount02 test Andrea Cervesato
2024-05-15  9:33 ` [LTP] [PATCH v1 05/10] Add stamount01 test Andrea Cervesato
2024-05-15  9:33 ` [LTP] [PATCH v1 06/10] Add statmount02 test Andrea Cervesato
2024-05-15  9:33 ` [LTP] [PATCH v1 07/10] Add statmount03 test Andrea Cervesato
2024-05-15  9:33 ` [LTP] [PATCH v1 08/10] Add statmount04 test Andrea Cervesato
2024-05-15  9:33 ` [LTP] [PATCH v1 09/10] Add statmount05 test Andrea Cervesato
2024-05-15  9:33 ` [LTP] [PATCH v1 10/10] Add statmount06 test Andrea Cervesato
2024-05-15 10:31 ` [LTP] [PATCH v1 00/10] statmount/listmount testing suites Andrea Cervesato via ltp

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=20240515093349.7347-2-andrea.cervesato@suse.de \
    --to=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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).