Use afs_sfsize_t for *_SIZE results

Callers of FDH_SIZE and OS_SIZE should be storing the results in an
afs_sfsize_t. Some were using regular 'int's and other things, which
can screw up if the file is sufficiently large.

Change-Id: Ibbc2067ed3b90edcbdd46cfa43da559fd6419f0b
Reviewed-on: http://gerrit.openafs.org/2357
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Andrew Deason 2010-07-07 15:43:26 -05:00 committed by Derrick Brashear
parent c658bfaf88
commit c62466ecab
8 changed files with 30 additions and 27 deletions

View File

@ -1265,7 +1265,7 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len)
static int
CopyOnWrite2(FdHandle_t *targFdP, FdHandle_t *newFdP, afs_foff_t off,
afs_fsize_t size)
afs_sfsize_t size)
{
char *buff = malloc(COPYBUFFSIZE);
size_t length;
@ -7484,7 +7484,8 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid,
FDH_SYNC(fdP);
}
if (errorCode) {
afs_fsize_t nfSize = (afs_fsize_t) FDH_SIZE(fdP);
afs_sfsize_t nfSize = FDH_SIZE(fdP);
assert(nfSize >= 0);
/* something went wrong: adjust size and return */
VN_SET_LEN(targetptr, nfSize); /* set new file size. */
/* changed_newTime is tested in StoreData to detemine if we

View File

@ -481,15 +481,16 @@ HandleVolume(struct DiskPartition64 *dp, char *name)
if (dheader) {
FdHandle_t *fdP;
int size = 0;
int code;
afs_sfsize_t size = 0;
afs_sfsize_t code;
if (afs_fstat(fd, &stat) == -1) {
perror("stat");
exit(1);
}
if (!dsizeOnly && !saveinodes) {
printf("Volume header (size = %d):\n", size = stat.st_size);
size = stat.st_size;
printf("Volume header (size = %d):\n", (int)size);
printf("\tstamp\t= 0x%x\n", header.stamp.version);
printf("\tVolId\t= %u\n", header.id);
}
@ -511,7 +512,7 @@ HandleVolume(struct DiskPartition64 *dp, char *name)
if (!dsizeOnly && !saveinodes) {
printf("\tparent\t= %u\n", header.parent);
printf("\tInfo inode\t= %s (size = %d)\n",
PrintInode(NULL, header.volumeInfo), code);
PrintInode(NULL, header.volumeInfo), (int)code);
}
IH_INIT(ih, dp->device, header.parent, header.smallVnodeIndex);
@ -530,7 +531,7 @@ HandleVolume(struct DiskPartition64 *dp, char *name)
size += code;
if (!dsizeOnly && !saveinodes) {
printf("\tSmall inode\t= %s (size = %d)\n",
PrintInode(NULL, header.smallVnodeIndex), code);
PrintInode(NULL, header.smallVnodeIndex), (int)code);
}
IH_INIT(ih, dp->device, header.parent, header.largeVnodeIndex);
@ -549,9 +550,9 @@ HandleVolume(struct DiskPartition64 *dp, char *name)
size += code;
if (!dsizeOnly && !saveinodes) {
printf("\tLarge inode\t= %s (size = %d)\n",
PrintInode(NULL, header.largeVnodeIndex), code);
PrintInode(NULL, header.largeVnodeIndex), (int)code);
#ifndef AFS_NT40_ENV
printf("Total aux volume size = %d\n\n", size);
printf("Total aux volume size = %d\n\n", (int)size);
#endif
}
#ifdef AFS_NAMEI_ENV
@ -571,8 +572,8 @@ HandleVolume(struct DiskPartition64 *dp, char *name)
size += code;
if (!dsizeOnly && !saveinodes) {
printf("\tLink inode\t= %s (size = %d)\n",
PrintInode(NULL, header.linkTable), code);
printf("Total aux volume size = %d\n\n", size);
PrintInode(NULL, header.linkTable), (int)code);
printf("Total aux volume size = %d\n\n", (int)size);
}
#endif
Vauxsize = size;

View File

@ -2504,8 +2504,9 @@ SalvageIndex(Inode ino, VnodeClass class, int RW,
StreamHandle_t *file;
struct VnodeClassInfo *vcp;
afs_sfsize_t size;
afs_sfsize_t nVnodes;
afs_fsize_t vnodeLength;
int vnodeIndex, nVnodes;
int vnodeIndex;
afs_ino_str_t stmp1, stmp2;
IHandle_t *handle;
FdHandle_t *fdP;
@ -3059,7 +3060,8 @@ JudgeEntry(void *dirVal, char *name, afs_int32 vnodeNumber,
Log("FOUND suid/sgid file: %s/%s (%u.%u %05o) author %u (vnode %u dir %u)\n", dir->name ? dir->name : "??", name, vnodeEssence->owner, vnodeEssence->group, vnodeEssence->modeBits, vnodeEssence->author, vnodeNumber, dir->vnodeNumber);
if (/* ShowMounts && */ (vnodeEssence->type == vSymlink)
&& !(vnodeEssence->modeBits & 0111)) {
ssize_t nBytes, size;
ssize_t nBytes;
afs_sfsize_t size;
char buf[1025];
IHandle_t *ihP;
FdHandle_t *fdP;

View File

@ -66,8 +66,8 @@ struct VolumeSummary { /* Volume summary an entry for each
struct VnodeInfo {
IHandle_t *handle; /* Inode containing this index */
int nVnodes; /* Total number of vnodes in index */
int nAllocatedVnodes; /* Total number actually used */
afs_sfsize_t nVnodes; /* Total number of vnodes in index */
afs_sfsize_t nAllocatedVnodes; /* Total number actually used */
int volumeBlockCount; /* Total number of blocks used by volume */
Inode *inodes; /* Directory only */
struct VnodeEssence {

View File

@ -5686,8 +5686,7 @@ static void
VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class)
{
StreamHandle_t *file;
int nVnodes;
int size;
afs_sfsize_t nVnodes, size;
struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
struct vnodeIndex *vip = &vp->vnodeIndex[class];
struct VnodeDiskObject *vnode;

View File

@ -992,9 +992,9 @@ DumpVnodeIndex(register struct iod *iodp, Volume * vp, VnodeClass class,
struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
StreamHandle_t *file;
FdHandle_t *fdP;
int size;
afs_sfsize_t size, nVnodes;
int flag;
register int vnodeIndex, nVnodes;
register int vnodeIndex;
fdP = IH_OPEN(vp->vnodeIndex[class].handle);
assert(fdP != NULL);
@ -1118,7 +1118,7 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_int32 ** Bufp, int *sizep,
int i, nVnodes, offset, code;
afs_int32 *Buf;
int cnt = 0;
int size;
afs_sfsize_t size;
StreamHandle_t *afile;
FdHandle_t *fdP;
struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
@ -1865,9 +1865,9 @@ SizeDumpVnodeIndex(register struct iod *iodp, Volume * vp, VnodeClass class,
struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
StreamHandle_t *file;
FdHandle_t *fdP;
int size;
afs_sfsize_t size, nVnodes;
int flag;
register int vnodeIndex, nVnodes;
register int vnodeIndex;
fdP = IH_OPEN(vp->vnodeIndex[class].handle);
assert(fdP != NULL);

View File

@ -782,7 +782,7 @@ DumpVnodeIndex(int dumpfd, Volume * vp, VnodeClass class, afs_int32 fromtime,
struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf;
StreamHandle_t *file;
FdHandle_t *fdP;
int size;
afs_sfsize_t size;
int flag;
int offset = 0;
register int vnodeIndex, nVnodes = 0;

View File

@ -96,7 +96,7 @@ ExtractVnodes(struct Msg *m, Volume *vol, afs_int32 class,
StreamHandle_t *stream = 0;
struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
struct VnodeExtract *e;
afs_uint32 size;
afs_sfsize_t size;
afs_uint32 offset;
*length = 0;
@ -255,7 +255,7 @@ copyDir(struct Msg *m, IHandle_t *inh, IHandle_t *outh)
{
FdHandle_t *infdP, *outfdP;
char *tbuf;
afs_size_t size;
afs_sfsize_t size;
infdP = IH_OPEN(inh);
if (!infdP) {
@ -326,7 +326,7 @@ afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol,
FdHandle_t *newfdP = 0;
struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
struct VnodeExtract *e;
afs_uint64 size;
afs_sfsize_t size;
afs_uint64 offset;
Inode ino, newino;
@ -656,7 +656,7 @@ deleteVnodes(Volume *vol, afs_int32 class,
FdHandle_t *fdP = 0;
struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
struct VnodeExtract *e;
afs_uint64 size;
afs_sfsize_t size;
afs_uint64 offset;
Inode ino;