#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
#include <afs/stds.h>
#if defined(AFS_LINUX24_ENV)
#define _REGEX_RE_COMP
#endif
#include <sys/types.h>
-#if defined(AFS_LINUX24_ENV)
-#include <regex.h>
-#endif
#include <afs/cmd.h>
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
-#include <strings.h>
#endif
#include <errno.h>
#include <afs/com_err.h>
+#include <afs/afsutil.h>
#include <afs/budb.h>
+#include <afs/budb_prototypes.h>
#include <afs/butc.h>
#include <afs/bubasics.h> /* PA */
#include <afs/volser.h>
#include <afs/voldefs.h> /* PA */
#include <afs/vldbint.h> /* PA */
#include <afs/ktime.h> /* PA */
+#include <ubik.h>
#include <time.h>
-
-#include <string.h>
#include <lock.h>
#include <afs/butc.h>
#include <afs/tcdata.h>
#include <afs/butx.h>
+#include <afs/vsutils_prototypes.h>
+#ifdef HAVE_POSIX_REGEX /* use POSIX regexp library */
+#include <regex.h>
+#endif
#include "bc.h"
#include "error_macros.h"
-
+#include "bucoord_internal.h"
+#include "bucoord_prototypes.h"
extern struct bc_config *bc_globalConfig;
-extern struct bc_dumpSchedule *bc_FindDumpSchedule();
-extern struct bc_volumeSet *bc_FindVolumeSet(struct bc_config *cfg,
- char *name);
extern struct bc_dumpTask bc_dumpTasks[BC_MAXSIMDUMPS];
extern struct ubik_client *cstruct;
-extern int bc_Dumper(); /* function to do dumps */
-extern int bc_Restorer(); /* function to do restores */
extern char *whoami;
-extern struct ktc_token ttoken;
-extern char *tailCompPtr();
-extern statusP createStatusNode();
char *loadFile;
extern afs_int32 lastTaskCode;
#define HOSTADDR(sockaddr) (sockaddr)->sin_addr.s_addr
+static int EvalVolumeSet1(struct bc_config *aconfig, struct bc_volumeSet *avs,
+ struct bc_volumeDump **avols,
+ struct ubik_client *uclient);
+
+static int EvalVolumeSet2(struct bc_config *aconfig, struct bc_volumeSet *avs,
+ struct bc_volumeDump **avols,
+ struct ubik_client *uclient);
+static int DBLookupByVolume(char *volumeName);
+
int
-bc_EvalVolumeSet(aconfig, avs, avols, uclient)
- struct bc_config *aconfig;
- register struct bc_volumeSet *avs;
- struct bc_volumeDump **avols;
- struct ubik_client *uclient;
+bc_EvalVolumeSet(struct bc_config *aconfig,
+ struct bc_volumeSet *avs,
+ struct bc_volumeDump **avols,
+ struct ubik_client *uclient)
{ /*bc_EvalVolumeSet */
- int code;
+ int code = -1;
static afs_int32 use = 2;
if (use == 2) { /* Use EvalVolumeSet2() */
};
afs_int32
-getSPEntries(server, partition, serverlist, ss, ps)
- afs_uint32 server;
- afs_int32 partition;
- struct serversort **serverlist, **ss;
- struct partitionsort **ps;
+getSPEntries(afs_uint32 server, afs_int32 partition,
+ struct serversort **serverlist,
+ struct serversort **ss,
+ struct partitionsort **ps)
{
if (!(*ss) || ((*ss)->ipaddr != server)) {
*ps = 0;
if (!(*ss)) {
*ss = (struct serversort *)malloc(sizeof(struct serversort));
if (!(*ss)) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
*ss = 0;
return (BC_NOMEM);
}
if (!(*ps)) {
*ps = (struct partitionsort *)malloc(sizeof(struct partitionsort));
if (!(*ps)) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
free(*ss);
*ps = 0;
*ss = 0;
}
afs_int32
-randSPEntries(serverlist, avols)
- struct serversort *serverlist;
- struct bc_volumeDump **avols;
+randSPEntries(struct serversort *serverlist,
+ struct bc_volumeDump **avols)
{
struct serversort *ss, **pss;
struct partitionsort *ps, **pps;
return 0;
}
-int
-EvalVolumeSet2(aconfig, avs, avols, uclient)
- struct bc_config *aconfig;
- struct bc_volumeSet *avs;
- struct bc_volumeDump **avols;
- struct ubik_client *uclient;
+static int
+EvalVolumeSet2(struct bc_config *aconfig,
+ struct bc_volumeSet *avs,
+ struct bc_volumeDump **avols,
+ struct ubik_client *uclient)
{ /*EvalVolumeSet2 */
struct bc_volumeEntry *tve;
struct bc_volumeDump *tavols;
struct bc_volumeDump *tvd;
afs_int32 code = 0, tcode;
afs_int32 count = 0;
- struct serversort *servers = 0, *lastserver = 0, *ss = 0;
+ struct serversort *servers = 0, *ss = 0;
struct partitionsort *ps = 0;
*avols = (struct bc_volumeDump *)0;
entries[e].serverPartition[ei], &servers,
&ss, &ps);
if (tcode) {
- com_err(whoami, tcode, "");
+ afs_com_err(whoami, tcode, NULL);
ERROR(tcode);
}
if ((strcmp(&entries[e].name[l], ".backup") == 0)
|| (strcmp(&entries[e].name[l], ".readonly")
== 0)
- || (strcmp(&entries[e].name[l], "") == 0))
+ || (strcmp(&entries[e].name[l], NULL) == 0))
add = 0;
}
}
tvd = (struct bc_volumeDump *)
malloc(sizeof(struct bc_volumeDump));
if (!tvd) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);
}
memset(tvd, 0, sizeof(*tvd));
tvd->name = (char *)malloc(strlen(entries[e].name) + 10);
if (!(tvd->name)) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
free(tvd);
ERROR(BC_NOMEM);
}
* None.
*-----------------------------------------------------------------------------
*/
-int
-EvalVolumeSet1(aconfig, avs, avols, uclient)
- struct bc_config *aconfig;
- struct bc_volumeSet *avs;
- struct bc_volumeDump **avols;
- struct ubik_client *uclient;
+static int
+EvalVolumeSet1(struct bc_config *aconfig,
+ struct bc_volumeSet *avs,
+ struct bc_volumeDump **avols,
+ struct ubik_client *uclient)
{ /*EvalVolumeSet1 */
afs_int32 code; /*Result of various calls */
- char *errm;
struct bc_volumeDump *tvd; /*Ptr to new dump instance */
struct bc_volumeEntry *tve, *ctve; /*Ptr to new volume entry instance */
char patt[256]; /*Composite regex; also, target string */
- int volType; /*Type of volume that worked */
+ int volType = 0; /*Type of volume that worked */
afs_int32 index; /*Current VLDB entry index */
afs_int32 count; /*Needed by VL_ListEntry() */
afs_int32 next_index; /*Next index to list */
struct vldbentry entry; /*VLDB entry */
int srvpartpair; /*Loop counter: server/partition pair */
afs_int32 total = 0;
- int found, foundentry;
+ int found;
+ int foundentry = 0;
struct serversort *servers = 0, *ss = 0;
struct partitionsort *ps = 0;
+#ifdef HAVE_POSIX_REGEX
+ regex_t re;
+ int need_regfree = 0;
+#else
+ char *errm;
+#endif
*avols = (struct bc_volumeDump *)0;
ctve = (struct bc_volumeEntry *)0; /* no compiled entry */
/* If the volume entry is not compiled, then compile it */
if (ctve != tve) {
sprintf(patt, "^%s$", tve->name);
+#ifdef HAVE_POSIX_REGEX
+ if (regcomp(&re, patt, REG_NOSUB) != 0) {
+ afs_com_err(whoami, 0, "Can't compile regular expression '%s'", patt);
+ return (-1);
+ }
+ need_regfree = 1;
+#else
errm = (char *)re_comp(patt);
if (errm) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Can't compile regular expression '%s': %s",
patt, errm);
return (-1);
}
+#endif
ctve = tve;
}
if (entry.serverFlags[srvpartpair] & ITSRWVOL) {
if (entry.flags & RW_EXISTS) {
sprintf(patt, "%s", entry.name);
+#ifdef HAVE_POSIX_REGEX
+ code = regexec(&re, patt, 0, NULL, 0);
+ if (code == 0) {
+#else
code = re_exec(patt);
if (code == 1) {
+#endif
found = 1;
foundentry = srvpartpair;
volType = RWVOL;
*/
if (entry.flags & BACK_EXISTS) {
sprintf(patt, "%s.backup", entry.name);
+#ifdef HAVE_POSIX_REGEX
+ code = regexec(&re, patt, 0, NULL, 0);
+ if (code == 0) {
+#else
code = re_exec(patt);
if (code == 1) {
+#endif
found = 1;
foundentry = srvpartpair;
volType = BACKVOL;
else if (!found && (entry.serverFlags[srvpartpair] & ITSROVOL)
&& (entry.flags & RO_EXISTS)) {
sprintf(patt, "%s.readonly", entry.name);
+#ifdef HAVE_POSIX_REGEX
+ code = regexec(&re, patt, 0, NULL, 0);
+ if (code == 0) {
+#else
code = re_exec(patt);
if (code == 1) {
+#endif
found = 1;
foundentry = srvpartpair;
volType = ROVOL;
}
if (code < 0)
- com_err(whoami, 0, "Internal error in regex package");
+ afs_com_err(whoami, 0, "Internal error in regex package");
} /*s */
/* If found a match, then create a new volume dump entry */
entry.serverPartition[foundentry], &servers,
&ss, &ps);
if (code) {
- com_err(whoami, code, "");
+ afs_com_err(whoami, code, NULL);
return (code);
}
tvd = (struct bc_volumeDump *)
malloc(sizeof(struct bc_volumeDump));
if (!tvd) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return (BC_NOMEM);
}
memset(tvd, 0, sizeof(*tvd));
tvd->name = (char *)malloc(strlen(entry.name) + 10);
if (!(tvd->name)) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
free(tvd);
return (BC_NOMEM);
}
} /*f */
} /*ve */
} /*w */
+#ifdef HAVE_POSIX_REGEX
+ if (need_regfree)
+ regfree(&re);
+#endif
/* Randomly link the volumedump entries together */
randSPEntries(servers, avols);
return (0);
} /*EvalVolumeSet1 */
-/* compactDateString
- * print out a date in compact format, 16 chars, format is
- * mm/dd/yyyy hh:mm
- * entry:
- * date_long - ptr to a long containing the time
- * exit:
- * ptr to a string containing a representation of the date
- */
char *
-compactDateString(date_long, string, size)
- afs_int32 *date_long, size;
- char *string;
+compactTimeString(time_t *date, char *string, afs_int32 size)
{
struct tm *ltime;
if (!string)
- return 0;
+ return NULL;
- if (*date_long == NEVERDATE) {
+ if (*date == NEVERDATE) {
sprintf(string, "NEVER");
} else {
- time_t t = *date_long;
- ltime = localtime(&t);
- /* prints date in U.S. format of mm/dd/yyyy */
+ ltime = localtime(date);
strftime(string, size, "%m/%d/%Y %H:%M", ltime);
}
return (string);
}
+/* compactDateString
+ * print out a date in compact format, 16 chars, format is
+ * mm/dd/yyyy hh:mm
+ * entry:
+ * date_long - ptr to a long containing the time
+ * exit:
+ * ptr to a string containing a representation of the date
+ */
+char *
+compactDateString(afs_uint32 *date_long, char *string, afs_int32 size)
+{
+ time_t t = *date_long;
+ return compactTimeString(&t, string, size);
+}
+
+
afs_int32
-bc_SafeATOI(anum)
- char *anum;
+bc_SafeATOI(char *anum)
{
afs_int32 total = 0;
* Return the size in KBytes.
*/
afs_int32
-bc_FloatATOI(anum)
- char *anum;
+bc_FloatATOI(char *anum)
{
float total = 0;
afs_int32 rtotal;
/* make a copy of a string so that it can be freed later */
char *
-bc_CopyString(astring)
- char *astring;
+bc_CopyString(char *astring)
{
afs_int32 tlen;
char *tp;
tlen = strlen(astring);
tp = (char *)malloc(tlen + 1); /* don't forget the terminating null */
if (!tp) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return (tp);
}
strcpy(tp, astring);
*/
char *
-concatParams(itemPtr)
- struct cmd_item *itemPtr;
+concatParams(struct cmd_item *itemPtr)
{
struct cmd_item *tempPtr;
afs_int32 length = 0;
}
if (length == 0) { /* no string (0 length) */
- com_err(whoami, 0, "Can't have zero length date and time string");
+ afs_com_err(whoami, 0, "Can't have zero length date and time string");
return (NULL);
}
string = (char *)malloc(length); /* allocate the string */
if (!string) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return (NULL);
}
string[0] = 0;
/* printIfStatus
* print out an interface status node as received from butc
*/
-
-printIfStatus(statusPtr)
- struct tciStatusS *statusPtr;
+
+void
+printIfStatus(struct tciStatusS *statusPtr)
{
printf("Task %d: %s: ", statusPtr->taskId, statusPtr->taskName);
if (statusPtr->nKBytes)
- printf("%ld Kbytes transferred", statusPtr->nKBytes);
+ printf("%ld Kbytes transferred", (long unsigned int) statusPtr->nKBytes);
if (strlen(statusPtr->volumeName) != 0) {
if (statusPtr->nKBytes)
printf(", ");
}
afs_int32
-getPortOffset(port)
- char *port;
+getPortOffset(char *port)
{
afs_int32 portOffset;
portOffset = bc_SafeATOI(port);
if (portOffset < 0) {
- com_err(whoami, 0, "Can't decode port offset '%s'", port);
+ afs_com_err(whoami, 0, "Can't decode port offset '%s'", port);
return (-1);
} else if (portOffset > BC_MAXPORTOFFSET) {
- com_err(whoami, 0, "%u exceeds max port offset %u", portOffset,
+ afs_com_err(whoami, 0, "%u exceeds max port offset %u", portOffset,
BC_MAXPORTOFFSET);
return (-1);
}
/* bc_GetTapeStatusCmd
* display status of all tasks on a particular tape coordinator
*/
-
-bc_GetTapeStatusCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_GetTapeStatusCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 code;
struct rx_connection *tconn;
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
if (code) {
if (code == TC_NOTASKS)
break;
- com_err(whoami, code, "; Can't get status from butc");
+ afs_com_err(whoami, code, "; Can't get status from butc");
return (-1);
}
if ((flags & TSK_STAT_NOTFOUND))
/* bc_WaitForNoJobs
* wait for all jobs to terminate
*/
-bc_WaitForNoJobs()
+int
+bc_WaitForNoJobs(void)
{
- afs_int32 wcode = 0;
int i;
- int waitmsg = 1;
int usefulJobRunning = 1;
extern dlqlinkT statusHead;
- com_err(whoami, 0, "waiting for job termination");
+ afs_com_err(whoami, 0, "waiting for job termination");
while (usefulJobRunning) {
usefulJobRunning = (dlqEmpty(&statusHead) ? 0 : 1);
* parameters
* ignored - a null "as" prints only jobs.
*/
-
-bc_JobsCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_JobsCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 prevTime;
dlqlinkP ptr;
if (statusPtr->dbDumpId)
printf(": DumpID %u", statusPtr->dbDumpId);
if (statusPtr->nKBytes)
- printf(", %ld Kbytes", statusPtr->nKBytes);
+ printf(", %ld Kbytes", afs_printable_int32_ld(statusPtr->nKBytes));
if (strlen(statusPtr->volumeName) != 0)
printf(", volume %s", statusPtr->volumeName);
}
/* Print token expiration time */
- if ((ttoken.endTime > prevTime)
- && (ttoken.endTime <= youngest->scheduledDump) && as
- && (ttoken.endTime != NEVERDATE)) {
- if (ttoken.endTime > time(0)) {
- compactDateString(&ttoken.endTime, ds, 50);
+ if ((tokenExpires > prevTime)
+ && (tokenExpires <= youngest->scheduledDump) && as
+ && (tokenExpires != NEVERDATE)) {
+ if (tokenExpires > time(0)) {
+ compactTimeString(&tokenExpires, ds, 50);
printf(" %16s: TOKEN EXPIRATION\n", ds);
} else {
printf(" TOKEN HAS EXPIRED\n");
}
/* Print token expiration time if havn't already */
- if ((ttoken.endTime == NEVERDATE) && as)
+ if ((tokenExpires == NEVERDATE) && as)
printf(" : TOKEN NEVER EXPIRES\n");
- else if ((ttoken.endTime > prevTime) && as) {
- if (ttoken.endTime > time(0)) {
- compactDateString(&ttoken.endTime, ds, 50);
+ else if ((tokenExpires > prevTime) && as) {
+ if (tokenExpires > time(0)) {
+ compactTimeString(&tokenExpires, ds, 50);
printf(" %16s: TOKEN EXPIRATION\n", ds);
} else {
printf(" : TOKEN HAS EXPIRED\n");
return 0;
}
-bc_KillCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_KillCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 i;
afs_int32 slot;
statusP statusPtr;
extern dlqlinkT statusHead;
- extern statusP findStatus();
-
tp = as->parms[0].items->data;
if (strchr(tp, '.') == 0) {
slot = bc_SafeATOI(tp);
if (slot == -1) {
- com_err(whoami, 0, "Bad syntax for number '%s'", tp);
+ afs_com_err(whoami, 0, "Bad syntax for number '%s'", tp);
return -1;
}
}
}
if (i >= BC_MAXSIMDUMPS) {
- com_err(whoami, 0, "Can't find job %s", tp);
+ afs_com_err(whoami, 0, "Can't find job %s", tp);
return -1;
}
statusPtr = findStatus(td->dumpID);
if (statusPtr == 0) {
- com_err(whoami, 0, "Can't locate status - internal error");
+ afs_com_err(whoami, 0, "Can't locate status - internal error");
unlock_Status();
return (-1);
}
}
/* restore a volume or volumes */
-bc_VolRestoreCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
{
/*
* parm 0 is the new server to restore to
afs_int32 code;
int oldFlag;
afs_int32 fromDate;
+ afs_int32 dumpID = 0;
char *newExt, *timeString;
afs_int32 i;
afs_int32 *ports = NULL;
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
if (as->parms[0].items) {
tp = as->parms[0].items->data;
if (bc_ParseHost(tp, &destServ)) {
- com_err(whoami, 0, "Failed to locate destination host '%s'", tp);
+ afs_com_err(whoami, 0, "Failed to locate destination host '%s'", tp);
return -1;
}
}
if (as->parms[1].items) {
tp = as->parms[1].items->data;
if (bc_GetPartitionID(tp, &destPartition)) {
- com_err(whoami, 0, "Can't parse destination partition '%s'", tp);
+ afs_com_err(whoami, 0, "Can't parse destination partition '%s'", tp);
return -1;
}
}
/* build list of volume items */
tvol = (struct bc_volumeDump *)malloc(sizeof(struct bc_volumeDump));
if (!tvol) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
memset(tvol, 0, sizeof(struct bc_volumeDump));
tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
if (!tvol->name) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
strncpy(tvol->name, ti->data, VOLSER_OLDMAXVOLNAME);
code = ktime_DateToLong(timeString, &fromDate);
free(timeString);
if (code) {
- com_err(whoami, 0, "Can't parse restore date and time");
- com_err(whoami, 0, "%s", ktime_GetDateUsage());
+ afs_com_err(whoami, 0, "Can't parse restore date and time");
+ afs_com_err(whoami, 0, "%s", ktime_GetDateUsage());
return code;
}
} else {
portCount++;
ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
if (!ports) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
dontExecute = (as->parms[6].items ? 1 : 0); /* -n */
+ if (as->parms[7].items)
+ {
+ dumpID = atoi(as->parms[7].items->data);
+ if (dumpID <= 0)
+ dumpID = 0;
+ }
+
/*
* Perform the call to start the restore.
*/
code =
bc_StartDmpRst(bc_globalConfig, "volume", "restore", volsToRestore,
&destServ, destPartition, fromDate, newExt, oldFlag,
- /*parentDump */ 0, /*dumpLevel */ 0,
+ /*parentDump */ dumpID, /*dumpLevel */ 0,
bc_Restorer, ports, portCount,
- /*dumpSched */ 0, /*append */ 0, dontExecute);
+ /*dumpSched */ NULL, /*append */ 0, dontExecute);
if (code)
- com_err(whoami, code, "; Failed to queue restore");
+ afs_com_err(whoami, code, "; Failed to queue restore");
return (code);
}
* various optional
*/
-bc_DiskRestoreCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_DiskRestoreCmd(struct cmd_syndesc *as, void *arock)
{
struct bc_volumeSet tvolumeSet; /* temporary volume set for EvalVolumeSet call */
struct bc_volumeEntry tvolumeEntry; /* entry within the volume set */
code = bc_UpdateVolumeSet();
if (code) {
- com_err(whoami, code, "; Can't retrieve volume sets");
+ afs_com_err(whoami, code, "; Can't retrieve volume sets");
return (code);
}
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
tvolumeEntry.partname = as->parms[1].items->data;
if (bc_GetPartitionID(tvolumeEntry.partname, &tvolumeEntry.partition)) {
- com_err(whoami, 0, "Can't parse partition '%s'",
+ afs_com_err(whoami, 0, "Can't parse partition '%s'",
tvolumeEntry.partname);
return -1;
}
if (bc_ParseHost(tvolumeEntry.serverName, &tvolumeEntry.server)) {
- com_err(whoami, 0, "Can't locate host '%s'", tvolumeEntry.serverName);
+ afs_com_err(whoami, 0, "Can't locate host '%s'", tvolumeEntry.serverName);
return -1;
}
if (as->parms[8].items) {
tp = as->parms[8].items->data;
if (bc_ParseHost(tp, &destServ)) {
- com_err(whoami, 0, "Can't locate destination host '%s'", tp);
+ afs_com_err(whoami, 0, "Can't locate destination host '%s'", tp);
return -1;
}
} else /* use destination host == original host */
if (as->parms[9].items) {
tp = as->parms[9].items->data;
if (bc_GetPartitionID(tp, &destPartition)) {
- com_err(whoami, 0, "Can't parse destination partition '%s'", tp);
+ afs_com_err(whoami, 0, "Can't parse destination partition '%s'", tp);
return -1;
}
} else /* use original partition */
portCount++;
ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
if (!ports) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
bc_EvalVolumeSet(bc_globalConfig, &tvolumeSet, &volsToRestore,
cstruct);
if (code) {
- com_err(whoami, code, "; Failed to evaluate volume set");
+ afs_com_err(whoami, code, "; Failed to evaluate volume set");
return (-1);
}
&destServ, destPartition, fromDate, newExt, oldFlag,
/*parentDump */ 0, /*dumpLevel */ 0,
bc_Restorer, ports, portCount,
- /*dumpSched */ 0, /*append */ 0, dontExecute);
+ /*dumpSched */ NULL, /*append */ 0, dontExecute);
if (code)
- com_err(whoami, code, "; Failed to queue restore");
+ afs_com_err(whoami, code, "; Failed to queue restore");
return (code);
}
* restore a volumeset or list of volumes.
*/
-bc_VolsetRestoreCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_VolsetRestoreCmd(struct cmd_syndesc *as, void *arock)
{
int oldFlag;
long fromDate;
afs_int32 *ports = NULL;
afs_int32 portCount = 0;
afs_int32 code = 0;
- afs_int32 portoffset = 0;
char *volsetName;
struct bc_volumeSet *volsetPtr; /* Ptr to list of generated volume info */
struct bc_volumeDump *volsToRestore = (struct bc_volumeDump *)0;
code = bc_UpdateVolumeSet();
if (code) {
- com_err(whoami, code, "; Can't retrieve volume sets");
+ afs_com_err(whoami, code, "; Can't retrieve volume sets");
return (code);
}
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
if (as->parms[0].items) {
if (as->parms[1].items) {
- com_err(whoami, 0, "Can't have both -name and -file options");
+ afs_com_err(whoami, 0, "Can't have both -name and -file options");
return (-1);
}
volsetName = as->parms[0].items->data;
volsetPtr = bc_FindVolumeSet(bc_globalConfig, volsetName);
if (!volsetPtr) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Can't find volume set '%s' in backup database",
volsetName);
return (-1);
bc_EvalVolumeSet(bc_globalConfig, volsetPtr, &volsToRestore,
cstruct);
if (code) {
- com_err(whoami, code, "; Failed to evaluate volume set");
+ afs_com_err(whoami, code, "; Failed to evaluate volume set");
return (-1);
}
} else if (as->parms[1].items) {
fd = fopen(as->parms[1].items->data, "r");
if (!fd) {
- com_err(whoami, errno, "; Cannot open file '%s'",
+ afs_com_err(whoami, errno, "; Cannot open file '%s'",
as->parms[1].items->data);
return (-1);
}
}
if (bc_ParseHost(server, &destServer)) {
- com_err(whoami, 0, "Failed to locate host '%s'", server);
+ afs_com_err(whoami, 0, "Failed to locate host '%s'", server);
continue;
}
if (bc_GetPartitionID(partition, &destPartition)) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Failed to parse destination partition '%s'",
partition);
continue;
tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
if (!tvol->name) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
strncpy(tvol->name, volume, VOLSER_OLDMAXVOLNAME);
}
fclose(fd);
} else {
- com_err(whoami, 0, "-name or -file option required");
+ afs_com_err(whoami, 0, "-name or -file option required");
return (-1);
}
portCount++;
ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
if (!ports) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
/* Perform the call to start the restore */
code = bc_StartDmpRst(bc_globalConfig, "disk", "restore", volsToRestore,
- /*destserver */ 0, /*destpartition */ 0, fromDate,
+ /*destserver */ NULL, /*destpartition */ 0, fromDate,
newExt, oldFlag,
/*parentDump */ 0, /*dumpLevel */ 0,
bc_Restorer, ports, portCount,
- /*dumpSched */ 0, /*append */ 0, dontExecute);
+ /*dumpSched */ NULL, /*append */ 0, dontExecute);
if (code)
- com_err(whoami, code, "; Failed to queue restore");
+ afs_com_err(whoami, code, "; Failed to queue restore");
return code;
}
int dontExecute;
int
-bc_DumpCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+bc_DumpCmd(struct cmd_syndesc *as, void *arock)
{ /*bc_DumpCmd */
- static char rn[] = "bc_DumpCmd"; /*Routine name */
- char *dumpPath, *vsName; /*Ptrs to various names */
- struct bc_volumeSet *tvs; /*Ptr to list of generated volume info */
- struct bc_dumpSchedule *tds, *baseds; /*Ptr to dump schedule node */
+ char *dumpPath = NULL;
+ char *vsName = NULL; /*Ptrs to various names */
+ struct bc_volumeSet *tvs = NULL; /*Ptr to list of generated volume info */
+ struct bc_dumpSchedule *tds;
+ struct bc_dumpSchedule *baseds = NULL; /*Ptr to dump schedule node */
struct bc_volumeDump *tve, *volsToDump; /*Ptr to individual vols to be dumped */
struct budb_dumpEntry dumpEntry, de, fde; /* dump entry */
afs_uint32 d;
afs_int32 doAt, atTime; /* Time a timed-dump is to start at */
afs_int32 length;
char *timeString;
- int doAppend; /* Append the dump to dump set */
+ int doAppend = 0; /* Append the dump to dump set */
afs_int32 code; /* Return code */
int loadfile; /* whether to load a file or not */
statusP statusPtr;
extern struct bc_dumpTask bc_dumpTasks[];
- extern afs_int32 bcdb_FindLastVolClone();
- extern afs_int32 volImageTime();
code = bc_UpdateDumpSchedule();
if (code) {
- com_err(whoami, code, "; Can't retrieve dump schedule");
+ afs_com_err(whoami, code, "; Can't retrieve dump schedule");
return (code);
}
code = bc_UpdateVolumeSet();
if (code) {
- com_err(whoami, code, "; Can't retrieve volume sets");
+ afs_com_err(whoami, code, "; Can't retrieve volume sets");
return (code);
}
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
loadfile = 1;
if (as->parms[0].items || as->parms[1].items || as->parms[2].items
|| as->parms[4].items) {
- com_err(whoami, 0, "Invalid option specified with -file option");
+ afs_com_err(whoami, 0, "Invalid option specified with -file option");
return -1;
}
} else {
loadfile = 0;
if (!as->parms[0].items || !as->parms[1].items) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Must specify volume set name and dump level name");
return -1;
}
code = ktime_DateToLong(timeString, &atTime);
free(timeString);
if (code) {
- com_err(whoami, 0, "Can't parse dump start date and time");
- com_err(whoami, 0, "%s", ktime_GetDateUsage());
+ afs_com_err(whoami, 0, "Can't parse dump start date and time");
+ afs_com_err(whoami, 0, "%s", ktime_GetDateUsage());
return (1);
}
} else
portCount = 1;
portp = (afs_int32 *) malloc(sizeof(afs_int32));
if (!portp) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
*/
tvs = bc_FindVolumeSet(bc_globalConfig, vsName);
if (!tvs) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Can't find volume set '%s' in backup database", vsName);
return (-1);
}
baseds = bc_FindDumpSchedule(bc_globalConfig, dumpPath);
if (!baseds) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Can't find dump schedule '%s' in backup database",
dumpPath);
return (-1);
*/
if (doAt) {
if (atTime < time(0)) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Time of dump is earlier then current time - not added");
} else {
statusPtr = createStatusNode();
statusPtr->scheduledDump = atTime;
statusPtr->cmdLine = (char *)malloc(length);
if (!statusPtr->cmdLine) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
strcat(statusPtr->cmdLine, " -n");
printf("Add scheduled dump as job %d\n", statusPtr->jobNumber);
- if ((atTime > ttoken.endTime) && (ttoken.endTime != NEVERDATE))
- com_err(whoami, 0,
+ if ((atTime > tokenExpires) && (tokenExpires != NEVERDATE))
+ afs_com_err(whoami, 0,
"Warning: job %d starts after expiration of AFS token",
statusPtr->jobNumber);
if (loadfile) {
loadFile = (char *)malloc(strlen(as->parms[6].items->data) + 1);
if (!loadFile) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
strcpy(loadFile, as->parms[6].items->data);
* dump at the level we requested it be done at.
*/
if (problemFindingDump) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Warning: Doing level %d dump due to missing higher-level dumps",
level);
if (parent) {
/* Expand out the volume set into its component list of volumes. */
code = bc_EvalVolumeSet(bc_globalConfig, tvs, &volsToDump, cstruct);
if (code) {
- com_err(whoami, code, "; Failed to evaluate volume set");
+ afs_com_err(whoami, code, "; Failed to evaluate volume set");
return (-1);
}
if (!volsToDump) {
tve->cloneDate = 0;
if (tve->cloneDate && (tve->cloneDate == tve->date)) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"Warning: Timestamp on volume %s unchanged from previous dump",
tve->name);
}
return (0);
code = bc_StartDmpRst(bc_globalConfig, dumpPath, vsName, volsToDump,
- /*destServer */ 0, /*destPartition */ 0,
+ /*destServer */ NULL, /*destPartition */ 0,
/*fromDate */ 0,
/*newExt */ NULL, /*oldFlag */ 0,
parent, level, bc_Dumper, portp, /*portCount */ 1,
baseds, doAppend, dontExecute);
if (code)
- com_err(whoami, code, "; Failed to queue dump");
+ afs_com_err(whoami, code, "; Failed to queue dump");
return (code);
} /*bc_DumpCmd */
* parameters:
* ignored
*/
-
-bc_QuitCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_QuitCmd(struct cmd_syndesc *as, void *arock)
{
int i;
struct bc_dumpTask *td;
statusPtr = (statusP) ptr;
if (!(statusPtr->flags & ABORT_REQUEST)) {
unlock_Status();
- com_err(whoami, 0, "Job %d still running (and not aborted)",
+ afs_com_err(whoami, 0, "Job %d still running (and not aborted)",
statusPtr->jobNumber);
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"You must at least 'kill' all running jobs before quitting");
return -1;
}
*/
for (td = bc_dumpTasks, i = 0; i < BC_MAXSIMDUMPS; i++, td++) {
if (td->flags & BC_DI_INUSE) {
- com_err(whoami, 0, "A job is still running");
- com_err(whoami, 0,
+ afs_com_err(whoami, 0, "A job is still running");
+ afs_com_err(whoami, 0,
"You must at least 'kill' all running jobs before quitting");
return -1;
}
* Labels a tape i.e. request the tape coordinator to perform this
* operation
*/
-
-bc_LabelTapeCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_LabelTapeCmd(struct cmd_syndesc *as, void *arock)
{
char *tapename = 0, *pname = 0;
afs_int32 size;
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
if (as->parms[0].items) { /* -name */
tapename = as->parms[0].items->data;
if (strlen(tapename) >= TC_MAXTAPELEN) {
- com_err(whoami, 0, "AFS tape name '%s' is too long", tapename);
+ afs_com_err(whoami, 0, "AFS tape name '%s' is too long", tapename);
return -1;
}
}
if (as->parms[3].items) { /* -pname */
if (tapename) {
- com_err(whoami, 0, "Can only specify -name or -pname");
+ afs_com_err(whoami, 0, "Can only specify -name or -pname");
return -1;
}
pname = as->parms[3].items->data;
if (strlen(pname) >= TC_MAXTAPELEN) {
- com_err(whoami, 0, "Permanent tape name '%s' is too long", pname);
+ afs_com_err(whoami, 0, "Permanent tape name '%s' is too long", pname);
return -1;
}
}
if (as->parms[1].items) {
size = bc_FloatATOI(as->parms[1].items->data);
if (size == -1) {
- com_err(whoami, 0, "Bad syntax for tape size '%s'",
+ afs_com_err(whoami, 0, "Bad syntax for tape size '%s'",
as->parms[1].items->data);
return -1;
}
* params:
* optional port number
*/
-
-bc_ReadLabelCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_ReadLabelCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 code;
afs_int32 port = 0;
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
* read content information from dump tapes, and if user desires,
* add it to the database
*/
-
-bc_ScanDumpsCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_ScanDumpsCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 port = 0;
afs_int32 dbAddFlag = 0;
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
*/
afs_int32
-bc_ParseExpiration(paramPtr, expType, expDate)
- struct cmd_parmdesc *paramPtr;
- afs_int32 *expType;
- afs_int32 *expDate;
+bc_ParseExpiration(struct cmd_parmdesc *paramPtr, afs_int32 *expType,
+ afs_int32 *expDate)
{
struct cmd_item *itemPtr;
struct ktime_date kt;
* Currently a single option, volumename to search for. Reports
* all dumps containing the specified volume
*/
-
-bc_dblookupCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_dblookupCmd(struct cmd_syndesc *as, void *arock)
{
struct cmd_item *ciptr;
afs_int32 code;
/* for ubik version */
-
-bc_dbVerifyCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_dbVerifyCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 status;
afs_int32 orphans;
&host);
if (code) {
- com_err(whoami, code, "; Unable to verify database");
+ afs_com_err(whoami, code, "; Unable to verify database");
return (-1);
}
if (status == 0)
printf("Database OK\n");
else
- com_err(whoami, status, "; Database is NOT_OK");
+ afs_com_err(whoami, status, "; Database is NOT_OK");
if (detail) {
printf("Orphan blocks %d\n", orphans);
/* deleteDump:
* Delete a dump. If port is >= 0, it means try to delete from XBSA server
*/
-deleteDump(dumpid, port, force)
- afs_uint32 dumpid; /* The dumpid to delete */
- afs_int32 port; /* port==-1 means don't go to butc */
- afs_int32 force;
+int
+deleteDump(afs_uint32 dumpid, /* The dumpid to delete */
+ afs_int32 port, /* port==-1 means don't go to butc */
+ afs_int32 force)
{
afs_int32 code = 0, tcode;
struct budb_dumpEntry dumpEntry;
if (port >= 0) {
tcode = bc_UpdateHosts();
if (tcode) {
- com_err(whoami, tcode, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, tcode, "; Can't retrieve tape hosts");
ERROR(tcode);
}
/* Find the dump in the backup database */
tcode = bcdb_FindDumpByID(dumpid, &dumpEntry);
if (tcode) {
- com_err(whoami, tcode, "; Unable to locate dumpID %u in database",
+ afs_com_err(whoami, tcode, "; Unable to locate dumpID %u in database",
dumpid);
ERROR(tcode);
}
if (tcode) {
if (tcode == RXGEN_OPCODE)
tcode = BC_VERSIONFAIL;
- com_err(whoami, tcode,
+ afs_com_err(whoami, tcode,
"; Unable to delete dumpID %u via butc", dumpid);
ERROR(tcode);
}
/* Wait for task to finish */
taskflag = waitForTask(taskId);
if (taskflag & (TASK_ERROR | ABORT_DONE)) {
- com_err(whoami, BUTX_DELETEOBJFAIL,
+ afs_com_err(whoami, BUTX_DELETEOBJFAIL,
"; Unable to delete dumpID %u via butc", dumpid);
ERROR(BUTX_DELETEOBJFAIL); /* the task failed */
}
tcode = bcdb_deleteDump(dumpid, 0, 0, &dumps);
if (tcode) {
- com_err(whoami, tcode,
+ afs_com_err(whoami, tcode,
"; Unable to delete dumpID %u from database", dumpid);
dumps.budb_dumpsList_len = 0;
if (!code)
/* Display the dumps that were deleted - includes appended dumps */
for (i = 0; i < dumps.budb_dumpsList_len; i++)
printf(" %u%s\n", dumps.budb_dumpsList_val[i],
- (i > 0) ? " Appended Dump" : "");
+ (i > 0) ? " Appended Dump" : NULL);
if (dumps.budb_dumpsList_val)
free(dumps.budb_dumpsList_val);
}
* entry:
* dump id - single required arg as param 0.
*/
-
-bc_deleteDumpCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_deleteDumpCmd(struct cmd_syndesc *as, void *arock)
{
afs_uint32 dumpid;
afs_int32 code = 0;
afs_int32 rcode = 0;
afs_int32 groupId = 0, havegroupid, sflags, noexecute;
struct cmd_item *ti;
- afs_uint32 fromTime = 0, toTime = 0, havetime = 0;
+ afs_int32 fromTime = 0, toTime = 0, havetime = 0;
char *timeString;
budb_dumpsList dumps, flags;
int i;
- afs_int32 port = -1, dbonly = 0, force;
+ afs_int32 port = -1, force;
/* Must specify at least one of -dumpid, -from, or -to */
if (!as->parms[0].items && !as->parms[1].items && !as->parms[2].items
&& !as->parms[4].items) {
- com_err(whoami, 0, "Must specify at least one field");
+ afs_com_err(whoami, 0, "Must specify at least one field");
return (-1);
}
/* Must have -to option with -from option */
if (as->parms[1].items && !as->parms[2].items) {
- com_err(whoami, 0, "Must specify '-to' field with '-from' field");
+ afs_com_err(whoami, 0, "Must specify '-to' field with '-from' field");
return (-1);
}
code = ktime_DateToLong(timeString, &fromTime);
free(timeString);
if (code) {
- com_err(whoami, 0, "Can't parse 'from' date and time");
- com_err(whoami, 0, "%s", ktime_GetDateUsage());
+ afs_com_err(whoami, 0, "Can't parse 'from' date and time");
+ afs_com_err(whoami, 0, "%s", ktime_GetDateUsage());
return (-1);
}
havetime = 1;
code = ktime_DateToLong(timeString, &toTime);
free(timeString);
if (code) {
- com_err(whoami, 0, "Can't parse 'to' date and time");
- com_err(whoami, 0, "%s", ktime_GetDateUsage());
+ afs_com_err(whoami, 0, "Can't parse 'to' date and time");
+ afs_com_err(whoami, 0, "%s", ktime_GetDateUsage());
return (-1);
}
toTime += 59;
}
if (fromTime > toTime) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"'-from' date/time cannot be later than '-to' date/time");
return (-1);
}
code =
bcdb_listDumps(sflags, groupId, fromTime, toTime, &dumps, &flags);
if (code) {
- com_err(whoami, code,
+ afs_com_err(whoami, code,
"; Error while deleting dumps from %u to %u", fromTime,
toTime);
rcode = -1;
return (rcode);
}
-bc_saveDbCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_saveDbCmd(struct cmd_syndesc *as, void *arock)
{
struct rx_connection *tconn;
afs_int32 portOffset = 0;
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
code = ktime_DateToLong(timeString, &toTime);
free(timeString);
if (code) {
- com_err(whoami, 0, "Can't parse '-archive' date and time");
- com_err(whoami, 0, "%s", ktime_GetDateUsage());
+ afs_com_err(whoami, 0, "Can't parse '-archive' date and time");
+ afs_com_err(whoami, 0, "%s", ktime_GetDateUsage());
return (-1);
}
toTime += 59;
code = TC_SaveDb(tconn, toTime, &taskId);
if (code) {
- com_err(whoami, code, "; Failed to save database");
+ afs_com_err(whoami, code, "; Failed to save database");
goto exit;
}
return (code);
}
-bc_restoreDbCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_restoreDbCmd(struct cmd_syndesc *as, void *arock)
{
struct rx_connection *tconn;
afs_int32 portOffset = 0;
code = bc_UpdateHosts();
if (code) {
- com_err(whoami, code, "; Can't retrieve tape hosts");
+ afs_com_err(whoami, code, "; Can't retrieve tape hosts");
return (code);
}
code = TC_RestoreDb(tconn, &taskId);
if (code) {
- com_err(whoami, code, "; Failed to restore database");
+ afs_com_err(whoami, code, "; Failed to restore database");
goto exit;
}
* volumeName - volume to lookup
*/
-DBLookupByVolume(volumeName)
- char *volumeName;
+static int
+DBLookupByVolume(char *volumeName)
{
struct budb_dumpEntry dumpEntry;
struct budb_volumeEntry volumeEntry[DBL_MAX_VOLUMES];
}
if (code)
- com_err(whoami, code, "");
+ afs_com_err(whoami, code, NULL);
return (code);
}
*/
afs_int32
-dumpInfo(dumpid, detailFlag)
- afs_int32 dumpid;
- afs_int32 detailFlag;
+dumpInfo(afs_int32 dumpid, afs_int32 detailFlag)
{
struct budb_dumpEntry dumpEntry;
struct tapeLink *head = 0;
for (tapeNumber = dumpEntry.tapes.b; tapeNumber <= dumpEntry.tapes.maxTapes; tapeNumber++) { /*f */
tapeLinkPtr = (struct tapeLink *)malloc(sizeof(struct tapeLink));
if (!tapeLinkPtr) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);
}
volumeLinkPtr =
(struct volumeLink *)malloc(sizeof(struct volumeLink));
if (!volumeLinkPtr) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);
}
memset(volumeLinkPtr, 0, sizeof(*volumeLinkPtr));
error_exit:
if (code)
- com_err("dumpInfo", code, "; Can't get dump information");
+ afs_com_err("dumpInfo", code, "; Can't get dump information");
/* free all allocated structures */
tapeLinkPtr = head;
}
int
-compareDump(ptr1, ptr2)
- struct budb_dumpEntry *ptr1, *ptr2;
+compareDump(struct budb_dumpEntry *ptr1, struct budb_dumpEntry *ptr2)
{
if (ptr1->created < ptr2->created)
return (-1);
}
afs_int32
-printRecentDumps(ndumps)
- int ndumps;
+printRecentDumps(int ndumps)
{
afs_int32 code = 0;
afs_int32 nextindex, index = 0;
char ds[50];
extern struct udbHandleS udbHandle;
- extern compareDump();
do { /* while (nextindex != -1) */
/* initialize the dump list */
if (code) {
if (code == BUDB_ENDOFLIST)
return 0;
- com_err("dumpInfo", code, "; Can't get dump information");
+ afs_com_err("dumpInfo", code, "; Can't get dump information");
return (code);
}
* as - name of tape
* arock -
*/
-bc_dumpInfoCmd(as, arock)
- struct cmd_syndesc *as;
- char *arock;
+int
+bc_dumpInfoCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 dumpid;
afs_int32 detailFlag;
afs_int32 ndumps;
afs_int32 code = 0;
- afs_int32 dumpInfo();
-
if (as->parms[0].items) {
if (as->parms[1].items) {
- com_err(whoami, 0,
+ afs_com_err(whoami, 0,
"These options are exclusive - select only one");
return (BC_BADARG);
}
ndumps = atoi(as->parms[0].items->data);
if (ndumps <= 0) {
- com_err(whoami, 0, "Must provide a positive number");
+ afs_com_err(whoami, 0, "Must provide a positive number");
return -1;
}