fix libxfs compiler warnings
Hi all,
this series has a few fixes so that xfsprogs compiles warning free on Debian unstable.
PATCH 1/7 libfrog: constify getprnam
--- libfrog/projects.c | 2 +- libfrog/projects.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libfrog/projects.c +1 -1
@@ -94,7 +94,7 @@ getprent(void)fs_project_t *getprnam ( -char *name) +const char *name) {fs_project_t *p =NULL ;
libfrog/projects.h +1 -1
@@ -20,7 +20,7 @@ typedef struct fs_project {extern void setprent (void );extern void endprent (void );extern fs_project_t *getprent (void ); -extern fs_project_t *getprnam (char *__name); +extern fs_project_t *getprnam (const char *__name);extern fs_project_t *getprprid (prid_t __id); typedef struct fs_project_path {
Signature · 1 line
2.53.0
PATCH 2/7 libfrog: constify cvt*
In reply to Christoph Hellwig--- libfrog/convert.c | 20 ++++++++++---------- libfrog/convert.h | 24 ++++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-)
libfrog/convert.c +10 -10
@@ -29,7 +29,7 @@ numlen(*/ int64_t cvt_s64 ( -char *s, +const char *s,int base) {long long i;
@@ -59,7 +59,7 @@ cvt_s64(*/ int32_t cvt_s32 ( -char *s, +const char *s,int base) {int64_t i;
@@ -82,7 +82,7 @@ cvt_s32(*/ int16_t cvt_s16 ( -char *s, +const char *s,int base) {int64_t i;
@@ -105,7 +105,7 @@ cvt_s16(*/ uint64_t cvt_u64 ( -char *s, +const char *s,int base) {unsigned long long i;
@@ -135,7 +135,7 @@ cvt_u64(*/ uint32_t cvt_u32 ( -char *s, +const char *s,int base) {uint64_t i;
@@ -158,7 +158,7 @@ cvt_u32(*/ uint16_t cvt_u16 ( -char *s, +const char *s,int base) {uint64_t i;
@@ -266,7 +266,7 @@ cvtstr(time64_t cvttime ( -char *s) +const char *s) {time64_t i;char *sp;
@@ -303,7 +303,7 @@ cvttime(prid_t prid_from_string ( -char *project) +const char *project) {fs_project_t *prj;unsigned long prid_long;
@@ -328,7 +328,7 @@ prid_from_string(uid_t uid_from_string ( -char *user) +const char *user) {struct passwd *pwd;unsigned long uid_long;
@@ -349,7 +349,7 @@ uid_from_string(gid_t gid_from_string ( -char *group) +const char *group) {struct group *grp;unsigned long gid_long;
libfrog/convert.h +12 -12
@@ -6,21 +6,21 @@#ifndef __LIBFROG_CONVERT_H__#define __LIBFROG_CONVERT_H__ -extern int64_t cvt_s64 (char *s,int base); -extern int32_t cvt_s32 (char *s,int base); -extern int16_t cvt_s16 (char *s,int base); +int64_t cvt_s64 (const char *s,int base); +int32_t cvt_s32 (const char *s,int base); +int16_t cvt_s16 (const char *s,int base); -extern uint64_t cvt_u64 (char *s,int base); -extern uint32_t cvt_u32 (char *s,int base); -extern uint16_t cvt_u16 (char *s,int base); +uint64_t cvt_u64 (const char *s,int base); +uint32_t cvt_u32 (const char *s,int base); +uint16_t cvt_u16 (const char *s,int base); -extern long long cvtnum (size_t blocksize,size_t sectorsize,const char *s); -extern void cvtstr (double value,char *str,size_t sz); -extern time64_t cvttime (char *s); +long long cvtnum (size_t blocksize,size_t sectorsize,const char *s); +void cvtstr (double value,char *str,size_t sz); +time64_t cvttime (const char *s); -extern uid_t uid_from_string (char *user); -extern gid_t gid_from_string (char *group); -extern prid_t prid_from_string (char *project); +uid_t uid_from_string (const char *user); +gid_t gid_from_string (const char *group); +prid_t prid_from_string (const char *project);#define EXABYTES (x) ((unsigned long long)(x) << 60)#define PETABYTES (x) ((unsigned long long)(x) << 50)
Signature · 1 line
2.53.0
PATCH 3/7 db: constify construct_records_per_block
In reply to Christoph HellwigWithout this Debian's gcc 16.2.0-3 is unhappy:
btheight.c: In function ‘construct_records_per_block’:
btheight.c:158:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
158 | p = strchr(tag, ':');
| ^
--- db/btheight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
db/btheight.c +1 -1
@@ -144,7 +144,7 @@ construct_records_per_block(char *toktag;struct btmap *m;unsigned int record_size, key_size, ptr_size; -char *p; +const char *p;int i, ret;for (i =0 , m = maps; i <ARRAY_SIZE (maps); i++, m++) {
Signature · 1 line
2.53.0
PATCH 4/7 repair: remove the unused queues_started variable in do_inode_prefetch
In reply to Christoph Hellwig--- repair/prefetch.c | 2 -- 1 file changed, 2 deletions(-)
repair/prefetch.c +0 -2
@@ -1024,7 +1024,6 @@ do_inode_prefetch( {int i;struct workqueue queue; -int queues_started =0 ;/* * If the previous phases of repair have not overflowed the buffer
@@ -1067,7 +1066,6 @@ do_inode_prefetch( wargs->func = func;queue_work (&queue, prefetch_ag_range_work,0 , wargs); - queues_started++;if (wargs->end_ag >= mp->m_sb.sb_agcount)break ;
Signature · 1 line
2.53.0
PATCH 5/7 stubs: use the i paramter to trace_xfs_trans_resv_calc_minlogsize
In reply to Christoph HellwigTo avoid a compiler warning:
xfs_log_rlimit.c: In function 'libxfs_log_get_max_trans_res':
xfs_log_rlimit.c:162:33: warning: variable 'i' set but not used [-Wunused-but-set-variable=]
162 | unsigned int i;
--- libxfs/stubs/xfs_trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libxfs/stubs/xfs_trace.h +1 -1
@@ -228,7 +228,7 @@#define trace_xfs_trans_read_buf_recur (a) ((void) 0)#define trace_xfs_trans_read_buf (a) ((void) 0)#define trace_xfs_trans_commit (a,b) ((void) 0) -#define trace_xfs_trans_resv_calc_minlogsize (a,b,c) ((void) 0) +#define trace_xfs_trans_resv_calc_minlogsize (a,b,c) ((void)b)#define trace_xfs_log_get_max_trans_res (a,b) ((void) 0)#define trace_xfs_defer_cancel (a,b) ((void) 0)
Signature · 1 line
2.53.0
PATCH 6/7 platform: use the iomap_flags argument to xfs_bmbt_to_iomap
In reply to Christoph HellwigWithout this my gcc is unhappy:
xfs_bmap.c: In function 'xfs_bmapi_convert_one_delalloc':
xfs_bmap.c:4360:33: warning: variable 'flags' set but not used [-Wunused-but-set-variable=]
4360 | uint16_t flags = 0;
--- libxfs/xfs_platform.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
libxfs/xfs_platform.h +2 -1
@@ -51,7 +51,8 @@ extern struct kmem_cache *xfs_trans_cache;/* fake up iomap, (not) used in xfs_bmap.[ch] */ #define IOMAP_F_SHARED 0x04 -#define xfs_bmbt_to_iomap (a, b, c, d, e, f) ((void) 0) +#define xfs_bmbt_to_iomap (ip, iomap, got, mapping_flags, iomap_flags, seq) \ + ((void)iomap_flags)/* fake up kernel's iomap, (not) used in xfs_bmap.[ch] */ struct iomap {
Signature · 1 line
2.53.0
PATCH 7/7 stubs: use more arguments to xfs_extent_busy_insert
In reply to Christoph HellwigAlso use the flags argument, and switch to the simpler (void) shutup method for xg to make my gcc happy:
xfs_alloc.c: In function '__xfs_free_extent':
xfs_alloc.c:4017:41: warning: variable 'busy_flags' set but not used [-Wunused-but-set-variable=]
4017 | unsigned int busy_flags = 0;
--- libxfs/stubs/xfs_extent_busy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libxfs/stubs/xfs_extent_busy.h +2 -2
@@ -7,8 +7,8 @@#define xfs_extent_busy_reuse (...) ((void) 0)/* avoid unused variable warning */ #define xfs_extent_busy_insert (tp,xg,bno,len,flags)({ \ - struct xfs_group *__foo = xg; \ - __foo = __foo; /* no set-but-unused warning */ \ + (void)xg;/* no set-but-unused warning */ \ + (void )flags; \ })#define xfs_extent_busy_trim (group,minlen,maxlen,bno,len,busy_gen) ({ \ unsigned __foo = *(busy_gen); \
Signature · 1 line
2.53.0
Andrey Albershteyn
Reviewed-byQuoted 5 lines · Christoph Hellwig
Hi all,
this series has a few fixes so that xfsprogs compiles warning free on Debian unstable.
The series looks good to me
Signature · 1 line
- Andrey
Carlos Maiolino
Reviewed-byQuoted 5 lines · Christoph Hellwig
Hi all,
this series has a few fixes so that xfsprogs compiles warning free on Debian unstable.
For the series: