Skip to contentSkip to conversation

xfsprogs: Fix mismatched return type of filesize()

PATCH Superseded Pavel Reichl 3 participants 4 messages Feb 17, 2025 – Feb 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsprogs: Fix mismatched return type of filesize()

The function filesize() was declared with a return type of 'long' but defined with 'off_t'. This mismatch caused build issues due to type incompatibility.

This commit updates the declaration to match the definition, ensuring consistency and preventing potential compilation errors.

---
 mkfs/proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/proto.c +1 -1
index 6dd3a200..981f5b11 100644
@@ -20,7 +20,7 @@ static struct xfs_trans * getres(struct xfs_mount *mp, uint blocks);
 static void rsvfile(xfs_mount_t *mp, xfs_inode_t *ip, long long len);
 static int newregfile(char **pp, char **fname);
 static void rtinit(xfs_mount_t *mp);
-static long filesize(int fd);
+static off_t filesize(int fd);
 static int slashes_are_spaces;
 
 /*
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Pavel Reichl

The function filesize() was declared with a return type of 'long' but defined with 'off_t'. This mismatch caused build issues due to type incompatibility.

This commit updates the declaration to match the definition, ensuring consistency and preventing potential compilation errors.

Looks good, perhaps add:

Fixes 73fb78e5ee8 ("mkfs: support copying in large or sparse files")

?

Otherwise,

Quoted 21 lines
---
 mkfs/proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/proto.c +1 -2
index 6dd3a200..981f5b11 100644
@@ -20,7 +20,7 @@ static struct xfs_trans * getres(struct xfs_mount *mp, uint blocks);
 static void rsvfile(xfs_mount_t *mp, xfs_inode_t *ip, long long len);
 static int newregfile(char **pp, char **fname);
 static void rtinit(xfs_mount_t *mp);
-static long filesize(int fd);
+static off_t filesize(int fd);
 static int slashes_are_spaces;
 
 /*
--

2.48.1

Reviewed-by
#2 lore raw
Quoted 5 lines · Carlos Maiolino
Quoted 4 lines · Pavel Reichl

The function filesize() was declared with a return type of 'long' but defined with 'off_t'. This mismatch caused build issues due to type incompatibility.

Quoted 8 lines
Quoted 4 lines

This commit updates the declaration to match the definition, ensuring consistency and preventing potential compilation errors.

Looks good, perhaps add:

Fixes 73fb78e5ee8 ("mkfs: support copying in large or sparse files")

Yes please! Sorry about the discrepancy.

With that fixed,

--D

Quoted 27 lines

?

Otherwise,

Quoted 21 lines
---
 mkfs/proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/proto.c +1 -2
index 6dd3a200..981f5b11 100644
@@ -20,7 +20,7 @@ static struct xfs_trans * getres(struct xfs_mount *mp, uint blocks);
 static void rsvfile(xfs_mount_t *mp, xfs_inode_t *ip, long long len);
 static int newregfile(char **pp, char **fname);
 static void rtinit(xfs_mount_t *mp);
-static long filesize(int fd);
+static off_t filesize(int fd);
 static int slashes_are_spaces;
 
 /*
--

2.48.1

#3 lore raw

PATCH v2 1/1 xfsprogs: Fix mismatched return type of filesize()

In reply to Pavel Reichl

The function filesize() was declared with a return type of 'long' but defined with 'off_t'. This mismatch caused build issues due to type incompatibility.

This commit updates the declaration to match the definition, ensuring consistency and preventing potential compilation errors.

Fixes 73fb78e5ee8 ("mkfs: support copying in large or sparse files")
---
 mkfs/proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/proto.c +1 -1
index 6dd3a200..981f5b11 100644
@@ -20,7 +20,7 @@ static struct xfs_trans * getres(struct xfs_mount *mp, uint blocks);
 static void rsvfile(xfs_mount_t *mp, xfs_inode_t *ip, long long len);
 static int newregfile(char **pp, char **fname);
 static void rtinit(xfs_mount_t *mp);
-static long filesize(int fd);
+static off_t filesize(int fd);
 static int slashes_are_spaces;
 
 /*
Signature · 1 line
2.48.1