From 73b42831167926d1743ad894d5c560d41c5f8a1a Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 28 Mar 2003 09:35:53 +0000 Subject: [PATCH] revert-large-file-support-20030328 FIXES 1341 sadly there are problems. how long before this comes to the fore again i don't know. --- acconfig.h | 1 - acinclude.m4 | 6 - src/config/param.i386_linux24.h | 5 - src/config/stds.h | 2 - src/dir/buffer.c | 10 +- src/dir/test/dtest.c | 4 +- src/dir/test/physio.c | 12 +- src/viced/afsfileprocs.c | 340 ++++++++++++++-------------------------- src/viced/physio.c | 10 +- src/viced/viced.c | 3 +- src/vol/ihandle.c | 36 ++--- src/vol/ihandle.h | 27 +--- src/vol/namei_ops.c | 135 ++-------------- src/vol/namei_ops.h | 6 +- src/vol/partition.c | 34 +--- src/vol/partition.h | 4 +- src/vol/physio.c | 12 +- src/vol/viceinode.h | 2 +- src/vol/vnode.h | 38 ----- src/vol/vol-info.c | 17 +- src/vol/vol-salvage.c | 123 ++------------- src/vol/volume.c | 23 +-- src/vol/volume.h | 2 +- src/volser/dumpstuff.c | 91 ++--------- src/volser/physio.c | 12 +- src/volser/restorevol.c | 33 +--- src/volser/volprocs.c | 7 +- 27 files changed, 235 insertions(+), 760 deletions(-) diff --git a/acconfig.h b/acconfig.h index 3b43a10..ade7616 100644 --- a/acconfig.h +++ b/acconfig.h @@ -22,7 +22,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } #endif #undef AFS_AFSDB_ENV -#undef AFS_LARGEFILE_ENV #undef AFS_NAMEI_ENV #undef BITMAP_LATER diff --git a/acinclude.m4 b/acinclude.m4 index 1394e65..57b9c8d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -23,8 +23,6 @@ AC_ARG_ENABLE( bos-restricted-mode, [ --enable-bos-restricted-mode enable bosserver restricted mode which disables certain bosserver functionality],, enable_bos_restricted_mode="no") AC_ARG_ENABLE( bos-new-config, [ --enable-bos-new-config enable bosserver pickup of BosConfig.new on restarts],, enable_bos_new_config="no") -AC_ARG_ENABLE( largefile-fileserver, -[ --enable-largefile-filesever enable large file support in fileserver],, enable_largefile_fileserver="no") AC_ARG_ENABLE( namei-fileserver, [ --enable-namei-fileserver force compilation of namei fileserver in preference to inode fileserver],, enable_namei_fileserver="no") AC_ARG_ENABLE( supergroups, @@ -672,10 +670,6 @@ if test "$enable_bos_new_config" = "yes"; then AC_DEFINE(BOS_NEW_CONFIG, 1, [define if you want to enable automatic renaming of BosConfig.new to BosConfig at startup]) fi -if test "$enable_largefile_fileserver" = "yes"; then - AC_DEFINE(AFS_LARGEFILE_ENV) -fi - if test "$enable_namei_fileserver" = "yes"; then AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver]) fi diff --git a/src/config/param.i386_linux24.h b/src/config/param.i386_linux24.h index 6cfc388..77f863a 100644 --- a/src/config/param.i386_linux24.h +++ b/src/config/param.i386_linux24.h @@ -26,11 +26,6 @@ #define AFS_64BIT_ENV 1 #define AFS_64BIT_CLIENT 1 -#ifdef AFS_LARGEFILE_ENV -#define _FILE_OFFSET_BITS 64 -#endif - - #if defined(__KERNEL__) && !defined(KDUMP_KERNEL) #include diff --git a/src/config/stds.h b/src/config/stds.h index e7fc6ae..7e8b4ff 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -88,11 +88,9 @@ typedef struct u_Int64 afs_uint64; #ifdef AFS_64BIT_CLIENT typedef afs_int64 afs_size_t; typedef afs_uint64 afs_offs_t; -#define SplitOffsetOrSize(t,h,l) SplitInt64(t,h,l) #else /* AFS_64BIT_CLIENT */ typedef afs_int32 afs_size_t; typedef afs_uint32 afs_offs_t; -#define SplitOffsetOrSize(t,h,l) (h) = 0; (l) = (t); #endif /* AFS_64BIT_CLIENT */ /* you still have to include to make these work */ diff --git a/src/dir/buffer.c b/src/dir/buffer.c index cbb2e5e..0d0549e 100644 --- a/src/dir/buffer.c +++ b/src/dir/buffer.c @@ -184,7 +184,7 @@ DRead(fid, page) ObtainWriteLock(&tb->lock); tb->lockers++; ReleaseWriteLock(&afs_bufferLock); - if (ReallyRead(tb->fid, (afs_size_t) tb->page,tb->data)) { + if (ReallyRead(tb->fid,tb->page,tb->data)) { tb->lockers--; FidZap(tb->fid); /* disaster */ ReleaseWriteLock(&tb->lock); @@ -261,7 +261,7 @@ newslot (afid, apage, lp) * and the afs_bufferLock prevents other threads from zapping this * buffer while we are writing it out */ if (lp->dirty) { - if (ReallyWrite(lp->fid, (afs_size_t) lp->page,lp->data)) Die("writing bogus buffer"); + if (ReallyWrite(lp->fid,lp->page,lp->data)) Die("writing bogus buffer"); lp->dirty = 0; } @@ -336,7 +336,7 @@ DFlushVolume (vid) if (FidVolEq(tb->fid,vid)) { ObtainWriteLock(&tb->lock); if (tb->dirty) { - code = ReallyWrite(tb->fid, (afs_size_t) tb->page, tb->data); + code = ReallyWrite(tb->fid, tb->page, tb->data); if (code && !rcode) rcode = code; tb->dirty = 0; @@ -361,7 +361,7 @@ DFlushEntry (fid) if (FidEq(tb->fid, fid) && tb->dirty) { ObtainWriteLock(&tb->lock); if (tb->dirty) { - code = ReallyWrite(tb->fid, (afs_size_t) tb->page, tb->data); + code = ReallyWrite(tb->fid, tb->page, tb->data); if (code) { ReleaseWriteLock(&tb->lock); ReleaseReadLock(&afs_bufferLock); @@ -392,7 +392,7 @@ DFlush () (*tbp)->lockers++; ReleaseReadLock(&afs_bufferLock); if ((*tbp)->dirty) { - code = ReallyWrite((*tbp)->fid, (afs_size_t) (*tbp)->page, (*tbp)->data); + code = ReallyWrite((*tbp)->fid, (*tbp)->page, (*tbp)->data); if (!code) (*tbp)->dirty = 0; /* Clear the dirty flag */ if (code && !rcode) { diff --git a/src/dir/test/dtest.c b/src/dir/test/dtest.c index 4cf7af8..59a9bca 100644 --- a/src/dir/test/dtest.c +++ b/src/dir/test/dtest.c @@ -202,7 +202,7 @@ CreateDir(name, dir) ReallyRead(dir, block, data) dirhandle *dir; - afs_size_t block; + int block; char *data; { int code; @@ -218,7 +218,7 @@ ReallyRead(dir, block, data) ReallyWrite(dir, block, data) dirhandle *dir; - afs_size_t block; + int block; char *data; { int code; diff --git a/src/dir/test/physio.c b/src/dir/test/physio.c index b61da50..f6cf803 100644 --- a/src/dir/test/physio.c +++ b/src/dir/test/physio.c @@ -45,7 +45,7 @@ RCSID("$Header$"); ReallyRead(fid, block, data) long *fid; /* View the fid as longs. */ - afs_size_t block; + long block; char *data; {/* Do a real read. */ char fname[100]; @@ -53,9 +53,9 @@ ReallyRead(fid, block, data) sprintf(fname, "F%d", *fid); s = open(fname,O_RDONLY,0644); if (s<0) Die("can't open cache file"); - code=lseek(s,(off_t)(PAGESIZE*block),0); + code=lseek(s,PAGESIZE*block,0); if (code<0) Die("r:lseek"); - code=read(s,data,(size_t)PAGESIZE); + code=read(s,data,PAGESIZE); if (code<0) { Die("read"); } @@ -65,7 +65,7 @@ ReallyRead(fid, block, data) ReallyWrite(fid, block, data) long *fid; /* View the fid as longs. */ - afs_size_t block; + long block; char *data; {/* Do a real write. */ char fname[100]; @@ -73,9 +73,9 @@ ReallyWrite(fid, block, data) sprintf(fname, "F%d", *fid); s = open(fname,O_RDWR|O_CREAT,0644); if (s<0) Die("can't find cache file"); - code = lseek(s,(off_t)(PAGESIZE*block),0); + code = lseek(s,PAGESIZE*block,0); if (code<0) Die("w:lseek"); - code=write(s,data,(size_t)PAGESIZE); + code=write(s,data,PAGESIZE); if (code<0) Die("write"); close(s); return 0; diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index b392099..800cbb9 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -200,12 +200,12 @@ afs_int32 FetchData_RXStyle(Volume *volptr, Vnode *targetptr, register struct rx_call *Call, - afs_size_t Pos, - afs_size_t Len, + afs_int32 Pos, + afs_int32 Len, afs_int32 Int64Mode, #if FS_STATS_DETAILED - afs_size_t *a_bytesToFetchP, - afs_size_t *a_bytesFetchedP + afs_int32 *a_bytesToFetchP, + afs_int32 *a_bytesFetchedP #endif /* FS_STATS_DETAILED */ ); @@ -215,13 +215,13 @@ StoreData_RXStyle(Volume *volptr, struct AFSFid *Fid, struct client *client, register struct rx_call *Call, - afs_offs_t Pos, - afs_offs_t Length, - afs_offs_t FileLength, + afs_uint32 Pos, + afs_uint32 Length, + afs_uint32 FileLength, int sync, #if FS_STATS_DETAILED - afs_size_t *a_bytesToStoreP, - afs_size_t *a_bytesStoredP + afs_int32 *a_bytesToStoreP, + afs_int32 *a_bytesStoredP #endif /* FS_STATS_DETAILED */ ); @@ -1009,8 +1009,7 @@ static int CopyOnWrite(Vnode *targetptr, Volume *volptr) Inode ino, nearInode; int rdlen; int wrlen; - register afs_size_t size; - register int length; + register int size, length; int ifd, ofd; char *buff; int rc; /* return code */ @@ -1020,7 +1019,7 @@ static int CopyOnWrite(Vnode *targetptr, Volume *volptr) if (targetptr->disk.type == vDirectory) DFlush(); /* just in case? */ - VN_GET_LEN(size, targetptr); + size = targetptr->disk.length; buff = (char *)malloc(COPYBUFFSIZE); if (buff == NULL) { return EIO; @@ -1236,13 +1235,8 @@ DeleteTarget(Vnode *parentptr, } } VN_SET_INO(*targetptr, (Inode)0); - { - afs_size_t adjLength; - VN_GET_LEN(adjLength, *targetptr); - VAdjustDiskUsage(&errorCode, volptr, - -nBlocks(adjLength), - (afs_size_t) 0); - } + VAdjustDiskUsage(&errorCode, volptr, + -(int)nBlocks((*targetptr)->disk.length), 0); } (*targetptr)->changed_newTime = 1; /* Status change of deleted file/dir */ @@ -1280,8 +1274,7 @@ Update_ParentVnodeStatus(Vnode *parentptr, #endif /* FS_STATS_DETAILED */ ) { - afs_offs_t newlength; /* Holds new directory length */ - afs_offs_t parentLength; + afs_uint32 newlength; /* Holds new directory length */ int errorCode; #if FS_STATS_DETAILED Date currDate; /*Current date*/ @@ -1297,13 +1290,11 @@ Update_ParentVnodeStatus(Vnode *parentptr, * XXX But we still don't check the error since we're dealing with dirs here and really the increase * of a new entry would be too tiny to worry about failures (since we have all the existing cushion) */ - VN_GET_LEN(parentLength, parentptr); - if (nBlocks(newlength) != nBlocks(parentLength)) { + if (nBlocks(newlength) != nBlocks(parentptr->disk.length)) VAdjustDiskUsage(&errorCode, volptr, - (nBlocks(newlength) - nBlocks(parentLength)), - (nBlocks(newlength) - nBlocks(parentLength))); - } - VN_SET_LEN(parentptr, newlength); + (int)(nBlocks(newlength) - nBlocks(parentptr->disk.length)), + (int)(nBlocks(newlength) - nBlocks(parentptr->disk.length))); + parentptr->disk.length = newlength; #if FS_STATS_DETAILED /* @@ -1362,7 +1353,7 @@ Update_TargetVnodeStatus(Vnode *targetptr, AFSStoreStatus *InStatus, Vnode *parentptr, Volume *volptr, - afs_size_t length) + afs_int32 length) { #if FS_STATS_DETAILED Date currDate; /*Current date*/ @@ -1372,7 +1363,7 @@ Update_TargetVnodeStatus(Vnode *targetptr, if (Caller & (TVS_CFILE|TVS_SLINK|TVS_MKDIR)) { /* initialize new file */ targetptr->disk.parent = parentptr->vnodeNumber; - VN_SET_LEN(targetptr, length); + targetptr->disk.length = length; /* targetptr->disk.group = 0; save some cycles */ targetptr->disk.modeBits = 0777; targetptr->disk.owner = client->ViceId; @@ -1517,14 +1508,14 @@ SetCallBackStruct(afs_uint32 CallBackTime, struct AFSCallBack *CallBack) * enough space before consuming some. */ static afs_int32 -AdjustDiskUsage(Volume *volptr, afs_size_t length, afs_size_t checkLength) +AdjustDiskUsage(Volume *volptr, afs_int32 length, afs_int32 checkLength) { int rc; int nc; VAdjustDiskUsage(&rc, volptr, length, checkLength); if (rc) { - VAdjustDiskUsage(&nc, volptr, -length, (afs_size_t) 0); + VAdjustDiskUsage(&nc, volptr, -length, 0); if (rc == VOVERQUOTA) { ViceLog(2,("Volume %u (%s) is full\n", V_id(volptr), V_name(volptr))); @@ -1554,7 +1545,7 @@ Alloc_NewVnode(Vnode *parentptr, char *Name, struct AFSFid *OutFid, int FileType, - afs_size_t BlocksPreallocatedForVnode) + int BlocksPreallocatedForVnode) { int errorCode = 0; /* Error code returned back */ int temp; @@ -1570,8 +1561,7 @@ Alloc_NewVnode(Vnode *parentptr, *targetptr = VAllocVnode(&errorCode, volptr, FileType); if (errorCode != 0) { - VAdjustDiskUsage(&temp, volptr, - BlocksPreallocatedForVnode, - (afs_size_t) 0); + VAdjustDiskUsage(&temp, volptr, - BlocksPreallocatedForVnode, 0); return(errorCode); } OutFid->Volume = V_id(volptr); @@ -1593,8 +1583,7 @@ Alloc_NewVnode(Vnode *parentptr, (*targetptr)->volumePtr->header->diskstuff.id, (*targetptr)->vnodeNumber, errno)); - VAdjustDiskUsage(&temp, volptr, -BlocksPreallocatedForVnode, - (afs_size_t) 0); + VAdjustDiskUsage(&temp, volptr, -BlocksPreallocatedForVnode,0); (*targetptr)->delete = 1; /* delete vnode */ return ENOSPC; } @@ -1613,7 +1602,7 @@ Alloc_NewVnode(Vnode *parentptr, /* delete the vnode previously allocated */ (*targetptr)->delete = 1; VAdjustDiskUsage(&temp, volptr, - -BlocksPreallocatedForVnode, (afs_size_t) 0); + -BlocksPreallocatedForVnode, 0); IH_REALLYCLOSE((*targetptr)->handle); if ( IH_DEC(V_linkHandle(volptr), inode, V_parentId(volptr)) ) ViceLog(0,("Alloc_NewVnode: partition %s idec %s failed\n", @@ -1629,8 +1618,7 @@ Alloc_NewVnode(Vnode *parentptr, SetDirHandle(dir, parentptr); if ((errorCode = Create(dir,(char *)Name, OutFid))) { (*targetptr)->delete = 1; - VAdjustDiskUsage(&temp, volptr, - BlocksPreallocatedForVnode, - (afs_size_t) 0); + VAdjustDiskUsage(&temp, volptr, - BlocksPreallocatedForVnode, 0); IH_REALLYCLOSE((*targetptr)->handle); if ( IH_DEC(V_linkHandle(volptr), inode, V_parentId(volptr))) ViceLog(0,("Alloc_NewVnode: partition %s idec %s failed\n", @@ -2001,7 +1989,8 @@ void GetStatus(Vnode *targetptr, else status->FileType = Invalid; /*invalid type field */ status->LinkCount = targetptr->disk.linkCount; - SET_STATUS_LEN(status, targetptr); + status->Length_hi = 0; + status->Length = targetptr->disk.length; status->DataVersion = targetptr->disk.dataVersion; status->Author = targetptr->disk.author; status->Owner = targetptr->disk.owner; @@ -2021,8 +2010,8 @@ void GetStatus(Vnode *targetptr, static afs_int32 common_FetchData64 (struct rx_call *acall, struct AFSFid *Fid, - afs_size_t Pos, - afs_size_t Len, + afs_int32 Pos, + afs_int32 Len, struct AFSFetchStatus *OutStatus, struct AFSCallBack *CallBack, struct AFSVolSync *Sync, @@ -2047,8 +2036,8 @@ afs_int32 common_FetchData64 (struct rx_call *acall, struct timeval xferStartTime, xferStopTime; /* Start/stop times for xfer portion*/ struct timeval elapsedTime; /* Transfer time */ - afs_size_t bytesToXfer; /* # bytes to xfer*/ - afs_size_t bytesXferred; /* # bytes actually xferred*/ + afs_int32 bytesToXfer; /* # bytes to xfer*/ + afs_int32 bytesXferred; /* # bytes actually xferred*/ int readIdx; /* Index of read stats array to bump*/ static afs_int32 tot_bytesXferred; /* shared access protected by FS_LOCK */ @@ -2131,13 +2120,10 @@ afs_int32 common_FetchData64 (struct rx_call *acall, /* actually do the data transfer */ #if FS_STATS_DETAILED - errorCode = FetchData_RXStyle(volptr, targetptr, acall, - (afs_size_t) Pos, (afs_size_t) Len, type, + errorCode = FetchData_RXStyle(volptr, targetptr, acall, Pos, Len, type, &bytesToXfer, &bytesXferred); #else - if ((errorCode = FetchData_RXStyle(volptr, targetptr, acall, - (afs_size_t) Pos, (afs_size_t) Len, - type))) + if ((errorCode = FetchData_RXStyle(volptr, targetptr, acall, Pos, Len, type))) goto Bad_FetchData; #endif /* FS_STATS_DETAILED */ @@ -2256,7 +2242,7 @@ Bad_FetchData: osi_auditU (acall, FetchDataEvent, errorCode, AUD_FID, Fid, AUD_END); return(errorCode); -} /*common_FetchData64*/ +} /*SRXAFS_FetchData*/ afs_int32 SRXAFS_FetchData (struct rx_call *acall, struct AFSFid *Fid, @@ -2269,10 +2255,8 @@ afs_int32 SRXAFS_FetchData (struct rx_call *acall, { int code; - code = common_FetchData64 (acall, Fid, - (afs_size_t) Pos, (afs_size_t) Len, - OutStatus, - CallBack, Sync, 0); + code = common_FetchData64 (acall, Fid, Pos, Len, OutStatus, + CallBack, Sync, 0); return code; } @@ -2285,13 +2269,11 @@ afs_int32 SRXAFS_FetchData64 (struct rx_call *acall, struct AFSVolSync *Sync) { int code; - afs_size_t tPos, tLen; + afs_int32 tPos, tLen; #ifdef AFS_64BIT_ENV -#ifndef AFS_LARGEFILE_ENV if (Pos + Len > 0x7fffffff) return E2BIG; -#endif /* !AFS_LARGEFILE_ENV */ tPos = Pos; tLen = Len; #else /* AFS_64BIT_ENV */ @@ -2845,15 +2827,15 @@ Bad_FetchStatus: } /*SRXAFS_FetchStatus*/ -static -afs_int32 common_StoreData64 (struct rx_call *acall, - struct AFSFid *Fid, - struct AFSStoreStatus *InStatus, - afs_offs_t Pos, - afs_offs_t Length, - afs_offs_t FileLength, - struct AFSFetchStatus *OutStatus, - struct AFSVolSync *Sync) + +afs_int32 SRXAFS_StoreData (struct rx_call *acall, + struct AFSFid *Fid, + struct AFSStoreStatus *InStatus, + afs_uint32 Pos, + afs_uint32 Length, + afs_uint32 FileLength, + struct AFSFetchStatus *OutStatus, + struct AFSVolSync *Sync) { Vnode * targetptr = 0; /* pointer to input fid */ Vnode * parentwhentargetnotdir = 0; /* parent of Fid to get ACL */ @@ -2874,8 +2856,8 @@ afs_int32 common_StoreData64 (struct rx_call *acall, struct timeval xferStartTime, xferStopTime; /* Start/stop times for xfer portion*/ struct timeval elapsedTime; /* Transfer time */ - afs_size_t bytesToXfer; /* # bytes to xfer */ - afs_size_t bytesXferred; /* # bytes actually xfer */ + afs_int32 bytesToXfer; /* # bytes to xfer */ + afs_int32 bytesXferred; /* # bytes actually xfer */ static afs_int32 tot_bytesXferred; /* shared access protected by FS_LOCK */ /* @@ -2906,22 +2888,6 @@ afs_int32 common_StoreData64 (struct rx_call *acall, ViceLog(5, ("StoreData: Fid = %u.%d.%d, Host %s, Id %d\n", Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr), t_client->ViceId)); -#ifdef AFS_LARGEFILE_ENV - ViceLog(25, ("StoreData: Fid = %u.%d.%d, Host %s, Id %d, Pos (0X%x,0X%x), Len (0X%x,0X%x), FileLen (0X%x,0X%x)\n", - Fid->Volume, Fid->Vnode, Fid->Unique, - inet_ntoa(logHostAddr), t_client->ViceId, - (unsigned) (Pos >> 32), (unsigned) (Pos & 0xffffffff), - (unsigned) (Length >> 32), (unsigned) (Length & 0xffffffff), - (unsigned) (FileLength >> 32), (unsigned) (FileLength & 0xffffffff))); -#else /* !AFS_LARGEFILE_ENV */ - ViceLog(25, ("StoreData: Fid = %u.%d.%d, Host %s, Id %d, Pos 0X%x, Len 0X%x, FileLen 0X%x\n", - Fid->Volume, Fid->Vnode, Fid->Unique, - inet_ntoa(logHostAddr), t_client->ViceId, - Pos, - Length, - FileLength)); -#endif /* !AFS_LARGEFILE_ENV */ - /* * Get associated volume/vnode for the stored file; caller's rights @@ -2971,16 +2937,13 @@ afs_int32 common_StoreData64 (struct rx_call *acall, /* Do the actual storing of the data */ #if FS_STATS_DETAILED errorCode = StoreData_RXStyle(volptr, targetptr, Fid, client, acall, - (afs_size_t) Pos, (afs_size_t) Length, - (afs_size_t) FileLength, + Pos, Length, FileLength, (InStatus->Mask & AFS_FSYNC), &bytesToXfer, &bytesXferred); #else errorCode = StoreData_RXStyle(volptr, targetptr, Fid, client, - acall, - (afs_size_t) Pos, (afs_size_t) Length, - (afs_size_t) FileLength, - (InStatus->Mask & AFS_FSYNC)); + acall, Pos, Length, FileLength, + (InStatus->Mask & AFS_FSYNC)); if (errorCode && (!targetptr->changed_newTime)) goto Bad_StoreData; #endif /* FS_STATS_DETAILED */ @@ -3061,7 +3024,7 @@ afs_int32 common_StoreData64 (struct rx_call *acall, /* Update the status of the target's vnode */ Update_TargetVnodeStatus(targetptr, TVS_SDATA, client, InStatus, targetptr, - volptr, (afs_size_t) 0); + volptr, 0); /* Get the updated File's status back to the caller */ GetStatus(targetptr, OutStatus, rights, anyrights, &tparentwhentargetnotdir); @@ -3094,23 +3057,6 @@ Bad_StoreData: osi_auditU (acall, StoreDataEvent, errorCode, AUD_FID, Fid, AUD_END); return(errorCode); -} /*common_StoreData64*/ - -afs_int32 SRXAFS_StoreData (struct rx_call *acall, - struct AFSFid *Fid, - struct AFSStoreStatus *InStatus, - afs_uint32 Pos, - afs_uint32 Length, - afs_uint32 FileLength, - struct AFSFetchStatus *OutStatus, - struct AFSVolSync *Sync) -{ - int code; - - code = common_StoreData64 (acall, Fid, InStatus, Pos, Length, FileLength, - OutStatus, Sync); - return code; - } /*SRXAFS_StoreData*/ afs_int32 SRXAFS_StoreData64 (struct rx_call *acall, @@ -3123,15 +3069,13 @@ afs_int32 SRXAFS_StoreData64 (struct rx_call *acall, struct AFSVolSync *Sync) { int code; - afs_offs_t tPos; - afs_offs_t tLength; - afs_offs_t tFileLength; + afs_int32 tPos; + afs_int32 tLength; + afs_int32 tFileLength; #ifdef AFS_64BIT_ENV -#ifndef AFS_LARGEFILE_ENV if (FileLength > 0x7fffffff) return E2BIG; -#endif /* !AFS_LARGEFILE_ENV */ tPos = Pos; tLength = Length; tFileLength = FileLength; @@ -3143,7 +3087,7 @@ afs_int32 SRXAFS_StoreData64 (struct rx_call *acall, tFileLength = FileLength.low; #endif /* AFS_64BIT_ENV */ - code = common_StoreData64 (acall, Fid, InStatus, tPos, tLength, tFileLength, + code = SRXAFS_StoreData (acall, Fid, InStatus, tPos, tLength, tFileLength, OutStatus, Sync); return code; } @@ -3322,8 +3266,7 @@ SAFSS_StoreStatus (struct rx_call *acall, /* Update the status of the target's vnode */ Update_TargetVnodeStatus(targetptr, TVS_SSTATUS, client, InStatus, (parentwhentargetnotdir ? - parentwhentargetnotdir : targetptr), volptr, - (afs_size_t)0); + parentwhentargetnotdir : targetptr), volptr, 0); /* convert the write lock to a read lock before breaking callbacks */ VVnodeWriteToRead(&errorCode, targetptr); @@ -3582,7 +3525,7 @@ SAFSS_CreateFile (struct rx_call *acall, int errorCode = 0; /* error code */ DirHandle dir; /* Handle for dir package I/O */ struct client * client; /* pointer to client structure */ - afs_int32 rights, anyrights; /* rights for this and any user */ + afs_int32 rights, anyrights; /* rights for this and any user */ struct client *t_client; /* tmp ptr to client data */ struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ struct rx_connection *tcon = rx_ConnectionOf(acall); @@ -3637,7 +3580,7 @@ SAFSS_CreateFile (struct rx_call *acall, /* update the status of the new file's vnode */ Update_TargetVnodeStatus(targetptr, TVS_CFILE, client, InStatus, - parentptr, volptr, (afs_size_t)0); + parentptr, volptr, 0); /* set up the return status for the parent dir and the newly created file */ GetStatus(targetptr, OutFidStatus, rights, anyrights, parentptr); @@ -4003,10 +3946,8 @@ SAFSS_Rename (struct rx_call *acall, /* Drop the link count */ newfileptr->disk.linkCount--; if (newfileptr->disk.linkCount == 0) { /* Link count 0 - delete */ - afs_size_t newSize; - VN_GET_LEN(newSize, newfileptr); VAdjustDiskUsage(&errorCode, volptr, - -nBlocks(newSize), (afs_size_t) 0); + -(int)nBlocks(newfileptr->disk.length), 0); if (VN_GET_INO(newfileptr)) { IH_REALLYCLOSE(newfileptr->handle); errorCode = IH_DEC(V_linkHandle(volptr), @@ -4300,7 +4241,7 @@ SAFSS_Symlink (struct rx_call *acall, /* update the status of the new symbolic link file vnode */ Update_TargetVnodeStatus(targetptr, TVS_SLINK, client, InStatus, parentptr, - volptr, (afs_size_t)strlen((char *)LinkContents)); + volptr, strlen((char *)LinkContents)); /* Write the contents of the symbolic link name into the target inode */ fdP = IH_OPEN(targetptr->handle); @@ -4697,13 +4638,13 @@ SAFSS_MakeDir (struct rx_call *acall, /* update the status for the target vnode */ Update_TargetVnodeStatus(targetptr, TVS_MKDIR, client, InStatus, - parentptr, volptr, (afs_size_t)0); + parentptr, volptr, 0); /* Actually create the New directory in the directory package */ SetDirHandle(&dir, targetptr); assert(!(MakeDir(&dir, OutFid, DirFid))); DFlush(); - VN_SET_LEN(targetptr, (afs_size_t) Length(&dir)); + targetptr->disk.length = Length(&dir); /* set up return status */ GetStatus(targetptr, OutFidStatus, rights, anyrights, parentptr); @@ -6643,12 +6584,12 @@ afs_int32 FetchData_RXStyle(Volume *volptr, Vnode *targetptr, register struct rx_call *Call, - afs_size_t Pos, - afs_size_t Len, + afs_int32 Pos, + afs_int32 Len, afs_int32 Int64Mode, #if FS_STATS_DETAILED - afs_size_t *a_bytesToFetchP, - afs_size_t *a_bytesFetchedP + afs_int32 *a_bytesToFetchP, + afs_int32 *a_bytesFetchedP #endif /* FS_STATS_DETAILED */ ) { @@ -6663,7 +6604,7 @@ FetchData_RXStyle(Volume *volptr, struct iovec tiov[RX_MAXIOVECS]; int tnio; #endif /* AFS_NT40_ENV */ - afs_size_t tlen; + afs_int32 tlen; afs_int32 optSize; struct stat tstat; #ifdef AFS_AIX_ENV @@ -6678,25 +6619,15 @@ FetchData_RXStyle(Volume *volptr, (*a_bytesFetchedP) = 0; #endif /* FS_STATS_DETAILED */ -#ifdef AFS_LARGEFILE_ENV - ViceLog(25, ("FetchData_RXStyle: Pos (0X%x,0X%x), Len (0X%x,0X%x)\n", - (unsigned) (Pos >> 32), (unsigned) (Pos & 0xffffffff), - (unsigned) (Len >> 32), (unsigned) (Len & 0xffffffff))); -#else /* !AFS_LARGEFILE_ENV */ - ViceLog(25, ("FetchData_RXStyle: Pos 0X%x, Len 0X%x\n", - (unsigned) Pos, - (unsigned) Len)); -#endif /* !AFS_LARGEFILE_ENV */ - if (!VN_GET_INO(targetptr)) { - afs_int32 zero = htonl(0); /* * This is used for newly created files; we simply send 0 bytes * back to make the cache manager happy... */ + tlen = htonl(0); if (Int64Mode) - rx_Write(Call, (char *)&zero, sizeof(afs_int32)); /* send 0-length */ - rx_Write(Call, (char *)&zero, sizeof(afs_int32)); /* send 0-length */ + rx_Write(Call, (char *)&tlen, sizeof(afs_int32)); /* send 0-length */ + rx_Write(Call, (char *)&tlen, sizeof(afs_int32)); /* send 0-length */ return (0); } TM_GetTimeOfDay(&StartTime, 0); @@ -6705,13 +6636,6 @@ FetchData_RXStyle(Volume *volptr, if (fdP == NULL) return EIO; optSize = sendBufSize; tlen = FDH_SIZE(fdP); -#ifdef AFS_LARGEFILE_ENV - ViceLog( 25, ("FetchData_RXStyle: file size (0X%x,0X%x)\n", - (unsigned) (tlen >> 32), (unsigned) (tlen & 0xffffffff))); -#else /* !AFS_LARGEFILE_ENV */ - ViceLog( 25, ("FetchData_RXStyle: file size 0X%x\n", - (unsigned) tlen)); -#endif /* !AFS_LARGEFILE_ENV */ if (tlen < 0) { FDH_CLOSE(fdP); return EIO; @@ -6719,17 +6643,12 @@ FetchData_RXStyle(Volume *volptr, if (Pos + Len > tlen) Len = tlen - Pos; /* get length we should send */ FDH_SEEK(fdP, Pos, 0); - { - afs_int32 high, low; - SplitOffsetOrSize(Len, high, low); - assert(Int64Mode || high==0); - if (Int64Mode) { - high = htonl(high); - rx_Write(Call, (char *)&high, sizeof(afs_int32)); /* High order bits */ - } - low = htonl(low); - rx_Write(Call, (char *)&low, sizeof(afs_int32)); /* send length on fetch */ + tlen = htonl(Len); + if (Int64Mode) { + afs_int32 zero = 0; + rx_Write(Call, (char *)&zero, sizeof(afs_int32)); /* High order bits */ } + rx_Write(Call, (char *)&tlen, sizeof(afs_int32)); /* send length on fetch */ #if FS_STATS_DETAILED (*a_bytesToFetchP) = Len; #endif /* FS_STATS_DETAILED */ @@ -6789,26 +6708,22 @@ FetchData_RXStyle(Volume *volptr, AFSCallStats.TotalFetchedBytes = AFSCallStats.AccumFetchTime = 0; AFSCallStats.AccumFetchTime += ((StopTime.tv_sec - StartTime.tv_sec) * 1000) + ((StopTime.tv_usec - StartTime.tv_usec) / 1000); - { - afs_size_t targLen; - VN_GET_LEN(targLen, targetptr); - AFSCallStats.TotalFetchedBytes += targLen; - AFSCallStats.FetchSize1++; - if (targLen < SIZE2) - AFSCallStats.FetchSize2++; - else if (targLen < SIZE3) - AFSCallStats.FetchSize3++; - else if (targLen < SIZE4) - AFSCallStats.FetchSize4++; - else - AFSCallStats.FetchSize5++; - } + AFSCallStats.TotalFetchedBytes += targetptr->disk.length; + AFSCallStats.FetchSize1++; + if (targetptr->disk.length < SIZE2) + AFSCallStats.FetchSize2++; + else if (targetptr->disk.length < SIZE3) + AFSCallStats.FetchSize3++; + else if (targetptr->disk.length < SIZE4) + AFSCallStats.FetchSize4++; + else + AFSCallStats.FetchSize5++; FS_UNLOCK return (0); } /*FetchData_RXStyle*/ -static int GetLinkCountAndSize(Volume *vp, FdHandle_t *fdP, int *lc, afs_size_t *size) +static int GetLinkCountAndSize(Volume *vp, FdHandle_t *fdP, int *lc, int *size) { #ifdef AFS_NAMEI_ENV FdHandle_t *lhp; @@ -6863,17 +6778,17 @@ StoreData_RXStyle(Volume *volptr, struct AFSFid *Fid, struct client *client, register struct rx_call *Call, - afs_offs_t Pos, - afs_offs_t Length, - afs_offs_t FileLength, + afs_uint32 Pos, + afs_uint32 Length, + afs_uint32 FileLength, int sync, #if FS_STATS_DETAILED - afs_size_t *a_bytesToStoreP, - afs_size_t *a_bytesStoredP + afs_int32 *a_bytesToStoreP, + afs_int32 *a_bytesStoredP #endif /* FS_STATS_DETAILED */ ) { - afs_size_t bytesTransfered; /* number of bytes actually transfered */ + int bytesTransfered; /* number of bytes actually transfered */ struct timeval StartTime, StopTime; /* Used to measure how long the store takes */ int errorCode = 0; /* Returned error code to caller */ #ifdef AFS_NT40_ENV @@ -6882,13 +6797,13 @@ StoreData_RXStyle(Volume *volptr, struct iovec tiov[RX_MAXIOVECS]; /* no data copying with iovec */ int tnio; /* temp for iovec size */ #endif /* AFS_NT40_ENV */ - afs_size_t tlen; /* temp for xfr length */ + int tlen; /* temp for xfr length */ Inode tinode; /* inode for I/O */ - afs_size_t optSize; /* optimal transfer size */ - afs_size_t DataLength; /* size of inode */ - afs_size_t TruncatedLength; /* size after ftruncate */ - afs_offs_t NewLength; /* size after this store completes */ - afs_size_t adjustSize; /* bytes to call VAdjust... with */ + afs_int32 optSize; /* optimal transfer size */ + int DataLength; /* size of inode */ + afs_int32 TruncatedLength; /* size after ftruncate */ + afs_uint32 NewLength; /* size after this store completes */ + afs_int32 adjustSize; /* bytes to call VAdjust... with */ int linkCount; /* link count on inode */ int code; FdHandle_t *fdP; @@ -6934,7 +6849,7 @@ StoreData_RXStyle(Volume *volptr, } if (linkCount != 1) { - afs_size_t size; + afs_uint32 size; ViceLog(25, ("StoreData_RXStyle : inode %s has more than onelink\n", PrintInode(NULL, VN_GET_INO(targetptr)))); /* other volumes share this data, better copy it first */ @@ -6946,7 +6861,7 @@ StoreData_RXStyle(Volume *volptr, * of the disk will be recorded... */ FDH_CLOSE(fdP); - VN_GET_LEN(size, targetptr); + size = targetptr->disk.length; volptr->partition->flags &= ~PART_DONTUPDATE; VSetPartitionDiskUsage(volptr->partition); volptr->partition->flags |= PART_DONTUPDATE; @@ -6984,11 +6899,7 @@ StoreData_RXStyle(Volume *volptr, NewLength = Pos+Length; /* and write */ /* adjust the disk block count by the difference in the files */ - { - afs_size_t targSize; - VN_GET_LEN(targSize, targetptr); - adjustSize = nBlocks(NewLength) - nBlocks(targSize); - } + adjustSize = (int) (nBlocks(NewLength) - nBlocks(targetptr->disk.length)); if((errorCode = AdjustDiskUsage(volptr, adjustSize, adjustSize - SpareComp(volptr)))) { FDH_CLOSE(fdP); @@ -7003,20 +6914,6 @@ StoreData_RXStyle(Volume *volptr, optSize = sendBufSize; -#ifdef AFS_LARGEFILE_ENV - ViceLog(25, ("StoreData_RXStyle: Pos (0X%x,0X%x), DataLength (0X%x,0X%x), FileLength (0X%x,0X%x), Length (0X%x,0X%x)\n", - (unsigned) (Pos >> 32), (unsigned) (Pos & 0xffffffff), - (unsigned) (DataLength >> 32), (unsigned) (DataLength & 0xffffffff), - (unsigned) (FileLength >> 32), (unsigned) (FileLength & 0xffffffff), - (unsigned) (Length >> 32), (unsigned) (Length & 0xffffffff))); -#else /* !AFS_LARGEFILE_ENV */ - ViceLog(25, ("StoreData_RXStyle: Pos 0X%x, DataLength 0X%x, FileLength 0X%x, Length 0X%x\n", - (unsigned) Pos, - (unsigned) DataLength, - (unsigned) FileLength, - (unsigned) Length)); -#endif /* !AFS_LARGEFILE_ENV */ - /* truncate the file iff it needs it (ftruncate is slow even when its a noop) */ if (FileLength < DataLength) FDH_TRUNC(fdP, FileLength); if (Pos > 0) FDH_SEEK(fdP, Pos, 0); @@ -7084,9 +6981,8 @@ StoreData_RXStyle(Volume *volptr, FDH_SYNC(fdP); } if (errorCode) { - afs_size_t nfSize = FDH_SIZE(fdP); /* something went wrong: adjust size and return */ - VN_SET_LEN(targetptr, nfSize); /* set new file size. */ + targetptr->disk.length = FDH_SIZE(fdP); /* set new file size. */ /* changed_newTime is tested in StoreData to detemine if we * need to update the target vnode. */ @@ -7094,33 +6990,29 @@ StoreData_RXStyle(Volume *volptr, FDH_CLOSE(fdP); /* set disk usage to be correct */ VAdjustDiskUsage(&errorCode, volptr, - (afs_size_t)(nBlocks(nfSize) - nBlocks(NewLength)), - (afs_size_t) 0); + (int)(nBlocks(targetptr->disk.length) + - nBlocks(NewLength)), 0); return errorCode; } FDH_CLOSE(fdP); TM_GetTimeOfDay(&StopTime, 0); - VN_SET_LEN(targetptr, NewLength); + targetptr->disk.length = NewLength; /* Update all StoreData related stats */ FS_LOCK if (AFSCallStats.TotalStoredBytes > 2000000000) /* reset if over 2 billion */ AFSCallStats.TotalStoredBytes = AFSCallStats.AccumStoreTime = 0; AFSCallStats.StoreSize1++; /* Piggybacked data */ - { - afs_size_t targLen; - VN_GET_LEN(targLen, targetptr); - if (targLen < SIZE2) - AFSCallStats.StoreSize2++; - else if (targLen < SIZE3) - AFSCallStats.StoreSize3++; - else if (targLen < SIZE4) - AFSCallStats.StoreSize4++; - else - AFSCallStats.StoreSize5++; - } + if (targetptr->disk.length < SIZE2) + AFSCallStats.StoreSize2++; + else if (targetptr->disk.length < SIZE3) + AFSCallStats.StoreSize3++; + else if (targetptr->disk.length < SIZE4) + AFSCallStats.StoreSize4++; + else + AFSCallStats.StoreSize5++; FS_UNLOCK return(errorCode); diff --git a/src/viced/physio.c b/src/viced/physio.c index 66ce91e..112d89b 100644 --- a/src/viced/physio.c +++ b/src/viced/physio.c @@ -48,14 +48,14 @@ RCSID("$Header$"); #ifdef PAGESIZE #undef PAGESIZE #endif -#define PAGESIZE (afs_size_t)2048 +#define PAGESIZE 2048 extern int LogLevel; afs_int32 lpErrno, lpCount; /* returns 0 on success, errno on failure */ -int ReallyRead (DirHandle *file, afs_size_t block, char *data) +int ReallyRead (DirHandle *file, int block, char *data) { int code; FdHandle_t *fdP; @@ -69,7 +69,7 @@ int ReallyRead (DirHandle *file, afs_size_t block, char *data) PrintInode(NULL, file->dirh_handle->ih_ino), code)); return code; } - if (FDH_SEEK(fdP, (afs_size_t)block * PAGESIZE, SEEK_SET) < 0) { + if (FDH_SEEK(fdP, block * PAGESIZE, SEEK_SET) < 0) { code = errno; ViceLog (0, ("ReallyRead(): lseek failed device %X inode %s errno %d\n", @@ -97,7 +97,7 @@ int ReallyRead (DirHandle *file, afs_size_t block, char *data) } /* returns 0 on success, errno on failure */ -int ReallyWrite (DirHandle *file, afs_size_t block, char *data) +int ReallyWrite (DirHandle *file, int block, char *data) { afs_int32 count; FdHandle_t *fdP; @@ -111,7 +111,7 @@ int ReallyWrite (DirHandle *file, afs_size_t block, char *data) lpErrno = errno; return 0; } - if (FDH_SEEK(fdP, (afs_size_t) block * PAGESIZE, SEEK_SET) < 0) { + if (FDH_SEEK(fdP, block * PAGESIZE, SEEK_SET) < 0) { ViceLog (0, ("ReallyWrite(): lseek failed device %X inode %s errno %d\n", file->dirh_handle->ih_dev, diff --git a/src/viced/viced.c b/src/viced/viced.c index b982b58..fc5370f 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -999,8 +999,7 @@ static int ParseArgs(int argc, char *argv[]) static void NewParms(int initializing) { static struct stat sbuf; - register afs_offs_t i; - register int fd; + register int i, fd; char *parms; char *argv[MAXPARMS]; register int argc; diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index 83e5677..cfd7614 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -22,17 +22,11 @@ RCSID("$Header$"); #ifdef AFS_NT40_ENV #include #else -#ifdef AFS_LARGEFILE_ENV -#include -#else #include -#endif #include #include #if defined(AFS_SUN5_ENV) || defined(AFS_NBSD_ENV) -#ifndef AFS_LARGEFILE_ENV #include -#endif #include #endif #endif @@ -105,7 +99,7 @@ void ih_glock_init() #endif /* AFS_PTHREAD_ENV */ /* Initialize the file descriptor cache */ -void ih_Initialize(void) { +void ih_Initialize() { int i; assert(!ih_Inited); ih_Inited = 1; @@ -150,7 +144,7 @@ void ih_Initialize(void) { /* Make the file descriptor cache as big as possible. Don't this call * if the program uses fopen or fdopen. */ -void ih_UseLargeCache(void) { +void ih_UseLargeCache() { IH_LOCK if (!ih_Inited) { @@ -162,7 +156,7 @@ void ih_UseLargeCache(void) { } /* Allocate a chunk of inode handles */ -void iHandleAllocateChunk(void) +void iHandleAllocateChunk() { int i; IHandle_t *ihP; @@ -228,7 +222,7 @@ IHandle_t *ih_copy(IHandle_t *ihP) } /* Allocate a chunk of file descriptor handles */ -void fdHandleAllocateChunk(void) +void fdHandleAllocateChunk() { int i; FdHandle_t *fdP; @@ -245,7 +239,7 @@ void fdHandleAllocateChunk(void) } /* Allocate a chunk of stream handles */ -void streamHandleAllocateChunk(void) +void streamHandleAllocateChunk() { int i; StreamHandle_t *streamP; @@ -494,10 +488,9 @@ StreamHandle_t *stream_open(const char *filename, const char *mode) } /* fread for buffered I/O handles */ -afs_size_t stream_read(void *ptr, afs_size_t size, afs_size_t nitems, - StreamHandle_t *streamP) +int stream_read(void *ptr, int size, int nitems, StreamHandle_t *streamP) { - afs_size_t nbytes, bytesRead, bytesToRead; + int nbytes, bytesRead, bytesToRead; char *p; /* Need to seek before changing direction */ @@ -544,11 +537,10 @@ afs_size_t stream_read(void *ptr, afs_size_t size, afs_size_t nitems, } /* fwrite for buffered I/O handles */ -afs_size_t stream_write(void *ptr, afs_size_t size, afs_size_t nitems, - StreamHandle_t *streamP) +int stream_write(void *ptr, int size, int nitems, StreamHandle_t *streamP) { char *p; - afs_size_t rc, nbytes, bytesWritten, bytesToWrite; + int rc, nbytes, bytesWritten, bytesToWrite; /* Need to seek before changing direction */ if (streamP->str_direction == STREAM_DIRECTION_NONE) { @@ -591,7 +583,7 @@ afs_size_t stream_write(void *ptr, afs_size_t size, afs_size_t nitems, } /* fseek for buffered I/O handles */ -int stream_seek(StreamHandle_t *streamP, afs_size_t offset, int whence) +int stream_seek(StreamHandle_t *streamP, int offset, int whence) { int rc; int retval = 0; @@ -847,17 +839,11 @@ Inode ih_icreate(IHandle_t *ih, int dev, char *part, Inode nI, int p1, int p2, #ifndef AFS_NT40_ENV -afs_size_t ih_size(int fd) +int ih_size(int fd) { -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; - if (fstat64(fd, &status)<0) - return -1; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; if (fstat(fd, &status)<0) return -1; -#endif /* !AFS_LARGEFILE_ENV */ return status.st_size; } #endif diff --git a/src/vol/ihandle.h b/src/vol/ihandle.h index b1ceb55..a14f2f7 100644 --- a/src/vol/ihandle.h +++ b/src/vol/ihandle.h @@ -249,9 +249,8 @@ extern FILE *ih_fdopen(FdHandle_t *h, char *fdperms); #endif /* AFS_NAMEI_ENV */ /* - * Prototypes for file descriptor cache routines + * Prototypes for file descriptor cache routined */ -extern void ih_Initialize(void); extern void ih_UseLargeCache(void); extern IHandle_t *ih_init(int dev, int vid, Inode ino); extern IHandle_t *ih_copy(IHandle_t *ihP); @@ -260,11 +259,11 @@ extern int fd_close(FdHandle_t *fdP); extern int fd_reallyclose(FdHandle_t *fdP); extern StreamHandle_t *stream_fdopen(FD_t fd); extern StreamHandle_t *stream_open(const char *file, const char *mode); -extern afs_size_t stream_read(void *ptr, afs_size_t size, afs_size_t nitems, - StreamHandle_t *streamP); -extern afs_size_t stream_write(void *ptr, afs_size_t size, afs_size_t nitems, - StreamHandle_t *streamP); -extern int stream_seek(StreamHandle_t *streamP, afs_size_t offset, int whence); +extern int stream_read(void *ptr, int size, int nitems, + StreamHandle_t *streamP); +extern int stream_write(void *ptr, int size, int nitems, + StreamHandle_t *streamP); +extern int stream_seek(StreamHandle_t *streamP, int offset, int whence); extern int stream_flush(StreamHandle_t *streamP); extern int stream_close(StreamHandle_t *streamP, int reallyClose); extern int ih_reallyclose(IHandle_t *ihP); @@ -340,29 +339,16 @@ extern int ih_condsync(IHandle_t *ihP); namei_icreate(H, P, P1, P2, P3, P4) #define OS_IOPEN(H) namei_iopen(H) -#ifdef AFS_LARGEFILE_ENV -#define OS_OPEN(F, M, P) open64(F, M, P) -#else /* !AFS_LARGEFILE_ENV */ #define OS_OPEN(F, M, P) open(F, M, P) -#endif /* !AFS_LARGEFILE_ENV */ #define OS_CLOSE(FD) close(FD) #define OS_READ(FD, B, S) read(FD, B, S) #define OS_WRITE(FD, B, S) write(FD, B, S) -#ifdef AFS_LARGEFILE_ENV -#define OS_SEEK(FD, O, F) lseek64(FD, (off64_t) O, F) -#else /* !AFS_LARGEFILE_ENV */ #define OS_SEEK(FD, O, F) lseek(FD, O, F) -#endif /* !AFS_LARGEFILE_ENV */ #define OS_SYNC(FD) fsync(FD) -#ifdef AFS_LARGEFILE_ENV -#define OS_TRUNC(FD, L) ftruncate64(FD, (off64_t) L) -#else /* !AFS_LARGEFILE_ENV */ #define OS_TRUNC(FD, L) ftruncate(FD, L) -#endif /* !AFS_LARGEFILE_ENV */ #define OS_SIZE(FD) ih_size(FD) -extern afs_size_t ih_size(int fd); #define IH_INC(H, I, P) namei_inc(H, I, P) #define IH_DEC(H, I, P) namei_dec(H, I, P) @@ -392,7 +378,6 @@ extern Inode ih_icreate(IHandle_t *ih, int dev, char *part, Inode nI, int p1,\ #define OS_SYNC(FD) fsync(FD) #define OS_TRUNC(FD, L) ftruncate(FD, L) #define OS_SIZE(FD) ih_size(FD) -extern afs_size_t ih_size(int fd); #ifdef AFS_LINUX22_ENV #define IH_INC(H, I, P) -1 diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index ff3fc2b..81c0dc5 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -46,10 +46,9 @@ RCSID("$Header$"); extern char *volutil_PartitionName_r(int volid, char *buf, int buflen); -afs_size_t namei_iread(IHandle_t *h, afs_size_t offset, - char *buf, afs_size_t size) +int namei_iread(IHandle_t *h, int offset, char *buf, int size) { - afs_size_t nBytes; + int nBytes; FdHandle_t *fdP; fdP = IH_OPEN(h); @@ -66,10 +65,9 @@ afs_size_t namei_iread(IHandle_t *h, afs_size_t offset, return nBytes; } -afs_size_t namei_iwrite(IHandle_t *h, afs_size_t offset, - char *buf, afs_size_t size) +int namei_iwrite(IHandle_t *h, int offset, char *buf, int size) { - afs_size_t nBytes; + int nBytes; FdHandle_t *fdP; fdP = IH_OPEN(h); @@ -285,11 +283,7 @@ delTree(char *root, char *tree, int *errp) char *cp; DIR *ds; struct dirent *dirp; -#ifdef AFS_LARGEFILE_ENV - struct stat64 st; -#else struct stat st; -#endif if (*tree) { /* delete the children first */ @@ -313,13 +307,7 @@ delTree(char *root, char *tree, int *errp) */ strcat(root, "/"); strcat(root, dirp->d_name); - if ( -#ifdef AFS_LARGEFILE_ENV - stat64(root, &st) == 0 -#else /* !AFS_LARGEFILE_ENV */ - stat(root, &st) == 0 -#endif /* !AFS_LARGEFILE_ENV */ - && S_ISDIR(st.st_mode)) { + if ( stat(root, &st) == 0 && S_ISDIR(st.st_mode)) { /* delete this subtree */ delTree(root, cp+1, errp); } else @@ -437,11 +425,7 @@ static int SetOGM(int fd, int parm, int tag) } /* GetOGM - get parm and tag from owner, group and mode bits. */ -#ifdef AFS_LARGEFILE_ENV -static void GetOGMFromStat(struct stat64 *status, int *parm, int *tag) -#else /* ! AFS_LARGEFILE_ENV */ static void GetOGMFromStat(struct stat *status, int *parm, int *tag) -#endif /* !AFS_LARGEFILE_ENV */ { *parm = status->st_uid | (status->st_gid << 15); *parm |= (status->st_mode & 0x18) << 27; @@ -450,15 +434,9 @@ static void GetOGMFromStat(struct stat *status, int *parm, int *tag) static int GetOGM(int fd, int *parm, int *tag) { -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; - if (fstat64(fd, &status)<0) - return -1; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; if (fstat(fd, &status)<0) return -1; -#endif /* !AFS_LARGEFILE_ENV */ GetOGMFromStat(&status, parm, tag); return 0; @@ -533,20 +511,12 @@ Inode namei_icreate(IHandle_t *lh, char *part, int p1, int p2, int p3, int p4) } namei_HandleToName(&name, &tmp); -#ifdef AFS_LARGEFILE_ENV - fd = open64(name.n_path, O_CREAT|O_EXCL|O_TRUNC|O_RDWR, 0); -#else /* !AFS_LARGEFILE_ENV */ fd = open(name.n_path, O_CREAT|O_EXCL|O_TRUNC|O_RDWR, 0); -#endif /* !AFS_LARGEFILE_ENV */ if (fd < 0) { if (errno == ENOTDIR || errno == ENOENT) { if (namei_CreateDataDirectories(&name, &created_dir)<0) goto bad; -#ifdef AFS_LARGEFILE_ENV - fd = open64(name.n_path, O_CREAT|O_EXCL|O_TRUNC|O_RDWR, 0); -#else /* !AFS_LARGEFILE_ENV */ fd = open(name.n_path, O_CREAT|O_EXCL|O_TRUNC|O_RDWR, 0); -#endif /* !AFS_LARGEFILE_ENV */ if (fd < 0) goto bad; } @@ -592,11 +562,7 @@ int namei_iopen(IHandle_t *h) /* Convert handle to file name. */ namei_HandleToName(&name, h); -#ifdef AFS_LARGEFILE_ENV - fd = open64(name.n_path, O_RDWR, 0666); -#else /* !AFS_LARGEFILE_ENV */ fd = open(name.n_path, O_RDWR, 0666); -#endif /* !AFS_LARGEFILE_ENV */ return fd; } @@ -819,7 +785,7 @@ int namei_inc(IHandle_t *h, Inode ino, int p1) #define LINKTABLE_WIDTH 2 #define LINKTABLE_SHIFT 1 /* log 2 = 1 */ -static void namei_GetLCOffsetAndIndexFromIno(Inode ino, afs_size_t *offset, int *index) +static void namei_GetLCOffsetAndIndexFromIno(Inode ino, int *offset, int *index) { int toff = (int) (ino & NAMEI_VNODEMASK); int tindex = (int)((ino>>NAMEI_TAGSHIFT) & NAMEI_TAGMASK); @@ -836,8 +802,7 @@ static void namei_GetLCOffsetAndIndexFromIno(Inode ino, afs_size_t *offset, int int namei_GetLinkCount(FdHandle_t *h, Inode ino, int lockit) { unsigned short row = 0; - afs_size_t offset; - int index; + int offset, index; namei_GetLCOffsetAndIndexFromIno(ino, &offset, &index); @@ -850,13 +815,8 @@ int namei_GetLinkCount(FdHandle_t *h, Inode ino, int lockit) return -1; } -#ifdef AFS_LARGEFILE_ENV - if (lseek64(h->fd_fd, (off64_t) offset, SEEK_SET) == -1) + if (lseek(h->fd_fd, offset, SEEK_SET) == -1) goto bad_getLinkByte; -#else /* !AFS_LARGEFILE_ENV */ - if (lseek(h->fd_fd, (off_t) offset, SEEK_SET) == -1) - goto bad_getLinkByte; -#endif /* !AFS_LARGEFILE_ENV */ if (read(h->fd_fd, (char*)&row, sizeof(row))!=sizeof(row)) { goto bad_getLinkByte; @@ -878,7 +838,7 @@ int namei_GetLinkCount(FdHandle_t *h, Inode ino, int lockit) static int GetFreeTag(IHandle_t *ih, int vno) { FdHandle_t *fdP; - afs_size_t offset; + int offset; int col; int coldata; short row; @@ -900,15 +860,9 @@ static int GetFreeTag(IHandle_t *ih, int vno) } offset = (vno << LINKTABLE_SHIFT) + 8; /* * 2 + sizeof stamp */ -#ifdef AFS_LARGEFILE_ENV - if (lseek64(fdP->fd_fd, (off64_t) offset, SEEK_SET) == -1) { + if (lseek(fdP->fd_fd, offset, SEEK_SET) == -1) { goto badGetFreeTag; } -#else /* !AFS_LARGEFILE_ENV */ - if (lseek(fdP->fd_fd, (off_t) offset, SEEK_SET) == -1) { - goto badGetFreeTag; - } -#endif /* !AFS_LARGEFILE_ENV */ code = read(fdP->fd_fd, (char*)&row, sizeof(row)); if (code != sizeof(row)) { @@ -929,15 +883,9 @@ static int GetFreeTag(IHandle_t *ih, int vno) coldata = 1 << (col * 3); row |= coldata; -#ifdef AFS_LARGEFILE_ENV - if (lseek64(fdP->fd_fd, (off64_t) offset, SEEK_SET) == -1) { - goto badGetFreeTag; - } -#else /* !AFS_LARGEFILE_ENV */ - if (lseek(fdP->fd_fd, (off_t) offset, SEEK_SET) == -1) { + if (lseek(fdP->fd_fd, offset, SEEK_SET) == -1) { goto badGetFreeTag; } -#endif /* !AFS_LARGEFILE_ENV */ if (write(fdP->fd_fd, (char*)&row, sizeof(row))!=sizeof(row)) { goto badGetFreeTag; } @@ -968,8 +916,7 @@ static int GetFreeTag(IHandle_t *ih, int vno) */ int namei_SetLinkCount(FdHandle_t *fdP, Inode ino, int count, int locked) { - afs_size_t offset; - int index; + int offset, index; unsigned short row; int junk; int code = -1; @@ -985,17 +932,10 @@ int namei_SetLinkCount(FdHandle_t *fdP, Inode ino, int count, int locked) return -1; } } -#ifdef AFS_LARGEFILE_ENV - if (lseek64(fdP->fd_fd, (off64_t) offset, SEEK_SET) == -1) { + if (lseek(fdP->fd_fd, offset, SEEK_SET) == -1) { errno = EBADF; goto bad_SetLinkCount; } -#else /* !AFS_LARGEFILE_ENV */ - if (lseek(fdP->fd_fd, (off_t) offset, SEEK_SET) == -1) { - errno = EBADF; - goto bad_SetLinkCount; - } -#endif /* !AFS_LARGEFILE_ENV */ code = read(fdP->fd_fd, (char*)&row, sizeof(row)); @@ -1012,17 +952,10 @@ int namei_SetLinkCount(FdHandle_t *fdP, Inode ino, int count, int locked) row &= (unsigned short)~junk; row |= (unsigned short)count; -#ifdef AFS_LARGEFILE_ENV - if (lseek64(fdP->fd_fd, (off64_t) offset, SEEK_SET) == -1) { - errno = EBADF; - goto bad_SetLinkCount; - } -#else /* !AFS_LARGEFILE_ENV */ - if (lseek(fdP->fd_fd, (off_t) offset, SEEK_SET) == -1) { + if (lseek(fdP->fd_fd, offset, SEEK_SET) == -1) { errno = EBADF; goto bad_SetLinkCount; } -#endif /* !AFS_LARGEFILE_ENV */ if (write(fdP->fd_fd, (char*)&row, sizeof(short)) != sizeof(short)) { errno = EBADF; @@ -1077,19 +1010,9 @@ static int WriteInodeInfo(FILE *fp, struct ViceInodeInfo *info, char *dir, int mode_errors; /* Number of errors found in mode bits on directories. */ void VerifyDirPerms(char *path) { -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; -#endif /* !AFS_LARGEFILE_ENV */ - - if ( -#ifdef AFS_LARGEFILE_ENV - stat64(path, &status) -#else /* ! AFS_LARGEFILE_ENV */ - stat(path, &status) -#endif /* ! AFS_LARGEFILE_ENV */ - <0) { + + if (stat(path, &status)<0) { Log("Unable to stat %s. Please manually verify mode bits for this" " directory\n", path); } @@ -1119,11 +1042,7 @@ int ListViceInodes(char *devname, char *mountedOn, char *resultFile, { FILE *fp = (FILE*)-1; int ninodes; -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; -#endif /* !AFS_LARGEFILE_ENV */ if (resultFile) { fp = fopen(resultFile, "w"); @@ -1166,13 +1085,7 @@ int ListViceInodes(char *devname, char *mountedOn, char *resultFile, /* * Paranoia: check that the file is really the right size */ - if ( -#ifdef AFS_LARGEFILE_ENV - stat64(resultFile, &status) -#else /* !AFS_LARGEFILE_ENV */ - stat(resultFile, &status) -#endif /* !AFS_LARGEFILE_ENV */ - == -1) { + if (stat(resultFile, &status) == -1) { Log("Unable to successfully stat inode file for %s\n", mountedOn); return -2; } @@ -1305,11 +1218,7 @@ static int namei_ListAFSSubDirs(IHandle_t *dirIH, else { /* Open this handle */ (void) sprintf(path2, "%s/%s", path1, dp1->d_name); -#ifdef AFS_LARGEFILE_ENV - linkHandle.fd_fd = open64(path2, O_RDONLY, 0666); -#else /* !AFS_LARGEFILE_ENV */ linkHandle.fd_fd = open(path2, O_RDONLY, 0666); -#endif /* !AFS_LARGEFILE_ENV */ info.linkCount = namei_GetLinkCount(&linkHandle, (Inode)0, 0); } if (judgeFun && !(*judgeFun)(&info, singleVolumeNumber)) @@ -1421,26 +1330,16 @@ static int DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, int volid) { char fpath[512]; -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; -#endif /* !AFS_LARGEFILE_ENV */ int parm, tag; (void) strcpy(fpath, dpath); (void) strcat(fpath, "/"); (void) strcat(fpath, name); -#ifdef AFS_LARGEFILE_ENV - if (stat64(fpath, &status)<0) { - return -1; - } -#else /* !AFS_LARGEFILE_ENV */ if (stat(fpath, &status)<0) { return -1; } -#endif /* !AFS_LARGEFILE_ENV */ info->byteCount = status.st_size; info->inodeNumber = flipbase64_to_int64(name); diff --git a/src/vol/namei_ops.h b/src/vol/namei_ops.h index 831cd83..df55e01 100644 --- a/src/vol/namei_ops.h +++ b/src/vol/namei_ops.h @@ -34,10 +34,8 @@ extern Inode namei_MakeSpecIno(int volid, int type); extern Inode namei_icreate(IHandle_t *h, char *p, int p1, int p2, int p3, int p4); extern FD_t namei_iopen(IHandle_t *h); extern int namei_irelease(IHandle_t *h); -afs_size_t namei_iread(IHandle_t *h, afs_size_t offset, - char *buf, afs_size_t size); -afs_size_t namei_iwrite(IHandle_t *h, afs_size_t offset, - char *buf, afs_size_t size); +int namei_iread(IHandle_t *h, int offset, char *buf, int size); +int namei_iwrite(IHandle_t *h, int offset, char *buf, int size); extern int namei_dec(IHandle_t *h, Inode ino, int p1); extern int namei_inc(IHandle_t *h, Inode ino, int p1); extern int namei_GetLinkCount(FdHandle_t *h, Inode ino, int lockit); diff --git a/src/vol/partition.c b/src/vol/partition.c index b4075d7..60a07c2 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -253,11 +253,7 @@ static void VInitPartition(char *path, char *devname, Device dev) */ int VCheckPartition(char *part, char *devname) { -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; -#endif /* !AFS_LARGEFILE_ENV */ #if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV) char AFSIDatPath[MAXPATHLEN]; #endif @@ -267,34 +263,20 @@ int VCheckPartition(char *part, char *devname) if (strncmp(part, VICE_PARTITION_PREFIX, VICE_PREFIX_SIZE)) { return 0; } -#ifdef AFS_LARGEFILE_ENV - if (stat64(part, &status) < 0) { - Log("VInitVnodes: Couldn't find file system %s; ignored\n", part); - return 0; - } -#else /* !AFS_LARGEFILE_ENV */ if (stat(part, &status) < 0) { Log("VInitVnodes: Couldn't find file system %s; ignored\n", part); return 0; } -#endif /* AFS_LARGEFILE_ENV */ #ifndef AFS_AIX32_ENV if (programType == fileServer) { char salvpath[MAXPATHLEN]; strcpy(salvpath, part); strcat(salvpath, "/FORCESALVAGE"); -#ifdef AFS_LARGEFILE_ENV - if (stat64(salvpath, &status) == 0) { - Log("VInitVnodes: Found %s; aborting\n", salvpath); - return -1; - } -#else /* !AFS_LARGEFILE_ENV */ if (stat(salvpath, &status) == 0) { Log("VInitVnodes: Found %s; aborting\n", salvpath); return -1; } -#endif /* !AFS_LARGEFILE_ENV */ } #endif @@ -302,13 +284,7 @@ int VCheckPartition(char *part, char *devname) strcpy(AFSIDatPath, part); strcat(AFSIDatPath, "/AFSIDat"); #ifdef AFS_NAMEI_ENV - if ( -#ifdef AFS_LARGEFILE_ENV - stat64(AFSIDatPath, &status) -#else /* !AFS_LARGEFILE_ENV */ - stat(AFSIDatPath, &status) -#endif /* !AFS_LARGEFILE_ENV */ - < 0) { + if (stat(AFSIDatPath, &status) < 0) { DIR *dirp; struct dirent *dp; @@ -923,7 +899,7 @@ void VResetDiskUsage(void) VOL_UNLOCK } -void VAdjustDiskUsage_r(Error *ec, Volume *vp, afs_size_t blocks, afs_size_t checkBlocks) +void VAdjustDiskUsage_r(Error *ec, Volume *vp, afs_int32 blocks, afs_int32 checkBlocks) { *ec = 0; /* why blocks instead of checkBlocks in the check below? Otherwise, any check @@ -947,14 +923,14 @@ void VAdjustDiskUsage_r(Error *ec, Volume *vp, afs_size_t blocks, afs_size_t che V_diskused(vp) += blocks; } -void VAdjustDiskUsage(Error *ec, Volume *vp, afs_size_t blocks, afs_size_t checkBlocks) +void VAdjustDiskUsage(Error *ec, Volume *vp, afs_int32 blocks, afs_int32 checkBlocks) { VOL_LOCK VAdjustDiskUsage_r(ec, vp, blocks, checkBlocks); VOL_UNLOCK } -int VDiskUsage_r(Volume *vp, afs_size_t blocks) +int VDiskUsage_r(Volume *vp, afs_int32 blocks) { if (blocks > 0) { #ifdef AFS_AIX32_ENV @@ -971,7 +947,7 @@ int VDiskUsage_r(Volume *vp, afs_size_t blocks) return 0; } -int VDiskUsage(Volume *vp, afs_size_t blocks) +int VDiskUsage(Volume *vp, afs_int32 blocks) { int retVal; VOL_LOCK diff --git a/src/vol/partition.h b/src/vol/partition.h index 0ddb25b..e471dea 100644 --- a/src/vol/partition.h +++ b/src/vol/partition.h @@ -102,7 +102,7 @@ extern void VResetDiskUsage_r(void); extern void VSetPartitionDiskUsage(register struct DiskPartition *dp); extern void VSetPartitionDiskUsage_r(register struct DiskPartition *dp); extern char *VPartitionPath(struct DiskPartition *p); -/*extern void VAdjustDiskUsage(Error *ec, Volume *vp, afs_size_t blocks, - afs_size_t checkBlocks); */ +/*extern void VAdjustDiskUsage(Error *ec, Volume *vp, afs_int32 blocks, + afs_int32 checkBlocks); */ extern void VPrintDiskStats(void); diff --git a/src/vol/physio.c b/src/vol/physio.c index f54504e..b4674fa 100644 --- a/src/vol/physio.c +++ b/src/vol/physio.c @@ -49,7 +49,7 @@ RCSID("$Header$"); #include "afs/dir.h" /* returns 0 on success, errno on failure */ -int ReallyRead(DirHandle *file, afs_size_t block, char *data) +int ReallyRead(DirHandle *file, int block, char *data) { FdHandle_t *fdP; int code; @@ -59,12 +59,12 @@ int ReallyRead(DirHandle *file, afs_size_t block, char *data) code = errno; return code; } - if (FDH_SEEK(fdP, (afs_size_t)(block*AFS_PAGESIZE), SEEK_SET) < 0) { + if (FDH_SEEK(fdP, block*AFS_PAGESIZE, SEEK_SET) < 0) { code = errno; FDH_REALLYCLOSE(fdP); return code; } - code = FDH_READ(fdP, data, (afs_size_t) AFS_PAGESIZE); + code = FDH_READ(fdP, data, AFS_PAGESIZE); if (code != AFS_PAGESIZE) { if (code < 0) code = errno; @@ -78,7 +78,7 @@ int ReallyRead(DirHandle *file, afs_size_t block, char *data) } /* returns 0 on success, errno on failure */ -int ReallyWrite(DirHandle *file, afs_size_t block, char *data) +int ReallyWrite(DirHandle *file, int block, char *data) { FdHandle_t *fdP; extern int VolumeChanged; @@ -91,12 +91,12 @@ int ReallyWrite(DirHandle *file, afs_size_t block, char *data) code = errno; return code; } - if (FDH_SEEK(fdP, (afs_size_t)(block*AFS_PAGESIZE), SEEK_SET) < 0) { + if (FDH_SEEK(fdP, block*AFS_PAGESIZE, SEEK_SET) < 0) { code = errno; FDH_REALLYCLOSE(fdP); return code; } - code = FDH_WRITE(fdP, data, (afs_size_t) AFS_PAGESIZE); + code = FDH_WRITE(fdP, data, AFS_PAGESIZE); if (code != AFS_PAGESIZE) { if (code < 0) code = errno; diff --git a/src/vol/viceinode.h b/src/vol/viceinode.h index 1828651..015d673 100644 --- a/src/vol/viceinode.h +++ b/src/vol/viceinode.h @@ -46,7 +46,7 @@ struct SpecialInodeParams { */ struct ViceInodeInfo { Inode inodeNumber; - afs_offs_t byteCount; + int byteCount; int linkCount; union { bit32 param[4]; diff --git a/src/vol/vnode.h b/src/vol/vnode.h index 360c922..b8058c3 100644 --- a/src/vol/vnode.h +++ b/src/vol/vnode.h @@ -154,33 +154,6 @@ typedef struct Vnode { (sizeof(struct Vnode) - sizeof(VnodeDiskObject) + SIZEOF_LARGEDISKVNODE) #define SIZEOF_SMALLVNODE (sizeof (struct Vnode)) -#ifdef AFS_LARGEFILE_ENV - -#ifndef AFS_NAMEI_ENV -#define AFS_NAMEI_ENV -#endif - -#define VN_GET_INO(V) ((Inode)((V)->disk.vn_ino_lo | \ - (((Inode)(V)->disk.uniquifier)<<32))) - -#define VN_SET_INO(V, I) ((V)->disk.vn_ino_lo = (int)((I)&0xffffffff)) - -#define VNDISK_GET_INO(V) ((Inode)((V)->vn_ino_lo | \ - (((Inode)(V)->uniquifier)<<32))) - -#define VNDISK_SET_INO(V, I) ((V)->vn_ino_lo = (int)((I)&0xffffffff)) - -#define VN_GET_LEN(N, V) FillInt64(N, (V)->disk.vn_ino_hi, (V)->disk.length) -#define VNDISK_GET_LEN(N, V) FillInt64(N, (V)->vn_ino_hi, (V)->length) - -#define VN_SET_LEN(V, N) SplitInt64(N, (V)->disk.vn_ino_hi, (V)->disk.length) -#define VNDISK_SET_LEN(V, N) SplitInt64(N, (V)->vn_ino_hi, (V)->length) - -#define SET_STATUS_LEN(S, V) (((S)->Length_hi=(afs_uint32)(V)->disk.vn_ino_hi), \ - ((S)->Length=(afs_uint32)(V)->disk.length)) - -#else /*AFS_LARGEFILE_ENV*/ - #ifdef AFS_64BIT_IOPS_ENV #define VN_GET_INO(V) ((Inode)((V)->disk.vn_ino_lo | \ ((V)->disk.vn_ino_hi ? \ @@ -204,17 +177,6 @@ typedef struct Vnode { #define VNDISK_SET_INO(V, I) ((V)->vn_ino_lo = (I)) #endif -#define VN_GET_LEN(N, V) (N) = (V)->disk.length; -#define VNDISK_GET_LEN(N, V) (N) = (V)->length; -#define VN_SET_LEN(V, N) (V)->disk.length = (N); -#define VNDISK_SET_LEN(V, N) (V)->length = (N); - -#define SET_STATUS_LEN(S, V) (((S)->Length_hi = 0), \ - ((S)->Length = (afs_uint32)(V)->disk.length)) - -#endif /*AFS_LARGEFILE_ENV*/ - - #define VVnodeDiskACL(v) /* Only call this with large (dir) vnode!! */ \ ((AL_AccessList *) (((byte *)(v))+SIZEOF_SMALLDISKVNODE)) #define VVnodeACL(vnp) (VVnodeDiskACL(&(vnp)->disk)) diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index 48f784a..641961e 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -815,22 +815,11 @@ void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber, Inode ino) char filename[MAX_PATH]; #endif #endif - afs_size_t fileLength; - - VNDISK_GET_LEN(fileLength, vnode); - Vvnodesize += fileLength; + Vvnodesize += vnode->length; if (dsizeOnly) return; - if (orphaned && (fileLength ==0 || vnode->parent || !offset)) return; -#ifdef AFS_LARGEFILE_ENV - printf("%10d Vnode %u.%u.%u cloned: %d, length: (0X%x,0X%x) linkCount: %d parent: %d", - offset, vnodeNumber, vnode->uniquifier, vnode->dataVersion, vnode->cloned, - (unsigned) (fileLength >> 32), - (unsigned) (fileLength & 0xffffffff), - vnode->linkCount, vnode->parent); -#else + if (orphaned && (vnode->length ==0 || vnode->parent || !offset)) return; printf("%10d Vnode %u.%u.%u cloned: %d, length: %d linkCount: %d parent: %d", - offset, vnodeNumber, vnode->uniquifier, vnode->dataVersion, vnode->cloned, fileLength, vnode->linkCount, vnode->parent); -#endif + offset, vnodeNumber, vnode->uniquifier, vnode->dataVersion, vnode->cloned, vnode->length, vnode->linkCount, vnode->parent); if (DumpInodeNumber) printf(" inode: %s", PrintInode(NULL, ino)); if (DumpDate) diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index c3b9d79..4a7db5c 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -322,7 +322,7 @@ struct VnodeInfo { 0 after scanning all directories */ unsigned salvaged:1;/* Set if this directory vnode has already been salvaged. */ unsigned todelete:1;/* Set if this vnode is to be deleted (should not be claimed) */ - afs_offs_t blockCount; + afs_uint32 blockCount; /* Number of blocks (1K) used by this vnode, approximately */ VnodeId parent; /* parent in vnode */ @@ -1438,11 +1438,7 @@ int OnlyOneVolume(struct ViceInodeInfo *inodeinfo, VolumeId singleVolumeNumber) */ int GetInodeSummary(char *path, VolumeId singleVolumeNumber) { -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; -#endif /* !AFS_LARGEFILE_ENV */ int forceSal, err; struct ViceInodeInfo *ip; struct InodeSummary summary; @@ -1473,13 +1469,7 @@ int GetInodeSummary(char *path, VolumeId singleVolumeNumber) ForceSalvage = 1; } inodeFd = open(path, O_RDWR); - if (inodeFd == -1 || -#ifdef AFS_LARGEFILE_ENV - fstat64(inodeFd, &status) -#else /* !AFS_LARGEFILE_ENV */ - fstat(inodeFd, &status) -#endif /* !AFS_LARGEFILE_ENV */ - == -1) { + if (inodeFd == -1 || fstat(inodeFd, &status) == -1) { unlink(path); Abort("No inode description file for \"%s\"; not salvaged\n", dev); } @@ -1522,13 +1512,8 @@ int GetInodeSummary(char *path, VolumeId singleVolumeNumber) Abort("Unable to read inode table; %s not salvaged\n", dev); } qsort(ip, nInodes, sizeof(struct ViceInodeInfo), CompareInodes); - if ( -#ifdef AFS_LARGEFILE_ENV - lseek64(inodeFd, (off64_t) 0, SEEK_SET) == -1 -#else /* !AFS_LARGEFILE_ENV */ - lseek(inodeFd, (off_t) 0, SEEK_SET) == -1 -#endif /* !AFS_LARGEFILE_ENV */ - || write(inodeFd, ip, status.st_size) != status.st_size) { + if (lseek(inodeFd, 0, SEEK_SET) == -1 || + write(inodeFd, ip, status.st_size) != status.st_size) { fclose(summaryFile); close(inodeFd); unlink(path); unlink(summaryFileName); @@ -1565,21 +1550,13 @@ int GetInodeSummary(char *path, VolumeId singleVolumeNumber) Exit(1); /* salvage of this partition aborted */ } } -#ifdef AFS_LARGEFILE_ENV - assert(fstat64(fileno(summaryFile), &status) != -1); -#else /* !AFS_LARGEFILE_ENV */ assert(fstat(fileno(summaryFile), &status) != -1); -#endif /* !AFS_LARGEFILE_ENV */ if ( status.st_size != 0 ) { int ret; inodeSummary = (struct InodeSummary *) malloc(status.st_size); assert(inodeSummary != NULL); /* For GNU we need to do lseek to get the file pointer moved. */ -#ifdef AFS_LARGEFILE_ENV - assert(lseek64(fileno(summaryFile), (off64_t) 0, SEEK_SET) == 0); -#else /* !AFS_LARGEFILE_ENV */ - assert(lseek(fileno(summaryFile), (off_t) 0, SEEK_SET) == 0); -#endif /* !AFS_LARGEFILE_ENV */ + assert(lseek(fileno(summaryFile), 0, SEEK_SET) == 0); ret = read(fileno(summaryFile), inodeSummary, status.st_size); assert(ret == status.st_size); } @@ -1832,11 +1809,7 @@ void DoSalvageVolumeGroup(register struct InodeSummary *isp, int nVols) allInodes = inodes - isp->index; /* this would the base of all the inodes for the partition, if all the inodes had been read into memory */ -#ifdef AFS_LARGEFILE_ENV - assert(lseek64(inodeFd,(off64_t)(isp->index*sizeof(struct ViceInodeInfo)),SEEK_SET) != -1); -#else /* !AFS_LARGEFILE_ENV */ - assert(lseek(inodeFd,(off_t)(isp->index*sizeof(struct ViceInodeInfo)),SEEK_SET) != -1); -#endif /* !AFS_LARGEFILE_ENV */ + assert(lseek(inodeFd,isp->index*sizeof(struct ViceInodeInfo),SEEK_SET) != -1); assert(read(inodeFd,inodes,size) == size); /* Don't try to salvage a read write volume if there isn't one on this @@ -1923,19 +1896,10 @@ void DoSalvageVolumeGroup(register struct InodeSummary *isp, int nVols) #endif if (ip->linkCount != 0 && TraceBadLinkCounts) { TraceBadLinkCounts--; /* Limit reports, per volume */ -#ifdef AFS_LARGEFILE_ENV - Log("#### DEBUG #### Link count incorrect by %d; inode %s, size (0X%x,0x%x), p=(%u,%u,%u,%u)\n", - ip->linkCount, PrintInode(NULL, ip->inodeNumber), - (unsigned) ((ip->byteCount) >> 32), - (unsigned) ((ip->byteCount) & 0xffffffff), - ip->u.param[0], ip->u.param[1], - ip->u.param[2], ip->u.param[3]); -#else Log("#### DEBUG #### Link count incorrect by %d; inode %s, size %u, p=(%u,%u,%u,%u)\n", ip->linkCount, PrintInode(NULL, ip->inodeNumber), ip->byteCount, ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]); -#endif /* !AFS_LARGEFILE_ENV */ } while (ip->linkCount > 0) { /* below used to assert, not break */ @@ -2344,7 +2308,7 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW, int err = 0; StreamHandle_t *file; struct VnodeClassInfo *vcp; - afs_size_t size, vnodeSize; + int size; int vnodeIndex, nVnodes; afs_ino_str_t stmp1, stmp2; IHandle_t *handle; @@ -2500,75 +2464,36 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW, if (ip->inodeNumber != VNDISK_GET_INO(vnode)) { if (check) { if (!Showmode) { -#ifdef AFS_LARGEFILE_ENV - Log("Vnode %d: inode number incorrect (is %s should be %s). FileSize=(0X%x,0X%x)\n", - vnodeNumber, - PrintInode(stmp1, VNDISK_GET_INO(vnode)), - PrintInode(stmp2, ip->inodeNumber), - (unsigned) (ip->byteCount >> 32), - (unsigned) (ip->byteCount & 0xffffffff)); -#else Log("Vnode %d: inode number incorrect (is %s should be %s). FileSize=%d\n", vnodeNumber, PrintInode(stmp1, VNDISK_GET_INO(vnode)), PrintInode(stmp2, ip->inodeNumber), ip->byteCount); -#endif /* !AFS_LARGEFILE_ENV */ } VNDISK_SET_INO(vnode, ip->inodeNumber); err = -1; goto zooks; } if (!Showmode) { -#ifdef AFS_LARGEFILE_ENV - Log("Vnode %d: inode number incorrect; changed from %s to %s. FileSize=(0X%x,0X%x)\n", - vnodeNumber, - PrintInode(stmp1, VNDISK_GET_INO(vnode)), - PrintInode(stmp2, ip->inodeNumber), - (unsigned) (ip->byteCount >> 32), - (unsigned) (ip->byteCount & 0xffffffff)); -#else Log("Vnode %d: inode number incorrect; changed from %s to %s. FileSize=%d\n", vnodeNumber, PrintInode(stmp1, VNDISK_GET_INO(vnode)), PrintInode(stmp2, ip->inodeNumber), ip->byteCount); -#endif /* !AFS_LARGEFILE_ENV */ } VNDISK_SET_INO(vnode, ip->inodeNumber); vnodeChanged = 1; } - VNDISK_GET_LEN(vnodeSize, vnode); - if (ip->byteCount != vnodeSize) { + if (ip->byteCount != vnode->length) { if (check) { - if (!Showmode) -#ifdef AFS_LARGEFILE_ENV - Log("Vnode %d: length incorrect; (is (0X%x,0X%x) should be (0X%x,0X%x))\n", - vnodeNumber, - (unsigned) (vnodeSize >> 32), - (unsigned) (vnodeSize & 0xffffffff), - (unsigned) (ip->byteCount >> 32), - (unsigned) (ip->byteCount & 0xffffffff)); -#else - Log("Vnode %d: length incorrect; (is %d should be %d)\n", - vnodeNumber, vnodeSize, ip->byteCount); -#endif /* !AFS_LARGEFILE_ENV */ + if (!Showmode) Log("Vnode %d: length incorrect; (is %d should be %d)\n", + vnodeNumber, vnode->length, ip->byteCount); err = -1; goto zooks; } - if (!Showmode) -#ifdef AFS_LARGEFILE_ENV - Log("Vnode %d: length incorrect; changed from (0X%x,0X%x) to (0X%x,0X%x)\n", - vnodeNumber, - (unsigned) (vnodeSize >> 32), - (unsigned) (vnodeSize & 0xffffffff), - (unsigned) (ip->byteCount >> 32), - (unsigned) (ip->byteCount & 0xffffffff)); -#else - Log("Vnode %d: length incorrect; changed from %d to %d\n", - vnodeNumber, vnodeSize, ip->byteCount); -#endif /* !AFS_LARGEFILE_ENV */ - VNDISK_SET_LEN(vnode, ip->byteCount); + if (!Showmode) Log("Vnode %d: length incorrect; changed from %d to %d\n", + vnodeNumber, vnode->length, ip->byteCount); + vnode->length = ip->byteCount; vnodeChanged = 1; } if (!check) @@ -2752,7 +2677,7 @@ void CopyAndSalvage(register struct DirSummary *dir) } vnode.cloned = 0; VNDISK_SET_INO(&vnode, newinode); - VNDISK_SET_LEN(&vnode, (afs_size_t) Length(&newdir)); + vnode.length = Length(&newdir); code = IH_IWRITE(vnodeInfo[vLarge].handle, vnodeIndexOffset(vcp, dir->vnodeNumber), (char*)&vnode, sizeof (vnode)); @@ -3054,11 +2979,9 @@ void DistilVnodeEssence(VolumeId rwVId, VnodeClass class, Inode ino, nVnodes--, vnodeIndex++) { if (vnode->type != vNull) { register struct VnodeEssence *vep = &vip->vnodes[vnodeIndex]; - afs_size_t vnodeLength; vip->nAllocatedVnodes++; vep->count = vnode->linkCount; - VNDISK_GET_LEN(vnodeLength, vnode); - vep->blockCount = nBlocks(vnodeLength); + vep->blockCount = nBlocks(vnode->length); vip->volumeBlockCount += vep->blockCount; vep->parent = vnode->parent; vep->unique = vnode->uniquifier; @@ -3558,34 +3481,18 @@ void PrintInodeList(void) { register struct ViceInodeInfo *ip; struct ViceInodeInfo *buf; -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; -#endif /* !AFS_LARGEFILE_ENV */ register nInodes; -#ifdef AFS_LARGEFILE_ENV - assert(fstat64(inodeFd, &status) == 0); -#else /* !AFS_LARGEFILE_ENV */ assert(fstat(inodeFd, &status) == 0); -#endif /* !AFS_LARGEFILE_ENV */ buf = (struct ViceInodeInfo *) malloc(status.st_size); assert(buf != NULL); nInodes = status.st_size / sizeof(struct ViceInodeInfo); assert(read(inodeFd, buf, status.st_size) == status.st_size); for(ip = buf; nInodes--; ip++) { -#ifdef AFS_LARGEFILE_ENV - Log("Inode:%s, linkCount=%d, size=(0X%x,0X%x), p=(%u,%u,%u,%u)\n", - PrintInode(NULL, ip->inodeNumber), ip->linkCount, - (unsigned) (ip->byteCount >> 32), - (unsigned) (ip->byteCount & 0xffffffff), - ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]); -#else Log("Inode:%s, linkCount=%d, size=%u, p=(%u,%u,%u,%u)\n", PrintInode(NULL, ip->inodeNumber), ip->linkCount, ip->byteCount, ip->u.param[0], ip->u.param[1], ip->u.param[2], ip->u.param[3]); -#endif } free(buf); } diff --git a/src/vol/volume.c b/src/vol/volume.c index cd1602b..ef3a3e5 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -528,11 +528,7 @@ VAttachVolumeByName_r(Error *ec, char *partition, char *name, int mode) { register Volume *vp; int fd,n; -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; -#endif /* !AFS_LARGEFILE_ENV */ struct VolumeDiskHeader diskHeader; struct VolumeHeader iheader; struct DiskPartition *partp; @@ -568,13 +564,7 @@ VAttachVolumeByName_r(Error *ec, char *partition, char *name, int mode) strcat(path, "/"); strcat(path, name); VOL_UNLOCK - if ((fd = open(path, O_RDONLY)) == -1 -#ifdef AFS_LARGEFILE_ENV - || fstat64(fd,&status) == -1 -#else /* !AFS_LARGEFILE_ENV */ - || fstat(fd,&status) == -1 -#endif /* !AFS_LARGEFILE_ENV */ - ) { + if ((fd = open(path, O_RDONLY)) == -1 || fstat(fd,&status) == -1) { close(fd); VOL_LOCK *ec = VNOVOL; @@ -1496,19 +1486,10 @@ static void GetVolumePath(Error *ec, VolId volumeId, char **partitionp, name[0] = '/'; sprintf(&name[1],VFORMAT,volumeId); for (dp = DiskPartitionList; dp; dp = dp->next) { -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else /* !AFS_LARGEFILE_ENV */ struct stat status; -#endif strcpy(path, VPartitionPath(dp)); strcat(path, name); -#ifdef AFS_LARGEFILE_ENV - if (stat64(path,&status) == 0) -#else /* !AFS_LARGEFILE_ENV */ - if (stat(path,&status) == 0) -#endif /* !AFS_LARGEFILE_ENV */ - { + if (stat(path,&status) == 0) { strcpy(partition, dp->name); found = 1; break; diff --git a/src/vol/volume.h b/src/vol/volume.h index cecba13..e90cab5 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -448,7 +448,7 @@ extern void VolumeHeaderToDisk(VolumeDiskHeader_t *dh, VolumeHeader_t *h); /* Note: we charge 1 block for 0 length files so the user can't store an inifite number of them; for most files, we give him the inode, vnode, and indirect block overhead, for FREE! */ -#define nBlocks(bytes) ((afs_size_t)((bytes) == 0? 1: (((afs_size_t)bytes)+1023)/1024)) +#define nBlocks(bytes) ((bytes) == 0? 1: ((bytes)+1023)/1024) /* Client process id -- file server sends a Check volumes signal back to the client at this pid */ #define CLIENTPID "/vice/vol/clientpid" diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 85da7bc..831cb53 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -87,9 +87,8 @@ static int ReadDumpHeader(register struct iod *iodp, struct DumpHeader *hp); static int ReadVnodes(register struct iod *iodp, Volume *vp, int incremental, afs_int32 *Lbuf, afs_int32 s1, afs_int32 *Sbuf, afs_int32 s2, afs_int32 delo); -static afs_offs_t volser_WriteFile(int vn, struct iod *iodp, - FdHandle_t *handleP, - int tag, Error *status); +static bit32 volser_WriteFile(int vn, struct iod *iodp, FdHandle_t *handleP, + Error *status); static void iod_Init(register struct iod *iodp, register struct rx_call *call) @@ -421,18 +420,14 @@ static int DumpByteString(register struct iod *iodp, char tag, return 0; } -static int DumpFile(struct iod *iodp, int vnode, FdHandle_t *handleP) +static int DumpFile(struct iod *iodp, char tag, int vnode, FdHandle_t *handleP) { int code = 0, lcode = 0, error = 0; afs_int32 pad = 0, offset; - afs_size_t n, nbytes, howMany, howBig; + int n, nbytes, howMany, howBig; byte *p; -#ifdef AFS_LARGEFILE_ENV - struct stat64 status; -#else struct stat status; -#endif - afs_size_t size; + int size; #ifdef AFS_AIX_ENV #include struct statfs tstatfs; @@ -443,11 +438,7 @@ static int DumpFile(struct iod *iodp, int vnode, FdHandle_t *handleP) howMany = 4096; #else -#ifdef AFS_LARGEFILE_ENV - fstat64(handleP->fd_fd, &status); -#else /* !AFS_LARGEFILE_ENV */ fstat(handleP->fd_fd, &status); -#endif /* !AFS_LARGEFILE_ENV */ howBig = status.st_size; #ifdef AFS_AIX_ENV @@ -463,19 +454,7 @@ static int 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); - } - } -#else /* !AFS_LARGEFILE_ENV */ - code = DumpInt32(iodp, 'f', size); -#endif /* !AFS_LARGEFILE_ENV */ + code = DumpInt32(iodp, tag, size); if (code) { return VOLSERDUMPERROR; } @@ -748,7 +727,7 @@ static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v, IH_RELEASE(ihP); return VOLSERREAD_DUMPERROR; } - code = DumpFile(iodp, vnodeNumber, fdP); + code = DumpFile(iodp, 'f', vnodeNumber, fdP); FDH_CLOSE(fdP); IH_RELEASE(ihP); } @@ -786,19 +765,9 @@ int ProcessIndex(Volume *vp, VnodeClass class, afs_int32 **Bufp, int *sizep, if (vnode->type != vNull && VNDISK_GET_INO(vnode)) { cnt1++; if (DoLogging) { -#ifdef AFS_LARGEFILE_ENV - afs_offs_t fileLen; - VNDISK_GET_LEN(fileLen, vnode); - Log("RestoreVolume %d Cleanup: Removing old vnode=%d inode=%d size=(0X%x,0X%x)\n", - V_id(vp), bitNumberToVnodeNumber(i,class), - VNDISK_GET_INO(vnode), - (unsigned) (fileLen >> 32), - (unsigned) (fileLen & 0xffffffff)); -#else /* !AFS_LARGEFILE_ENV */ Log("RestoreVolume %d Cleanup: Removing old vnode=%d inode=%d size=%d\n", V_id(vp), bitNumberToVnodeNumber(i,class), VNDISK_GET_INO(vnode), vnode->length); -#endif /* !AFS_LARGEFILE_ENV */ } IH_DEC(V_linkHandle(vp), VNDISK_GET_INO(vnode), V_parentId(vp)); @@ -1008,13 +977,9 @@ static int ReadVnodes(register struct iod *iodp, Volume *vp, VAclDiskSize(vnode)); acl_NtohACL(VVnodeDiskACL(vnode)); break; -#ifdef AFS_LARGEFILE_ENV - case 'h': -#endif case 'f': { Inode ino; Error error; - afs_offs_t fileLen; ino = IH_CREATE(V_linkHandle(vp), V_device(vp), @@ -1035,10 +1000,8 @@ static int ReadVnodes(register struct iod *iodp, Volume *vp, IH_RELEASE(tmpH); return VOLSERREAD_DUMPERROR; } - - fileLen = volser_WriteFile(vnodeNumber, iodp, fdP, - tag, &error); - VNDISK_SET_LEN(vnode, fileLen); + vnode->length = volser_WriteFile(vnodeNumber, iodp, fdP, + &error); FDH_REALLYCLOSE(fdP); IH_RELEASE(tmpH); if (error) { @@ -1106,41 +1069,22 @@ static int ReadVnodes(register struct iod *iodp, Volume *vp, * needing to read an ungetc'd character, since the ReadInt32 will have read * it instead. */ -static afs_offs_t volser_WriteFile(int vn, struct iod *iodp, FdHandle_t *handleP, - int tag, Error *status) +static bit32 volser_WriteFile(int vn, struct iod *iodp, FdHandle_t *handleP, + Error *status) { afs_int32 code; - afs_offs_t filesize; - afs_offs_t written=0; + afs_uint32 filesize; + bit32 written=0; register afs_uint32 size = 8192; - register afs_offs_t nbytes; + register afs_uint32 nbytes; unsigned char *p; *status = 0; -#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 - if (!ReadInt32(iodp, &filesize_low)) { - *status = 1; - return(0); - } - FillInt64(filesize, filesize_high, filesize_low); - } -#else /* !AFS_64BIT_ENV */ if (!ReadInt32(iodp, &filesize)) { *status = 1; return(0); } -#endif /* !AFS_64BIT_ENV */ p = (unsigned char *) malloc(size); if (p == NULL) { *status = 2; @@ -1151,14 +1095,7 @@ static afs_offs_t volser_WriteFile(int vn, struct iod *iodp, FdHandle_t *handleP size = nbytes; if ((code = iod_Read(iodp, p, size)) != size) { -#ifdef AFS_64BIT_ENV - Log("1 Volser: WriteFile: Error reading dump file %d size=(0X%x,0X%x) nbytes=%d (%d of %d); restore aborted\n", vn, - (unsigned) (filesize >> 32), - (unsigned) (filesize & 0xffffffff), - nbytes, code, size); -#else /* !AFS_LARGEFILE_ENV */ Log("1 Volser: WriteFile: Error reading dump file %d size=%d nbytes=%d (%d of %d); restore aborted\n", vn, filesize, nbytes, code, size); -#endif /* !AFS_LARGEFILE_ENV */ *status = 3; break; } diff --git a/src/volser/physio.c b/src/volser/physio.c index 281861b..c778eab 100644 --- a/src/volser/physio.c +++ b/src/volser/physio.c @@ -44,7 +44,7 @@ RCSID("$Header$"); /* returns 0 on success, errno on failure */ int ReallyRead (file, block, data) DirHandle * file; -afs_size_t block; +int block; char * data; { FdHandle_t *fdP; @@ -55,12 +55,12 @@ char * data; code = errno; return code; } - if (FDH_SEEK(fdP, (afs_size_t)(block*AFS_PAGESIZE), SEEK_SET) < 0) { + if (FDH_SEEK(fdP, block*AFS_PAGESIZE, SEEK_SET) < 0) { code = errno; FDH_REALLYCLOSE(fdP); return code; } - code = FDH_READ(fdP, data, (afs_size_t) AFS_PAGESIZE); + code = FDH_READ(fdP, data, AFS_PAGESIZE); if (code != AFS_PAGESIZE) { if (code < 0) code = errno; @@ -76,7 +76,7 @@ char * data; /* returns 0 on success, errno on failure */ int ReallyWrite (file, block, data) DirHandle * file; -afs_size_t block; +int block; char * data; { FdHandle_t *fdP; @@ -90,12 +90,12 @@ char * data; code = errno; return code; } - if (FDH_SEEK(fdP, (afs_size_t)(block*AFS_PAGESIZE), SEEK_SET) < 0) { + if (FDH_SEEK(fdP, block*AFS_PAGESIZE, SEEK_SET) < 0) { code = errno; FDH_REALLYCLOSE(fdP); return code; } - code = FDH_WRITE(fdP, data, (afs_size_t) AFS_PAGESIZE); + code = FDH_WRITE(fdP, data, AFS_PAGESIZE); if (code != AFS_PAGESIZE) { if (code < 0) code = errno; diff --git a/src/volser/restorevol.c b/src/volser/restorevol.c index fcb8326..b928144 100644 --- a/src/volser/restorevol.c +++ b/src/volser/restorevol.c @@ -122,7 +122,7 @@ char buf[BUFSIZE]; char readdata(buffer, size) char *buffer; - afs_size_t size; + afs_int32 size; { int code; afs_int32 s; @@ -384,7 +384,7 @@ struct vNode } entries[100]; } acl; #endif - afs_size_t dataSize; + afs_int32 dataSize; }; #define MAXNAMELEN 256 @@ -456,24 +456,12 @@ afs_int32 ReadVNode(count) break; case 'A': - readdata(vn.acl, (afs_size_t) 192); /* Skip ACL data */ + readdata(vn.acl, 192); /* Skip ACL data */ break; -#ifdef AFS_LARGEFILE_ENV - case 'h': - { - afs_uint32 hi, lo; - hi = ntohl(readvalue(4)); - lo = ntohl(readvalue(4)); - FillInt64(vn.dataSize, hi, lo); - } - goto common_vnode; -#endif /* AFS_LARGEFILE_ENV */ - case 'f': - vn.dataSize = (afs_size_t) ntohl(readvalue(4)); + vn.dataSize = ntohl(readvalue(4)); - common_vnode: /* parentdir is the name of this dir's vnode-file-link * or this file's parent vnode-file-link. * "./AFSDir-<#>". It's a symbolic link to its real dir. @@ -649,8 +637,7 @@ afs_int32 ReadVNode(count) */ int fid; int lfile; - afs_size_t size; - afs_int32 s; + afs_int32 size, s; /* Check if its vnode-file-link exists. If not, * then the file will be an orphaned file. @@ -674,7 +661,7 @@ afs_int32 ReadVNode(count) fid = open(filename, (O_CREAT | O_WRONLY | O_TRUNC), mode); size = vn.dataSize; while (size > 0) { - s = (afs_int32) ((size > BUFSIZE) ? BUFSIZE : size); + s = ((size > BUFSIZE) ? BUFSIZE : size); code = fread(buf, 1, s, dumpfile); if (code > 0) { write(fid, buf, code); @@ -684,16 +671,8 @@ afs_int32 ReadVNode(count) if (code < 0) fprintf (stderr, "Code = %d; Errno = %d\n", code, errno); else -#ifdef AFS_LARGEFILE_ENV - fprintf (stderr, "Read (0X%x,0X%x) bytes out of (0X%x,0X%x)\n", - (unsigned) ((vn.dataSize - size) >> 32), - (unsigned) ((vn.dataSize - size) & 0xffffffff), - (unsigned) (vn.dataSize >> 32), - (unsigned) (vn.dataSize & 0xffffffff)); -#else /* !AFS_LARGEFILE_ENV */ fprintf (stderr, "Read %d bytes out of %d\n", (vn.dataSize - size), vn.dataSize); -#endif /* !AFS_LARGEFILE_ENV */ break; } } diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 9c99319..a265e3b 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -197,7 +197,7 @@ Volume * vp; IHandle_t *h; FdHandle_t *fdP; int code; - afs_offs_t length; + int length; memset(vnode, 0, SIZEOF_LARGEDISKVNODE); @@ -236,7 +236,7 @@ Volume * vp; vnode->cloned = 0; vnode->modeBits = 0777; vnode->linkCount = 2; - VNDISK_SET_LEN(vnode, length); + vnode->length = length; vnode->uniquifier = 1; V_uniquifier(vp) = vnode->uniquifier+1; vnode->dataVersion = 1; @@ -257,8 +257,7 @@ Volume * vp; assert(code == SIZEOF_LARGEDISKVNODE); FDH_REALLYCLOSE(fdP); IH_RELEASE(h); - VNDISK_GET_LEN(length, vnode); - V_diskused(vp) = nBlocks(length); + V_diskused(vp) = nBlocks(vnode->length); return 1; } -- 1.9.4