xfstests: fix build errors and warnings
authorDave Chinner <david@fromorbit.com>
Tue, 4 Aug 2015 06:34:42 +0000 (16:34 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 4 Aug 2015 06:34:42 +0000 (16:34 +1000)
After upgrading userspace on test machines to xfsprogs-4.2.0-rc1,
lots of build warnings and failures are exposed from implicit
includes that no longer exist. Hence these need fixing to allow
fstests to build correctly.

gcc also seems to have grown new stupidities around uninitialised
variables, so fix them while touching the same files.

Signed-off-by: Dave Chinner <david@fromorbit.com>
12 files changed:
dmapi/src/common/cmd/write_invis.c
dmapi/src/common/lib/util.c
dmapi/src/suite1/cmd/get_dirattrs.c
dmapi/src/suite1/cmd/probe_punch_xfsctl_hole.c
dmapi/src/suite2/src/test_dmattr.c
ltp/doio.c
src/bulkstat_unlink_test.c
src/bulkstat_unlink_test_modified.c
src/iopat.c
src/trunc.c
src/unwritten_sync.c
src/xfsctl.c

index 28744ac5d05c0963ae35732c957bff196e0e3847..b0b2af6216b88ed6da7a78b9bc6eb0c0aa5d49db 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <lib/hsm.h>
 
+#include <unistd.h>
 #include <string.h>
 #include <malloc.h>
 #include <getopt.h>
index 2ee7c33cfa3f451545c6888ce9ba1ae7da5c1a77..8a256b31483d0646ce970a85cf1f752425ab59fa 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <unistd.h>
 #include <stdarg.h>
+#include <ctype.h>
 
 #include <lib/hsm.h>
 
index 49ac356e9dda8b57bff7414a3d631545ce4ebae1..a7e671ef372f6ec57f38e279a3d76e4c980e8b37 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <lib/hsm.h>
+#include <string.h>
 
 /*---------------------------------------------------------------------------
 
index c01dff0056fed8ea96626f18ac4fc5e4aa7ebc6c..855c5f60dd4ed1ecb7f7392dc8e689769142483f 100644 (file)
 
 #include <lib/hsm.h>
 
+#include <unistd.h>
 #include <getopt.h>
 #include <string.h>
+#include <fcntl.h>
+
 
 
 /*---------------------------------------------------------------------------
index cf870772c4c44668c41b1eb39356c75d72a08cad..a8a05958003fea2f20cb9eb70a2c9280f56ba8c2 100644 (file)
@@ -16,6 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
index 966cff1d75dc85fda695ca2f7c78ccc1fb293dab..dcb3efd8c87dbaeae775a3006960da08b537447b 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "global.h"
 
+#include <stdarg.h>
 #include <sys/uio.h>   /* for struct iovec (readv)*/
 #include <sys/mman.h>  /* for mmap(2) */
 #include <sys/ipc.h>   /* for i/o buffer in shared memory */
index afd69ffec1b03ce91bbc83faa7fd574a700eb77b..cdf720efc456df001fb1c45b364f992f1bb89fb4 100644 (file)
@@ -3,12 +3,14 @@
  * Test bulkstat doesn't returned unlinked inodes.
  * Mark Goodwin <markgw@sgi.com> Fri Jul 20 09:13:57 EST 2007
  */
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <xfs/xfs.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <string.h>
 
 int
 main(int argc, char *argv[])
index 3a50d61bfaffa5925bc1037da07183e7136a61b8..660499261aea5da875fa9a9e1bc9534a8996381c 100644 (file)
@@ -6,11 +6,13 @@
  * This is a modified version of bulkstat_unlink_test.c to reproduce a specific
  * problem see pv 969192
  */
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <xfs/xfs.h>
 #include <unistd.h>
+#include <string.h>
 
 int
 main(int argc, char *argv[])
index f34de19c688afbf2b0130062055a0c316a101ee6..7383af5065d59fcfd1d2238aec3cfd06eb8c1eaa 100644 (file)
@@ -16,6 +16,9 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <xfs/xfs.h>
index c60985238368d7c7ae197c79a5837758c845b2da..2b35d1ef37594b493803a4eea7048f7d0f9ce42c 100644 (file)
@@ -47,17 +47,17 @@ int argc;
 char   **argv;
 {
        int fd, err, elapsed;
-       char *buf, *goodbuf;
+       char *buf = NULL, *goodbuf = NULL;
        time_t starttime;
         char *filename="testfile";
-       int c;
+       int c;
 
-if(argc != 3)
-               printf("Usage: trunc -f testfilename\n");
-                exit(1);
+       if (argc != 3) {
+               printf("Usage: trunc -f testfilename\n");
+               exit(1);
         }
 
-while((c=getopt(argc,argv,"f:"))!=EOF) {
+       while((c=getopt(argc,argv,"f:"))!=EOF) {
                switch (c) {
                case 'f':
                        filename = optarg;
index bf61adf07c5e8460955da6a996c83e533f7b37c3..ebdc8248bff7c60a7e3244fb9a01ed97b2598fa5 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <errno.h>
index 3f82f4adb3500637637da4a80423a32f5c400b13..bf2a873a1457cf57a629033b4e42d3f528048924 100644 (file)
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 #include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
 
 #include <xfs/xfs.h>
 #include <xfs/jdm.h>