#error We require size of long and pointers to be equal
#endif */
+#define MAX_AFS_INT32 0x7FFFFFFFL
+#define MAX_AFS_UINT32 0xFFFFFFFFL
+#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) = ((afs_int64)(h) << 32) | (l);
-#define SplitInt64(t,h,l) (h) = ((afs_int64)t) >> 32; (l) = (t) & 0xFFFFFFFF;
+#define SplitInt64(t,h,l) (h) = ((afs_int64)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 & MAX_AFS_INT32);
#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 timeval tv; /*Time structure */
int conn_idx; /*Connection index */
struct fsprobe_ConnectionInfo *curr_conn; /*Current connection */
- struct ProbeViceStatistics *curr_stats; /*Current stats region */
+ struct ProbeViceStatistics *curr_stats; /*Current stats region */
int *curr_probeOK; /*Current probeOK field */
-
+ ViceStatistics64 stats64;
+ stats64.ViceStatistics64_val = (afs_uint64 *)malloc(STATS64_VERSION *
+ sizeof(afs_uint64));
while (1) { /*Service loop */
/*
* Iterate through the server connections, gathering data.
fprintf(stderr,
"[%s] Connection valid, calling RXAFS_GetStatistics\n",
rn);
- *curr_probeOK =
- RXAFS_GetStatistics(curr_conn->rxconn, curr_stats);
-
+ *curr_probeOK = RXGEN_OPCODE;
+ 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,
if (curr_conn->partList.partFlags[i] & PARTVALID) {
MapPartIdIntoName(curr_conn->partList.partId[i],
pname);
- code =
- AFSVolPartitionInfo(curr_conn->rxVolconn, pname,
- &partition);
+ code =
+ 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);
return NULL;
} /*fsprobe_LWP */
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);
strncpy(name->SeqBody, V_name(volptr), (int)name->MaxSeqLen);
name->SeqLen = strlen(V_name(volptr)) + 1;
if (name->SeqLen > name->MaxSeqLen)
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 = RoundInt64ToInt31(part->totalUsable);
+ stats->Disks[i].BlocksAvailable = RoundInt64ToInt31(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;
+ if (statsVersion > STATS64_VERSION)
+ 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 */
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_SGI_XFS_IOPS_ENV
/* Verify that the on disk XFS inodes on the partition are large enough to
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;
for (dp = DiskPartitionList; dp; dp = dp->next) {
if (strcmp(dp->name, name) == 0)
break;
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;
+ afs_int64 totalblks, free, used, availblks;
+ int fd, bsize, code;
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);
* 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 */
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 */
};
#define PART_DONTUPDATE 1
#define PART_DUPLICATE 2 /* NT - used if we find more than one partition
struct Volume; /* Potentially forward definition */
-extern struct DiskPartition *DiskPartitionList;
-extern struct DiskPartition *VGetPartition();
+extern struct DiskPartition64 *DiskPartitionList;
+extern struct DiskPartition64 *VGetPartition();
extern int VAttachPartitions(void);
extern void VLockPartition(char *name);
extern void VLockPartition_r(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
/* 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 */
void SalvageDir(char *name, VolumeId rwVid, struct VnodeInfo *dirVnodeInfo,
IHandle_t * alinkH, int i, struct DirSummary *rootdir,
int *rootdirfound);
-void SalvageFileSysParallel(struct DiskPartition *partP);
-void SalvageFileSys(struct DiskPartition *partP, VolumeId singleVolumeNumber);
-void SalvageFileSys1(struct DiskPartition *partP,
+void SalvageFileSysParallel(struct DiskPartition64 *partP);
+void SalvageFileSys(struct DiskPartition64 *partP, VolumeId singleVolumeNumber);
+void SalvageFileSys1(struct DiskPartition64 *partP,
VolumeId singleVolumeNumber);
int SalvageHeader(register struct stuff *sp, struct InodeSummary *isp,
int check, int *deleteMe);
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) {
#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];
/* Forward declarations */
static Volume *attach2(Error * ec, char *path,
register struct VolumeHeader *header,
- struct DiskPartition *partp, int isbusy);
+ struct DiskPartition64 *partp, int isbusy);
static void FreeVolume(Volume * vp);
static void VScanUpdateList(void);
static void InitLRU(int howMany);
#include "rx/rx_queue.h"
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;
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;
struct afs_stat status;
struct VolumeDiskHeader diskHeader;
struct VolumeHeader iheader;
- struct DiskPartition *partp;
+ struct DiskPartition64 *partp;
char path[64];
int isbusy = 0;
*ec = 0;
private Volume *
attach2(Error * ec, char *path, register struct VolumeHeader * header,
- struct DiskPartition * partp, int isbusy)
+ struct DiskPartition64 * partp, int isbusy)
{
register Volume *vp;
VDetachVolume_r(Error * ec, Volume * vp)
{
VolumeId volume;
- struct DiskPartition *tpartp;
+ struct DiskPartition64 *tpartp;
int notifyServer, useDone;
*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] = '/';
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, int nLargeVnodes,
int nSmallVnodes, int connect, int volcache);
extern void DiskToVolumeHeader(VolumeHeader_t * h, VolumeDiskHeader_t * dh);
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 */
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];
+ 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;
+ if (dp->free > MAX_AFS_INT32)
+ partition->free = MAX_AFS_INT32;
+ else
+ partition->free = dp->free;
+ if (dp->minFree > MAX_AFS_INT32)
+ partition->minFree = MAX_AFS_INT32;
+ else
+ partition->minFree = 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_askfs(cloneId, tpartp->name, FSYNC_RESTOREVOLUME, 0);
}
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 */
{
volintInfo *pntr;
register struct Volume *tv;
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
struct volser_trans *ttc;
char pname[9], volname[20];
afs_int32 error = 0;
volintXInfo *xInfoP; /*Ptr to the extended vol info */
register struct Volume *tv; /*Volume ptr */
struct volser_trans *ttc; /*Volume transaction ptr */
- 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 */
afs_int32 code; /*Return code */
{
volintInfo *pntr;
register struct Volume *tv;
- struct DiskPartition *partP;
+ struct DiskPartition64 *partP;
struct volser_trans *ttc;
afs_int32 allocSize = 1000; /*to be changed to a larger figure */
char pname[9], volname[20];
volintXInfo *xInfoP; /*Ptr to the extended vol info */
register struct Volume *tv; /*Volume ptr */
- struct DiskPartition *partP; /*Ptr to partition */
+ struct DiskPartition64 *partP; /*Ptr to partition */
struct volser_trans *ttc; /*Volume transaction ptr */
afs_int32 allocSize = 1000; /*To be changed to a larger figure */
char pname[9], volname[20]; /*Partition, volume names */
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);