Skip to contentSkip to conversation

f2fs-tools: convert to lseek() and kill lseek64

PATCH New Jaegeuk Kim 1 participant 1 message Aug 24, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs-tools: convert to lseek() and kill lseek64

From: Waldemar Brodkorb <[email protected]>

This patch replaces lseek64 with lseek() having #define _FILE_OFFSET_BITS 64.

---
 configure.ac              |  2 --
 fsck/Makefile.am          |  2 +-
 include/android_config.h  |  4 ----
 lib/Makefile.am           |  2 +-
 lib/libf2fs.c             |  3 ---
 lib/libf2fs_io.c          | 47 +++++++++++++++------------------------
 lib/libf2fs_zoned.c       |  1 -
 mkfs/Makefile.am          |  4 ++--
 mkfs/f2fs_format.c        |  2 --
 mkfs/f2fs_format_main.c   |  2 --
 mkfs/f2fs_format_utils.c  | 10 ---------
 mkfs/f2fs_format_utils.h  |  2 --
 tools/Makefile.am         |  2 +-
 tools/f2fs_io/Makefile.am |  2 +-
 tools/f2fs_io/f2fs_io.c   |  6 -----
 tools/f2fs_io_parse.c     |  1 -
 tools/f2fscrypt.c         |  9 --------
 tools/fibmap.c            |  7 ------
 18 files changed, 24 insertions(+), 84 deletions(-)
configure.ac +0 -2
index efab8d8412b6..123ddbbaf3eb 100644
@@ -187,8 +187,6 @@ AC_CHECK_FUNCS_ONCE([
 	getmntent
 	getuid
 	keyctl
-	llseek
-	lseek64
 	memset
 	setmntent
 	clock_gettime
fsck/Makefile.am +1 -1
index 579dd26cd6c9..40d31b837dac 100644
@@ -1,7 +1,7 @@
 ## Makefile.am
 
 AM_CPPFLAGS = ${libuuid_CFLAGS} -I$(top_srcdir)/include
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
 sbin_PROGRAMS = fsck.f2fs
 noinst_HEADERS = common.h dict.h dqblk_v2.h f2fs.h fsck.h node.h quotaio.h \
 		quotaio_tree.h quotaio_v2.h xattr.h compress.h
include/android_config.h +0 -4
index 141fe0640a17..da8abcb2f972 100644
@@ -30,8 +30,6 @@
 #define HAVE_FSTAT 1
 #define HAVE_FSTAT64 1
 #define HAVE_GETMNTENT 1
-#define HAVE_LLSEEK 1
-#define HAVE_LSEEK64 1
 #define HAVE_MEMSET 1
 #define HAVE_SELINUX_ANDROID_H 1
 #define HAVE_SETMNTENT 1
@@ -67,7 +65,6 @@
 #define HAVE_FSTAT 1
 #define HAVE_FSTAT64 1
 #define HAVE_GETMNTENT 1
-#define HAVE_LLSEEK 1
 #define HAVE_MEMSET 1
 #define HAVE_SPARSE_SPARSE_H 1
 #define HAVE_LIBLZ4 1
@@ -78,6 +75,5 @@
 #endif
 
 #if defined(_WIN32)
-#define HAVE_LSEEK64
 #define HAVE_SPARSE_SPARSE_H 1
 #endif
lib/Makefile.am +1 -1
index 871d773176e9..69d46f833c30 100644
@@ -3,7 +3,7 @@
 lib_LTLIBRARIES = libf2fs.la
 
 libf2fs_la_SOURCES = libf2fs.c libf2fs_io.c libf2fs_zoned.c nls_utf8.c
-libf2fs_la_CFLAGS = -Wall
+libf2fs_la_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
 libf2fs_la_CPPFLAGS = -I$(top_srcdir)/include
 libf2fs_la_LDFLAGS = -version-info $(LIBF2FS_CURRENT):$(LIBF2FS_REVISION):$(LIBF2FS_AGE)
 
lib/libf2fs.c +0 -3
index 577a7e8caccd..c3d574432c87 100644
@@ -6,9 +6,6 @@
  *
  * Dual licensed under the GPL or LGPL version 2 licenses.
  */
-#define _LARGEFILE64_SOURCE
-#define _FILE_OFFSET_BITS 64
-
 #include <f2fs_fs.h>
 #include <stdio.h>
 #include <stdlib.h>
lib/libf2fs_io.c +18 -29

137 lines not on this page · raw message

lib/libf2fs_zoned.c +0 -1
index a0dd8bd269ef..2ab2497ab211 100644
@@ -6,7 +6,6 @@
  *
  * Dual licensed under the GPL or LGPL version 2 licenses.
  */
-#define _LARGEFILE64_SOURCE
 
 #include <f2fs_fs.h>
 #include <stdio.h>
mkfs/Makefile.am +2 -2
index af5b1c74b831..bfffd88de108 100644
@@ -1,7 +1,7 @@
 ## Makefile.am
 
 AM_CPPFLAGS = ${libuuid_CFLAGS} ${libblkid_CFLAGS} -I$(top_srcdir)/include
-AM_CFLAGS = -Wall -DWITH_BLKDISCARD
+AM_CFLAGS = -Wall -DWITH_BLKDISCARD -D_FILE_OFFSET_BITS=64
 sbin_PROGRAMS = mkfs.f2fs
 noinst_HEADERS = f2fs_format_utils.h
 include_HEADERS = $(top_srcdir)/include/f2fs_fs.h
@@ -10,7 +10,7 @@ mkfs_f2fs_LDADD = ${libuuid_LIBS} ${libblkid_LIBS} $(top_builddir)/lib/libf2fs.l
 
 lib_LTLIBRARIES = libf2fs_format.la
 libf2fs_format_la_SOURCES = f2fs_format_main.c f2fs_format.c f2fs_format_utils.c
-libf2fs_format_la_CFLAGS = -DWITH_BLKDISCARD
+libf2fs_format_la_CFLAGS = -DWITH_BLKDISCARD -D_FILE_OFFSET_BITS=64
 libf2fs_format_la_LDFLAGS = ${libblkid_LIBS} ${libuuid_LIBS} -L$(top_builddir)/lib -lf2fs \
 	-version-info $(FMT_CURRENT):$(FMT_REVISION):$(FMT_AGE)
 
mkfs/f2fs_format.c +0 -2
index 019fb3a3d9af..d937eda39221 100644
@@ -6,8 +6,6 @@
  *
  * Dual licensed under the GPL or LGPL version 2 licenses.
  */
-#define _LARGEFILE64_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
mkfs/f2fs_format_main.c +0 -2
index d8c9cea160a3..08c1b254d24c 100644
@@ -6,8 +6,6 @@
  *
  * Dual licensed under the GPL or LGPL version 2 licenses.
  */
-#define _LARGEFILE64_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
mkfs/f2fs_format_utils.c +0 -10
index 448fbaa8866e..437f113b49c6 100644
@@ -6,20 +6,10 @@
  *
  * Dual licensed under the GPL or LGPL version 2 licenses.
  */
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
 
-#ifndef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-
 #include <f2fs_fs.h>
 
 #include <stdio.h>
mkfs/f2fs_format_utils.h +0 -2
index 807e7c327601..6a7f6874a951 100644
@@ -6,8 +6,6 @@
  *
  * Dual licensed under the GPL or LGPL version 2 licenses.
  */
-#define _LARGEFILE64_SOURCE
-
 #include "f2fs_fs.h"
 
 extern struct f2fs_configuration c;
tools/Makefile.am +1 -1
index 6b03814463bc..7dfffb17a31f 100644
@@ -1,7 +1,7 @@
 ## Makefile.am
 
 AM_CPPFLAGS = ${libuuid_CFLAGS} -I$(top_srcdir)/include
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
 sbin_PROGRAMS =
 if !WINDOWS
 sbin_PROGRAMS += fibmap.f2fs parse.f2fs
tools/f2fs_io/Makefile.am +1 -1
index bc4f9d011331..f5227ce21b00 100644
@@ -2,7 +2,7 @@
 
 if LINUX
 AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
 sbin_PROGRAMS = f2fs_io
 f2fs_io_SOURCES = f2fs_io.c
 endif
tools/f2fs_io/f2fs_io.c +0 -6
index 771fd165fb68..1f6549b46746 100644
@@ -9,12 +9,6 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
 #endif
tools/f2fs_io_parse.c +0 -1
index 47f1194f7335..c3c1005ac27f 100644
@@ -8,7 +8,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#define _LARGEFILE64_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
tools/f2fscrypt.c +0 -9
index 8640ffae1404..d5222fb4121b 100644
@@ -7,15 +7,6 @@
  * Authors: Michael Halcrow <[email protected]>,
  *	    Ildar Muslukhov <[email protected]>
  */
-
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
-
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
tools/fibmap.c +0 -7
index bda8238d5ece..3acc77ba1f6a 100644
@@ -1,13 +1,6 @@
 #if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
 #define _XOPEN_SOURCE 600
 #define _DARWIN_C_SOURCE
-#define _FILE_OFFSET_BITS 64
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
Signature · 8 lines
2.42.0.rc1.204.g551eb34607-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel