#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
#include <stdio.h>
#include <sys/types.h>
#include <afs/acl.h>
#include "afs/audit.h"
#include <afs/dir.h>
+#include <afs/afsutil.h>
+#include <afs/vol_prototypes.h>
#include "volser.h"
#include "volint.h"
#include "volser_prototypes.h"
+#include "physio.h"
+#include "dumpstuff.h"
extern int DoLogging;
-extern struct volser_trans *FindTrans(), *NewTrans(), *TransList();
extern struct afsconf_dir *tdir;
-/* Needed by Irix. Leave, or include a header */
-extern char *volutil_PartitionName();
-
extern void LogError(afs_int32 errcode);
/* Forward declarations */
#endif
afs_int32 localTid = 1;
-afs_int32 VolPartitionInfo(), VolNukeVolume(), VolCreateVolume(),
-VolDeleteVolume(), VolClone();
-afs_int32 VolReClone(), VolTransCreate(), VolGetNthVolume(), VolGetFlags(),
-VolForward(), VolDump();
-afs_int32 VolRestore(), VolEndTrans(), VolSetForwarding(), VolGetStatus(),
-VolSetInfo(), VolGetName();
-afs_int32 VolListPartitions(), VolListOneVolume(),
-VolXListOneVolume(), VolXListVolumes();
-afs_int32 VolListVolumes(), XVolListPartitions(), VolMonitor(),
-VolSetIdsTypes(), VolSetDate(), VolSetFlags();
+
+static afs_int32 VolPartitionInfo(struct rx_call *, char *pname,
+ struct diskPartition64 *);
+static afs_int32 VolNukeVolume(struct rx_call *, afs_int32, afs_uint32);
+static afs_int32 VolCreateVolume(struct rx_call *, afs_int32, char *,
+ afs_int32, afs_uint32, afs_uint32 *,
+ afs_int32 *);
+static afs_int32 VolDeleteVolume(struct rx_call *, afs_int32);
+static afs_int32 VolClone(struct rx_call *, afs_int32, afs_uint32,
+ afs_int32, char *, afs_uint32 *);
+static afs_int32 VolReClone(struct rx_call *, afs_int32, afs_int32);
+static afs_int32 VolTransCreate(struct rx_call *, afs_uint32, afs_int32,
+ afs_int32, afs_int32 *);
+static afs_int32 VolGetNthVolume(struct rx_call *, afs_int32, afs_uint32 *,
+ afs_int32 *);
+static afs_int32 VolGetFlags(struct rx_call *, afs_int32, afs_int32 *);
+static afs_int32 VolSetFlags(struct rx_call *, afs_int32, afs_int32 );
+static afs_int32 VolForward(struct rx_call *, afs_int32, afs_int32,
+ struct destServer *destination, afs_int32,
+ struct restoreCookie *cookie);
+static afs_int32 VolDump(struct rx_call *, afs_int32, afs_int32, afs_int32);
+static afs_int32 VolRestore(struct rx_call *, afs_int32, afs_int32,
+ struct restoreCookie *);
+static afs_int32 VolEndTrans(struct rx_call *, afs_int32, afs_int32 *);
+static afs_int32 VolSetForwarding(struct rx_call *, afs_int32, afs_int32);
+static afs_int32 VolGetStatus(struct rx_call *, afs_int32,
+ struct volser_status *);
+static afs_int32 VolSetInfo(struct rx_call *, afs_int32, struct volintInfo *);
+static afs_int32 VolGetName(struct rx_call *, afs_int32, char **);
+static afs_int32 VolListPartitions(struct rx_call *, struct pIDs *);
+static afs_int32 XVolListPartitions(struct rx_call *, struct partEntries *);
+static afs_int32 VolListOneVolume(struct rx_call *, afs_int32, afs_uint32,
+ volEntries *);
+static afs_int32 VolXListOneVolume(struct rx_call *, afs_int32, afs_uint32,
+ volXEntries *);
+static afs_int32 VolListVolumes(struct rx_call *, afs_int32, afs_int32,
+ volEntries *);
+static afs_int32 VolXListVolumes(struct rx_call *, afs_int32, afs_int32,
+ volXEntries *);
+static afs_int32 VolMonitor(struct rx_call *, transDebugEntries *);
+static afs_int32 VolSetIdsTypes(struct rx_call *, afs_int32, char [],
+ afs_int32, afs_uint32, afs_uint32,
+ afs_uint32);
+static afs_int32 VolSetDate(struct rx_call *, afs_int32, afs_int32);
/* this call unlocks all of the partition locks we've set */
int
-VPFullUnlock()
+VPFullUnlock(void)
{
register struct DiskPartition64 *tp;
for (tp = DiskPartitionList; tp; tp = tp->next) {
{
DirHandle dir;
struct acl_accessList *ACL;
- ViceFid did;
+ AFSFid did;
Inode inodeNumber, nearInode;
struct VnodeDiskObject *vnode;
struct VnodeClassInfo *vcp = &VnodeClassInfo[vLarge];
return code;
}
-afs_int32
+static afs_int32
VolNukeVolume(struct rx_call *acid, afs_int32 apartID, afs_uint32 avolID)
{
char partName[50];
afs_int32 error;
+ Error verror;
register afs_int32 code;
struct Volume *tvp;
char caller[MAXKTCNAMELEN];
tvp = XAttachVolume(&error, avolID, apartID, V_VOLUPD);
code = nuke(partName, avolID);
if (tvp)
- VDetachVolume(&error, tvp);
+ VDetachVolume(&verror, tvp);
return code;
}
return code;
}
-afs_int32
+static afs_int32
VolCreateVolume(struct rx_call *acid, afs_int32 apart, char *aname,
afs_int32 atype, afs_uint32 aparent, afs_uint32 *avolid,
afs_int32 *atrans)
{
- afs_int32 error;
+ Error error;
register Volume *vp;
- afs_int32 junk; /* discardable error code */
+ Error junk; /* discardable error code */
afs_uint32 volumeID;
afs_int32 doCreateRoot = 1;
register struct volser_trans *tt;
return code;
}
-afs_int32
+static afs_int32
VolDeleteVolume(struct rx_call *acid, afs_int32 atrans)
{
register struct volser_trans *tt;
- afs_int32 error;
+ Error error;
char caller[MAXKTCNAMELEN];
if (!afsconf_SuperUser(tdir, acid, caller))
/* make a clone of the volume associated with atrans, possibly giving it a new
* number (allocate a new number if *newNumber==0, otherwise use *newNumber
- * for the clone's id). The new clone is given the name newName. Finally, due to
- * efficiency considerations, if purgeId is non-zero, we purge that volume when doing
- * the clone operation. This may be useful when making new backup volumes, for instance
- * since the net result of a clone and a purge generally leaves many inode ref counts
- * the same, while doing them separately would result in far more iincs and idecs being
- * peformed (and they are slow operations).
+ * for the clone's id). The new clone is given the name newName. Finally,
+ * due to efficiency considerations, if purgeId is non-zero, we purge that
+ * volume when doing the clone operation. This may be useful when making
+ * new backup volumes, for instance since the net result of a clone and a
+ * purge generally leaves many inode ref counts the same, while doing them
+ * separately would result in far more iincs and idecs being peformed
+ * (and they are slow operations).
*/
/* for efficiency reasons, sometimes faster to piggyback a purge here */
afs_int32
return code;
}
-afs_int32
+static afs_int32
VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId,
afs_int32 newType, char *newName, afs_uint32 *newNumber)
{
ttc = NewTrans(newId, tt->partition);
if (!ttc) { /* someone is messing with the clone already */
TRELE(tt);
- return VBUSY;
+ return VOLSERVOLBUSY;
}
strcpy(tt->lastProcName, "Clone");
tt->rxCallPtr = acid;
return code;
}
-afs_int32
+static afs_int32
VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId)
{
register struct Volume *originalvp, *clonevp;
ttc = NewTrans(cloneId, tt->partition);
if (!ttc) { /* someone is messing with the clone already */
TRELE(tt);
- return VBUSY;
+ return VOLSERVOLBUSY;
}
strcpy(tt->lastProcName, "ReClone");
tt->rxCallPtr = acid;
return code;
}
-afs_int32
+static afs_int32
VolTransCreate(struct rx_call *acid, afs_uint32 volume, afs_int32 partition,
afs_int32 iflags, afs_int32 *ttid)
{
register struct volser_trans *tt;
register Volume *tv;
- afs_int32 error, code;
+ afs_int32 error;
+ Error code;
afs_int32 mode;
char caller[MAXKTCNAMELEN];
return code;
}
-afs_int32
-VolGetNthVolume(struct rx_call *acid, afs_int32 aindex, afs_int32 *avolume,
+static afs_int32
+VolGetNthVolume(struct rx_call *acid, afs_int32 aindex, afs_uint32 *avolume,
afs_int32 *apart)
{
Log("1 Volser: GetNthVolume: Not yet implemented\n");
return code;
}
-afs_int32
+static afs_int32
VolGetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 *aflags)
{
register struct volser_trans *tt;
return code;
}
-afs_int32
+static afs_int32
VolSetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 aflags)
{
register struct volser_trans *tt;
register struct Volume *vp;
- afs_int32 error;
+ Error error;
char caller[MAXKTCNAMELEN];
if (!afsconf_SuperUser(tdir, acid, caller))
return code;
}
-afs_int32
+static afs_int32
VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
struct destServer *destination, afs_int32 destTrans,
struct restoreCookie *cookie)
}
afs_int32
-SAFSVolDumpV2(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, afs_int32 flags)
+SAFSVolDumpV2(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
+ afs_int32 flags)
{
afs_int32 code;
return code;
}
-afs_int32
-VolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, afs_int32 flags)
+static afs_int32
+VolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
+ afs_int32 flags)
{
int code = 0;
register struct volser_trans *tt;
* Ha! No more helper process!
*/
afs_int32
-SAFSVolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags,
+SAFSVolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags,
struct restoreCookie *cookie)
{
afs_int32 code;
return code;
}
-afs_int32
-VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags,
- struct restoreCookie *cookie)
+static afs_int32
+VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags,
+ struct restoreCookie *cookie)
{
register struct volser_trans *tt;
register afs_int32 code, tcode;
return code;
}
-afs_int32
+static afs_int32
VolEndTrans(struct rx_call *acid, afs_int32 destTrans, afs_int32 *rcode)
{
register struct volser_trans *tt;
return code;
}
-afs_int32
+static afs_int32
VolSetForwarding(struct rx_call *acid, afs_int32 atid, afs_int32 anewsite)
{
register struct volser_trans *tt;
}
afs_int32
-SAFSVolGetStatus(struct rx_call *acid, afs_int32 atrans,
+SAFSVolGetStatus(struct rx_call *acid, afs_int32 atrans,
register struct volser_status *astatus)
{
afs_int32 code;
return code;
}
-afs_int32
-VolGetStatus(struct rx_call *acid, afs_int32 atrans,
- register struct volser_status *astatus)
+static afs_int32
+VolGetStatus(struct rx_call *acid, afs_int32 atrans,
+ register struct volser_status *astatus)
{
register struct Volume *tv;
register struct VolumeDiskData *td;
}
afs_int32
-SAFSVolSetInfo(struct rx_call *acid, afs_int32 atrans,
+SAFSVolSetInfo(struct rx_call *acid, afs_int32 atrans,
register struct volintInfo *astatus)
{
afs_int32 code;
return code;
}
-afs_int32
-VolSetInfo(struct rx_call *acid, afs_int32 atrans,
+static afs_int32
+VolSetInfo(struct rx_call *acid, afs_int32 atrans,
register struct volintInfo *astatus)
{
register struct Volume *tv;
register struct VolumeDiskData *td;
struct volser_trans *tt;
char caller[MAXKTCNAMELEN];
- afs_int32 error;
+ Error error;
if (!afsconf_SuperUser(tdir, acid, caller))
return VOLSERBAD_ACCESS; /*not a super user */
return code;
}
-afs_int32
+static afs_int32
VolGetName(struct rx_call *acid, afs_int32 atrans, char **aname)
{
register struct Volume *tv;
/*this is a handshake to indicate that the next call will be SAFSVolRestore
* - a noop now !*/
afs_int32
-SAFSVolSignalRestore(struct rx_call *acid, char volname[], int volType,
+SAFSVolSignalRestore(struct rx_call *acid, char volname[], int volType,
afs_uint32 parentId, afs_uint32 cloneId)
{
return 0;
return code;
}
-afs_int32
+static afs_int32
VolListPartitions(struct rx_call *acid, struct pIDs *partIds)
{
char namehead[9];
- char i;
+ int i;
strcpy(namehead, "/vicep"); /*7 including null terminator */
return code;
}
-afs_int32
+static afs_int32
XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries)
{
char namehead[9];
return 0;
}
+#ifdef AFS_DEMAND_ATTACH_FS
+
/**
* get struct Volume out of the fileserver.
*
return code;
}
+#endif
+
/**
* mode of volume list operation.
*/
vol_info_list_mode_t mode)
{
int code = -1;
- afs_int32 error;
+ Error error;
struct volser_trans *ttc = NULL;
struct Volume *fill_tv, *tv = NULL;
#ifdef AFS_DEMAND_ATTACH_FS
ttc = NewTrans(volumeId, partId);
if (!ttc) {
code = -3;
- VOLINT_INFO_STORE(handle, status, VBUSY);
+ VOLINT_INFO_STORE(handle, status, VOLSERVOLBUSY);
VOLINT_INFO_STORE(handle, volid, volumeId);
goto drop;
}
return code;
}
-afs_int32
+static afs_int32
VolListOneVolume(struct rx_call *acid, afs_int32 partid,
afs_uint32 volumeId, volEntries *volumeInfo)
{
volintInfo *pntr;
struct DiskPartition64 *partP;
char pname[9], volname[20];
- afs_int32 error = 0;
DIR *dirp;
afs_uint32 volid;
int found = 0;
return code;
}
-afs_int32
+static afs_int32
VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID,
afs_uint32 a_volID, volXEntries *a_volumeXInfoP)
{ /*SAFSVolXListOneVolume */
return code;
}
-afs_int32
+static afs_int32
VolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags,
volEntries *volumeInfo)
{
struct DiskPartition64 *partP;
afs_int32 allocSize = 1000; /*to be changed to a larger figure */
char pname[9], volname[20];
- afs_int32 error = 0;
DIR *dirp;
afs_uint32 volid;
int code;
/*just volids are needed */
}
- drop:
pntr++;
volumeInfo->volEntries_len += 1;
if ((allocSize - volumeInfo->volEntries_len) < 5) {
return code;
}
-afs_int32
+static afs_int32
VolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID,
afs_int32 a_flags, volXEntries *a_volumeXInfoP)
{ /*SAFSVolXListVolumes */
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; /*Partition directory ptr */
afs_uint32 volid; /*Current volume ID */
int code;
xInfoP->volid = volid;
}
- drop:
/*
* Bump the pointer in the data area we're building, along with
* the count of the number of entries it contains.
return code;
}
-afs_int32
+static afs_int32
VolMonitor(struct rx_call *acid, transDebugEntries *transInfo)
{
transDebugInfo *pntr;
}
afs_int32
-SAFSVolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 type, afs_uint32 pId, afs_uint32 cloneId, afs_uint32 backupId)
+SAFSVolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[],
+ afs_int32 type, afs_uint32 pId, afs_uint32 cloneId,
+ afs_uint32 backupId)
{
afs_int32 code;
return code;
}
-afs_int32
-VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 type, afs_uint32 pId, afs_uint32 cloneId, afs_uint32 backupId)
+static afs_int32
+VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[],
+ afs_int32 type, afs_uint32 pId, afs_uint32 cloneId,
+ afs_uint32 backupId)
{
struct Volume *tv;
- afs_int32 error = 0;
+ Error error = 0;
register struct volser_trans *tt;
char caller[MAXKTCNAMELEN];
return code;
}
-afs_int32
+static afs_int32
VolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate)
{
struct Volume *tv;
- afs_int32 error = 0;
+ Error error = 0;
register struct volser_trans *tt;
char caller[MAXKTCNAMELEN];
#endif
ttc = NewTrans(volumeId, partId);
if (!ttc) {
- return VBUSY;
+ return VOLSERVOLBUSY;
}
#ifdef AFS_NAMEI_ENV
ret = namei_ConvertROtoRWvolume(pname, volumeId);
}
afs_int32
-SAFSVolSplitVolume(struct rx_call *acall, afs_uint32 vid, afs_uint32 new,
+SAFSVolSplitVolume(struct rx_call *acall, afs_uint32 vid, afs_uint32 new,
afs_uint32 where, afs_int32 verbose)
{
-#ifdef AFS_NAMEI_ENV
- afs_int32 code, code2;
+#if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
+ Error code, code2;
Volume *vol=0, *newvol=0;
struct volser_trans *tt = 0, *tt2 = 0;
char caller[MAXKTCNAMELEN];