AFS
view release on metacpan or search on metacpan
}
safe_hv_store(stats, "command", 7, newRV_inc((SV *) (av)), 0);
tp = buffer;
code = BOZO_GetInstanceParm(aconn, aname, 999, &tp);
if (!code) {
/* Any type of failure is treated as not having a notifier program */
/* printf(" Notifier is '%s'\n", buffer); */
safe_hv_store(stats, "notifier", 8, newSVpv(buffer, strlen(buffer)), 0);
}
/* printf("\n"); */
}
return 0;
}
static afs_int32 GetServerGoal(aconn, aname)
char *aname;
struct rx_connection *aconn;
{
char buffer[500];
char *tp;
register afs_int32 code;
struct bozo_status istatus;
tp = buffer;
code = BOZO_GetInstanceInfo(aconn, aname, &tp, &istatus);
if (code) {
printf("AFS::BOS: failed to get instance info for '%s' (%s)\n", aname, em(code));
/* if we can't get the answer, assume its running */
return BSTAT_NORMAL;
}
if (istatus.goal == 0)
return BSTAT_SHUTDOWN;
else
return BSTAT_NORMAL;
}
#define PARMBUFFERSSIZE 32
static struct SalvageParms {
afs_int32 Optdebug;
afs_int32 Optnowrite;
afs_int32 Optforce;
afs_int32 Optoktozap;
afs_int32 Optrootfiles;
afs_int32 Optsalvagedirs;
afs_int32 Optblockreads;
afs_int32 OptListResidencies;
afs_int32 OptSalvageRemote;
afs_int32 OptSalvageArchival;
afs_int32 OptIgnoreCheck;
afs_int32 OptForceOnLine;
afs_int32 OptUseRootDirACL;
afs_int32 OptTraceBadLinkCounts;
afs_int32 OptDontAskFS;
afs_int32 OptLogLevel;
afs_int32 OptRxDebug;
afs_uint32 OptResidencies;
} mrafsParm;
static int DoSalvage(aconn, aparm1, aparm2, aoutName, showlog, parallel, atmpDir, orphans)
struct rx_connection *aconn;
char *aoutName;
char *aparm1;
char *aparm2;
afs_int32 showlog;
char *parallel;
char *atmpDir;
char *orphans;
{
register afs_int32 code;
char *parms[6];
char buffer;
char tbuffer[BOZO_BSSIZE];
struct bozo_status istatus;
struct rx_call *tcall;
char *tp;
FILE *outFile;
int closeIt = 0;
char partName[20]; /* canonical name for partition */
char pbuffer[PARMBUFFERSSIZE];
afs_int32 partNumber;
char *notifier = NONOTIFIER;
/* if a partition was specified, canonicalize the name, since
the salvager has a stupid partition ID parser */
if (aparm1) {
partNumber = volutil_GetPartitionID(aparm1);
if (partNumber < 0) {
char buffer[256];
sprintf(buffer, "AFS::BOS: could not parse partition ID '%s'\n", aparm1);
BSETCODE(EINVAL, buffer);
return EINVAL;
}
tp = (char *) volutil_PartitionName(partNumber);
if (!tp) {
char buffer[256];
sprintf(buffer, "AFS::BOS: internal error parsing partition ID '%s'\n",
aparm1);
BSETCODE(EINVAL, buffer);
return EINVAL;
}
strcpy(partName, tp);
}
else
partName[0] = 0;
/* open the file name */
if (aoutName) {
outFile = fopen(aoutName, "w");
if (!outFile) {
char buffer[256];
sprintf(buffer, "AFS::BOS: can't open specified SalvageLog file '%s'\n",
aoutName);
BSETCODE(ENOENT, buffer);
return ENOENT;
}
closeIt = 1; /* close this file later */
}
else {
outFile = stdout;
closeIt = 0; /* don't close this file later */
}
for (code = 2; code < 6; code++)
parms[code] = "";
if (mrafsParm.Optblockreads)
strcat(tbuffer, " -blockreads");
if (mrafsParm.OptListResidencies)
strcat(tbuffer, " -ListResidencies");
if (mrafsParm.OptSalvageRemote)
strcat(tbuffer, " -SalvageRemote");
if (mrafsParm.OptSalvageArchival)
strcat(tbuffer, " -SalvageArchival");
if (mrafsParm.OptIgnoreCheck)
strcat(tbuffer, " -IgnoreCheck");
if (mrafsParm.OptForceOnLine)
strcat(tbuffer, " -ForceOnLine");
if (mrafsParm.OptUseRootDirACL)
strcat(tbuffer, " -UseRootDirACL");
if (mrafsParm.OptTraceBadLinkCounts)
strcat(tbuffer, " -TraceBadLinkCounts");
if (mrafsParm.OptDontAskFS)
strcat(tbuffer, " -DontAskFS");
if (mrafsParm.OptLogLevel) {
sprintf(pbuffer, " -LogLevel %d", mrafsParm.OptLogLevel);
strcat(tbuffer, pbuffer);
}
if (mrafsParm.OptRxDebug)
strcat(tbuffer, " -rxdebug");
if (mrafsParm.OptResidencies) {
sprintf(pbuffer, " -Residencies %u", mrafsParm.OptResidencies);
strcat(tbuffer, pbuffer);
}
parms[0] = tbuffer;
parms[1] = "now"; /* when to do it */
code = BOZO_CreateBnode(aconn, "cron", "salvage-tmp", parms[0], parms[1],
parms[2], parms[3], parms[4], notifier);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: failed to start 'salvager' (%s)\n", em(code));
BSETCODE(code, buffer);
goto done;
}
/* now wait for bnode to disappear */
while (1) {
#ifdef AFS_PTHREAD_ENV
sleep(5);
#else
IOMGR_Sleep(5);
#endif /* AFS_PTHREAD_ENV*/
tp = tbuffer;
code = BOZO_GetInstanceInfo(aconn, "salvage-tmp", &tp, &istatus);
if (code)
break;
/* fprintf(stderr, "AFS::BOS: waiting for salvage to complete.\n"); */
}
if (code != BZNOENT) {
char buffer[256];
sprintf(buffer, "AFS::BOS: salvage failed (%s)\n", em(code));
BSETCODE(code, buffer);
goto done;
}
code = 0;
/* now print the log file to the output file */
/* fprintf(stderr, "AFS::BOS: salvage completed\n"); */
if (aoutName || showlog) {
fprintf(outFile, "SalvageLog:\n");
tcall = rx_NewCall(aconn);
/* MUST pass canonical (wire-format) salvager log path to bosserver */
code = StartBOZO_GetLog(tcall, AFSDIR_CANONICAL_SERVER_SLVGLOG_FILEPATH);
if (code) {
rx_EndCall(tcall, code);
goto done;
}
/* copy data */
while (1) {
code = rx_Read(tcall, &buffer, 1);
if (code != 1)
break;
putc(buffer, outFile);
if (buffer == 0)
break; /* the end delimeter */
}
code = rx_EndCall(tcall, 0);
/* fall through into cleanup code */
}
done:
if (closeIt && outFile)
fclose(outFile);
return code;
}
/* end of helper functions for BOS class */
/* helper functions for FS class: */
static int32 isafs(path, follow)
char *path;
int32 follow;
{
struct ViceIoctl vi;
register int32 code;
char space[MAXSIZE];
vi.in_size = 0;
vi.out_size = MAXSIZE;
vi.out = space;
code = pioctl(path, VIOC_FILE_CELL_NAME, &vi, follow);
if (code) {
if ((errno == EINVAL) || (errno == ENOENT))
return 0;
if (errno == ENOSYS)
return 0;
}
return 1;
}
static char *format_rights(rights)
int32 rights;
{
static char buff[32];
char *p;
p = buff;
if (rights & PRSFS_READ) {
*p++ = 'r';
int32
fs_checkconn()
CODE:
{
struct ViceIoctl vi;
int32 code;
int32 status;
vi.in_size = 0;
vi.out_size = sizeof(status);
vi.out = (caddr_t) & status;
code = pioctl(NULL, VIOCCKCONN, &vi, 0);
SETCODE(code);
RETVAL = (status == 0);
}
OUTPUT:
RETVAL
int32
fs_getcacheparms()
PPCODE:
{
struct ViceIoctl vi;
int32 code;
int32 stats[16];
vi.in_size = 0;
vi.in = 0;
vi.out_size = sizeof(stats);
vi.out = (char *) stats;
code = pioctl(NULL, VIOCGETCACHEPARMS, &vi, 0);
SETCODE(code);
if (code == 0) {
EXTEND(sp, 2);
PUSHs(sv_2mortal(newSViv(stats[0])));
PUSHs(sv_2mortal(newSViv(stats[1])));
}
}
int32
fs_setcachesize(size)
int32 size
CODE:
{
struct ViceIoctl vi;
int32 code;
vi.in_size = sizeof(size);;
vi.in = (char *) &size;
vi.out_size = 0;
vi.out = 0;
code = pioctl(NULL, VIOCSETCACHESIZE, &vi, 0);
SETCODE(code);
RETVAL = (code == 0);
}
OUTPUT:
RETVAL
int32
fs_unlog()
CODE:
{
struct ViceIoctl vi;
int32 code;
vi.in_size = 0;
vi.out_size = 0;
code = pioctl(NULL, VIOCUNLOG, &vi, 0);
SETCODE(code);
RETVAL = (code == 0);
}
OUTPUT:
RETVAL
int32
fs_getfid(path,follow=1)
char * path
int32 follow
PPCODE:
{
struct ViceIoctl vi;
int32 code;
struct VenusFid vf;
vi.in_size = 0;
vi.out_size = sizeof(vf);
vi.out = (char *) &vf;
code = pioctl(path, VIOCGETFID, &vi, follow);
SETCODE(code);
if (code == 0) {
EXTEND(sp, 4);
PUSHs(sv_2mortal(newSViv(vf.Cell)));
PUSHs(sv_2mortal(newSViv(vf.Fid.Volume)));
PUSHs(sv_2mortal(newSViv(vf.Fid.Vnode)));
PUSHs(sv_2mortal(newSViv(vf.Fid.Unique)));
}
}
int32
fs_isafs(path,follow=1)
char * path
int32 follow
CODE:
{
int32 code;
RETVAL = isafs(path, follow);
if (!RETVAL)
code = errno;
else
code = 0;
SETCODE(code);
}
OUTPUT:
RETVAL
int32
fs_cm_access(path,perm="read",follow=1)
char * path
char * perm
int32 follow
if (!SvROK(object)) {
/* printf("DEBUG-bos-delete-2 \n"); */
name = (char *) SvPV_nolen(object);
code = BOZO_DeleteBnode(self, name);
if (code) {
char buffer[256];
/* printf("DEBUG-bos-delete-3 %d \n", code); */
if (code == BZBUSY)
sprintf(buffer, "AFS::BOS: can't delete running instance '%s'\n", name);
else
sprintf(buffer, "AFS::BOS: failed to delete instance '%s' (%s)\n", name,
em(code));
BSETCODE(code, buffer);
/* printf("DEBUG-bos-delete-4 %s \n", buffer); */
goto done;
}
}
else if (SvTYPE(SvRV(object)) == SVt_PVAV) {
/* printf("DEBUG-bos-delete-5 \n"); */
av = (AV *) SvRV(object);
len = av_len(av);
if (len != -1) {
/* printf("DEBUG-bos-delete-6 \n"); */
for (i = 0; i <= len; i++) {
sv = *av_fetch(av, i, 0);
if (sv) {
name = (char *) safemalloc(BOZO_BSSIZE);
name = SvPV(sv, namelen);
/* printf("DEBUG-bos-delete-7 %s\n", name); */
code = BOZO_DeleteBnode(self, name);
/* printf("DEBUG-bos-delete-8 %d \n", code); */
if (code) {
char buffer[256];
if (code == BZBUSY)
sprintf(buffer, "AFS::BOS: can't delete running instance '%s'\n",
name);
else
sprintf(buffer, "AFS::BOS: failed to delete instance '%s' (%s)\n",
name, em(code));
BSETCODE(code, buffer);
goto done;
}
}
} /* for loop */
}
}
SETCODE(0);
/* printf("DEBUG-bos-delete-9 \n"); */
done:
RETVAL = (code == 0);
/* printf("DEBUG-bos-delete-10 \n"); */
/* if (name) */
/* Safefree(name); */
/* printf("DEBUG-bos-delete-11 \n"); */
}
OUTPUT:
RETVAL
void
bos_getlog(self, file)
AFS::BOS self
char* file
PREINIT:
register struct rx_call *tcall;
int32 code = 0;
char buf, c[255];
int error, num = 0, i = 0;
PPCODE:
{
tcall = rx_NewCall(self);
code = StartBOZO_GetLog(tcall, file);
if (code) {
char buffer[256];
rx_EndCall(tcall, code);
sprintf(buffer, "AFS::BOS error %d (while reading log)\n", code);
BSETCODE(code, buffer);
XSRETURN_UNDEF;
}
/* copy data */
error = 0;
while (1) {
code = rx_Read(tcall, &buf, 1);
if (code != 1) {
error = EIO;
break;
}
if (buf == 0)
break; /* the end delimeter */
/* putchar(buf); */
c[i++] = buf;
if (buf == '\n') {
XPUSHs(sv_2mortal(newSVpv(c, i)));
i = 0;
num++;
}
}
code = rx_EndCall(tcall, error);
#if (tcall)
# Safefree(tcall);
/* fall through into cleanup code */
XSRETURN(num);
}
int32
bos__start(self, object=NULL)
AFS::BOS self
SV * object
PREINIT:
int32 code = 0;
CODE:
{
if (object && (! (SvTYPE(SvRV(object)) == SVt_PVAV))) {
code = -1;
BSETCODE(code, "AFS::BOS: SERVER not an array reference\n");
goto done;
}
if (object && (SvTYPE(SvRV(object)) == SVt_PVAV)) {
AV *av;
SV *sv;
char *instance;
STRLEN namelen;
int i, len;
av = (AV *) SvRV(object);
len = av_len(av);
if (len != -1) {
for (i = 0; i <= len; i++) {
sv = *av_fetch(av, i, 0);
if (sv) {
/* instance = (char *) safemalloc(BOZO_BSSIZE); */
Newx(instance, BOZO_BSSIZE, char);
instance = SvPV(sv, namelen);
code = 0;
}
if (everWorked) {
XSRETURN(2);
}
else {
XSRETURN_EMPTY;
hv_undef(list);
}
}
int32
bos_getrestricted(self)
AFS::BOS self
CODE:
{
#ifdef BOS_RESTRICTED_MODE
int32 val, code;
RETVAL = 0;
code = BOZO_GetRestrictedMode(self, &val);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: failed to get restricted mode (%s)\n", em(code));
BSETCODE(code, buffer);
}
RETVAL = val;
#else
RETVAL = 0;
not_here("AFS::BOS::getrestricted");
#endif
}
OUTPUT:
RETVAL
int32
bos_setrestricted(self, mode)
AFS::BOS self
char *mode
CODE:
{
#ifdef BOS_RESTRICTED_MODE
int32 val, code;
util_GetInt32(mode, &val);
code = BOZO_SetRestrictedMode(self, val);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: failed to set restricted mode (%s)\n", em(code));
BSETCODE(code, buffer);
}
RETVAL = (code == 0);
#else
RETVAL = 0;
not_here("AFS::BOS::setrestricted");
#endif
}
OUTPUT:
RETVAL
int32
bos_salvage(self, partition=NULL, volume=NULL, all=0, outName=NULL, showlog=0, parallel=NULL, tmpDir=NULL, orphans=NULL, localauth=0, tmpname=NULL, debug=0, nowrite=0, force=0, oktozap=0, rootfiles=0, salvagedirs=0, blockreads=0, ListResidencies=0, S...
AFS::BOS self
char *partition
char *volume
int32 all
char *outName
int32 showlog
char *parallel
char *tmpDir
char *orphans
int32 localauth
char *tmpname
int32 debug
int32 nowrite
int32 force
int32 oktozap
int32 rootfiles
int32 salvagedirs
int32 blockreads
int32 ListResidencies
int32 SalvageRemote
int32 SalvageArchival
int32 IgnoreCheck
int32 ForceOnLine
int32 UseRootDirACL
int32 TraceBadLinkCounts
int32 DontAskFS
int32 LogLevel
int32 rxdebug
int32 Residencies
PREINIT:
afs_int32 code = 0, rc;
char tname[BOZO_BSSIZE];
afs_int32 newID;
extern struct ubik_client *cstruct;
afs_int32 curGoal, mrafs = 0;
char *tp;
CODE:
{
not_here("AFS::BOS::salvage");
if (partition && strlen(partition) == 0)
partition = NULL;
if (volume && strlen(volume) == 0)
volume = NULL;
if (outName && strlen(outName) == 0)
outName = NULL;
if (parallel && strlen(parallel) == 0)
parallel = NULL;
if (tmpDir && strlen(tmpDir) == 0)
tmpDir = NULL;
if (orphans && strlen(orphans) == 0)
orphans = NULL;
Zero(&mrafsParm, 1, mrafsParm);
/* Find out whether fileserver is running MR-AFS (has a scanner instance) */
/* XXX this should really be done some other way, potentially by RPC */
tp = (char *) &tname;
if ((code = BOZO_GetInstanceParm(self, "fs", 3, &tp) == 0))
mrafs = 1;
/* we can do a volume, a partition or the whole thing, but not mixtures
* thereof */
if (!partition && volume) {
char buffer[256];
sprintf(buffer, "AFS::BOS: must specify partition to salvage individual volume.\n");
BSETCODE(-1, buffer);
goto done;
}
if (showlog && outName) {
char buffer[256];
sprintf(buffer, "AFS::BOS: can not specify both -file and -showlog.\n");
BSETCODE(-1, buffer);
goto done;
}
if (all && (partition || volume)) {
char buffer[256];
sprintf(buffer, "AFS::BOS: can not specify ALL with other flags.\n");
BSETCODE(-1, buffer);
goto done;
}
if (orphans && mrafs) {
char buffer[256];
sprintf(buffer, "Can't specify -orphans for MR-AFS fileserver\n");
BSETCODE(EINVAL, buffer);
goto done;
}
if (mrafs) {
if (debug)
mrafsParm.Optdebug = 1;
if (nowrite)
mrafsParm.Optnowrite = 1;
if (force)
mrafsParm.Optforce = 1;
if (oktozap)
mrafsParm.Optoktozap = 1;
if (rootfiles)
mrafsParm.Optrootfiles = 1;
if (salvagedirs)
mrafsParm.Optsalvagedirs = 1;
if (blockreads)
mrafsParm.Optblockreads = 1;
if (ListResidencies)
mrafsParm.OptListResidencies = 1;
if (SalvageRemote)
mrafsParm.OptSalvageRemote = 1;
if (SalvageArchival)
mrafsParm.OptSalvageArchival = 1;
if (IgnoreCheck)
mrafsParm.OptIgnoreCheck = 1;
if (ForceOnLine)
mrafsParm.OptForceOnLine = 1;
if (UseRootDirACL)
mrafsParm.OptUseRootDirACL = 1;
if (TraceBadLinkCounts)
mrafsParm.OptTraceBadLinkCounts = 1;
if (DontAskFS)
mrafsParm.OptDontAskFS = 1;
if (LogLevel)
mrafsParm.OptLogLevel = LogLevel;
if (rxdebug)
mrafsParm.OptRxDebug = 1;
if (Residencies) {
if (SalvageRemote || SalvageArchival) {
char buffer[256];
sprintf(buffer,
"Can't specify -Residencies with -SalvageRemote or -SalvageArchival\n");
BSETCODE(EINVAL, buffer);
goto done;
}
/* muss naeher ueberprueft werden !!! */
/* #if defined(OpenAFS_1_2) */
/* code = GetUInt32(Residencies, &mrafsParm.OptResidencies); */
/* #else */
/* #if defined(OpenAFS_1_3) || defined(OpenAFS_1_4) || defined(OpenAFS_1_5) */
/* code = util_GetUInt32(Residencies, &mrafsParm.OptResidencies); */
/* #endif */
/* #endif */
/* if (code) { */
/* char buffer[256]; */
/* sprintf(buffer, "AFS::BOS: '%d' is not a valid residency mask.\n", TraceBadLinkCounts); /\* this doesn't really make sense to me AW *\/ */
/* BSETCODE(code, buffer); */
/* goto done; */
/* } */
/* muss naeher ueberprueft werden !!! */
mrafsParm.OptResidencies = Residencies;
}
}
else {
if (debug || nowrite || force || oktozap || rootfiles || salvagedirs || blockreads ||
ListResidencies || SalvageRemote || SalvageArchival || IgnoreCheck ||
ForceOnLine || UseRootDirACL || TraceBadLinkCounts || DontAskFS || LogLevel ||
rxdebug || Residencies) {
char buffer[256];
sprintf(buffer, "Parameter only possible for MR-AFS fileserver.\n");
BSETCODE(-1, buffer);
goto done;
}
}
if (all) {
/* salvage whole enchilada */
curGoal = GetServerGoal(self, "fs");
if (curGoal == BSTAT_NORMAL) {
fprintf(stderr, "AFS::BOS: shutting down fs.\n");
code = BOZO_SetTStatus(self, "fs", BSTAT_SHUTDOWN);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: failed to stop 'fs' (%s)\n", em(code));
BSETCODE(code, buffer);
goto done;
}
code = BOZO_WaitAll(self); /* wait for shutdown to complete */
if (code) {
char buffer[256];
sprintf(buffer,
"AFS::BOS: failed to wait for file server shutdown, continuing.\n");
BSETCODE(code, buffer);
}
}
/* now do the salvage operation */
/* fprintf(stderr, "Starting salvage of everything.\n"); */
rc = DoSalvage(self, (char *) 0, (char *) 0, outName, showlog, parallel, tmpDir,
orphans);
if (curGoal == BSTAT_NORMAL) {
/* fprintf(stderr, "AFS::BOS: restarting fs.\n"); */
code = BOZO_SetTStatus(self, "fs", BSTAT_NORMAL);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: failed to restart 'fs' (%s)\n", em(code));
BSETCODE(code, buffer);
goto done;
}
}
if (rc) {
code = rc;
goto done;
}
}
else if (!volume) {
if (!partition) {
char buffer[256];
sprintf(buffer, "AFS::BOS: must specify ALL switch to salvage all partitions.\n");
BSETCODE(-1, buffer);
goto done;
}
if (volutil_GetPartitionID(partition) < 0) {
/* can't parse volume ID, so complain before shutting down
* file server.
*/
char buffer[256];
sprintf(buffer, "AFS::BOS: can't interpret %s as partition ID.\n", partition);
BSETCODE(-1, buffer);
goto done;
}
curGoal = GetServerGoal(self, "fs");
/* salvage a whole partition (specified by parms[1]) */
if (curGoal == BSTAT_NORMAL) {
/* fprintf(stderr, "AFS::BOS: shutting down fs.\n"); */
code = BOZO_SetTStatus(self, "fs", BSTAT_SHUTDOWN);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: can't stop 'fs' (%s)\n", em(code));
BSETCODE(code, buffer);
goto done;
}
code = BOZO_WaitAll(self); /* wait for shutdown to complete */
if (code) {
char buffer[256];
sprintf(buffer,
"AFS::BOS: failed to wait for file server shutdown, continuing.\n");
BSETCODE(code, buffer);
}
}
/* now do the salvage operation */
/* fprintf(stderr, "Starting salvage of partition %s.\n", partition); */
rc = DoSalvage(self, partition, (char *) 0,
outName, showlog, parallel, tmpDir, orphans);
if (curGoal == BSTAT_NORMAL) {
/* fprintf(stderr, "AFS::BOS: restarting fs.\n"); */
code = BOZO_SetTStatus(self, "fs", BSTAT_NORMAL);
if (code) {
char buffer[256];
sprintf(buffer, "AFS::BOS: failed to restart 'fs' (%s)\n", em(code));
BSETCODE(code, buffer);
goto done;
}
}
if (rc) {
code = rc;
goto done;
}
}
else {
/* salvage individual volume (don't shutdown fs first), just use
* single-shot cron bnode. Must leave server running when using this
* option, since salvager will ask file server for the volume */
afs_int32 err;
const char *confdir;
confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH);
code = internal_vsu_ClientInit( /* noauth */ 1, confdir, tmpname,
/* server auth */ 0, &cstruct, (int (*)()) 0);
if (code == 0) {
newID = vsu_GetVolumeID(volume, cstruct, &err);
if (newID == 0) {
char buffer[256];
sprintf(buffer, "AFS::BOS: can't interpret %s as volume name or ID\n",
volume);
BSETCODE(-1, buffer);
goto done;
}
sprintf(tname, "%u", newID);
}
else {
char buffer[256];
sprintf(buffer,
"AFS::BOS: can't initialize volume system client (code %d), trying anyway.\n",
code);
BSETCODE(code, buffer);
strncpy(tname, volume, sizeof(tname));
}
if (volutil_GetPartitionID(partition) < 0) {
/* can't parse volume ID, so complain before shutting down
* file server.
*/
char buffer[256];
sprintf(buffer, "AFS::BOS: can't interpret %s as partition ID.\n", partition);
BSETCODE(-1, buffer);
goto done;
}
/* fprintf(stderr, "Starting salvage of volume %d on partition %s.\n",
newID, partition); */
rc = DoSalvage(self, partition, tname, outName, showlog, parallel, tmpDir, orphans);
if (rc) {
code = rc;
goto done;
}
}
code = 0;
SETCODE(code);
done:
RETVAL = (code == 0);
}
OUTPUT:
RETVAL
MODULE = AFS PACKAGE = AFS::PTS PREFIX = pts_
AFS::PTS
pts__new(class=0, sec=1, cell=0)
char * class
int32 sec
char * cell
PREINIT:
int32 code = -1;
AFS__PTS server;
PPCODE:
{
if (cell && (cell[0] == '\0' || cell[0] == '0'))
cell = NULL;
server = internal_pts_new(&code, sec, cell);
# SETCODE(code); wird tiefer gesetzt...
if (code == 0) {
ST(0) = sv_newmortal();
sv_setref_pv(ST(0), "AFS::PTS", (void *) server);
XSRETURN(1);
}
else
XSRETURN_UNDEF;
}
int32
pts__DESTROY(server)
AFS::PTS server
CODE:
{
int32 code;
/* printf("pts DEBUG ubik_ClientDestroy\n"); */
code = ubik_ClientDestroy(server);
SETCODE(code);
RETVAL = (code == 0);
}
OUTPUT:
RETVAL
void
pts_id(server,object,anon=1)
AFS::PTS server
XSRETURN_UNDEF;
}
}
MODULE = AFS PACKAGE = AFS PREFIX = afs_
BOOT:
initialize_bz_error_table();
initialize_vols_error_table();
initialize_vl_error_table();
initialize_u_error_table();
initialize_pt_error_table();
initialize_ka_error_table();
initialize_acfg_error_table();
initialize_ktc_error_table();
initialize_rxk_error_table();
/* initialize_cmd_error_table(); */
/* initialize_budb_error_table(); */
/* initialize_butm_error_table(); */
/* initialize_butc_error_table(); */
void
afs__finalize()
CODE:
{
if (rx_initialized) {
rx_Finalize();
/* printf("AFS DEBUG rx_Finalize\n"); */
}
}
int32
afs_ascii2ptsaccess(access)
char * access
CODE:
{
int32 code, flags;
code = parse_pts_setfields(access, &flags);
SETCODE(code);
if (code != 0)
flags = 0;
RETVAL = flags;
}
OUTPUT:
RETVAL
void
afs_ptsaccess2ascii(flags)
int32 flags
CODE:
{
SETCODE(0);
ST(0) = sv_newmortal();
sv_setpv(ST(0), parse_flags_ptsaccess(flags));
}
void
afs_ka_ParseLoginName(login)
char * login
PPCODE:
{
int32 code;
char name[MAXKTCNAMELEN];
char inst[MAXKTCNAMELEN];
char cell[MAXKTCREALMLEN];
code = ka_ParseLoginName(login, name, inst, cell);
SETCODE(code);
if (code == 0) {
EXTEND(sp, 3);
PUSHs(sv_2mortal(newSVpv(name, strlen(name))));
PUSHs(sv_2mortal(newSVpv(inst, strlen(inst))));
PUSHs(sv_2mortal(newSVpv(cell, strlen(cell))));
}
}
void
afs_ka_StringToKey(str,cell)
char * str
char * cell
PPCODE:
{
struct ktc_encryptionKey *key;
SV *st;
key = (struct ktc_encryptionKey *) safemalloc(sizeof(*key));
ka_StringToKey(str, cell, key);
SETCODE(0);
EXTEND(sp, 1);
st = sv_newmortal();
sv_setref_pv(st, "AFS::KTC_EKEY", (void *) key);
PUSHs(st);
}
void
afs_ka_UserAthenticateGeneral(p,pass,life,flags,pwexpires=-1,reason=0)
AFS::KTC_PRINCIPAL p
char * pass
int32 life
int32 flags
int32 pwexpires
char * reason
PPCODE:
{
int32 code, pw = 255;
char *r;
code = ka_UserAuthenticateGeneral(flags,
p->name, p->instance, p->cell, pass, life, &pw, 0, &r);
if (pwexpires != -1)
sv_setiv(ST(4), (IV) pw);
if (reason)
sv_setpv(ST(5), r);
SETCODE(code);
EXTEND(sp, 1);
PUSHs(sv_2mortal(newSViv(code == 0)));
}
void
afs_ka_ReadPassword(prompt,verify=0,cell=0)
char * prompt
int32 verify
char * cell
PPCODE:
{
int32 code = 0;
( run in 0.790 second using v1.01-cache-2.11-cpan-39bf76dae61 )