From 26f27b64e44f56622b9774fba3a64af39ae0e1ce Mon Sep 17 00:00:00 2001 From: Tom Keiser Date: Wed, 21 Jun 2006 18:59:07 +0000 Subject: [PATCH] STABLE14-aix-largefile-cleanup-20060620 some largefile cleanup and other minor aix tweaking (cherry picked from commit 7826b313868ec8ce975b65e5c430a9503fca4dd5) --- src/bozo/bnode.c | 4 +--- src/cf/osconf.m4 | 8 ++++---- src/export/Makefile.in | 6 +++++- src/libafs/Makefile.common.in | 2 +- src/libafs/MakefileProto.AIX.in | 4 ++++ src/libuafs/Makefile.common.in | 2 +- src/libuafs/MakefileProto.AIX.in | 5 +++++ src/vol/vol-salvage.c | 23 +++++++++++++---------- src/volser/dumpstuff.c | 28 +++++++++++++++++++++------- 9 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/bozo/bnode.c b/src/bozo/bnode.c index a4ba07e48..952e59231 100644 --- a/src/bozo/bnode.c +++ b/src/bozo/bnode.c @@ -738,12 +738,10 @@ hdl_notifier(struct bnode_proc *tp) #if defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI51_ENV) ec = setsid(); -#else -#ifdef AFS_LINUX20_ENV +#elif defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) ec = setpgrp(); #else ec = setpgrp(0, 0); -#endif #endif fout = popen(tb->notifier, "w"); if (fout == NULL) { diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index 85a1e9029..a7e2069ee 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -502,7 +502,7 @@ case $AFS_SYSNAME in MT_LIBS="-lpthreads" SHLIB_SUFFIX="o" TXLIBS="-lcurses" - XCFLAGS="-K -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void" + XCFLAGS="-K -D_NONSTD_TYPES -D_MBI=void" XLIBS="${LIB_AFSDB} -ldl" SHLIB_LINKER="${MT_CC} -bM:SRE -berok" AIX64="#" @@ -518,7 +518,7 @@ case $AFS_SYSNAME in MT_LIBS="-lpthreads" SHLIB_SUFFIX="o" TXLIBS="-lcurses" - XCFLAGS="-K -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void" + XCFLAGS="-K -D_NONSTD_TYPES -D_MBI=void" XLIBS="${LIB_AFSDB} -ldl" SHLIB_LINKER="${MT_CC} -bM:SRE -berok" AIX64="" @@ -533,7 +533,7 @@ case $AFS_SYSNAME in MT_LIBS="-lpthreads" SHLIB_SUFFIX="o" TXLIBS="-lcurses" - XCFLAGS="-K -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void" + XCFLAGS="-K -D_NONSTD_TYPES -D_MBI=void" XLIBS="${LIB_AFSDB} -ldl" SHLIB_LINKER="${MT_CC} -bM:SRE -berok" AIX64="" @@ -548,7 +548,7 @@ case $AFS_SYSNAME in MT_LIBS="-lpthreads" SHLIB_SUFFIX="o" TXLIBS="-lcurses" - XCFLAGS="-K -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void" + XCFLAGS="-K -D_NONSTD_TYPES -D_MBI=void" XLIBS="${LIB_AFSDB} -ldl" SHLIB_LINKER="${MT_CC} -bM:SRE -berok" AIX64="" diff --git a/src/export/Makefile.in b/src/export/Makefile.in index 4b5e79860..d35450e1c 100644 --- a/src/export/Makefile.in +++ b/src/export/Makefile.in @@ -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} $? $@ diff --git a/src/libafs/Makefile.common.in b/src/libafs/Makefile.common.in index 25606cf16..351949ddc 100644 --- a/src/libafs/Makefile.common.in +++ b/src/libafs/Makefile.common.in @@ -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 diff --git a/src/libafs/MakefileProto.AIX.in b/src/libafs/MakefileProto.AIX.in index 36c6ceb2c..66129fc3a 100644 --- a/src/libafs/MakefileProto.AIX.in +++ b/src/libafs/MakefileProto.AIX.in @@ -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 diff --git a/src/libuafs/Makefile.common.in b/src/libuafs/Makefile.common.in index 74411de96..cef7299c4 100644 --- a/src/libuafs/Makefile.common.in +++ b/src/libuafs/Makefile.common.in @@ -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) diff --git a/src/libuafs/MakefileProto.AIX.in b/src/libuafs/MakefileProto.AIX.in index 6dfd9c8d8..865b31434 100644 --- a/src/libuafs/MakefileProto.AIX.in +++ b/src/libuafs/MakefileProto.AIX.in @@ -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 diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 04eb2694f..8ff3af450 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -2744,7 +2744,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; @@ -2795,18 +2795,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 @@ -2837,8 +2838,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"); @@ -2851,11 +2854,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 @@ -3095,7 +3098,7 @@ DistilVnodeEssence(VolumeId rwVId, VnodeClass class, Inode ino, Unique * maxu) struct VnodeClassInfo *vcp = &VnodeClassInfo[class]; char buf[SIZEOF_LARGEDISKVNODE]; struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf; - int size; + afs_sfsize_t size; StreamHandle_t *file; int vnodeIndex; int nVnodes; @@ -3302,7 +3305,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; @@ -3575,7 +3578,7 @@ void ClearROInUseBit(struct VolumeSummary *summary) { IHandle_t *h = summary->volumeInfoHandle; - int nBytes; + afs_sfsize_t nBytes; VolumeDiskData volHeader; diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 88111f08f..10e137076 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -519,9 +519,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 = 0; byte *p; #ifndef AFS_NT40_ENV struct afs_stat status; @@ -529,7 +530,12 @@ DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP) afs_sfsize_t size; #ifdef AFS_AIX_ENV #include +#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 @@ -544,7 +550,15 @@ 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; #else howMany = status.st_blksize; @@ -570,9 +584,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; } @@ -581,7 +595,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. @@ -615,7 +629,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); @@ -629,7 +643,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(); -- 2.39.5