]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix tree relcd + add rate
authorKern Sibbald <kern@sibbald.com>
Mon, 19 Aug 2002 09:42:57 +0000 (09:42 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 19 Aug 2002 09:42:57 +0000 (09:42 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@103 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/backup.c
bacula/src/dird/ua_restore.c
bacula/src/lib/tree.c

index fd889b74b3a18d9c491769514de3e8b8ea9a328d..6015dd7349cb07998ae4e5761029899a634cd4d6 100644 (file)
@@ -296,6 +296,7 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since)
    char *term_msg;
    int msg_type;
    MEDIA_DBR mr;
+   double kbps;
 
    Dmsg0(100, "Enter backup_cleanup()\n");
    memset(&mr, 0, sizeof(mr));
@@ -342,6 +343,7 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since)
    }
    bstrftime(sdt, sizeof(sdt), jcr->jr.StartTime);
    bstrftime(edt, sizeof(edt), jcr->jr.EndTime);
+   kbps = (double)jcr->jr.JobBytes / (1000 * (jcr->jr.EndTime - jcr->jr.StartTime));
    if (!db_get_job_volume_names(jcr->db, jcr->jr.JobId, &jcr->VolumeName)) {
       jcr->VolumeName[0] = 0;        /* none */
    }
@@ -354,8 +356,9 @@ Backup Level:           %s%s\n\
 Client:                 %s\n\
 Start time:             %s\n\
 End time:               %s\n\
-Bytes Written:          %s\n\
 Files Written:          %s\n\
+Bytes Written:          %s\n\
+Rate:                   %.1f KBps\n\
 Volume names(s):        %s\n\
 Volume Session Id:      %d\n\
 Volume Session Time:    %d\n\
@@ -369,8 +372,9 @@ Termination:            %s\n\n"),
        jcr->client->hdr.name,
        sdt,
        edt,
-       edit_uint64_with_commas(jcr->jr.JobBytes, ec1),
-       edit_uint64_with_commas(jcr->jr.JobFiles, ec2),
+       edit_uint64_with_commas(jcr->jr.JobFiles, ec1),
+       edit_uint64_with_commas(jcr->jr.JobBytes, ec2),
+       (float)kbps,
        jcr->VolumeName,
        jcr->VolSessionId,
        jcr->VolSessionTime,
index 4f5922b37a1413b3e61059c9a9daadbdc6727ee5..2c3ff8b5bafd6bd28c21319e88870e0fb847cbe3 100644 (file)
@@ -563,6 +563,7 @@ static void user_select_files(TREE_CTX *tree)
         }
       if (!found) {
          bsendmsg(tree->ua, _("Illegal command. Enter \"done\" to exit.\n"));
+        continue;
       }
       if (!stat) {
         break;
index 59e1c60091cbf12e8455faa05e6ab8457c84859c..f89214cdb99f9bbb1be11f2fe273a4de8a3e96de 100755 (executable)
@@ -312,7 +312,7 @@ void print_tree(char *path, TREE_NODE *tree)
       print_tree(buf, tree->child);
       break;
    default:
-      Dmsg1(000, "Unknown node type %d\n", tree->type);
+      Pmsg1(000, "Unknown node type %d\n", tree->type);
    }
    print_tree(path, tree->sibling);
    return;
@@ -375,9 +375,11 @@ TREE_NODE *tree_relcwd(char *path, TREE_ROOT *root, TREE_NODE *node)
    } else {
       len = strlen(path);
    }
+   Dmsg2(100, "tree_relcwd: len=%d path=%s\n", len, path);
    for (cd=node->child; cd; cd=cd->sibling) {
-      if (strncmp(cd->fname, path, len) == 0) {
-         Dmsg1(100, "tree_relcwd: found cd=%s\n", cd->fname);
+      Dmsg1(100, "tree_relcwd: test cd=%s\n", cd->fname);
+      if (cd->fname[0] == path[0] && len == (int)strlen(cd->fname)    
+         && strncmp(cd->fname, path, len) == 0) {
         break;
       }
    }
@@ -421,14 +423,14 @@ int main(int argc, char *argv[])
     }
 
     node = (TREE_NODE *)root;
-    Dmsg0(000, "doing cd /home/kern/bacula/k/techlogs\n");
+    Pmsg0(000, "doing cd /home/kern/bacula/k/techlogs\n");
     node = tree_cwd("/home/kern/bacula/k/techlogs", root, node);
     if (node) {
        tree_getpath(node, buf, sizeof(buf));
        Dmsg2(100, "findex=%d: cwd=%s\n", node->FileIndex, buf);
     }
 
-    Dmsg0(000, "doing cd /home/kern/bacula/k/src/testprogs\n");
+    Pmsg0(000, "doing cd /home/kern/bacula/k/src/testprogs\n");
     node = tree_cwd("/home/kern/bacula/k/src/testprogs", root, node);
     if (node) {
        tree_getpath(node, buf, sizeof(buf));