Whamcloud - gitweb
Branch b1_8_gate
authoradilger <adilger>
Thu, 10 Jul 2008 21:03:37 +0000 (21:03 +0000)
committeradilger <adilger>
Thu, 10 Jul 2008 21:03:37 +0000 (21:03 +0000)
Fix compile warnings.
Make v{err}print() be variadic macros to allow proper passing of
output stream in case of error.
b=15625

lustre/utils/mount_utils.c
lustre/utils/mount_utils.h

index 17d00d7..f2f2885 100644 (file)
@@ -10,8 +10,8 @@
 extern char *progname;
 extern int verbose;
 
-#define vprint if (verbose > 0) printf
-#define verrprint if (verbose >= 0) printf
+#define vprint(fmt, arg...) if (verbose > 0) printf(fmt, ##arg)
+#define verrprint(fmt, arg...) if (verbose >= 0) fprintf(stderr, fmt, ##arg)
 
 void fatal(void)
 {
@@ -73,9 +73,8 @@ int get_mountdata(char *dev, struct lustre_disk_data *mo_ldd)
 
         /* Make a temporary directory to hold Lustre data files. */
         if (!mkdtemp(tmpdir)) {
-                verrprint(stderr, "%s: Can't create temporary "
-                        "directory %s: %s\n",
-                        progname, tmpdir, strerror(errno));
+                verrprint("%s: Can't create temporary directory %s: %s\n",
+                         progname, tmpdir, strerror(errno));
                 return errno;
         }
 
@@ -98,7 +97,7 @@ int get_mountdata(char *dev, struct lustre_disk_data *mo_ldd)
                 verrprint("%s: Unable to read %d.%d config %s.\n",
                           progname, LUSTRE_MAJOR, LUSTRE_MINOR, filepnm);
                 goto out_close;
-       }       
+       }
 
 out_close:
         fclose(filep);
index 600b6b4..3311b0f 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef _MOUNT_UTILS_H_
 #define _MOUNT_UTILS_H_
 
+#include <lustre_disk.h>
+
 void fatal(void);
 int run_command(char *, int);
 int get_mountdata(char *, struct lustre_disk_data *);