xfstests: fix compile warnings
cover xfstests: fix compile warnings
This series fixes all the compile warnings when building xfstests. It doesn't deal with the dmapi subdirectory but cleans everything else up.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/8 xfstests: fix compile warning in doio.c
Use of sigblock is deprecated. Use sigprocmask instead.
--- ltp/doio.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
ltp/doio.c +4 -2
@@ -350,7 +350,7 @@ char **argv; {int i, pid, stat, ex_stat;struct sigaction sa; -int omask; +sigset_t block_mask, old_mask;umask (0 );/* force new file modes to known values */ #if _CRAYMPP Npes =sysconf (_SC_CRAY_NPES);/* must do this before parse_cmdline */
@@ -434,7 +434,9 @@ char **argv; Children[i] =-1 ; } - omask =sigblock (sigmask (SIGCLD )); +sigemptyset (&block_mask); +sigaddset (&block_mask,SIGCHLD ); +sigprocmask (SIG_BLOCK , &block_mask, &old_mask);/* * Fork Nprocs. This [parent] process is a watchdog, to notify the
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/8] xfstests: fix compile warning in doio.c
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/8 xfstests: fix bulkstat related compile warnings.
In reply to Dave ChinnerUse correct types for bulkstat structure to avoid pointer warnings.
--- ltp/fsstress.c | 4 ++-- src/bulkstat_unlink_test.c | 2 +- src/bulkstat_unlink_test_modified.c | 2 +- src/t_immutable.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-)
ltp/fsstress.c +2 -2
@@ -1550,7 +1550,7 @@ bulkstat_f(int opno, long r) {int count;int fd; -__uint64_t last; +__u64 last;int nent;xfs_bstat_t *t;__int64_t total;
@@ -1583,7 +1583,7 @@ bulkstat1_f(int opno, long r)pathname_t f;int fd;int good; -__uint64_t ino; +__u64 ino;struct stat64 s;xfs_bstat_t t;int v;
src/bulkstat_unlink_test.c +1 -1
@@ -68,7 +68,7 @@ main(int argc, char *argv[])printf ("Iteration %d ... (%d files)" , k, nfiles);memset (&a,0 ,sizeof (xfs_fsop_bulkreq_t)); - a.lastip = &last_inode; + a.lastip = (__u64 *)&last_inode; a.icount = nfiles; a.ubuffer = ret; a.ocount = &count;
src/bulkstat_unlink_test_modified.c +1 -1
@@ -61,7 +61,7 @@ main(int argc, char *argv[])memset (genlist,0 , nfiles *sizeof (__u32));memset (ret,0 , nfiles *sizeof (xfs_bstat_t));memset (&a,0 ,sizeof (xfs_fsop_bulkreq_t)); - a.lastip = &last_inode; + a.lastip = (__u64 *)&last_inode; a.icount = nfiles; a.ubuffer = ret; a.ocount = &count;
src/t_immutable.c +3 -3
@@ -283,7 +283,7 @@ static int test_immutable(const char *dir) ino = st.st_ino; - bulkreq.lastip = &ino; + bulkreq.lastip = (__u64 *)&ino; bulkreq.icount =1 ; bulkreq.ubuffer = &bstat; bulkreq.ocount =NULL ;
@@ -943,7 +943,7 @@ static int test_append(const char *dir) ino = st.st_ino; - bulkreq.lastip = &ino; + bulkreq.lastip = (__u64 *)&ino; bulkreq.icount =1 ; bulkreq.ubuffer = &bstat; bulkreq.ocount =NULL ;
@@ -1353,7 +1353,7 @@ static int test_append(const char *dir) ino = st.st_ino; - bulkreq.lastip = &ino; + bulkreq.lastip = (__u64 *)&ino; bulkreq.icount =1 ; bulkreq.ubuffer = &bstat; bulkreq.ocount =NULL ;
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/8] xfstests: fix bulkstat related compile warnings.
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/8 xfstests: Don't use tempnam in growfiles.c
In reply to Dave Chinnertempnam() generates a compiler warning as a dangerous function. This code doesn't care about security issues with tempnam, so remove it and just manually build the filenames without the randomness of tempnam.
--- ltp/growfiles.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
ltp/growfiles.c +2 -3
@@ -1162,10 +1162,9 @@ no whole file checking will be performed!\n", Progname, TagName, (int)getpid());/* * construct auto filename and insert them into filenames space */ -for (ind=0 ;ind<num_auto_files; ind++, num++) { -sprintf ((char *)filenames+(num*PATH_MAX ),"%s.%d" , -tempnam (auto_dir, auto_file), ind ); +sprintf ((char *)filenames+(num*PATH_MAX ),"%s/%s.%d" , + auto_dir, auto_file, ind); }/*
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/8] xfstests: Don't use tempnam in growfiles.c
Quoted 4 lines · Dave Chinner
tempnam()generates a compiler warning as a dangerous function. This code doesn't care about security issues with tempnam, so remove it and just manually build the filenames without the randomness of tempnam.
Looks good,
Btw, I wonder if we should sync back changes to the ltp/* files to LTP..
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/8 xfstests: fix printf format warnings in aio-stress.c
In reply to Dave Chinner--- ltp/aio-stress.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
ltp/aio-stress.c +9 -6
@@ -1167,9 +1167,9 @@ restart:if (t->stage_mb_trans && t->num_files >0 ) {double seconds =time_since_now (&stage_time); -fprintf (stderr,"thread %d %s totals (%.2f MB/s) %.2f MB in %.2fs\n" , - t - global_thread_info, this_stage, t->stage_mb_trans/seconds, - t->stage_mb_trans, seconds); +fprintf (stderr,"thread %llu %s totals (%.2f MB/s) %.2f MB in %.2fs\n" , + (unsigned long long )(t - global_thread_info), this_stage, + t->stage_mb_trans/seconds, t->stage_mb_trans, seconds); }if (num_threads >1 ) {
@@ -1449,16 +1449,19 @@ int main(int ac, char **av)if (file_size < num_contexts * context_offset) {fprintf (stderr,"file size %Lu too small for %d contexts\n" , - file_size, num_contexts); + (unsigned long long )file_size, num_contexts);exit (1 ); } -fprintf (stderr,"file size %LuMB, record size %luKB, depth %d, ios per iteration %d\n" , file_size / (1024 *1024 ), rec_len /1024 , depth, io_iter); +fprintf (stderr,"file size %LuMB, record size %luKB, depth %d, ios per iteration %d\n" , + (unsigned long long )file_size / (1024 *1024 ), + rec_len /1024 , depth, io_iter);fprintf (stderr,"max io_submit %d, buffer alignment set to %luKB\n" , max_io_submit, (page_size_mask +1 )/1024 );fprintf (stderr,"threads %d files %d contexts %d context offset %LuMB verification %s\n" , num_threads, num_files, num_contexts, - context_offset / (1024 *1024 ), verify ?"on" :"off" ); + (unsigned long long )context_offset / (1024 *1024 ), + verify ?"on" :"off" );/* open all the files and do any required setup for them */ for (i = optind ; i < ac ; i++) {int thread_index;
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 4/8] xfstests: fix printf format warnings in aio-stress.c
Quoted 5 lines
ltp/aio-stress.c +0
-0
ltp/aio-stress.c restart: · line 1172
Quoted 9 lines
ltp/aio-stress.c +3
-3@@ -1167,9 +1167,9 @@ restart:if (t->stage_mb_trans && t->num_files >0 ) {double seconds =time_since_now (&stage_time); -fprintf (stderr,"thread %d %s totals (%.2f MB/s) %.2f MB in %.2fs\n" , - t - global_thread_info, this_stage, t->stage_mb_trans/seconds, - t->stage_mb_trans, seconds); +fprintf (stderr,"thread %llu %s totals (%.2f MB/s) %.2f MB in %.2fs\n" , + (unsigned long long )(t - global_thread_info), this_stage, + t->stage_mb_trans/seconds, t->stage_mb_trans, seconds);
Differences between two pointers in C99 is a ptrdiff_t. Probably not worth searching the printf sepcifier for it and just casting it up, so ok.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/8 xfstests: fix compile warnings in iopat.c
In reply to Dave ChinnerPrintf format warnings and return value warnings need fixing.
--- src/iopat.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
src/iopat.c +2 -1
@@ -47,12 +47,13 @@ int main(int argc, char **argv)read (fd, &x,1048576 );for (i =0 ; i <131072 ; i++) {if (x[i] != i) { -printf ("error: %d %d %d\n" ,i,8 *i,x[i]); +printf ("error: %d %d %lld\n" , i ,8 * i, (long long )x[i]);exit (1 ); } }#endif close (fd); +exit (0 ); }
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 5/8] xfstests: fix compile warnings in iopat.c
Quoted 12 lines · Dave Chinner
Printf format warnings and return value warnings need fixing.
Signed-off-by Dave Chinner <[email protected]>--- src/iopat.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)src/iopat.c +0
-0
src/iopat.c int main(int argc, char **argv) · line 51
Quoted 6 lines
src/iopat.c +1
-1@@ -47,12 +47,13 @@ int main(int argc, char **argv)read (fd, &x,1048576 );for (i =0 ; i <131072 ; i++) {if (x[i] != i) { -printf ("error: %d %d %d\n" ,i,8 *i,x[i]); +printf ("error: %d %d %lld\n" , i ,8 * i, (long long )x[i]);exit (1 );
Instead of the casting we could also use the C99 macro for the uin64_t format. But either way good enough for the tests,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/8 xfstests: fix printf format warnings in looptest.c
In reply to Dave Chinner--- src/looptest.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
src/looptest.c +4 -4
@@ -202,7 +202,7 @@ main(int argc, char *argv[])if ((flags &FLAG_OPENCLOSE ) && (flags &FLAG_SEQUENTIAL )) {if (flags &FLAG_VERBOSE ) -printf ("seek %" LL "d\n" , seek_to); +printf ("seek %" LL "d\n" , (long long )seek_to);if (SEEK (f, seek_to,FILE_BEGIN ) <0 )PERROR ("SEEK" ,GET_LAST_ERROR ); }
@@ -212,7 +212,7 @@ main(int argc, char *argv[])if (!(flags &FLAG_SEQUENTIAL )) {if (flags &FLAG_VERBOSE ) -printf ("seek %" LL "d\n" , seek_to); +printf ("seek %" LL "d\n" , (long long )seek_to);if (SEEK (f, seek_to,FILE_BEGIN ) <0 )PERROR ("SEEK" ,GET_LAST_ERROR ); }
@@ -233,7 +233,7 @@ main(int argc, char *argv[])if (!(flags &FLAG_SEQUENTIAL ) || (flags &FLAG_WRITE )) {if (flags &FLAG_VERBOSE ) -printf ("seek %" LL "d\n" , seek_to); +printf ("seek %" LL "d\n" , (long long )seek_to);if (SEEK (f, seek_to,FILE_BEGIN ) <0 )PERROR ("SEEK" ,GET_LAST_ERROR ); }
@@ -279,7 +279,7 @@ main(int argc, char *argv[]) seek_to += bufsize;if (flags &FLAG_TRUNCATE ) {if (flags &FLAG_VERBOSE ) -printf ("seek %" LL "d\n" , seek_to); +printf ("seek %" LL "d\n" , (long long )seek_to);if (SEEK (f, seek_to,FILE_BEGIN ) <0 )PERROR ("SEEK" ,GET_LAST_ERROR ); }
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 6/8] xfstests: fix printf format warnings in looptest.c
Quoted 10 lines · Dave Chinner
Signed-off-by Dave Chinner <[email protected]>--- src/looptest.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)src/looptest.c +0
-0
src/looptest.c main(int argc, char *argv[]) · line 208
Quoted 8 lines
src/looptest.c +1
-1@@ -202,7 +202,7 @@ main(int argc, char *argv[])if ((flags &FLAG_OPENCLOSE ) && (flags &FLAG_SEQUENTIAL )) {if (flags &FLAG_VERBOSE ) -printf ("seek %" LL "d\n" , seek_to); +printf ("seek %" LL "d\n" , (long long )seek_to);if (SEEK (f, seek_to,FILE_BEGIN ) <0 )PERROR ("SEEK" ,GET_LAST_ERROR ); seek_to += bufsize;
Ok.
What an ugly code in this file, urggg.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/8 xfstests: fix printf warnings in locktest.c
In reply to Dave Chinner--- src/locktest.c | 35 ++++++++++++++++++++--------------- 1 files changed, 20 insertions(+), 15 deletions(-)
src/locktest.c +20 -15
@@ -718,7 +718,7 @@ send_ctl(void)if (debug >1 ) {fprintf (stderr,"send_ctl: test=%d, command=%d offset=%" LL "d, length=%" LL "d, result=%d, error=%d\n" , - ctl.test, ctl.command, ctl.offset, ctl.length,ctl.result, ctl.error); + ctl.test, ctl.command, (long long )ctl.offset, (long long )ctl.length,ctl.result, ctl.error); } ctl.test=bswap_uint32 (ctl.test);
@@ -741,7 +741,7 @@ send_ctl(void)if (nwrite <0 )perror ("send_ctl: write" );else -fprintf (stderr,"send_ctl[%d]: write() returns %d, not %d as expected\n" , +fprintf (stderr,"send_ctl[%d]: write() returns %d, not %lu as expected\n" , ctl.test, nwrite,sizeof (ctl));exit (1 );/*NOTREACHED*/
@@ -756,7 +756,7 @@ void recv_ctl(void)if (nread <0 )perror ("recv_ctl: read" );else { -fprintf (stderr,"recv_ctl[%d]: read() returns %d, not %d as expected\n" , +fprintf (stderr,"recv_ctl[%d]: read() returns %d, not %lu as expected\n" , ctl.test, nread,sizeof (ctl));fprintf (stderr,"socket might has been closed by other locktest\n" ); }
@@ -773,7 +773,7 @@ void recv_ctl(void)if (debug >1 ) {fprintf (stderr,"recv_ctl: test=%d, command=%d offset=%" LL "d, length=%" LL "d, result=%d, error=%d\n" , - ctl.test, ctl.command, ctl.offset, ctl.length, ctl.result, ctl.error); + ctl.test, ctl.command, (long long )ctl.offset, (long long )ctl.length, ctl.result, ctl.error); } }
@@ -1040,14 +1040,16 @@ main(int argc, char *argv[]) fail_flag++;/* We have a failure */ if (debug) -fprintf (stderr,"Server failure in test %d, while %sing using offset %llu, length %llu - err = %d:%s\n" , +fprintf (stderr,"Server failure in test %d, while %sing using offset %lld, length %lld - err = %d:%s\n" , ctl.test, tests[index][COMMAND ]==WRLOCK ?"write lock" : tests[index][COMMAND ]==RDLOCK ?"read lock" : tests[index][COMMAND ]==UNLOCK ?"unlock" : tests[index][COMMAND ]==F_OPEN ?"open" :"clos" , - tests[index][OFFSET ], tests[index][LENGTH ], saved_errno,strerror (saved_errno)); -fprintf (stderr,"Server failure in %llu:%s\n" , - tests[index][TEST_NUM ], + (long long )tests[index][OFFSET ], + (long long )tests[index][LENGTH ], + saved_errno,strerror (saved_errno)); +fprintf (stderr,"Server failure in %lld:%s\n" , + (long long )tests[index][TEST_NUM ], descriptions[tests[index][TEST_NUM ] -1 ]); } }
@@ -1058,12 +1060,13 @@ main(int argc, char *argv[]) end=1 ; }if (debug >1 ) -fprintf (stderr,"Sending command to client (%d) - %s - %llu:%llu\n" , +fprintf (stderr,"Sending command to client (%d) - %s - %lld:%lld\n" , index, tests[index][COMMAND ]==WRLOCK ?"write lock" : tests[index][COMMAND ]==RDLOCK ?"read lock" : tests[index][COMMAND ]==UNLOCK ?"unlock" : tests[index][COMMAND ]==F_OPEN ?"open" :"clos" , - tests[index][OFFSET ], tests[index][LENGTH ]); + (long long )tests[index][OFFSET ], + (long long )tests[index][LENGTH ]);/* get the client to do something */ ctl.index = index;send_ctl ();
@@ -1075,14 +1078,15 @@ main(int argc, char *argv[])if ( ctl.result ==FAIL ) { fail_flag++;if (debug) -fprintf (stderr,"Client failure in test %d, while %sing using offset %llu, length %llu - err = %d:%s\n" , +fprintf (stderr,"Client failure in test %d, while %sing using offset %lld, length %lld - err = %d:%s\n" , ctl.test, ctl.command==WRLOCK ?"write lock" : ctl.command==RDLOCK ?"read lock" : ctl.command==UNLOCK ?"unlock" : ctl.command==F_OPEN ?"open" :"clos" , - ctl.offset, ctl.length, ctl.error,strerror (ctl.error)); -fprintf (stderr,"Client failure in %llu:%s\n" , - tests[index][TEST_NUM ], + (long long )ctl.offset, (long long )ctl.length, + ctl.error,strerror (ctl.error)); +fprintf (stderr,"Client failure in %lld:%s\n" , + (long long )tests[index][TEST_NUM ], descriptions[tests[index][TEST_NUM ] -1 ]); } }
@@ -1144,7 +1148,8 @@ main(int argc, char *argv[]) }if ( result != tests[index][RESULT ] ) {if (debug) -fprintf (stderr,"Got %d, wanted %llu\n" , result, tests[index][RESULT ]); +fprintf (stderr,"Got %d, wanted %lld\n" , result, + (long long )tests[index][RESULT ]); ctl.result =FAIL ; ctl.error = saved_errno; fail_count++;
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 7/8] xfstests: fix printf warnings in locktest.c
Quoted 4 lines · Dave Chinner
Signed-off-by Dave Chinner <[email protected]>--- src/locktest.c | 35 ++++++++++++++++++++--------------- 1 files changed, 20 insertions(+), 15 deletions(-)
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/8 xfstests: don't redefine _GNU_SOURCE in aio tests
In reply to Dave Chinner--- src/aio-dio-regress/aio-dio-subblock-eof-read.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
src/aio-dio-regress/aio-dio-subblock-eof-read.c +0 -2
@@ -31,8 +31,6 @@* worth of data, and the user issued a 4k read, we want to ensure that * the return value is 300, not 4k. */ - -#define _GNU_SOURCE#include <stdio.h> #include <stdlib.h> #include <libaio.h>
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 8/8] xfstests: don't redefine _GNU_SOURCE in aio tests
Quoted 1 line · Dave Chinner
Signed-off-by Dave Chinner <[email protected]>
Yes, I think Eric fixed this in most others earlier already.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 3 lines · Dave Chinner
This series fixes all the compile warnings when building xfstests. It doesn't deal with the dmapi subdirectory but cleans everything else up.
Pushed into xfstests-dev tree.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs