#endif
#undef AFS_AFSDB_ENV
-#undef AFS_LARGEFILE_ENV
#undef AFS_NAMEI_ENV
#undef BITMAP_LATER
[ --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,
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
#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 <linux/threads.h>
#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 <netinet/in.h> to make these work */
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);
* 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;
}
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;
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);
(*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) {
ReallyRead(dir, block, data)
dirhandle *dir;
- afs_size_t block;
+ int block;
char *data;
{
int code;
ReallyWrite(dir, block, data)
dirhandle *dir;
- afs_size_t block;
+ int block;
char *data;
{
int code;
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];
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");
}
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];
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;
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 */
);
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 */
);
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 */
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;
}
}
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 */
#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*/
* 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
/*
AFSStoreStatus *InStatus,
Vnode *parentptr,
Volume *volptr,
- afs_size_t length)
+ afs_int32 length)
{
#if FS_STATS_DETAILED
Date currDate; /*Current date*/
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;
* 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)));
char *Name,
struct AFSFid *OutFid,
int FileType,
- afs_size_t BlocksPreallocatedForVnode)
+ int BlocksPreallocatedForVnode)
{
int errorCode = 0; /* Error code returned back */
int temp;
*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);
(*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;
}
/* 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",
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",
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;
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,
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 */
/* 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 */
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,
{
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;
}
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 */
} /*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 */
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 */
/*
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
/* 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 */
/* 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);
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,
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;
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;
}
/* 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);
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);
/* 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);
/* 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),
/* 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);
/* 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);
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 */
)
{
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
(*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);
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;
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 */
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;
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
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;
}
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 */
* 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;
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);
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);
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.
*/
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);
#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;
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",
}
/* 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;
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,
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;
#ifdef AFS_NT40_ENV
#include <fcntl.h>
#else
-#ifdef AFS_LARGEFILE_ENV
-#include <fcntl.h>
-#else
#include <sys/file.h>
-#endif
#include <unistd.h>
#include <sys/stat.h>
#if defined(AFS_SUN5_ENV) || defined(AFS_NBSD_ENV)
-#ifndef AFS_LARGEFILE_ENV
#include <sys/fcntl.h>
-#endif
#include <sys/resource.h>
#endif
#endif
#endif /* AFS_PTHREAD_ENV */
/* Initialize the file descriptor cache */
-void ih_Initialize(void) {
+void ih_Initialize() {
int i;
assert(!ih_Inited);
ih_Inited = 1;
/* 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) {
}
/* Allocate a chunk of inode handles */
-void iHandleAllocateChunk(void)
+void iHandleAllocateChunk()
{
int i;
IHandle_t *ihP;
}
/* Allocate a chunk of file descriptor handles */
-void fdHandleAllocateChunk(void)
+void fdHandleAllocateChunk()
{
int i;
FdHandle_t *fdP;
}
/* Allocate a chunk of stream handles */
-void streamHandleAllocateChunk(void)
+void streamHandleAllocateChunk()
{
int i;
StreamHandle_t *streamP;
}
/* 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 */
}
/* 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) {
}
/* 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;
#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
#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);
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);
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)
#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
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);
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);
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 */
*/
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
}
/* 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;
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;
}
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;
}
/* 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;
}
#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);
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);
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;
static int GetFreeTag(IHandle_t *ih, int vno)
{
FdHandle_t *fdP;
- afs_size_t offset;
+ int offset;
int col;
int coldata;
short row;
}
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)) {
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;
}
*/
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;
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));
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;
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);
}
{
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");
/*
* 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;
}
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))
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);
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);
*/
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
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
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;
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
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
return 0;
}
-int VDiskUsage(Volume *vp, afs_size_t blocks)
+int VDiskUsage(Volume *vp, afs_int32 blocks)
{
int retVal;
VOL_LOCK
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);
#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;
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;
}
/* 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;
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;
*/
struct ViceInodeInfo {
Inode inodeNumber;
- afs_offs_t byteCount;
+ int byteCount;
int linkCount;
union {
bit32 param[4];
(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 ? \
#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))
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)
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 */
*/
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;
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);
}
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);
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);
}
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
#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 */
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;
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)
}
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));
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;
{
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);
}
{
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;
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;
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;
/* 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"
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)
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 <sys/statfs.h>
struct statfs tstatfs;
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
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;
}
IH_RELEASE(ihP);
return VOLSERREAD_DUMPERROR;
}
- code = DumpFile(iodp, vnodeNumber, fdP);
+ code = DumpFile(iodp, 'f', vnodeNumber, fdP);
FDH_CLOSE(fdP);
IH_RELEASE(ihP);
}
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));
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),
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) {
* 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;
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;
}
/* 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;
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;
/* 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;
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;
char readdata(buffer, size)
char *buffer;
- afs_size_t size;
+ afs_int32 size;
{
int code;
afs_int32 s;
} entries[100];
} acl;
#endif
- afs_size_t dataSize;
+ afs_int32 dataSize;
};
#define MAXNAMELEN 256
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.
*/
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.
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);
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;
}
}
IHandle_t *h;
FdHandle_t *fdP;
int code;
- afs_offs_t length;
+ int length;
memset(vnode, 0, SIZEOF_LARGEDISKVNODE);
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;
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;
}