Remove --disable-largefile-fileserver
[openafs.git] / src / volser / dumpstuff.c
index cca8763..313f26f 100644 (file)
@@ -115,7 +115,7 @@ RegisterTag(afs_int32 section, unsigned char tag)
 }
 
 static void
-initNonStandardTags()
+initNonStandardTags(void)
 {
     RegisterTag(0, 'n');                /* volume name */
     RegisterTag(0, 't');                /* fromtime, V_backupDate */
@@ -313,7 +313,7 @@ ReadStandardTagLen(register struct iod *iodp, unsigned char tag, afs_int32 secti
             *length = len;
         else {
             len &= 0x7f;
-            if (code = iod_Read(iodp, buf, len) != len)
+            if ((code = iod_Read(iodp, (char *)buf, len)) != len)
                 return VOLSERDUMPERROR;
             *length = 0;
             p = (unsigned char *)&buf;
@@ -334,11 +334,11 @@ static afs_int32
 SkipData(register struct iod *iodp, afs_size_t length)
 {
     while (length > 256) {
-        if (iod_Read(iodp, &skipbuf, 256) != 256)
+        if (iod_Read(iodp, (char *)&skipbuf, 256) != 256)
             return 0;
         length -= 256;
     }
-    if (iod_Read(iodp, &skipbuf, length) != length)
+    if (iod_Read(iodp, (char *)&skipbuf, length) != length)
         return 0;
     return 1;
 }
@@ -346,10 +346,10 @@ SkipData(register struct iod *iodp, afs_size_t length)
 static char *secname[3] = {"ReadDumpHeader", "ReadVolumeHeader", "ReadVnodes"};
 
 static int
-HandleUnknownTag(struct iod *iodp, register tag, afs_int32 section, 
+HandleUnknownTag(struct iod *iodp, int tag, afs_int32 section,
                afs_int32 critical)
 {
-    afs_size_t taglen;
+    afs_size_t taglen = 0;
     afs_uint32 trash;
 
     if (critical) {
@@ -667,6 +667,7 @@ DumpStandardTag(register struct iod *iodp, char tag, afs_uint32 section)
     return 0;
 }
 
+AFS_UNUSED
 static afs_int32
 DumpStandardTagLen(register struct iod *iodp, char tag, afs_uint32 section,
                         afs_size_t length)
@@ -710,17 +711,18 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
     afs_sfsize_t n, nbytes, howMany, howBig;
     afs_foff_t lcode = 0;
     byte *p;
+    afs_uint32 hi, lo;
 #ifndef AFS_NT40_ENV
     struct afs_stat status;
 #endif
     afs_sfsize_t size;
 #ifdef AFS_AIX_ENV
 #include <sys/statfs.h>
-#if defined(AFS_AIX52_ENV) && defined(AFS_LARGEFILE_ENV)
+#if defined(AFS_AIX52_ENV)
     struct statfs64 tstatfs;
-#else /* !AFS_AIX52_ENV || !AFS_LARGEFILE_ENV */
+#else /* !AFS_AIX52_ENV */
     struct statfs tstatfs;
-#endif /* !AFS_AIX52_ENV || !AFS_LARGEFILE_ENV */
+#endif /* !AFS_AIX52_ENV */
     int statfs_code;
 #endif
 
@@ -736,11 +738,11 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
     /* Unfortunately in AIX valuable fields such as st_blksize are 
      * gone from the stat structure.
      */
-#if defined(AFS_AIX52_ENV) && defined(AFS_LARGEFILE_ENV)
+#if defined(AFS_AIX52_ENV)
     statfs_code = fstatfs64(handleP->fd_fd, &tstatfs);
-#else /* !AFS_AIX52_ENV || !AFS_LARGEFILE_ENV */
+#else /* !AFS_AIX52_ENV */
     statfs_code = fstatfs(handleP->fd_fd, &tstatfs);
-#endif /* !AFS_AIX52_ENV || !AFS_LARGEFILE_ENV */
+#endif /* !AFS_AIX52_ENV */
     if (statfs_code != 0) {
         Log("DumpFile: fstatfs returned error code %d on descriptor %d\n", errno, handleP->fd_fd);
        return VOLSERDUMPERROR;
@@ -753,19 +755,12 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
 
 
     size = FDH_SIZE(handleP);
-#ifdef AFS_LARGEFILE_ENV
-    {
-       afs_uint32 hi, lo;
-       SplitInt64(size, hi, lo);
-       if (hi == 0L) {
-           code = DumpInt32(iodp, 'f', lo);
-       } else {
-           code = DumpDouble(iodp, 'h', hi, lo);
-       }
+    SplitInt64(size, hi, lo);
+    if (hi == 0L) {
+       code = DumpInt32(iodp, 'f', lo);
+    } else {
+       code = DumpDouble(iodp, 'h', hi, lo);
     }
-#else /* !AFS_LARGEFILE_ENV */
-    code = DumpInt32(iodp, 'f', size);
-#endif /* !AFS_LARGEFILE_ENV */
     if (code) {
        return VOLSERDUMPERROR;
     }
@@ -799,7 +794,7 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
            /* Record the read error */
            if (n < 0) {
                n = 0;
-               Log("1 Volser: DumpFile: Error %d reading inode %s for vnode %d\n", errno, PrintInode(NULL, handleP->fd_ih->ih_ino), vnode);
+               Log("1 Volser: DumpFile: Error reading inode %s for vnode %d: %s\n", PrintInode(NULL, handleP->fd_ih->ih_ino), vnode, afs_error_message(errno));
            } else if (!pad) {
                Log("1 Volser: DumpFile: Error reading inode %s for vnode %d\n", PrintInode(NULL, handleP->fd_ih->ih_ino), vnode);
            }
@@ -818,7 +813,7 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
            lcode = FDH_SEEK(handleP, (size_t)((size - nbytes) + howMany), SEEK_SET);
            if (lcode != ((size - nbytes) + howMany)) {
                if (lcode < 0) {
-                   Log("1 Volser: DumpFile: Error %d seeking in inode %s for vnode %d\n", errno, PrintInode(NULL, handleP->fd_ih->ih_ino), vnode);
+                   Log("1 Volser: DumpFile: Error seeking in inode %s for vnode %d: %s\n", PrintInode(NULL, handleP->fd_ih->ih_ino), vnode, afs_error_message(errno));
                } else {
                    Log("1 Volser: DumpFile: Error seeking in inode %s for vnode %d\n", PrintInode(NULL, handleP->fd_ih->ih_ino), vnode);
                    lcode = -1;
@@ -1182,7 +1177,7 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_int32 ** Bufp, int *sizep,
                FDH_CLOSE(fdP);
                return -1;
            }
-           memset((char *)Buf, 0, nVnodes * sizeof(afs_int32));
+           memset(Buf, 0, nVnodes * sizeof(afs_int32));
            STREAM_SEEK(afile, offset = vcp->diskSize, 0);
            while (1) {
                code = STREAM_READ(vnode, vcp->diskSize, 1, afile);
@@ -1399,9 +1394,7 @@ ReadVnodes(register struct iod *iodp, Volume * vp, int incremental,
                               VAclDiskSize(vnode));
                acl_NtohACL(VVnodeDiskACL(vnode));
                break;
-#ifdef AFS_LARGEFILE_ENV
            case 'h':
-#endif
            case 'f':{
                    Inode ino;
                    Error error;
@@ -1467,12 +1460,14 @@ ReadVnodes(register struct iod *iodp, Volume * vp, int incremental,
        if (haveStuff) {
            FdHandle_t *fdP = IH_OPEN(vp->vnodeIndex[class].handle);
            if (fdP == NULL) {
-               Log("1 Volser: ReadVnodes: Error opening vnode index; restore aborted\n");
+               Log("1 Volser: ReadVnodes: Error opening vnode index: %s; restore aborted\n",
+                   afs_error_message(errno));
                return VOLSERREAD_DUMPERROR;
            }
            if (FDH_SEEK(fdP, vnodeIndexOffset(vcp, vnodeNumber), SEEK_SET) <
                0) {
-               Log("1 Volser: ReadVnodes: Error seeking into vnode index; restore aborted\n");
+               Log("1 Volser: ReadVnodes: Error seeking into vnode index: %s; restore aborted\n",
+                   afs_error_message(errno));
                FDH_REALLYCLOSE(fdP);
                return VOLSERREAD_DUMPERROR;
            }
@@ -1486,12 +1481,14 @@ ReadVnodes(register struct iod *iodp, Volume * vp, int incremental,
            vnode->vnodeMagic = vcp->magic;
            if (FDH_SEEK(fdP, vnodeIndexOffset(vcp, vnodeNumber), SEEK_SET) <
                0) {
-               Log("1 Volser: ReadVnodes: Error seeking into vnode index; restore aborted\n");
+               Log("1 Volser: ReadVnodes: Error seeking into vnode index: %s; restore aborted\n",
+                   afs_error_message(errno));
                FDH_REALLYCLOSE(fdP);
                return VOLSERREAD_DUMPERROR;
            }
            if (FDH_WRITE(fdP, vnode, vcp->diskSize) != vcp->diskSize) {
-               Log("1 Volser: ReadVnodes: Error writing vnode index; restore aborted\n");
+               Log("1 Volser: ReadVnodes: Error writing vnode index: %s; restore aborted\n",
+                   afs_error_message(errno));
                FDH_REALLYCLOSE(fdP);
                return VOLSERREAD_DUMPERROR;
            }
@@ -1525,14 +1522,12 @@ volser_WriteFile(int vn, struct iod *iodp, FdHandle_t * handleP, int tag,
 #ifdef AFS_64BIT_ENV
     {
        afs_uint32 filesize_high = 0L, filesize_low = 0L;
-#ifdef AFS_LARGEFILE_ENV
        if (tag == 'h') {
            if (!ReadInt32(iodp, &filesize_high)) {
                *status = 1;
                return 0;
            }
        }
-#endif /* !AFS_LARGEFILE_ENV */
        if (!ReadInt32(iodp, &filesize_low)) {
            *status = 1;
            return 0;
@@ -1555,7 +1550,7 @@ volser_WriteFile(int vn, struct iod *iodp, FdHandle_t * handleP, int tag,
            size = nbytes;
 
        if ((code = iod_Read(iodp, (char *) p, size)) != size) {
-           Log("1 Volser: WriteFile: Error reading dump file %d size=%llu nbytes=%u (%d of %u); restore aborted\n", vn, (afs_uintmax_t) filesize, nbytes, code, size);
+           Log("1 Volser: WriteFile: Error reading dump file %d size=%llu nbytes=%u (%d of %u): %s; restore aborted\n", vn, (afs_uintmax_t) filesize, nbytes, code, size, afs_error_message(errno));
            *status = 3;
            break;
        }
@@ -1563,7 +1558,7 @@ volser_WriteFile(int vn, struct iod *iodp, FdHandle_t * handleP, int tag,
        if (lcode > 0)
            written += lcode;
        if (lcode != size) {
-           Log("1 Volser: WriteFile: Error writing (%d,%u) bytes to vnode %d; restore aborted\n", (int)(lcode>>32), (int)(lcode & 0xffffffff), vn);
+           Log("1 Volser: WriteFile: Error writing (%d,%u) bytes to vnode %d: %s; restore aborted\n", (int)(lcode>>32), (int)(lcode & 0xffffffff), vn, afs_error_message(errno));
            *status = 4;
            break;
        }