mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Gellermann <christian.gellermann@codasip.com>
To: shuah@kernel.org, linux-kselftest@vger.kernel.org
Cc: reddybalavignesh9979@gmail.com, richard.weiyang@gmail.com,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Chris Gellermann <christian.gellermann@codasip.com>
Subject: [PATCH 1/2] selftests/dma-buf: Convert off64_t to off_t for portability
Date: Thu,  3 Sep 2026 12:50:17 +0200	[thread overview]
Message-ID: <20260903105018.565425-2-christian.gellermann@codasip.com> (raw)
In-Reply-To: <20260903105018.565425-1-christian.gellermann@codasip.com>

Use the POSIX type off_t [1] instead of the GNU-specific 64-bit offset type
off64_t. Ensure it is 64 bit wide by compiling with _FILE_OFFSET_BITS
set to 64.

Link: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html [1]
Signed-off-by: Chris Gellermann <christian.gellermann@codasip.com>
---
 tools/testing/selftests/drivers/dma-buf/Makefile  |  1 +
 tools/testing/selftests/drivers/dma-buf/udmabuf.c | 14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/drivers/dma-buf/Makefile b/tools/testing/selftests/drivers/dma-buf/Makefile
index 441407bb0e80..1d65676f969e 100644
--- a/tools/testing/selftests/drivers/dma-buf/Makefile
+++ b/tools/testing/selftests/drivers/dma-buf/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
+CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += $(KHDR_INCLUDES)
 
 TEST_GEN_PROGS := udmabuf
diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
index d78aec662586..2def04ed3451 100644
--- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c
+++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
@@ -25,7 +25,7 @@
 
 static unsigned int page_size;
 
-static int create_memfd_with_seals(off64_t size, bool hpage)
+static int create_memfd_with_seals(off_t size, bool hpage)
 {
 	int memfd, ret;
 	unsigned int flags = MFD_ALLOW_SEALING;
@@ -54,7 +54,7 @@ static int create_memfd_with_seals(off64_t size, bool hpage)
 	return memfd;
 }
 
-static int create_udmabuf_list(int devfd, int memfd, off64_t memfd_size)
+static int create_udmabuf_list(int devfd, int memfd, off_t memfd_size)
 {
 	struct udmabuf_create_list *list;
 	int ubuf_fd, i;
@@ -84,7 +84,7 @@ static int create_udmabuf_list(int devfd, int memfd, off64_t memfd_size)
 	return ubuf_fd;
 }
 
-static void write_to_memfd(void *addr, off64_t size, char chr)
+static void write_to_memfd(void *addr, off_t size, char chr)
 {
 	int i;
 
@@ -93,7 +93,7 @@ static void write_to_memfd(void *addr, off64_t size, char chr)
 	}
 }
 
-static void *mmap_fd(int fd, off64_t size)
+static void *mmap_fd(int fd, off_t size)
 {
 	void *addr;
 
@@ -106,9 +106,9 @@ static void *mmap_fd(int fd, off64_t size)
 	return addr;
 }
 
-static int compare_chunks(void *addr1, void *addr2, off64_t memfd_size)
+static int compare_chunks(void *addr1, void *addr2, off_t memfd_size)
 {
-	off64_t off;
+	off_t off;
 	int i = 0, j, k = 0, ret = 0;
 	char char1, char2;
 
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
 {
 	struct udmabuf_create create;
 	int devfd, memfd, buf, ret;
-	off64_t size;
+	off_t size;
 	void *addr1, *addr2;
 
 	ksft_print_header();
-- 
2.47.3


  reply	other threads:[~2026-09-03 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 10:50 [PATCH 0/2] selftests/dma-buf: Minor improvements to udmabuf selftest Chris Gellermann
2026-09-03 10:50 ` Chris Gellermann [this message]
2026-09-03 10:50 ` [PATCH 2/2] selftests/dma-buf: Skip some tests if not enough free huge pages Chris Gellermann

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=20260903105018.565425-2-christian.gellermann@codasip.com \
    --to=christian.gellermann@codasip.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=reddybalavignesh9979@gmail.com \
    --cc=richard.weiyang@gmail.com \
    --cc=shuah@kernel.org \
    /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

all inboxes | Powered by JetHome®