public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
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,
	mike.kravetz@oracle.com
Subject: [LTP] [PATCH v4 4/7] Hugetlb: Safe macro for posix_fadvise call
Date: Wed, 16 Nov 2022 16:55:13 +0530	[thread overview]
Message-ID: <20221116112516.261535-5-tsahu@linux.ibm.com> (raw)
In-Reply-To: <20221116112516.261535-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 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/tst_safe_macros.h b/include/tst_safe_macros.h
index 81c4b0844..4965e44d0 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 | TERRNO,
+			"posix_fadvise(%d,%ld,%ld,%d) failed",
+			fd, (long)offset, (long)len, advice);
+
+	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)
 {
-- 
2.31.1


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

  parent reply	other threads:[~2022-11-16 11:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 11:25 [LTP] [PATCH v4 0/7] Hugetlb:Migrating the libhugetlbfs tests Tarun Sahu
2022-11-16 11:25 ` [LTP] [PATCH v4 1/7] Hugetlb: Add new argument flags in tst_creat_unlinked Tarun Sahu
2022-11-16 15:17   ` Cyril Hrubis
2022-11-17  7:02     ` Tarun Sahu
2022-11-18  8:27       ` Tarun Sahu
2022-11-16 11:25 ` [LTP] [PATCH v4 2/7] Hugetlb: Migrating libhugetlbfs counters Tarun Sahu
2022-11-16 15:37   ` Cyril Hrubis
2022-11-16 16:26     ` Tarun Sahu
2022-11-18 14:48       ` Cyril Hrubis
2022-11-18 15:51         ` Tarun Sahu
2022-11-16 11:25 ` [LTP] [PATCH v4 3/7] Hugetlb: Migrating libhugetlbfs directio Tarun Sahu
2022-11-16 11:25 ` Tarun Sahu [this message]
2022-11-16 11:25 ` [LTP] [PATCH v4 5/7] Hugetlb: Migrating libhugetlbfs fadvise_reserve Tarun Sahu
2022-11-16 11:25 ` [LTP] [PATCH v4 6/7] Hugetlb: Migrating libhugetlbfs fallocate_align Tarun Sahu
2022-11-16 11:25 ` [LTP] [PATCH v4 7/7] Hugetlb: Migrating libhugetlbfs fallocate_basic 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=20221116112516.261535-5-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=mike.kravetz@oracle.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox