/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
+#include <roken.h>
#include <sys/types.h>
#include <afs/cmd.h>
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#else
#include <sys/param.h>
-#include <strings.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include "bc.h"
#include "error_macros.h"
+#include "bucoord_internal.h"
+#include "bucoord_prototypes.h"
struct bc_dumpTask bc_dumpTasks[BC_MAXSIMDUMPS];
-extern char *bc_CopyString();
-extern void bc_HandleMisc();
extern char *whoami;
-extern char *tailCompPtr();
-extern statusP createStatusNode();
-extern afs_int32 bc_jobNumber();
extern afs_int32 lastTaskCode;
/* bc_Dumper
* called (indirectly) to make a dump
* entry:
- * aindex - index into dumpTask array, contains all the information
+ * aindex - index into dumpTask array, contains all the information
* relevant to the dump
*/
-bc_Dumper(aindex)
+int
+bc_Dumper(int aindex)
{
struct rx_connection *tconn;
- register struct bc_volumeDump *tde;
+ struct bc_volumeDump *tde;
afs_int32 count, port;
struct tc_dumpDesc *volDesc = 0;
struct tc_dumpArray volArray;
struct tc_dumpInterface dumpInterface;
struct tc_dumpInterface *tcdiPtr = &dumpInterface;
- register struct bc_dumpTask *dumpTaskPtr;
+ struct bc_dumpTask *dumpTaskPtr;
- register afs_int32 code = 0;
+ afs_int32 code = 0;
dumpTaskPtr = &bc_dumpTasks[aindex];
return (code);
/* count number of volumes to be dumped and
- * build array of volumes to be sent to backup system
+ * build array of volumes to be sent to backup system
*/
for (count = 0, tde = dumpTaskPtr->volumes; tde;
tde = tde->next, count++);
volDesc =
(struct tc_dumpDesc *)malloc(count * sizeof(struct tc_dumpDesc));
if (!volDesc) {
- com_err(whoami, BC_NOMEM, "");
+ afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);
}
printf("Starting dump\n");
code = TC_PerformDump(tconn, tcdiPtr, &volArray, &dumpTaskPtr->dumpID);
if (code) {
- com_err(whoami, code, "; Failed to start dump");
+ afs_com_err(whoami, code, "; Failed to start dump");
ERROR(code);
}
- com_err(whoami, 0, "Task %u: Dump (%s)", dumpTaskPtr->dumpID,
+ afs_com_err(whoami, 0, "Task %u: Dump (%s)", dumpTaskPtr->dumpID,
tcdiPtr->dumpName);
/* create status monitor block */
* free the list of volumes used for dumps
*/
-freeDumpTaskVolumeList(vdptr)
- struct bc_volumeDump *vdptr;
+void
+freeDumpTaskVolumeList(struct bc_volumeDump *vdptr)
{
struct bc_volumeDump *nextVdPtr;
}
/* bc_DmpRstStart
- * The other half of the dump/restore create process call. In bc_StartDmpRst,
+ * The other half of the dump/restore create process call. In bc_StartDmpRst,
* we allocated a dumpTask entry. Here we do the task and then free the entry.
*/
-bc_DmpRstStart(aindex)
- afs_int32 aindex;
+void *
+bc_DmpRstStart(void *param)
{
- register struct bc_dumpTask *tdump;
- register afs_int32 code;
+ afs_int32 aindex = (intptr_t)param;
+ struct bc_dumpTask *tdump;
+ afs_int32 code;
tdump = &bc_dumpTasks[aindex];
free(tdump->portOffset);
tdump->flags &= ~BC_DI_INUSE;
- return code;
+ return (void *)(intptr_t)code;
}
/* bc_StartDmpRst
* function to start dump running. Packages the relevant information
* (from params) into any free dumpTask structure (globally allocated),
- * and then invokes bc_DmpRstStart to do the work, passing it a single
+ * and then invokes bc_DmpRstStart to do the work, passing it a single
* parameter, the index into the dumpTask array.
*
* entry:
* bc_Restorer for doing restores
*/
-bc_StartDmpRst(aconfig, adname, avname, avolsToDump, adestServer,
- adestPartition, afromDate, anewExt, aoldFlag, aparent, alevel,
- aproc, ports, portCount, dsptr, append, dontExecute)
- struct bc_config *aconfig;
- char *adname;
- char *avname;
- struct bc_volumeDump *avolsToDump;
- struct sockaddr_in *adestServer;
- afs_int32 adestPartition;
- afs_int32 afromDate;
- char *anewExt;
- int aoldFlag;
- afs_int32 aparent, alevel;
- int (*aproc) ();
- afs_int32 *ports;
- afs_int32 portCount;
- struct bc_dumpSchedule *dsptr;
- int append, dontExecute;
+int
+bc_StartDmpRst(struct bc_config *aconfig, char *adname, char *avname,
+ struct bc_volumeDump *avolsToDump,
+ struct sockaddr_in *adestServer,
+ afs_int32 adestPartition, afs_int32 afromDate, char *anewExt,
+ int aoldFlag, afs_int32 aparent, afs_int32 alevel,
+ int (*aproc) (int), afs_int32 *ports, afs_int32 portCount,
+ struct bc_dumpSchedule *dsptr, int append, int dontExecute)
{
- register int i;
- register afs_int32 code;
- char *junk;
+ int i;
+ afs_int32 code;
+ PROCESS junk;
for (i = 0; i < BC_MAXSIMDUMPS; i++)
if (!(bc_dumpTasks[i].flags & BC_DI_INUSE))
break;
if (i >= BC_MAXSIMDUMPS) {
- com_err(whoami, BC_NOTLOCKED,
+ afs_com_err(whoami, BC_NOTLOCKED,
"All of the dump/restore slots are in use, try again later");
return (BC_NOTLOCKED);
}
code =
LWP_CreateProcess(bc_DmpRstStart, 20480, LWP_NORMAL_PRIORITY,
- (void *)i, "helper", &junk);
+ (void *)(intptr_t)i, "helper", &junk);
if (code) {
bc_HandleMisc(code);
- com_err(whoami, code, "; Can't start thread");
+ afs_com_err(whoami, code, "; Can't start thread");
/* Cleanup allocated data structures */
freeDumpTaskVolumeList(bc_dumpTasks[i].volumes);
*/
afs_int32
-bc_FindDumpSlot(dumpID, port)
- afs_int32 dumpID;
- afs_int32 port;
+bc_FindDumpSlot(afs_int32 dumpID, afs_int32 port)
{
int i;
* label a tape
*/
-bc_LabelTape(afsname, pname, size, config, port)
- char *afsname, *pname;
- struct bc_config *config;
- afs_int32 port;
- afs_int32 size;
+int
+bc_LabelTape(char *afsname, char *pname, afs_int32 size,
+ struct bc_config *config, afs_int32 port)
{
struct rx_connection *tconn;
afs_int32 code = 0;
code = TC_LabelTape(tconn, &label, &taskId);
if (code) {
- com_err(whoami, code, "; Failed to start labeltape");
+ afs_com_err(whoami, code, "; Failed to start labeltape");
return (code);
}
* a tape
*/
-bc_ReadLabel(config, port)
- struct bc_config *config;
- afs_int32 port;
+int
+bc_ReadLabel(struct bc_config *config, afs_int32 port)
{
struct rx_connection *tconn;
struct tc_tapeLabel label;
printf("Tape read was unlabelled\n");
return 0;
}
- com_err(whoami, code, "; Failed to start readlabel");
+ afs_com_err(whoami, code, "; Failed to start readlabel");
return (code);
}
printf("Tape read was labelled : <NULL> size : %u\n", label.size);
} else if (!label.tapeId) {
printf("Tape read was labelled : %s size : %lu Kbytes\n", tname,
- label.size);
+ (long unsigned int) label.size);
} else {
printf("Tape read was labelled : %s (%lu) size : %lu Kbytes\n", tname,
- label.tapeId, label.size);
+ (long unsigned int) label.tapeId, (long unsigned int) label.size);
}
return 0;
}
-bc_ScanDumps(config, dbAddFlag, port)
- struct bc_config *config;
- afs_int32 dbAddFlag;
- afs_int32 port;
+int
+bc_ScanDumps(struct bc_config *config, afs_int32 dbAddFlag, afs_int32 port)
{
struct rx_connection *tconn;
statusP statusPtr;
code = TC_ScanDumps(tconn, dbAddFlag, &taskId);
if (code) {
- com_err(whoami, code, "; Failed to start scantape");
+ afs_com_err(whoami, code, "; Failed to start scantape");
return (code);
}
/* get a connection to the tape controller */
afs_int32
-bc_GetConn(aconfig, aport, tconn)
- struct bc_config *aconfig;
- afs_int32 aport;
- struct rx_connection **tconn;
+bc_GetConn(struct bc_config *aconfig, afs_int32 aport,
+ struct rx_connection **tconn)
{
- afs_int32 code = 0;
afs_uint32 host;
unsigned short port;
static struct rx_securityClass *rxsc;
/* CheckTCVersion
* make sure we are talking to a compatible butc process.
- * exit:
+ * exit:
* 0 - ok
* -1 - not compatible
*/
-CheckTCVersion(tconn)
- struct rx_connection *tconn;
+int
+CheckTCVersion(struct rx_connection *tconn)
{
struct tc_tcInfo tci;
afs_int32 code;
return 0;
}
-ConnectButc(config, port, tconn)
- struct bc_config *config;
- afs_int32 port;
- struct rx_connection **tconn;
+int
+ConnectButc(struct bc_config *config, afs_int32 port,
+ struct rx_connection **tconn)
{
afs_int32 code;
code = bc_GetConn(config, port, tconn);
if (code) {
- com_err(whoami, code,
+ afs_com_err(whoami, code,
"; Can't connect to tape coordinator at port %d", port);
return (code);
}
rx_DestroyConnection(*tconn);
if (code == BC_VERSIONFAIL)
- com_err(whoami, code,
+ afs_com_err(whoami, code,
"; Backup and butc are not the same version");
else
- com_err(whoami, code,
+ afs_com_err(whoami, code,
"; Can't access tape coordinator at port %d", port);
return (code);