[LTP] [PATCH v3 1/2] lapi/fs: Replace loff_t with long long

Petr Vorel pvorel@suse.cz
Thu Apr 25 17:55:31 CEST 2024


loff_t in tst_max_lfs_filesize() would require define _GNU_SOURCE.
Replace with long long to avoid this.

This fixes build error on musl (alpine):

    In file included from unlink09.c:18:
    ../../../../include/lapi/fs.h:58:15: error: unknown type name 'loff_t'
       58 | static inline loff_t tst_max_lfs_filesize(void)

Fixes: 2cf78f47a ("unlink: Add error tests for EPERM and EROFS")
Suggested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
changes v2->v3
* Use just long long instead of define _GNU_SOURCE (Jan)

Later I move this out of LAPI header, but now let's fix the CI.

Kind regards,
Petr

 include/lapi/fs.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/lapi/fs.h b/include/lapi/fs.h
index c19ee821d..635979b02 100644
--- a/include/lapi/fs.h
+++ b/include/lapi/fs.h
@@ -55,13 +55,13 @@
  * 64 bit: macro taken from kernel from include/linux/fs.h
  * 32 bit: own implementation
  */
-static inline loff_t tst_max_lfs_filesize(void)
+static inline long long tst_max_lfs_filesize(void)
 {
 #ifdef TST_ABI64
-	return (loff_t)LLONG_MAX;
+	return LLONG_MAX;
 #else
         long page_size = getpagesize();
-        loff_t ret = ULONG_MAX;
+        long long ret = ULONG_MAX;
 
         while (page_size >>= 1)
                 ret <<= 1;
-- 
2.43.0



More information about the ltp mailing list