configure: Use 64bit off_t
PATCH v4 1/3 configure: Use 64bit off_t
Pass -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 via CFLAGS this enabled large file support on 32bit architectures
Signed-off-by Khem Raj <[email protected]>
--- configure.ac | 3 +++ 1 file changed, 3 insertions(+)
configure.ac +3 -0
@@ -319,6 +319,9 @@ if test "x$enable_lzma" = "xyes"; then CPPFLAGS="${saved_CPPFLAGS}" fi +# Enable 64-bit off_t +CFLAGS+=" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + # Set up needed symbols, conditionals and compiler/linker flags AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"]) AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"])
Signature · 1 line
2.39.0
PATCH v4 2/3 erofs: replace [l]stat64 by equivalent [l]stat
Signed-off-by Khem Raj <[email protected]>
--- lib/inode.c | 10 +++++----- lib/xattr.c | 4 ++-- mkfs/main.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-)
lib/inode.c +5 -5
@@ -773,7 +773,7 @@ static u32 erofs_new_encode_dev(dev_t dev)#ifdef WITH_ANDROID int erofs_droid_inode_fsconfig (struct erofs_inode *inode, -struct stat64 *st, +struct stat *st,const char *path) {/* filesystem_config does not preserve file type bits */
@@ -818,7 +818,7 @@ int erofs_droid_inode_fsconfig(struct erofs_inode *inode, }#else static int erofs_droid_inode_fsconfig (struct erofs_inode *inode, -struct stat64 *st, +struct stat *st,const char *path) {return 0 ;
@@ -826,7 +826,7 @@ static int erofs_droid_inode_fsconfig(struct erofs_inode *inode,#endif static int erofs_fill_inode (struct erofs_inode *inode, -struct stat64 *st, +struct stat *st,const char *path) {int err =erofs_droid_inode_fsconfig (inode, st, path);
@@ -910,7 +910,7 @@ static struct erofs_inode *erofs_new_inode(void)/* get the inode from the (source) path */ static struct erofs_inode *erofs_iget_from_path (const char *path,bool is_src) { -struct stat64 st; +struct stat st;struct erofs_inode *inode;int ret;
@@ -918,7 +918,7 @@ static struct erofs_inode *erofs_iget_from_path(const char *path, bool is_src)if (!is_src)return ERR_PTR (-EINVAL ); - ret =lstat64 (path, &st); + ret =lstat (path, &st);if (ret)return ERR_PTR (-errno);
lib/xattr.c +2 -2
@@ -467,7 +467,7 @@ static int erofs_count_all_xattrs_from_path(const char *path) {int ret;DIR *_dir; -struct stat64 st; +struct stat st; _dir =opendir (path);if (!_dir) {
@@ -502,7 +502,7 @@ static int erofs_count_all_xattrs_from_path(const char *path) goto fail; } - ret =lstat64 (buf, &st); + ret =lstat (buf, &st);if (ret) { ret = -errno; goto fail;
mkfs/main.c +2 -2
@@ -581,7 +581,7 @@ int main(int argc, char **argv)struct erofs_buffer_head *sb_bh;struct erofs_inode *root_inode;erofs_nid_t root_nid; -struct stat64 st; +struct stat st;erofs_blk_t nblocks;struct timeval t;char uuid_str[37 ] ="not available" ;
@@ -609,7 +609,7 @@ int main(int argc, char **argv)return 1 ; } - err =lstat64 (cfg.c_src_path, &st); + err =lstat (cfg.c_src_path, &st);if (err)return 1 ;if (!S_ISDIR (st.st_mode)) {
Signature · 1 line
2.39.0
PATCH v4 3/3 internal.h: Make LFS mandatory for all usecases
In reply to Khem Rajerosfs depend on the consistent use of a 64bit offset
type, force downstreams to use transparent LFS (_FILE_OFFSET_BITS=64), so that it becomes impossible for them to use 32bit interfaces.
Signed-off-by Khem Raj <[email protected]>
--- include/erofs/internal.h | 5 +++++ 1 file changed, 5 insertions(+)
include/erofs/internal.h +5 -0
@@ -21,6 +21,7 @@ typedef unsigned short umode_t;#include "erofs_fs.h" #include <fcntl.h> +#include <sys/types.h> /* for off_t definition */ #ifndef PATH_MAX #define PATH_MAX 4096/* # chars in a path name including nul */
@@ -104,6 +105,10 @@ struct erofs_sb_info { }; }; + +/* make sure that any user of the erofs headers has atleast 64bit off_t type */ +extern int erofs_assert_largefile[sizeof (off_t)-8 ]; +/* global sbi */ extern struct erofs_sb_info sbi;
Signature · 1 line
2.39.0
Hi Khem,
Quoted 4 lines · Khem Raj
Pass -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 via CFLAGS this enabled large file support on 32bit architectures
Signed-off-by Khem Raj <[email protected]>
I use this version, rebase to -dev branch and apply them.
Thanks,
Gao Xiang