From: Tarun Sahu <tsahu@linux.ibm.com>
To: ltp@lists.linux.it
Cc: geetika@linux.ibm.com, sbhat@linux.ibm.com,
aneesh.kumar@linux.ibm.com, vaibhav@linux.ibm.com
Subject: [LTP] [PATCH v6 1/2] Hugetlb: Safe macro for posix_fadvise call
Date: Sat, 26 Nov 2022 04:07:39 +0530 [thread overview]
Message-ID: <20221125223740.80580-1-tsahu@linux.ibm.com> (raw)
In-Reply-To: <20221120191533.164848-1-tsahu@linux.ibm.com>
This patch adds SAFE_POSIX_FADVISE for posix_fadvise call.
Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com>
---
include/tst_safe_macros.h | 17 +++++++++++++++++
include/tst_test.h | 24 ++++++++++++------------
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index 81c4b0844..ab00dd14a 100644
--- a/include/tst_safe_macros.h
+++ b/include/tst_safe_macros.h
@@ -298,6 +298,23 @@ static inline int safe_ftruncate(const char *file, const int lineno,
#define SAFE_FTRUNCATE(fd, length) \
safe_ftruncate(__FILE__, __LINE__, (fd), (length))
+static inline int safe_posix_fadvise(const char *file, const int lineno,
+ int fd, off_t offset, off_t len, int advice)
+{
+ int rval;
+
+ rval = posix_fadvise(fd, offset, len, advice);
+
+ if (rval)
+ tst_brk_(file, lineno, TBROK,
+ "posix_fadvise(%d,%ld,%ld,%d) failed: %s",
+ fd, (long)offset, (long)len, advice, tst_strerrno(rval));
+
+ return rval;
+}
+#define SAFE_POSIX_FADVISE(fd, offset, len, advice) \
+ safe_posix_fadvise(__FILE__, __LINE__, (fd), (offset), (len), (advice))
+
static inline int safe_truncate(const char *file, const int lineno,
const char *path, off_t length)
{
diff --git a/include/tst_test.h b/include/tst_test.h
index a62515bfe..2de9301e5 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -95,6 +95,18 @@ pid_t safe_fork(const char *filename, unsigned int lineno);
({int ret = expr; \
ret != 0 ? tst_res(TINFO, #expr " failed"), ret : ret; }) \
+/*
+ * Functions to convert ERRNO to its name and SIGNAL to its name.
+ */
+const char *tst_strerrno(int err);
+const char *tst_strsig(int sig);
+/*
+ * Returns string describing status as returned by wait().
+ *
+ * BEWARE: Not thread safe.
+ */
+const char *tst_strstatus(int status);
+
#include "tst_safe_macros.h"
#include "tst_safe_file_ops.h"
#include "tst_safe_net.h"
@@ -333,18 +345,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
*/
void tst_reinit(void);
-/*
- * Functions to convert ERRNO to its name and SIGNAL to its name.
- */
-const char *tst_strerrno(int err);
-const char *tst_strsig(int sig);
-/*
- * Returns string describing status as returned by wait().
- *
- * BEWARE: Not thread safe.
- */
-const char *tst_strstatus(int status);
-
unsigned int tst_multiply_timeout(unsigned int timeout);
/*
--
2.31.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-11-25 22:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-20 19:15 [LTP] [PATCH v5 0/7][PART 2] Hugetlb:Migrating the libhugetlbfs tests Tarun Sahu
2022-11-20 19:15 ` [LTP] [PATCH v5 1/7] Hugetlb: Add new argument flags in tst_creat_unlinked Tarun Sahu
2022-11-24 11:55 ` Cyril Hrubis
2022-11-20 19:15 ` [LTP] [PATCH v5 2/7] Hugetlb: Migrating libhugetlbfs counters Tarun Sahu
2022-11-20 19:15 ` [LTP] [PATCH v5 3/7] Hugetlb: Migrating libhugetlbfs directio Tarun Sahu
2022-11-20 19:15 ` [LTP] [PATCH v5 4/7] Hugetlb: Safe macro for posix_fadvise call Tarun Sahu
2022-11-24 11:59 ` Cyril Hrubis
2022-11-25 17:34 ` Tarun Sahu
2022-11-25 18:59 ` Cyril Hrubis
2022-11-20 19:15 ` [LTP] [PATCH v5 5/7] Hugetlb: Migrating libhugetlbfs fadvise_reserve Tarun Sahu
2022-11-20 19:15 ` [LTP] [PATCH v5 6/7] Hugetlb: Migrating libhugetlbfs fallocate_align Tarun Sahu
2022-11-24 14:51 ` Cyril Hrubis
2022-11-20 19:15 ` [LTP] [PATCH v5 7/7] Hugetlb: Migrating libhugetlbfs fallocate_basic Tarun Sahu
2022-11-25 22:37 ` Tarun Sahu [this message]
2022-11-25 22:37 ` [LTP] [PATCH v6 2/2] Hugetlb: Migrating libhugetlbfs fadvise_reserve Tarun Sahu
2022-11-29 16:21 ` [LTP] [PATCH v6 1/2] Hugetlb: Safe macro for posix_fadvise call Cyril Hrubis
2022-12-01 8:35 ` Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 0/8][PART 3] Hugetlb:Migrating the libhugetlbfs tests Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 1/8] Hugetlb: Migrating libhugetlbfs fork-cow Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 2/8] Hugetlb: Migrating libhugetlbfs huge_at_4GB_normal_below Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 3/8] Hugetlb: Migrating libhugetlbfs huge_below_4GB_normal_above Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 4/8] Hugetlb: Migrating libhugetlbfs icache-hygiene Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 5/8] Hugetlb: Migrating libhugetlbfs madvise_reserve Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 6/8] Hugetlb: Migrating libhugetlbfs map_high_truncate_2 Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 7/8] Hugetlb: Migrating libhugetlbfs misalign Tarun Sahu
2022-12-01 12:02 ` [LTP] [PATCH 8/8] Hugetlb: Migrating libhugetlbfs misaligned_offset Tarun Sahu
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=20221125223740.80580-1-tsahu@linux.ibm.com \
--to=tsahu@linux.ibm.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=geetika@linux.ibm.com \
--cc=ltp@lists.linux.it \
--cc=sbhat@linux.ibm.com \
--cc=vaibhav@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.