backup: pass in valid dummy pid for LWP
[openafs.git] / src / bucoord / dump.c
index 4a373f1..6f5d175 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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>
 
+#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
@@ -51,14 +55,14 @@ 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
  */
 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;
@@ -67,9 +71,9 @@ bc_Dumper(int aindex)
 
     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];
 
@@ -83,14 +87,14 @@ bc_Dumper(int 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) {
-       afs_com_err(whoami, BC_NOMEM, "");
+       afs_com_err(whoami, BC_NOMEM, NULL);
        ERROR(BC_NOMEM);
     }
 
@@ -191,15 +195,15 @@ freeDumpTaskVolumeList(struct bc_volumeDump *vdptr)
 }
 
 /* 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.
  */
 void *
 bc_DmpRstStart(void *param)
 {
-    afs_int32 aindex = (afs_int32) 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];
 
@@ -220,13 +224,13 @@ bc_DmpRstStart(void *param)
        free(tdump->portOffset);
     tdump->flags &= ~BC_DI_INUSE;
 
-    return (void *)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:
@@ -236,17 +240,17 @@ bc_DmpRstStart(void *param)
  */
 
 int
-bc_StartDmpRst(struct bc_config *aconfig, char *adname, char *avname, 
-              struct bc_volumeDump *avolsToDump, 
+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, 
+              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, 
+              int (*aproc) (int), afs_int32 *ports, afs_int32 portCount,
               struct bc_dumpSchedule *dsptr, int append, int dontExecute)
 {
-    register int i;
-    register afs_int32 code;
-    void *junk = NULL;
+    int i;
+    afs_int32 code;
+    PROCESS junk;
 
     for (i = 0; i < BC_MAXSIMDUMPS; i++)
        if (!(bc_dumpTasks[i].flags & BC_DI_INUSE))
@@ -289,7 +293,7 @@ bc_StartDmpRst(struct bc_config *aconfig, char *adname, char *avname,
 
     code =
        LWP_CreateProcess(bc_DmpRstStart, 20480, LWP_NORMAL_PRIORITY,
-                         (void *)i, "helper", junk);
+                         (void *)(intptr_t)i, "helper", &junk);
     if (code) {
        bc_HandleMisc(code);
        afs_com_err(whoami, code, "; Can't start thread");
@@ -345,7 +349,7 @@ bc_FindDumpSlot(afs_int32 dumpID, afs_int32 port)
  */
 
 int
-bc_LabelTape(char *afsname, char *pname, afs_int32 size, 
+bc_LabelTape(char *afsname, char *pname, afs_int32 size,
             struct bc_config *config, afs_int32 port)
 {
     struct rx_connection *tconn;
@@ -471,7 +475,7 @@ bc_ScanDumps(struct bc_config *config, afs_int32 dbAddFlag, afs_int32 port)
 
 /* get a connection to the tape controller */
 afs_int32
-bc_GetConn(struct bc_config *aconfig, afs_int32 aport, 
+bc_GetConn(struct bc_config *aconfig, afs_int32 aport,
           struct rx_connection **tconn)
 {
     afs_uint32 host;
@@ -506,7 +510,7 @@ bc_GetConn(struct bc_config *aconfig, afs_int32 aport,
 
 /* CheckTCVersion
  *     make sure we are talking to a compatible butc process.
- * exit: 
+ * exit:
  *     0 - ok
  *     -1 - not compatible
  */
@@ -528,7 +532,7 @@ CheckTCVersion(struct rx_connection *tconn)
 }
 
 int
-ConnectButc(struct bc_config *config, afs_int32 port, 
+ConnectButc(struct bc_config *config, afs_int32 port,
            struct rx_connection **tconn)
 {
     afs_int32 code;