Expand ProgramType enumeration
[openafs.git] / src / volser / vol-dump.c
index fa58852..e389c5b 100644 (file)
@@ -17,6 +17,9 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#ifdef IGNORE_SOME_GCC_WARNINGS
+# pragma GCC diagnostic warning "-Wformat"
+#endif
 
 #include <ctype.h>
 #include <errno.h>
 
 #include <rx/xdr.h>
 #include <afs/afsint.h>
-#include "nfs.h"
+#include <afs/nfs.h>
 #include <afs/errors.h>
-#include "lock.h"
-#include "lwp.h"
+#include <lock.h>
+#include <lwp.h>
 #include <afs/afssyscalls.h>
-#include "ihandle.h"
-#include "vnode.h"
-#include "volume.h"
-#include "partition.h"
-#include "viceinode.h"
+#include <afs/ihandle.h>
+#include <afs/vnode.h>
+#include <afs/volume.h>
+#include <afs/partition.h>
+#include <afs/viceinode.h>
 #include <afs/afssyscalls.h>
-#include "acl.h"
+#include <afs/acl.h>
+#include <afs/dir.h>
+#include <afs/com_err.h>
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -67,9 +72,9 @@
 
 #include <dirent.h>
 
-#include "volser/volser.h"
-#include "volser/volint.h"
-#include "volser/dump.h"
+#include "volser.h"
+#include "volint.h"
+#include "dump.h"
 
 #define putint32(p, v)  *p++ = v>>24, *p++ = v>>16, *p++ = v>>8, *p++ = v
 #define putshort(p, v) *p++ = v>>8, *p++ = v
@@ -104,7 +109,6 @@ char name[VMAXPATHLEN];
 int
 ReadHdr1(IHandle_t * ih, char *to, int size, u_int magic, u_int version)
 {
-    int bad = 0;
     int code;
 
     code = IH_IREAD(ih, 0, to, size);
@@ -249,10 +253,9 @@ HandleVolume(struct DiskPartition64 *dp, char *name, char *filename, int fromtim
 {
     struct VolumeHeader header;
     struct VolumeDiskHeader diskHeader;
-    struct afs_stat status, stat;
+    struct afs_stat status;
     register int fd;
     Volume *vp;
-    IHandle_t *ih;
     char headerName[1024];
 
     afs_int32 n;
@@ -296,8 +299,10 @@ main(int argc, char **argv)
 {
     register struct cmd_syndesc *ts;
     afs_int32 code;
+    VolumePackageOptions opts;
 
-    VInitVolumePackage(volumeUtility, 5, 5, DONT_CONNECT_FS, 0);
+    VOptDefaults(volumeUtility, &opts);
+    VInitVolumePackage2(volumeUtility, &opts);
 
     ts = cmd_CreateSyntax(NULL, handleit, NULL,
                          "Dump a volume to a 'vos dump' format file without using volserver");
@@ -557,7 +562,7 @@ DumpFile(int dumpfd, int vnode, FdHandle_t * handleP,  struct VnodeDiskObject *v
 #ifndef AFS_NT40_ENV
     struct afs_stat status;
 #endif
-    afs_sfsize_t size, tmpsize;
+    afs_sfsize_t size;
 #ifdef AFS_AIX_ENV
 #include <sys/statfs.h>
     struct statfs tstatfs;
@@ -590,7 +595,8 @@ DumpFile(int dumpfd, int vnode, FdHandle_t * handleP,  struct VnodeDiskObject *v
 
     if (verbose)
        fprintf(stderr, "  howBig = %u, howMany = %u, fdh size = %u\n",
-               howBig, howMany, size);
+               (unsigned int) howBig, (unsigned int) howMany,
+               (unsigned int) size);
 
 #ifdef AFS_LARGEFILE_ENV
     {
@@ -852,7 +858,8 @@ DoMyVolDump(Volume * vp, struct DiskPartition64 *dp, char *dumpfile, int fromtim
        dumpfd =
            afs_open(dumpfile, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
        if (dumpfd < 0) {
-           fprintf(stderr, "Failed to open dump file! Exiting.\n");
+           fprintf(stderr, "Failed to open dump file: %s. Exiting.\n",
+                   afs_error_message(errno));
            exit(1);
        }
     } else {