backup deletedump: Change -port to -portoffset
[openafs.git] / src / bucoord / commands.c
index e702c40..daeb791 100644 (file)
@@ -24,6 +24,7 @@
 #include <afs/budb_prototypes.h>
 #include <afs/butc.h>
 #include <afs/bubasics.h>      /* PA */
+#include <afs/afsint.h>
 #include <afs/volser.h>
 #include <afs/voldefs.h>       /* PA */
 #include <afs/vldbint.h>       /* PA */
@@ -313,7 +314,7 @@ EvalVolumeSet2(struct bc_config *aconfig,
                        ERROR(BC_NOMEM);
                    }
 
-                   tvd->name = (char *)malloc(strlen(entries[e].name) + 10);
+                   tvd->name = malloc(strlen(entries[e].name) + 10);
                    if (!(tvd->name)) {
                        afs_com_err(whoami, BC_NOMEM, NULL);
                        free(tvd);
@@ -581,7 +582,7 @@ EvalVolumeSet1(struct bc_config *aconfig,
                    return (BC_NOMEM);
                }
 
-               tvd->name = (char *)malloc(strlen(entry.name) + 10);
+               tvd->name = malloc(strlen(entry.name) + 10);
                if (!(tvd->name)) {
                    afs_com_err(whoami, BC_NOMEM, NULL);
                    free(tvd);
@@ -759,7 +760,7 @@ concatParams(struct cmd_item *itemPtr)
        return (NULL);
     }
 
-    string = (char *)malloc(length);   /* allocate the string */
+    string = malloc(length);   /* allocate the string */
     if (!string) {
        afs_com_err(whoami, BC_NOMEM, NULL);
        return (NULL);
@@ -1161,21 +1162,17 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
     }
 
     /* specified other destination host */
-    if (as->parms[0].items) {
-       tp = as->parms[0].items->data;
-       if (bc_ParseHost(tp, &destServ)) {
-           afs_com_err(whoami, 0, "Failed to locate destination host '%s'", tp);
-           return -1;
-       }
+    tp = as->parms[0].items->data;
+    if (bc_ParseHost(tp, &destServ)) {
+       afs_com_err(whoami, 0, "Failed to locate destination host '%s'", tp);
+       return -1;
     }
 
     /* specified other destination partition */
-    if (as->parms[1].items) {
-       tp = as->parms[1].items->data;
-       if (bc_GetPartitionID(tp, &destPartition)) {
-           afs_com_err(whoami, 0, "Can't parse destination partition '%s'", tp);
-           return -1;
-       }
+    tp = as->parms[1].items->data;
+    if (bc_GetPartitionID(tp, &destPartition)) {
+       afs_com_err(whoami, 0, "Can't parse destination partition '%s'", tp);
+       return -1;
     }
 
     for (ti = as->parms[2].items; ti; ti = ti->next) {
@@ -1186,7 +1183,7 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
            return BC_NOMEM;
        }
 
-       tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
+       tvol->name = malloc(VOLSER_MAXVOLNAME + 1);
        if (!tvol->name) {
            afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
@@ -1226,7 +1223,7 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
     if (as->parms[5].items) {
        for (ti = as->parms[5].items; ti; ti = ti->next)
            portCount++;
-       ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
+       ports = malloc(portCount * sizeof(afs_int32));
        if (!ports) {
            afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
@@ -1356,7 +1353,7 @@ bc_DiskRestoreCmd(struct cmd_syndesc *as, void *arock)
     if (as->parms[2].items) {
        for (ti = as->parms[2].items; ti; ti = ti->next)
            portCount++;
-       ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
+       ports = malloc(portCount * sizeof(afs_int32));
        if (!ports) {
            afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
@@ -1525,7 +1522,7 @@ bc_VolsetRestoreCmd(struct cmd_syndesc *as, void *arock)
            /* Allocate a volumeDump structure and link it in */
            tvol = calloc(1, sizeof(struct bc_volumeDump));
 
-           tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
+           tvol->name = malloc(VOLSER_MAXVOLNAME + 1);
            if (!tvol->name) {
                afs_com_err(whoami, BC_NOMEM, NULL);
                return BC_NOMEM;
@@ -1551,7 +1548,7 @@ bc_VolsetRestoreCmd(struct cmd_syndesc *as, void *arock)
     if (as->parms[2].items) {
        for (ti = as->parms[2].items; ti; ti = ti->next)
            portCount++;
-       ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
+       ports = malloc(portCount * sizeof(afs_int32));
        if (!ports) {
            afs_com_err(whoami, BC_NOMEM, NULL);
            return BC_NOMEM;
@@ -1706,7 +1703,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
 
        /* get the port number, if one was specified */
        if (as->parms[2].items) {
-           portp = (afs_int32 *) malloc(sizeof(afs_int32));
+           portp = malloc(sizeof(afs_int32));
            if (!portp) {
                afs_com_err(whoami, BC_NOMEM, NULL);
                return BC_NOMEM;
@@ -1787,7 +1784,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
            sprintf(statusPtr->taskName, "Scheduled Dump");
            statusPtr->jobNumber = bc_jobNumber();
            statusPtr->scheduledDump = atTime;
-           statusPtr->cmdLine = (char *)malloc(length);
+           statusPtr->cmdLine = malloc(length);
            if (!statusPtr->cmdLine) {
                afs_com_err(whoami, BC_NOMEM, NULL);
                return BC_NOMEM;
@@ -2448,7 +2445,7 @@ bc_deleteDumpCmd(struct cmd_syndesc *as, void *arock)
        havetime = 1;
     }
 
-    port = (as->parms[3].items ? getPortOffset(as->parms[3].items->data) : 0); /* -port */
+    port = (as->parms[3].items ? getPortOffset(as->parms[3].items->data) : 0); /* -portoffset */
     if (as->parms[5].items)    /* -dbonly */
        port = -1;