DEVEL15-aix-largefile-cleanup-20060620
authorTom Keiser <tkeiser@gmail.com>
Tue, 20 Jun 2006 22:40:04 +0000 (22:40 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 20 Jun 2006 22:40:04 +0000 (22:40 +0000)
some largefile cleanup and other minor aix tweaking

(cherry picked from commit 7826b313868ec8ce975b65e5c430a9503fca4dd5)

src/export/Makefile.in
src/libafs/Makefile.common.in
src/libafs/MakefileProto.AIX.in
src/libuafs/Makefile.common.in
src/libuafs/MakefileProto.AIX.in
src/vol/vol-salvage.c
src/volser/dumpstuff.c

index 4b5e798..d35450e 100644 (file)
@@ -113,7 +113,11 @@ cfgafs64.o: ${srcdir}/cfgafs.c AFS_component_version_number.c
        ${CC} -q64 ${CFLAGS} -c ${srcdir}/cfgafs.c -o cfgafs64.o
 
 clean:
-       $(RM) -f *.o *.Zlst *.map *.out cfgexport cfgafs *.ext AFS_component_version_number.c export.exp export64.exp
+       $(RM) -f *.o *.Zlst *.map *.out AFS_component_version_number.c
+       $(RM) -f export.exp export64.exp
+       $(RM) -f cfgexport cfgexport64
+       $(RM) -f cfgafs cfgafs64
+       $(RM) -f *.ext *.ext.nonfs
 
 ${DEST}/root.client/usr/vice/etc/dkload/export.ext: export.ext
        ${INSTALL} $? $@
index 25606cf..351949d 100644 (file)
@@ -410,7 +410,7 @@ osi_timeout.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_timeout.c
 
 
 clean:
-       -$(RM) -rf STATIC* MODLOAD*
+       -$(RM) -rf STATIC* MODLOAD* $(AFS_OS_CLEAN)
        -$(RM) -rf  h net netinet rpc ufs machine inet nfs sys afs afsint asm asm-generic config rx linux
 
 include ${TOP_OBJDIR}/src/config/Makefile.version
index 36c6ceb..66129fc 100644 (file)
@@ -35,6 +35,10 @@ AFSIAUTHOBJS = \
        osi_vfsops_iauth.o \
        osi_vnodeops_iauth.o
 
+AFS_OS_CLEAN = \
+       *.exp \
+       export.h
+
 # System specific build commands
 STRIP = /bin/strip
 DBUG  = -g
index 74411de..cef7299 100644 (file)
@@ -1314,7 +1314,7 @@ $(JUAFS)/Krxstat.xdr.o: $(TOP_OBJ_RXSTAT)/Krxstat.xdr.c
 
 clean:
        -$(RM) -rf UAFS* JUAFS* AFSWEB* nsapi des afs afsint config rx
-       -$(RM) -f  h net netinet rpc ufs machine inet nfs sys des linktest
+       -$(RM) -f  h net netinet rpc ufs machine inet nfs sys des linktest $(AFS_OS_CLEAN)
 
 
 ${TOP_LIBDIR}/$(LIBAFSWEB): AFSWEB/$(LIBAFSWEB)
index 6dfd9c8..865b314 100644 (file)
@@ -30,6 +30,11 @@ LIBJUAFS = libjuafs.a
 LIBAFSWEB = nsafs.a
 LIBAFSWEBKRB = nsafs.krb.a
 
+
+AFS_OS_CLEAN = \
+       *.exp \
+       export.h
+
 # To get __file__ (afs_osi_pag.c) you need to specify language level 
 # C99 to xlc_r like this:
 OPTF=-O -qlanglvl=stdc99
index 2183a6c..63d5f68 100644 (file)
@@ -2228,7 +2228,7 @@ CopyOnWrite(register struct DirSummary *dir)
     struct VnodeDiskObject vnode;
     struct VnodeClassInfo *vcp = &VnodeClassInfo[vLarge];
     Inode oldinode, newinode;
-    int code;
+    afs_sfsize_t code;
 
     if (dir->copied || Testing)
        return;
@@ -2279,18 +2279,19 @@ CopyAndSalvage(register struct DirSummary *dir)
     struct VnodeClassInfo *vcp = &VnodeClassInfo[vLarge];
     Inode oldinode, newinode;
     DirHandle newdir;
-    register afs_int32 code;
+    afs_int32 code;
+    afs_sfsize_t lcode;
     afs_int32 parentUnique = 1;
     struct VnodeEssence *vnodeEssence;
 
     if (Testing)
        return;
     Log("Salvaging directory %u...\n", dir->vnodeNumber);
-    code =
+    lcode =
        IH_IREAD(vnodeInfo[vLarge].handle,
                 vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode,
                 sizeof(vnode));
-    assert(code == sizeof(vnode));
+    assert(lcode == sizeof(vnode));
     oldinode = VNDISK_GET_INO(&vnode);
     /* Increment the version number by a whole lot to avoid problems with
      * clients that were promised new version numbers--but the file server
@@ -2321,8 +2322,10 @@ CopyAndSalvage(register struct DirSummary *dir)
     if (code) {
        /* didn't really build the new directory properly, let's just give up. */
        code = IH_DEC(dir->ds_linkH, newinode, dir->rwVid);
-       assert(code == 0);
        Log("Directory salvage returned code %d, continuing.\n", code);
+       if (code) {
+           Log("also failed to decrement link count on new inode");
+       }
        assert(1 == 2);
     }
     Log("Checking the results of the directory salvage...\n");
@@ -2335,11 +2338,11 @@ CopyAndSalvage(register struct DirSummary *dir)
     vnode.cloned = 0;
     VNDISK_SET_INO(&vnode, newinode);
     VNDISK_SET_LEN(&vnode, Length(&newdir));
-    code =
+    lcode =
        IH_IWRITE(vnodeInfo[vLarge].handle,
                  vnodeIndexOffset(vcp, dir->vnodeNumber), (char *)&vnode,
                  sizeof(vnode));
-    assert(code == sizeof(vnode));
+    assert(lcode == sizeof(vnode));
 #ifdef AFS_NT40_ENV
     nt_sync(fileSysDevice);
 #else
@@ -2786,7 +2789,7 @@ SalvageVolume(register struct InodeSummary *rwIsp, IHandle_t * alinkH)
     struct VnodeEssence *vep;
     afs_int32 v, pv;
     IHandle_t *h;
-    int nBytes;
+    afs_sfsize_t nBytes;
     ViceFid pa;
     VnodeId LFVnode, ThisVnode;
     Unique LFUnique, ThisUnique;
@@ -3059,7 +3062,7 @@ void
 ClearROInUseBit(struct VolumeSummary *summary)
 {
     IHandle_t *h = summary->volumeInfoHandle;
-    int nBytes;
+    afs_sfsize_t nBytes;
 
     VolumeDiskData volHeader;
 
index 9276a97..9bf8cff 100644 (file)
@@ -524,9 +524,10 @@ DumpByteString(register struct iod *iodp, char tag, register byte * bs,
 static int
 DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
 {
-    int code = 0, lcode = 0, error = 0;
+    int code = 0, error = 0;
     afs_int32 pad = 0, offset;
     afs_sfsize_t n, nbytes, howMany, howBig;
+    afs_foff_t lcode;
     byte *p;
 #ifndef AFS_NT40_ENV
     struct afs_stat status;
@@ -534,7 +535,12 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
     afs_sfsize_t size;
 #ifdef AFS_AIX_ENV
 #include <sys/statfs.h>
+#ifdef AFS_LARGEFILE_ENV
+    struct statfs64 tstatfs;
+#else /* !AFS_LARGEFILE_ENV */
     struct statfs tstatfs;
+#endif /* !AFS_LARGEFILE_ENV */
+    int statfs_code;
 #endif
 
 #ifdef AFS_NT40_ENV
@@ -549,8 +555,17 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
     /* Unfortunately in AIX valuable fields such as st_blksize are 
      * gone from the stat structure.
      */
-    fstatfs(handleP->fd_fd, &tstatfs);
+#ifdef AFS_LARGEFILE_ENV
+    statfs_code = fstatfs64(handleP->fd_fd, &tstatfs);
+#else /* !AFS_LARGEFILE_ENV */
+    statfs_code = fstatfs(handleP->fd_fd, &tstatfs);
+#endif /* !AFS_LARGEFILE_ENV */
+    if (statfs_code != 0) {
+        Log("DumpFile: fstatfs returned error code %d on descriptor %d\n", errno, handleP->fd_fd);
+       return VOLSERDUMPERROR;
+    }
     howMany = tstatfs.f_bsize;
+    Log("DumpFile: fstatfs returned block size of %lld; howMany=%lld", tstatfs.f_bsize, howMany);
 #else
     howMany = status.st_blksize;
 #endif /* AFS_AIX_ENV */
@@ -575,9 +590,9 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
        return VOLSERDUMPERROR;
     }
 
-    p = (unsigned char *)malloc(howMany);
+    p = (unsigned char *)malloc((size_t)howMany);
     if (!p) {
-       Log("1 Volser: DumpFile: no memory");
+       Log("1 Volser: DumpFile: not enough memory to allocate %u bytes\n", howMany);
        return VOLSERDUMPERROR;
     }
 
@@ -586,7 +601,7 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
            howMany = nbytes;
 
        /* Read the data - unless we know we can't */
-       n = (lcode ? 0 : FDH_READ(handleP, p, howMany));
+       n = (lcode ? 0 : FDH_READ(handleP, p, (size_t)howMany));
 
        /* If read any good data and we null padded previously, log the
         * amount that we had null padded.
@@ -620,7 +635,7 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
            /* Now seek over the data we could not get. An error here means we
             * can't do the next read.
             */
-           lcode = FDH_SEEK(handleP, ((size - nbytes) + howMany), SEEK_SET);
+           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);
@@ -634,7 +649,7 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
        }
 
        /* Now write the data out */
-       if (iod_Write(iodp, (char *)p, howMany) != howMany)
+       if (iod_Write(iodp, (char *)p, (size_t)howMany) != howMany)
            error = VOLSERDUMPERROR;
 #ifndef AFS_PTHREAD_ENV
        IOMGR_Poll();