Replace lseek64 with lseek
Update patch status accordingly

Signed-off-by: Khem Raj <[email protected]>
---
 ...d.h-not-argp.h-for-all-POSIX-systems.patch |  2 +-
 .../fatcat/0002-Enable-64bit-off_t.patch      | 71 +++++++++++++++++++
 .../recipes-utils/fatcat/fatcat_1.1.1.bb      |  1 +
 3 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 
meta-filesystems/recipes-utils/fatcat/fatcat/0002-Enable-64bit-off_t.patch

diff --git 
a/meta-filesystems/recipes-utils/fatcat/fatcat/0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch
 
b/meta-filesystems/recipes-utils/fatcat/fatcat/0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch
index fd8e22abca..7e215e3080 100644
--- 
a/meta-filesystems/recipes-utils/fatcat/fatcat/0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch
+++ 
b/meta-filesystems/recipes-utils/fatcat/fatcat/0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch
@@ -8,8 +8,8 @@ of any of the GNU specific argp extensions. Include unistd.h 
directly to
 allow building with musl on linux, whilst retaining compatibility with
 glibc and other unices.
 
+Upstream-status: Submitted [https://github.com/Gregwar/fatcat/pull/34]
 Signed-off-by: Alex Kiernan <[email protected]>
-Upstream-status: Pending
 ---
  src/fatcat.cpp | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)
diff --git 
a/meta-filesystems/recipes-utils/fatcat/fatcat/0002-Enable-64bit-off_t.patch 
b/meta-filesystems/recipes-utils/fatcat/fatcat/0002-Enable-64bit-off_t.patch
new file mode 100644
index 0000000000..caaf105eea
--- /dev/null
+++ b/meta-filesystems/recipes-utils/fatcat/fatcat/0002-Enable-64bit-off_t.patch
@@ -0,0 +1,71 @@
+From 0383fff94471278c92ef2ad5edc14abbb40a9acd Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 16 Dec 2022 18:54:55 -0800
+Subject: [PATCH] Enable 64bit off_t
+
+Ensure that off_t is always 64-bit by specifying -D_LARGEFILE_SOURCE
+-D_FILE_OFFSET_BITS=64 this will ensure that normal lseek() function is
+same as lseek64
+
+This helps compiling on latest musl where lseek64 and friends are not
+available
+
+Upstream-status: Submitted [https://github.com/Gregwar/fatcat/pull/34]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ CMakeLists.txt         | 2 ++
+ src/core/FatSystem.cpp | 4 ++--
+ src/core/FatSystem.h   | 2 --
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d6a2649..4cdd1fb 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -34,6 +34,8 @@ IF(DEFINE_WIN)
+       add_definitions(-D__WIN__)
+ ENDIF(DEFINE_WIN)
+ 
++add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64)
++
+ include_directories("${CMAKE_SOURCE_DIR}/src")
+ 
+ add_executable(fatcat "src/fatcat.cpp" ${ALL_SOURCES})
+diff --git a/src/core/FatSystem.cpp b/src/core/FatSystem.cpp
+index 79cda8c..1f52e82 100644
+--- a/src/core/FatSystem.cpp
++++ b/src/core/FatSystem.cpp
+@@ -90,7 +90,7 @@ int FatSystem::readData(unsigned long long address, char 
*buffer, int size)
+         cerr << "! Trying to read outside the disk" << endl;
+     }
+ 
+-    lseek64(fd, globalOffset+address, SEEK_SET);
++    lseek(fd, globalOffset+address, SEEK_SET);
+ 
+     int n;
+     int pos = 0;
+@@ -112,7 +112,7 @@ int FatSystem::writeData(unsigned long long address, const 
char *buffer, int siz
+         throw string("Trying to write data while write mode is disabled");
+     }
+ 
+-    lseek64(fd, globalOffset+address, SEEK_SET);
++    lseek(fd, globalOffset+address, SEEK_SET);
+ 
+     int n;
+     int pos = 0;
+diff --git a/src/core/FatSystem.h b/src/core/FatSystem.h
+index cd3c914..f9f2ca3 100644
+--- a/src/core/FatSystem.h
++++ b/src/core/FatSystem.h
+@@ -11,11 +11,9 @@
+ 
+ #ifdef __APPLE__
+ #define O_LARGEFILE 0
+-#define lseek64 lseek
+ #endif
+ #ifdef __WIN__
+ #define O_LARGEFILE 0
+-#define lseek64 lseek
+ #endif
+ using namespace std;
+ 
diff --git a/meta-filesystems/recipes-utils/fatcat/fatcat_1.1.1.bb 
b/meta-filesystems/recipes-utils/fatcat/fatcat_1.1.1.bb
index e344eda154..982a52d62f 100644
--- a/meta-filesystems/recipes-utils/fatcat/fatcat_1.1.1.bb
+++ b/meta-filesystems/recipes-utils/fatcat/fatcat_1.1.1.bb
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = 
"file://LICENSE;md5=57fbbfebd0dd1d6ff21b8cecb552a03f"
 
 SRC_URI = "git://github.com/Gregwar/fatcat.git;branch=master;protocol=https \
            file://0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch \
+           file://0002-Enable-64bit-off_t.patch \
            "
 
 SRCREV = "99cb99fc86eb1601ac7ae27f5bba23add04d2543"
-- 
2.39.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#100086): 
https://lists.openembedded.org/g/openembedded-devel/message/100086
Mute This Topic: https://lists.openembedded.org/mt/95753563/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to