#error We require size of long and pointers to be equal
#endif */
+#define MAX_AFS_INT32 0x7FFFFFFF
+#define MAX_AFS_UINT32 0xFFFFFFFF
+#define MAX_AFS_INT64 0x7FFFFFFFFFFFFFFFL
+#define MAX_AFS_UINT64 0xFFFFFFFFFFFFFFFFL
+
typedef short afs_int16;
typedef unsigned short afs_uint16;
#ifdef AFS_64BIT_ENV
#define CompareInt64(a,b) (afs_int64)(a) - (afs_int64)(b)
#define CompareUInt64(a,b) (afs_uint64)(a) - (afs_uint64)(b)
#define NonZeroInt64(a) (a)
-#define Int64ToInt32(a) (a) & 0xFFFFFFFFL
+#define Int64ToInt32(a) (a) & MAX_AFS_UINT32
#define FillInt64(t,h,l) (t) = (h); (t) <<= 32; (t) |= (l);
-#define SplitInt64(t,h,l) (h) = (t) >> 32; (l) = (t) & 0xFFFFFFFF;
+#define SplitInt64(t,h,l) (h) = (t) >> 32; (l) = (t) & MAX_AFS_UINT32;
+#define RoundInt64ToInt32(a) (a > MAX_AFS_UINT32) ? MAX_AFS_UINT32 : a;
+#define RoundInt64ToInt31(a) (a > MAX_AFS_INT32) ? MAX_AFS_INT32 : a;
#else /* AFS_64BIT_ENV */
typedef long afs_int32;
typedef unsigned long afs_uint32;
#define Int64ToInt32(a) (a).low
#define FillInt64(t,h,l) (t).high = (h); (t).low = (l);
#define SplitInt64(t,h,l) (h) = (t).high; (l) = (t).low;
+#define RoundInt64ToInt32(a) (a.high > 0) ? MAX_AFS_UINT32 : a.low;
+#define RoundInt64ToInt31(a) (a.high > 0) ? MAX_AFS_INT32 : a.low;
#endif /* AFS_64BIT_ENV */
/* AFS_64BIT_CLIENT should presently be set only for AFS_64BIT_ENV systems */
CallBackRxConnAddr(
IN afs_int32 *addr
) = 65541;
+
+%#define STATS64_CURRENTTIME 0
+%#define STATS64_BOOTTIME 1
+%#define STATS64_STARTTIME 2
+%#define STATS64_CURRENTCONNECTIONS 3
+%#define STATS64_TOTALFETCHES 4
+%#define STATS64_FETCHDATAS 5
+%#define STATS64_FETCHEDBYTES 6
+%#define STATS64_FETCHDATARATE 7
+%#define STATS64_TOTALSTORES 8
+%#define STATS64_STOREDATAS 9
+%#define STATS64_STOREDBYTES 10
+%#define STATS64_STOREDATARATE 11
+%#define STATS64_TOTALVICECALLS 12
+%#define STATS64_WORKSTATIONS 13
+%#define STATS64_ACTIVEWORKSTATIONS 14
+%#define STATS64_PROCESSSIZE 15
+
+const STATS64_VERSION = 16;
+typedef afs_uint64 ViceStatistics64<STATS64_VERSION>;
+
+/* the "version" is a number representing the number of
+ array elements to return, from 0 to N-1 */
+
+GetStatistics64(
+ IN afs_int32 statsVersion,
+ OUT ViceStatistics64 *Statistics
+) = 65542;
+
+/* rx osd. put here now to hold version numbers.
+ServerPath(
+ IN AFSFid *Fid,
+ afs_int32 writing,
+ OUT FilePath *NameiInfo,
+ AFSFetchStatus *OutStatus,
+ AFSCallBack *CallBack
+) = 65551;
+
+PerfTest(
+ IN afs_int32 type,
+ afs_int64 bytes,
+ afs_int32 bufsize
+) split = 65552;
+
+GetOSDlocation(
+ IN AFSFid *Fid,
+ afs_uint64 offset,
+ afs_uint64 length,
+ afs_int32 flag,
+ afsUUID uuid,
+ OUT AFSFetchStatus *OutStatus,
+ AFSCallBack *CallBack,
+ struct osd_file *osd
+) = 65557;
+
+InverseLookup(
+ IN AFSFid *Fid,
+ afs_uint32 parent,
+ OUT struct afs_filename *file,
+ afs_uint32 *nextparent
+) = 65558;
+
+CheckOSDconns() = 65559;
+
+OsdPolicy(IN AFSFid *Fid,
+ afs_uint64 length,
+ OUT afs_uint32 *protocol
+) = 65560;
+
+SetOsdFileReady(
+ IN AFSFid *Fid
+) = 65561;
+
+GetOsdMetadata(
+ IN AFSFid *Fid
+) split = 65562;
+*/
#include <fsprobe.h> /*Interface for this module */
#include <lwp.h> /*Lightweight process package */
#include <afs/cellconfig.h>
+#include <afs/afsint.h>
#define LWP_STACK_SIZE (16 * 1024)
struct fsprobe_ConnectionInfo *curr_conn; /*Current connection */
struct ProbeViceStatistics *curr_stats; /*Current stats region */
int *curr_probeOK; /*Current probeOK field */
-
+ ViceStatistics64 stats64; /*Current stats region */
+ stats64.ViceStatistics64_val = (afs_uint64 *)malloc(STATS64_VERSION *
+ sizeof(afs_uint64));
while (1) { /*Service loop */
/*
* Iterate through the server connections, gathering data.
"[%s] Connection valid, calling RXAFS_GetStatistics\n",
rn);
*curr_probeOK =
- RXAFS_GetStatistics(curr_conn->rxconn, curr_stats);
-
+ RXAFS_GetStatistics64(curr_conn->rxconn, STATS64_VERSION, &stats64);
+ if (*curr_probeOK == RXGEN_OPCODE)
+ *curr_probeOK =
+ RXAFS_GetStatistics(curr_conn->rxconn, curr_stats);
+ else if (*curr_probeOK == 0) {
+ curr_stats->CurrentTime = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_CURRENTTIME]);
+ curr_stats->BootTime = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_BOOTTIME]);
+ curr_stats->StartTime = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_STARTTIME]);
+ curr_stats->CurrentConnections = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_CURRENTCONNECTIONS]);
+ curr_stats->TotalFetchs = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_TOTALFETCHES]);
+ curr_stats->TotalStores = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_TOTALSTORES]);
+ curr_stats->WorkStations = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_WORKSTATIONS]);
+ }
}
/*Valid Rx connection */
int i, code;
char pname[10];
struct diskPartition partition;
+ struct diskPartition64 *partition64p =
+ (struct diskPartition64 *)malloc(sizeof(struct diskPartition64));
if (fsprobe_debug)
fprintf(stderr,
MapPartIdIntoName(curr_conn->partList.partId[i],
pname);
code =
- AFSVolPartitionInfo(curr_conn->rxVolconn, pname,
- &partition);
+ AFSVolPartitionInfo64(curr_conn->rxVolconn, pname,
+ partition64p);
+
+ if (!code) {
+ curr_stats->Disk[i].BlocksAvailable =
+ RoundInt64ToInt31(partition64p->free);
+ curr_stats->Disk[i].TotalBlocks =
+ RoundInt64ToInt31(partition64p->minFree);
+ strcpy(curr_stats->Disk[i].Name, pname);
+ }
+ if (code == RXGEN_OPCODE) {
+ code =
+ AFSVolPartitionInfo(curr_conn->rxVolconn,
+ pname, &partition);
+ if (!code) {
+ curr_stats->Disk[i].BlocksAvailable =
+ partition.free;
+ curr_stats->Disk[i].TotalBlocks =
+ partition.minFree;
+ strcpy(curr_stats->Disk[i].Name, pname);
+ }
+ }
if (code) {
fprintf(stderr,
"Could not get information on server %s partition %s\n",
curr_conn->hostName, pname);
- } else {
- curr_stats->Disk[i].BlocksAvailable =
- partition.free;
- curr_stats->Disk[i].TotalBlocks =
- partition.minFree;
- strcpy(curr_stats->Disk[i].Name, pname);
}
}
-
}
+ free(partition64p);
}
if (code)
fprintf(stderr, "[%s] IOMGR_Select returned code %d\n", rn, code);
} /*Service loop */
-
+ free(stats64.ViceStatistics64_val);
} /*fsprobe_LWP */
/*list all the partitions on <aserver> */
status->MinQuota = V_minquota(volptr);
status->MaxQuota = V_maxquota(volptr);
status->BlocksInUse = V_diskused(volptr);
- status->PartBlocksAvail = volptr->partition->free;
- status->PartMaxBlocks = volptr->partition->totalUsable;
+ status->PartBlocksAvail = RoundInt64ToInt32(volptr->partition->free);
+ status->PartMaxBlocks = RoundInt64ToInt32(volptr->partition->totalUsable);
/* now allocate and copy these things; they're freed by the RXGEN stub */
temp = strlen(V_name(volptr)) + 1;
void
SetVolumeStats(struct AFSStatistics *stats)
{
- struct DiskPartition *part;
+ struct DiskPartition64 *part;
int i = 0;
for (part = DiskPartitionList; part && i < AFS_MSTATDISKS;
part = part->next) {
- stats->Disks[i].TotalBlocks = part->totalUsable;
- stats->Disks[i].BlocksAvailable = part->free;
+ stats->Disks[i].TotalBlocks = RoundInt64ToInt32(part->totalUsable);
+ stats->Disks[i].BlocksAvailable = RoundInt64ToInt32(part->free);
memset(stats->Disks[i].Name, 0, AFS_DISKNAMESIZE);
strncpy(stats->Disks[i].Name, part->name, AFS_DISKNAMESIZE);
i++;
} /*SRXAFS_GetStatistics */
+afs_int32
+SRXAFS_GetStatistics64(struct rx_call *acall, afs_int32 statsVersion, ViceStatistics64 *Statistics)
+{
+ extern afs_int32 StartTime, CurrentConnections;
+ int seconds;
+ afs_int32 code;
+ struct rx_connection *tcon = rx_ConnectionOf(acall);
+ struct host *thost;
+ struct client *t_client = NULL; /* tmp ptr to client data */
+ struct timeval time;
+#if FS_STATS_DETAILED
+ struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
+ struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */
+ struct timeval elapsedTime; /* Transfer time */
+
+ /*
+ * Set our stats pointer, remember when the RPC operation started, and
+ * tally the operation.
+ */
+ opP = &(afs_FullPerfStats.det.rpcOpTimes[FS_STATS_RPCIDX_GETSTATISTICS]);
+ FS_LOCK;
+ (opP->numOps)++;
+ FS_UNLOCK;
+ TM_GetTimeOfDay(&opStartTime, 0);
+#endif /* FS_STATS_DETAILED */
+
+ if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost)))
+ goto Bad_GetStatistics64;
+
+ ViceLog(1, ("SAFS_GetStatistics64 Received\n"));
+ Statistics->ViceStatistics64_val =
+ malloc(statsVersion*sizeof(afs_int64));
+ Statistics->ViceStatistics64_len = statsVersion;
+ FS_LOCK;
+ AFSCallStats.GetStatistics++, AFSCallStats.TotalCalls++;
+ Statistics->ViceStatistics64_val[STATS64_STARTTIME] = StartTime;
+ Statistics->ViceStatistics64_val[STATS64_CURRENTCONNECTIONS] =
+ CurrentConnections;
+ Statistics->ViceStatistics64_val[STATS64_TOTALVICECALLS] =
+ AFSCallStats.TotalCalls;
+ Statistics->ViceStatistics64_val[STATS64_TOTALFETCHES] =
+ AFSCallStats.FetchData + AFSCallStats.FetchACL +
+ AFSCallStats.FetchStatus;
+ Statistics->ViceStatistics64_val[STATS64_FETCHDATAS] =
+ AFSCallStats.FetchData;
+ Statistics->ViceStatistics64_val[STATS64_FETCHEDBYTES] =
+ AFSCallStats.TotalFetchedBytes;
+ seconds = AFSCallStats.AccumFetchTime / 1000;
+ if (seconds <= 0)
+ seconds = 1;
+ Statistics->ViceStatistics64_val[STATS64_FETCHDATARATE] =
+ AFSCallStats.TotalFetchedBytes / seconds;
+ Statistics->ViceStatistics64_val[STATS64_TOTALSTORES] =
+ AFSCallStats.StoreData + AFSCallStats.StoreACL +
+ AFSCallStats.StoreStatus;
+ Statistics->ViceStatistics64_val[STATS64_STOREDATAS] =
+ AFSCallStats.StoreData;
+ Statistics->ViceStatistics64_val[STATS64_STOREDBYTES] =
+ AFSCallStats.TotalStoredBytes;
+ seconds = AFSCallStats.AccumStoreTime / 1000;
+ if (seconds <= 0)
+ seconds = 1;
+ Statistics->ViceStatistics64_val[STATS64_STOREDATARATE] =
+ AFSCallStats.TotalStoredBytes / seconds;
+#ifdef AFS_NT40_ENV
+ Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] = -1;
+#else
+ Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] =
+ (afs_int32) ((long)sbrk(0) >> 10);
+#endif
+ FS_UNLOCK;
+ h_GetWorkStats((int *)&(Statistics->ViceStatistics64_val[STATS64_WORKSTATIONS]),
+ (int *)&(Statistics->ViceStatistics64_val[STATS64_ACTIVEWORKSTATIONS]),
+ (int *)0,
+ (afs_int32) (FT_ApproxTime()) - (15 * 60));
+
+
+
+ /* this works on all system types */
+ TM_GetTimeOfDay(&time, 0);
+ Statistics->ViceStatistics64_val[STATS64_CURRENTTIME] = time.tv_sec;
+
+ Bad_GetStatistics64:
+ code = CallPostamble(tcon, code, thost);
+
+ t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
+
+#if FS_STATS_DETAILED
+ TM_GetTimeOfDay(&opStopTime, 0);
+ if (code == 0) {
+ FS_LOCK;
+ (opP->numSuccesses)++;
+ fs_stats_GetDiff(elapsedTime, opStartTime, opStopTime);
+ fs_stats_AddTo((opP->sumTime), elapsedTime);
+ fs_stats_SquareAddTo((opP->sqrTime), elapsedTime);
+ if (fs_stats_TimeLessThan(elapsedTime, (opP->minTime))) {
+ fs_stats_TimeAssign((opP->minTime), elapsedTime);
+ }
+ if (fs_stats_TimeGreaterThan(elapsedTime, (opP->maxTime))) {
+ fs_stats_TimeAssign((opP->maxTime), elapsedTime);
+ }
+ FS_UNLOCK;
+ }
+#endif /* FS_STATS_DETAILED */
+
+ osi_auditU(acall, GetStatisticsEvent, code,
+ AUD_ID, t_client ? t_client->ViceId : 0, AUD_END);
+ return code;
+} /*SRXAFS_GetStatistics */
+
+
/*------------------------------------------------------------------------
* EXPORTED SRXAFS_XStatsVersion
*
struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
int ReadWriteOriginal = VolumeWriteable(rwvp);
- struct DiskPartition *partition = rwvp->partition;
Device device = rwvp->device;
/* Open the RW volume's index file and seek to beginning */
static int VnQuery(struct cmd_syndesc * as, void * rock);
static void print_vol_stats_general(VolPkgStats * stats);
-static void print_vol_stats_viceP(struct DiskPartitionStats * stats);
+static void print_vol_stats_viceP(struct DiskPartitionStats64 * stats);
static void print_vol_stats_hash(struct VolumeHashChainStats * stats);
#ifdef AFS_DEMAND_ATTACH_FS
static void print_vol_stats_hdr(struct volume_hdr_LRU_stats * stats);
#ifdef AFS_DEMAND_ATTACH_FS
struct volume_hdr_LRU_stats * hdr_stats;
#endif
- struct DiskPartitionStats * vicep_stats;
+ struct DiskPartitionStats64 * vicep_stats;
} sres;
sres.ptr = res_buf;
}
static void
-print_vol_stats_viceP(struct DiskPartitionStats * stats)
+print_vol_stats_viceP(struct DiskPartitionStats64 * stats)
{
- printf("DiskPartitionStats = {\n");
- printf("\tfree = %d\n", stats->free);
- printf("\tminFree = %d\n", stats->minFree);
- printf("\ttotalUsable = %d\n", stats->totalUsable);
- printf("\tf_files = %d\n", stats->f_files);
+ printf("DiskPartitionStats64 = {\n");
+ printf("\tfree = %lld\n", stats->free);
+ printf("\tminFree = %lld\n", stats->minFree);
+ printf("\ttotalUsable = %lld\n", stats->totalUsable);
+ printf("\tf_files = %lld\n", stats->f_files);
#ifdef AFS_DEMAND_ATTACH_FS
printf("\tvol_list_len = %d\n", stats->vol_list_len);
#endif
FSYNC_com_StatsOpViceP(FSSYNC_StatsOp_command * scom, SYNC_response * res)
{
afs_int32 code = SYNC_OK;
- struct DiskPartition * dp;
- struct DiskPartitionStats * stats;
+ struct DiskPartition64 * dp;
+ struct DiskPartitionStats64 * stats;
if (SYNC_verifyProtocolString(scom->sop->args.partName, sizeof(scom->sop->args.partName))) {
res->hdr.reason = SYNC_REASON_MALFORMED_PACKET;
if (!dp) {
code = SYNC_FAILED;
} else {
- stats = (struct DiskPartitionStats *) res->payload.buf;
+ stats = (struct DiskPartitionStats64 *) res->payload.buf;
stats->free = dp->free;
stats->totalUsable = dp->totalUsable;
stats->minFree = dp->minFree;
stats->f_files = dp->f_files;
stats->vol_list_len = dp->vol_list.len;
- res->hdr.response_len += sizeof(struct DiskPartitionStats);
+ res->hdr.response_len += sizeof(struct DiskPartitionStats64);
}
done:
char *name;
int fd, err, forcep, len, j, code;
struct dirent *dp;
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
struct ViceInodeInfo info;
struct VolumeDiskHeader h;
IHandle_t *ih, *ih2;
DIR *dirp;
Inode ino;
struct dirent *dp;
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
struct ViceInodeInfo info;
struct VolumeDiskHeader h;
char volname[20];
/*@printflike@*/ extern void Log(const char *format, ...);
int aixlow_water = 8; /* default 8% */
-struct DiskPartition *DiskPartitionList;
+struct DiskPartition64 *DiskPartitionList;
#ifdef AFS_DEMAND_ATTACH_FS
-static struct DiskPartition *DiskPartitionTable[VOLMAXPARTS+1];
+static struct DiskPartition64 *DiskPartitionTable[VOLMAXPARTS+1];
-static struct DiskPartition * VLookupPartition_r(char * path);
-static void AddPartitionToTable_r(struct DiskPartition *);
-static void DeletePartitionFromTable_r(struct DiskPartition *);
+static struct DiskPartition64 * VLookupPartition_r(char * path);
+static void AddPartitionToTable_r(struct DiskPartition64 *);
+static void DeletePartitionFromTable_r(struct DiskPartition64 *);
#endif /* AFS_DEMAND_ATTACH_FS */
#ifdef AFS_SGI_XFS_IOPS_ENV
static void
VInitPartition_r(char *path, char *devname, Device dev)
{
- struct DiskPartition *dp, *op;
- dp = (struct DiskPartition *)malloc(sizeof(struct DiskPartition));
+ struct DiskPartition64 *dp, *op;
+ dp = (struct DiskPartition64 *)malloc(sizeof(struct DiskPartition64));
/* Add it to the end, to preserve order when we print statistics */
for (op = DiskPartitionList; op; op = op->next) {
if (!op->next)
int
VAttachPartitions(void)
{
- struct DiskPartition *partP, *prevP, *nextP;
+ struct DiskPartition64 *partP, *prevP, *nextP;
struct vpt_iter iter;
struct vptab entry;
* is required. The canonical name is still in part->name.
*/
char *
-VPartitionPath(struct DiskPartition *part)
+VPartitionPath(struct DiskPartition64 *part)
{
#ifdef AFS_NT40_ENV
return part->devName;
}
/* get partition structure, abortp tells us if we should abort on failure */
-struct DiskPartition *
+struct DiskPartition64 *
VGetPartition_r(char *name, int abortp)
{
- register struct DiskPartition *dp;
+ register struct DiskPartition64 *dp;
#ifdef AFS_DEMAND_ATTACH_FS
dp = VLookupPartition_r(name);
#else /* AFS_DEMAND_ATTACH_FS */
return dp;
}
-struct DiskPartition *
+struct DiskPartition64 *
VGetPartition(char *name, int abortp)
{
- struct DiskPartition *retVal;
+ struct DiskPartition64 *retVal;
VOL_LOCK;
retVal = VGetPartition_r(name, abortp);
VOL_UNLOCK;
#ifdef AFS_NT40_ENV
void
-VSetPartitionDiskUsage_r(register struct DiskPartition *dp)
+VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp)
{
ULARGE_INTEGER free_user, total, free_total;
int ufree, tot, tfree;
#else
void
-VSetPartitionDiskUsage_r(register struct DiskPartition *dp)
+VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp)
{
- int fd, totalblks, free, used, availblks, bsize, code;
+ int fd, bsize, code;
+ afs_int64 totalblks, free, used, availblks;
int reserved;
#ifdef afs_statvfs
struct afs_statvfs statbuf;
#endif /* AFS_NT40_ENV */
void
-VSetPartitionDiskUsage(register struct DiskPartition *dp)
+VSetPartitionDiskUsage(register struct DiskPartition64 *dp)
{
VOL_LOCK;
VSetPartitionDiskUsage_r(dp);
void
VResetDiskUsage_r(void)
{
- struct DiskPartition *dp;
+ struct DiskPartition64 *dp;
for (dp = DiskPartitionList; dp; dp = dp->next) {
VSetPartitionDiskUsage_r(dp);
#ifndef AFS_PTHREAD_ENV
void
VPrintDiskStats_r(void)
{
- struct DiskPartition *dp;
+ struct DiskPartition64 *dp;
for (dp = DiskPartitionList; dp; dp = dp->next) {
Log("Partition %s: %d available 1K blocks (minfree=%d), ", dp->name,
dp->totalUsable, dp->minFree);
void
VLockPartition_r(char *name)
{
- struct DiskPartition *dp = VGetPartition_r(name, 0);
+ struct DiskPartition64 *dp = VGetPartition_r(name, 0);
OVERLAPPED lap;
if (!dp)
void
VUnlockPartition_r(char *name)
{
- register struct DiskPartition *dp = VGetPartition_r(name, 0);
+ register struct DiskPartition64 *dp = VGetPartition_r(name, 0);
OVERLAPPED lap;
if (!dp)
void
VLockPartition_r(char *name)
{
- register struct DiskPartition *dp = VGetPartition_r(name, 0);
+ register struct DiskPartition64 *dp = VGetPartition_r(name, 0);
char *partitionName;
int retries, code;
struct timeval pausing;
void
VUnlockPartition_r(char *name)
{
- register struct DiskPartition *dp = VGetPartition_r(name, 0);
+ register struct DiskPartition64 *dp = VGetPartition_r(name, 0);
if (!dp)
return; /* no partition, will fail later */
close(dp->lock_fd);
/* XXX not sure this will work on AFS_NT40_ENV
* needs to be tested!
*/
-struct DiskPartition *
+struct DiskPartition64 *
VGetPartitionById_r(afs_int32 id, int abortp)
{
- struct DiskPartition * dp = NULL;
+ struct DiskPartition64 *dp = NULL;
if ((id >= 0) && (id <= VOLMAXPARTS)) {
dp = DiskPartitionTable[id];
return dp;
}
-struct DiskPartition *
+struct DiskPartition64 *
VGetPartitionById(afs_int32 id, int abortp)
{
- struct Diskpartition * dp;
+ struct Diskpartition64 * dp;
VOL_LOCK;
dp = VGetPartitionById_r(id, abortp);
return dp;
}
-static struct DiskPartition *
+static struct DiskPartition64 *
VLookupPartition_r(char * path)
{
afs_int32 id = volutil_GetPartitionID(path);
}
static void
-AddPartitionToTable_r(struct DiskPartition * dp)
+AddPartitionToTable_r(struct DiskPartition64 *dp)
{
assert(dp->index >= 0 && dp->index <= VOLMAXPARTS);
DiskPartitionTable[dp->index] = dp;
}
static void
-DeletePartitionFromTable_r(struct DiskPartition * dp)
+DeletePartitionFromTable_r(struct DiskPartition64 *dp)
{
assert(dp->index >= 0 && dp->index <= VOLMAXPARTS);
DiskPartitionTable[dp->index] = NULL;
* variant for VGetPartition as well. Also, the VolPartitionInfo RPC does
* a swap before sending the data out on the wire.
*/
-struct DiskPartition {
- struct DiskPartition *next;
+struct DiskPartition64 {
+ struct DiskPartition64 *next;
char *name; /* Mounted partition name */
char *devName; /* Device mounted on */
Device device; /* device number */
afs_int32 index; /* partition index (0<=x<=VOLMAXPARTS) */
int lock_fd; /* File descriptor of this partition if locked; otherwise -1;
* Not used by the file server */
- int free; /* Total number of blocks (1K) presumed
+ afs_int64 free; /* Total number of blocks (1K) presumed
* available on this partition (accounting
* for the minfree parameter for the
* partition). This is adjusted
* this is recomputed. This number can
* be negative, if the partition starts
* out too full */
- int totalUsable; /* Total number of blocks available on this
+ afs_int64 totalUsable; /* Total number of blocks available on this
* partition, taking into account the minfree
* parameter for the partition (see the
* 4.2bsd command tunefs, but note that the
* is not reread--does not apply here. The
* superblock is re-read periodically by
* VSetPartitionDiskUsage().) */
- int minFree; /* Number blocks to be kept free, as last read
+ afs_int64 minFree; /* Number blocks to be kept free, as last read
* from the superblock */
int flags;
- int f_files; /* total number of files in this partition */
+ afs_int64 f_files; /* total number of files in this partition */
#ifdef AFS_DEMAND_ATTACH_FS
struct {
struct rx_queue head; /* list of volumes on this partition (VByPList) */
#endif /* AFS_DEMAND_ATTACH_FS */
};
-struct DiskPartitionStats {
- afs_int32 free;
- afs_int32 totalUsable;
- afs_int32 minFree;
- afs_int32 f_files;
+struct DiskPartitionStats64 {
+ afs_int64 free;
+ afs_int64 totalUsable;
+ afs_int64 minFree;
+ afs_int64 f_files;
#ifdef AFS_DEMAND_ATTACH_FS
afs_int32 vol_list_len;
#endif
struct Volume; /* Potentially forward definition */
-extern struct DiskPartition *DiskPartitionList;
-extern struct DiskPartition *VGetPartition(char * name, int abortp);
-extern struct DiskPartition *VGetPartition_r(char * name, int abortp);
+extern struct DiskPartition64 *DiskPartitionList;
+extern struct DiskPartition64 *VGetPartition(char * name, int abortp);
+extern struct DiskPartition64 *VGetPartition_r(char * name, int abortp);
#ifdef AFS_DEMAND_ATTACH_FS
-extern struct DiskPartition *VGetPartitionById(afs_int32 index, int abortp);
-extern struct DiskPartition *VGetPartitionById_r(afs_int32 index, int abortp);
+extern struct DiskPartition64 *VGetPartitionById(afs_int32 index, int abortp);
+extern struct DiskPartition64 *VGetPartitionById_r(afs_int32 index, int abortp);
#endif
extern int VAttachPartitions(void);
extern void VLockPartition(char *name);
extern void VUnlockPartition_r(char *name);
extern void VResetDiskUsage(void);
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 VSetPartitionDiskUsage(register struct DiskPartition64 *dp);
+extern void VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp);
+extern char *VPartitionPath(struct DiskPartition64 *p);
extern void VAdjustDiskUsage(Error * ec, struct Volume *vp,
afs_sfsize_t blocks, afs_sfsize_t checkBlocks);
extern int VDiskUsage(struct Volume *vp, afs_sfsize_t blocks);
void
VPurgeVolume(Error * ec, Volume * vp)
{
- struct DiskPartition *tpartp = vp->partition;
+ struct DiskPartition64 *tpartp = vp->partition;
char purgePath[MAXPATHLEN];
/* N.B. it's important here to use the partition pointed to by the
register struct cmd_item *ti;
char pname[100], *temp;
afs_int32 seenpart = 0, seenvol = 0, vid = 0, seenany = 0;
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
#ifdef AFS_SGI_VNODE_GLUE
{
char childLog[AFSDIR_PATH_MAX];
int ret;
- struct DiskPartition * partP;
+ struct DiskPartition64 * partP;
/* do not allow further forking inside salvager */
canfork = 0;
register struct cmd_item *ti;
char pname[100], *temp;
afs_int32 seenpart = 0, seenvol = 0, vid = 0, seenany = 0;
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
#ifdef AFS_SGI_VNODE_GLUE
if (afs_init_kernel_config(-1) < 0) {
SALVSYNC_com_CancelAll(SALVSYNC_command * com, SALVSYNC_response * res)
{
struct SalvageQueueNode * np, *nnp;
- struct DiskPartition * dp;
+ struct DiskPartition64 * dp;
for (dp = DiskPartitionList ; dp ; dp = dp->next) {
for (queue_Scan(&salvageQueue.part[dp->index], np, nnp, SalvageQueueNode)) {
SALVSYNC_getWork(void)
{
int i, ret;
- struct DiskPartition * dp = NULL, * fdp;
+ struct DiskPartition64 * dp = NULL, * fdp;
static afs_int32 next_part_sched = 0;
struct SalvageQueueNode *node = NULL, *np;
/* Forward Declarations */
void PrintHeader(register Volume * vp);
void HandleAllPart(void);
-void HandlePart(struct DiskPartition *partP);
-void HandleVolume(struct DiskPartition *partP, char *name);
-struct DiskPartition *FindCurrentPartition(void);
-Volume *AttachVolume(struct DiskPartition *dp, char *volname,
+void HandlePart(struct DiskPartition64 *partP);
+void HandleVolume(struct DiskPartition64 *partP, char *name);
+struct DiskPartition64 *FindCurrentPartition(void);
+Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
register struct VolumeHeader *header);
#if defined(AFS_NAMEI_ENV)
void PrintVnode(int offset, VnodeDiskObject * vnode, VnodeId vnodeNumber,
Volume *
-AttachVolume(struct DiskPartition * dp, char *volname,
+AttachVolume(struct DiskPartition64 * dp, char *volname,
register struct VolumeHeader * header)
{
register Volume *vp;
int err = 0;
int volumeId = 0;
char *partName = 0;
- struct DiskPartition *partP = NULL;
+ struct DiskPartition64 *partP = NULL;
#ifndef AFS_NT40_ENV
#ifdef AFS_NT40_ENV
#include <direct.h>
-struct DiskPartition *
+struct DiskPartition64 *
FindCurrentPartition()
{
int dr = _getdrive();
- struct DiskPartition *dp;
+ struct DiskPartition64 *dp;
dr--;
for (dp = DiskPartitionList; dp; dp = dp->next) {
return dp;
}
#else
-struct DiskPartition *
+struct DiskPartition64 *
FindCurrentPartition()
{
char partName[1024];
char tmp = '\0';
char *p;
- struct DiskPartition *dp;
+ struct DiskPartition64 *dp;
if (!getcwd(partName, 1023)) {
perror("pwd");
void
HandleAllPart(void)
{
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
for (partP = DiskPartitionList; partP; partP = partP->next) {
void
-HandlePart(struct DiskPartition *partP)
+HandlePart(struct DiskPartition64 *partP)
{
int nvols = 0;
DIR *dirp;
void
-HandleVolume(struct DiskPartition *dp, char *name)
+HandleVolume(struct DiskPartition64 *dp, char *name)
{
struct VolumeHeader header;
struct VolumeDiskHeader diskHeader;
char *fileSysPathName; /* NT needs this to make name pretty in log. */
IHandle_t *VGLinkH; /* Link handle for current volume group. */
int VGLinkH_cnt; /* # of references to lnk handle. */
-struct DiskPartition *fileSysPartition; /* Partition being salvaged */
+struct DiskPartition64 *fileSysPartition; /* Partition being salvaged */
#ifndef AFS_NT40_ENV
char *fileSysDeviceName; /* The block device where the file system
* being salvaged was mounted */
#define HDSTR "\\Device\\Harddisk"
#define HDLEN (sizeof(HDSTR)-1) /* Length of "\Device\Harddisk" */
int
-SameDisk(struct DiskPartition *p1, struct DiskPartition *p2)
+SameDisk(struct DiskPartition64 *p1, struct DiskPartition64 *p2)
{
#define RES_LEN 256
char res[RES_LEN];
* PartsPerDisk are on the same disk.
*/
void
-SalvageFileSysParallel(struct DiskPartition *partP)
+SalvageFileSysParallel(struct DiskPartition64 *partP)
{
struct job {
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
int pid; /* Pid for this job */
int jobnumb; /* Log file job number */
struct job *nextjob; /* Next partition on disk to salvage */
void
-SalvageFileSys(struct DiskPartition *partP, VolumeId singleVolumeNumber)
+SalvageFileSys(struct DiskPartition64 *partP, VolumeId singleVolumeNumber)
{
if (!canfork || debug || Fork() == 0) {
SalvageFileSys1(partP, singleVolumeNumber);
}
void
-SalvageFileSys1(struct DiskPartition *partP, VolumeId singleVolumeNumber)
+SalvageFileSys1(struct DiskPartition64 *partP, VolumeId singleVolumeNumber)
{
char *name, *tdir;
char inodeListPath[256];
extern char *fileSysPathName; /* NT needs this to make name pretty in log. */
extern IHandle_t *VGLinkH; /* Link handle for current volume group. */
extern int VGLinkH_cnt; /* # of references to lnk handle. */
-extern struct DiskPartition *fileSysPartition; /* Partition being salvaged */
+extern struct DiskPartition64 *fileSysPartition; /* Partition being salvaged */
#ifndef AFS_NT40_ENV
extern char *fileSysDeviceName; /* The block device where the file system
* being salvaged was mounted */
extern void SalvageDir(char *name, VolumeId rwVid, struct VnodeInfo *dirVnodeInfo,
IHandle_t * alinkH, int i, struct DirSummary *rootdir,
int *rootdirfound);
-extern void SalvageFileSysParallel(struct DiskPartition *partP);
-extern void SalvageFileSys(struct DiskPartition *partP, VolumeId singleVolumeNumber);
-extern void SalvageFileSys1(struct DiskPartition *partP,
+extern void SalvageFileSysParallel(struct DiskPartition64 *partP);
+extern void SalvageFileSys(struct DiskPartition64 *partP, VolumeId singleVolumeNumber);
+extern void SalvageFileSys1(struct DiskPartition64 *partP,
VolumeId singleVolumeNumber);
extern int SalvageHeader(register struct stuff *sp, struct InodeSummary *isp,
int check, int *deleteMe);
/* Forward declarations */
static Volume *attach2(Error * ec, VolId vid, char *path,
register struct VolumeHeader *header,
- struct DiskPartition *partp, Volume * vp,
+ struct DiskPartition64 *partp, Volume * vp,
int isbusy, int mode);
static void ReallyFreeVolume(Volume * vp);
#ifdef AFS_DEMAND_ATTACH_FS
#ifdef AFS_PTHREAD_ENV
typedef struct diskpartition_queue_t {
struct rx_queue queue;
- struct DiskPartition * diskP;
+ struct DiskPartition64 * diskP;
} diskpartition_queue_t;
typedef struct vinitvolumepackage_thread_t {
struct rx_queue queue;
static void * VInitVolumePackageThread(void * args);
#endif /* AFS_PTHREAD_ENV */
-static int VAttachVolumesByPartition(struct DiskPartition *diskP,
+static int VAttachVolumesByPartition(struct DiskPartition64 *diskP,
int * nAttached, int * nUnattached);
/* VByP List */
static void AddVolumeToVByPList_r(Volume * vp);
static void DeleteVolumeFromVByPList_r(Volume * vp);
-static void VVByPListBeginExclusive_r(struct DiskPartition * dp);
-static void VVByPListEndExclusive_r(struct DiskPartition * dp);
-static void VVByPListWait_r(struct DiskPartition * dp);
+static void VVByPListBeginExclusive_r(struct DiskPartition64 * dp);
+static void VVByPListEndExclusive_r(struct DiskPartition64 * dp);
+static void VVByPListWait_r(struct DiskPartition64 * dp);
/* online salvager */
static int VCheckSalvage(register Volume * vp);
static void VHashWait_r(VolumeHashChainHead * head);
/* shutdown */
-static int ShutdownVByPForPass_r(struct DiskPartition * dp, int pass);
-static int ShutdownVolumeWalk_r(struct DiskPartition * dp, int pass,
+static int ShutdownVByPForPass_r(struct DiskPartition64 * dp, int pass);
+static int ShutdownVolumeWalk_r(struct DiskPartition64 * dp, int pass,
struct rx_queue ** idx);
static void ShutdownController(vshutdown_thread_t * params);
static void ShutdownCreateSchedule(vshutdown_thread_t * params);
return -1;
if (programType == fileServer) {
- struct DiskPartition *diskP;
+ struct DiskPartition64 *diskP;
#ifdef AFS_PTHREAD_ENV
struct vinitvolumepackage_thread_t params;
struct diskpartition_queue_t * dpq;
DIR *dirp;
struct dirent *dp;
- struct DiskPartition *diskP;
+ struct DiskPartition64 *diskP;
struct vinitvolumepackage_thread_t * params;
struct diskpartition_queue_t * dpq;
* attach all volumes on a given disk partition
*/
static int
-VAttachVolumesByPartition(struct DiskPartition *diskP, int * nAttached, int * nUnattached)
+VAttachVolumesByPartition(struct DiskPartition64 *diskP, int * nAttached, int * nUnattached)
{
DIR * dirp;
struct dirent * dp;
register Volume *vp, *np;
register afs_int32 code;
#ifdef AFS_DEMAND_ATTACH_FS
- struct DiskPartition * diskP;
+ struct DiskPartition64 * diskP;
struct diskpartition_queue_t * dpq;
vshutdown_thread_t params;
pthread_t tid;
ShutdownController(vshutdown_thread_t * params)
{
/* XXX debug */
- struct DiskPartition * diskP;
+ struct DiskPartition64 * diskP;
Device id;
vshutdown_thread_t shadow;
static void
ShutdownCreateSchedule(vshutdown_thread_t * params)
{
- struct DiskPartition * diskP;
+ struct DiskPartition64 * diskP;
int sum, thr_workload, thr_left;
int part_residue[VOLMAXPARTS+1];
Device id;
Volume * vp;
vshutdown_thread_t * params;
int part, code, found, pass, schedule_version_save, count;
- struct DiskPartition *diskP;
+ struct DiskPartition64 *diskP;
struct diskpartition_queue_t * dpq;
Device id;
* note that this function will not allow mp-fast
* shutdown of a partition */
int
-VShutdownByPartition_r(struct DiskPartition * dp)
+VShutdownByPartition_r(struct DiskPartition64 * dp)
{
int pass, retVal;
int pass_stats[4];
* traversal
*/
static int
-ShutdownVByPForPass_r(struct DiskPartition * dp, int pass)
+ShutdownVByPForPass_r(struct DiskPartition64 * dp, int pass)
{
struct rx_queue * q = queue_First(&dp->vol_list, rx_queue);
register int i = 0;
* returns 1 if a volume was shutdown in this pass,
* 0 otherwise */
static int
-ShutdownVolumeWalk_r(struct DiskPartition * dp, int pass,
+ShutdownVolumeWalk_r(struct DiskPartition64 * dp, int pass,
struct rx_queue ** idx)
{
struct rx_queue *qp, *nqp;
VolId volumeId)
{
Volume *vp;
- struct DiskPartition *partp;
+ struct DiskPartition64 *partp;
*ec = 0;
*/
Volume *
VPreAttachVolumeByVp_r(Error * ec,
- struct DiskPartition * partp,
+ struct DiskPartition64 * partp,
Volume * vp,
VolId vid)
{
struct afs_stat status;
struct VolumeDiskHeader diskHeader;
struct VolumeHeader iheader;
- struct DiskPartition *partp;
+ struct DiskPartition64 *partp;
char path[64];
int isbusy = 0;
VolId volumeId;
struct afs_stat status;
struct VolumeDiskHeader diskHeader;
struct VolumeHeader iheader;
- struct DiskPartition *partp;
+ struct DiskPartition64 *partp;
char path[64];
int isbusy = 0;
VolId volumeId;
*/
private Volume *
attach2(Error * ec, VolId volumeId, char *path, register struct VolumeHeader * header,
- struct DiskPartition * partp, register Volume * vp, int isbusy, int mode)
+ struct DiskPartition64 * partp, register Volume * vp, int isbusy, int mode)
{
vp->specialStatus = (byte) (isbusy ? VBUSY : 0);
IH_INIT(vp->vnodeIndex[vLarge].handle, partp->device, header->parent,
VDetachVolume_r(Error * ec, Volume * vp)
{
VolumeId volume;
- struct DiskPartition *tpartp;
+ struct DiskPartition64 *tpartp;
int notifyServer, useDone = FSYNC_VOL_ON;
*ec = 0; /* always "succeeds" */
static char partition[VMAXPATHLEN], name[VMAXPATHLEN];
char path[VMAXPATHLEN];
int found = 0;
- struct DiskPartition *dp;
+ struct DiskPartition64 *dp;
*ec = 0;
name[0] = '/';
*/
/* take exclusive control over the list */
static void
-VVByPListBeginExclusive_r(struct DiskPartition * dp)
+VVByPListBeginExclusive_r(struct DiskPartition64 * dp)
{
assert(dp->vol_list.busy == 0);
dp->vol_list.busy = 1;
* @internal volume package internal use only.
*/
static void
-VVByPListEndExclusive_r(struct DiskPartition * dp)
+VVByPListEndExclusive_r(struct DiskPartition64 * dp)
{
assert(dp->vol_list.busy);
dp->vol_list.busy = 0;
* @internal volume package internal use only.
*/
static void
-VVByPListWait_r(struct DiskPartition * dp)
+VVByPListWait_r(struct DiskPartition64 * dp)
{
while (dp->vol_list.busy) {
VOL_CV_WAIT(&dp->vol_list.cv);
/* print extended disk related statistics */
{
- struct DiskPartition * diskP;
+ struct DiskPartition64 * diskP;
afs_uint32 vol_count[VOLMAXPARTS+1];
byte part_exists[VOLMAXPARTS+1];
Device id;
VolumeId hashid; /* Volume number -- for hash table lookup */
struct volHeader *header; /* Cached disk data */
Device device; /* Unix device for the volume */
- struct DiskPartition
+ struct DiskPartition64
*partition; /* Information about the Unix partition */
struct vnodeIndex {
IHandle_t *handle; /* Unix inode holding this index */
extern void VPrintCacheStats(void);
extern void VReleaseVnodeFiles_r(Volume * vp);
extern void VCloseVnodeFiles_r(Volume * vp);
-extern struct DiskPartition *VGetPartition(char *name, int abortp);
-extern struct DiskPartition *VGetPartition_r(char *name, int abortp);
+extern struct DiskPartition64 *VGetPartition(char *name, int abortp);
+extern struct DiskPartition64 *VGetPartition_r(char *name, int abortp);
extern int VInitVolumePackage(ProgramType pt, afs_uint32 nLargeVnodes,
afs_uint32 nSmallVnodes, int connect, afs_uint32 volcache);
extern void DiskToVolumeHeader(VolumeHeader_t * h, VolumeDiskHeader_t * dh);
extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name);
extern Volume *VPreAttachVolumeById_r(Error * ec, char * partition,
VolId volumeId);
-extern Volume *VPreAttachVolumeByVp_r(Error * ec, struct DiskPartition * partp,
+extern Volume *VPreAttachVolumeByVp_r(Error * ec, struct DiskPartition64 * partp,
Volume * vp, VolId volume_id);
extern Volume *VGetVolumeByVp_r(Error * ec, Volume * vp);
-extern int VShutdownByPartition_r(struct DiskPartition * dp);
+extern int VShutdownByPartition_r(struct DiskPartition64 * dp);
extern int VShutdownVolume_r(Volume * vp);
extern int VConnectSALV(void);
extern int VConnectSALV_r(void);
int fd, i;
char headerName[32], volumePath[64];
Device device;
- struct DiskPartition *partition;
+ struct DiskPartition64 *partition;
struct VolumeDiskHeader diskHeader;
IHandle_t *handle;
FdHandle_t *fdP;
struct rx_call *call; /* call to which to write, might be an array */
int device; /* dump device ID for volume */
int parentId; /* dump parent ID for volume */
- struct DiskPartition *dumpPartition; /* Dump partition. */
+ struct DiskPartition64 *dumpPartition; /* Dump partition. */
struct rx_call **calls; /* array of pointers to calls */
int ncalls; /* how many calls/codes in array */
int *codes; /* one return code for each call */
(size <=
vcp->diskSize ? 0 : size - vcp->diskSize) >> vcp->logSize;
if (nVnodes > 0) {
+ if (DoLogging) {
+ Log("RestoreVolume ProcessIndex: Set up %d inodes for volume %d\n",
+ nVnodes, V_id(vp));
+ }
Buf = (afs_int32 *) malloc(nVnodes * sizeof(afs_int32));
if (Buf == NULL) {
STREAM_CLOSE(afile);
}
offset += vcp->diskSize;
}
+ if (DoLogging) {
+ Log("RestoreVolume ProcessIndex: found %d inodes\n", cnt);
+ }
*Bufp = Buf;
*sizep = nVnodes;
}
if (!ReadInt32(iodp, &vnode->uniquifier))
return VOLSERREAD_DUMPERROR;
+
+ if (DoLogging) {
+ Log("ReadVnodes: setup %d/%d\n", vnodeNumber, vnode->uniquifier);
+ }
while ((tag = iod_getc(iodp)) > D_MAX && tag != EOF) {
haveStuff = 1;
switch (tag) {
int verbose = 0;
/* Forward Declarations */
-void HandleVolume(struct DiskPartition *partP, char *name, char *filename);
-Volume *AttachVolume(struct DiskPartition *dp, char *volname,
+void HandleVolume(struct DiskPartition64 *partP, char *name, char *filename);
+Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
register struct VolumeHeader *header);
-static void DoMyVolDump(Volume * vp, struct DiskPartition *dp,
+static void DoMyVolDump(Volume * vp, struct DiskPartition64 *dp,
char *dumpfile);
#ifndef AFS_NT40_ENV
Volume *
-AttachVolume(struct DiskPartition * dp, char *volname,
+AttachVolume(struct DiskPartition64 * dp, char *volname,
register struct VolumeHeader * header)
{
register Volume *vp;
int volumeId = 0;
char *partName = 0;
char *fileName = NULL;
- struct DiskPartition *partP = NULL;
+ struct DiskPartition64 *partP = NULL;
char name1[128];
char tmpPartName[20];
}
void
-HandleVolume(struct DiskPartition *dp, char *name, char *filename)
+HandleVolume(struct DiskPartition64 *dp, char *name, char *filename)
{
struct VolumeHeader header;
struct VolumeDiskHeader diskHeader;
static void
-DoMyVolDump(Volume * vp, struct DiskPartition *dp, char *dumpfile)
+DoMyVolDump(Volume * vp, struct DiskPartition64 *dp, char *dumpfile)
{
int code = 0;
int fromtime = 0;
#define VOLCONVERTRO 65536
#define VOLGETSIZE 65537
#define VOLDUMPV2 65538
+#define VOLDISKPART64 65539
/* Bits for flags for DumpV2 */
%#define VOLDUMPV2_OMITDIRS 1
};
+struct diskPartition64 {
+ char name[256]; /* Mounted partition name */
+ char devName[256];
+ int lock_fd;
+ afs_int64 totalUsable;
+ afs_int64 free;
+ afs_int64 minFree;
+
+};
+
struct restoreCookie {
char name[32];
afs_int32 type;
IN afs_int32 flags
) split = VOLDUMPV2;
+proc PartitionInfo64(
+ IN string name<>,
+ OUT struct diskPartition64 *partition
+) = VOLDISKPART64;
int
VPFullUnlock()
{
- register struct DiskPartition *tp;
+ register struct DiskPartition64 *tp;
for (tp = DiskPartitionList; tp; tp = tp->next) {
if (tp->lock_fd != -1) {
close(tp->lock_fd); /* releases flock held on this partition */
*partition)
{
afs_int32 code;
+ struct diskPartition64 *dp = (struct diskPartition64 *)
+ malloc(sizeof(struct diskPartition64));
+
+ code = VolPartitionInfo(acid, pname, dp);
+ if (!code) {
+ strncpy(partition->name, dp->name, 32);
+ strncpy(partition->devName, dp->devName, 32);
+ partition->lock_fd = dp->lock_fd;
+ partition->free=RoundInt64ToInt32(dp->free);
+ partition->minFree=RoundInt64ToInt32(dp->minFree);
+ }
+ free(dp);
+ osi_auditU(acid, VS_ParInfEvent, code, AUD_STR, pname, AUD_END);
+ return code;
+}
+
+afs_int32
+SAFSVolPartitionInfo64(struct rx_call *acid, char *pname, struct diskPartition64
+ *partition)
+{
+ afs_int32 code;
code = VolPartitionInfo(acid, pname, partition);
osi_auditU(acid, VS_ParInfEvent, code, AUD_STR, pname, AUD_END);
}
afs_int32
-VolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition
+VolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition64
*partition)
{
- register struct DiskPartition *dp;
+ register struct DiskPartition64 *dp;
/*
if (!afsconf_SuperUser(tdir, acid, caller)) return VOLSERBAD_ACCESS;
DeleteTrans(ttc, 1);
{
- struct DiskPartition *tpartp = originalvp->partition;
+ struct DiskPartition64 *tpartp = originalvp->partition;
FSYNC_VolOp(cloneId, tpartp->name, FSYNC_VOL_BREAKCBKS, 0, NULL);
}
return 0;
struct stat rbuf, pbuf;
char namehead[9];
struct partList partList;
- struct DiskPartition *dp;
+ struct DiskPartition64 *dp;
int i, j = 0, k;
strcpy(namehead, "/vicep"); /*7 including null terminator */
volumeId, volEntries *volumeInfo)
{
volintInfo *pntr;
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
char pname[9], volname[20];
afs_int32 error = 0;
DIR *dirp;
{ /*SAFSVolXListOneVolume */
volintXInfo *xInfoP; /*Ptr to the extended vol info */
- struct DiskPartition *partP; /*Ptr to partition */
+ struct DiskPartition64 *partP; /*Ptr to partition */
char pname[9], volname[20]; /*Partition, volume names */
afs_int32 error; /*Error code */
DIR *dirp; /*Partition directory ptr */
volEntries *volumeInfo)
{
volintInfo *pntr;
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
afs_int32 allocSize = 1000; /*to be changed to a larger figure */
char pname[9], volname[20];
afs_int32 error = 0;
{ /*SAFSVolXListVolumes */
volintXInfo *xInfoP; /*Ptr to the extended vol info */
- struct DiskPartition *partP; /*Ptr to partition */
+ struct DiskPartition64 *partP; /*Ptr to partition */
afs_int32 allocSize = 1000; /*To be changed to a larger figure */
char pname[9], volname[20]; /*Partition, volume names */
afs_int32 error = 0; /*Return code */
DIR *dirp;
register struct volser_trans *ttc;
char pname[16], volname[20];
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
afs_int32 ret = ENODEV;
afs_int32 volid;
extern void SubEnumerateEntry(struct nvldbentry *entry);
extern void EnumerateEntry(struct nvldbentry *entry);
extern int UV_NukeVolume(afs_int32 server, afs_int32 partid, afs_int32 volid);
-extern int UV_PartitionInfo(afs_int32 server, char *pname,
- struct diskPartition *partition);
+extern int UV_PartitionInfo64(afs_int32 server, char *pname,
+ struct diskPartition64 *partition);
extern int UV_CreateVolume(afs_int32 aserver, afs_int32 apart, char *aname,
afs_int32 * anewid);
extern int UV_CreateVolume2(afs_int32 aserver, afs_int32 apart, char *aname,
afs_int32 flags, code, err;
char fromPartName[10], toPartName[10];
- struct diskPartition partition; /* for space check */
+ struct diskPartition64 partition; /* for space check */
volintInfo *p;
volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
* check target partition for space to move volume
*/
- code = UV_PartitionInfo(toserver, toPartName, &partition);
+ code = UV_PartitionInfo64(toserver, toPartName, &partition);
if (code) {
fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
exit(1);
afs_int32 volid, fromserver, toserver, frompart, topart, code, err, flags;
char fromPartName[10], toPartName[10], *tovolume;
struct nvldbentry entry;
- struct diskPartition partition; /* for space check */
+ struct diskPartition64 partition; /* for space check */
volintInfo *p;
volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);
* check target partition for space to move volume
*/
- code = UV_PartitionInfo(toserver, toPartName, &partition);
+ code = UV_PartitionInfo64(toserver, toPartName, &partition);
if (code) {
fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
exit(1);
afs_int32 code, err, flags;
char fromPartName[10], toPartName[10], toVolName[32], *tovolume;
struct nvldbentry entry;
- struct diskPartition partition; /* for space check */
+ struct diskPartition64 partition; /* for space check */
volintInfo *p, *q;
p = (volintInfo *) 0;
* check target partition for space to move volume
*/
- code = UV_PartitionInfo(toserver, toPartName, &partition);
+ code = UV_PartitionInfo64(toserver, toPartName, &partition);
if (code) {
fprintf(STDERR, "vos: cannot access partition %s\n", toPartName);
exit(1);
afs_int32 apart;
afs_int32 aserver, code;
char pname[10];
- struct diskPartition partition;
+ struct diskPartition64 partition;
struct partList dummyPartList;
int i, cnt;
int printSummary=0, sumPartitions=0;
for (i = 0; i < cnt; i++) {
if (dummyPartList.partFlags[i] & PARTVALID) {
MapPartIdIntoName(dummyPartList.partId[i], pname);
- code = UV_PartitionInfo(aserver, pname, &partition);
+ code = UV_PartitionInfo64(aserver, pname, &partition);
if (code) {
fprintf(STDERR, "Could not get information on partition %s\n",
pname);
exit(1);
}
fprintf(STDOUT,
- "Free space on partition %s: %d K blocks out of total %d\n",
+ "Free space on partition %s: %lld K blocks out of total %lld\n",
pname, partition.free, partition.minFree);
sumPartitions++;
- FillInt64(tmp,0,partition.free);
- AddUInt64(sumFree,tmp,&sumFree);
- FillInt64(tmp,0,partition.minFree);
- AddUInt64(sumStorage,tmp,&sumStorage);
+ AddUInt64(sumFree,partition.free,&sumFree);
+ AddUInt64(sumStorage,partition.minFree,&sumStorage);
}
}
if (printSummary) {
/* like df. Return usage of <pname> on <server> in <partition> */
int
-UV_PartitionInfo(afs_int32 server, char *pname,
- struct diskPartition *partition)
+UV_PartitionInfo64(afs_int32 server, char *pname,
+ struct diskPartition64 *partition)
{
register struct rx_connection *aconn;
- afs_int32 code;
+ afs_int32 code = 0;
- code = 0;
aconn = (struct rx_connection *)0;
aconn = UV_Bind(server, AFSCONF_VOLUMEPORT);
- code = AFSVolPartitionInfo(aconn, pname, partition);
+ code = AFSVolPartitionInfo64(aconn, pname, partition);
+ if (code == RXGEN_OPCODE) {
+ struct diskPartition *dpp =
+ (struct diskPartition *)malloc(sizeof(struct diskPartition));
+ code = AFSVolPartitionInfo(aconn, pname, dpp);
+ if (!code) {
+ strncpy(partition->name, dpp->name, 32);
+ strncpy(partition->devName, dpp->devName, 32);
+ partition->lock_fd = dpp->lock_fd;
+ partition->free = dpp->free;
+ partition->minFree = dpp->minFree;
+ }
+ free(dpp);
+ }
if (code) {
fprintf(STDERR, "Could not get information on partition %s\n", pname);
PrintError("", code);