]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/bsr.c
Fix Win32 build -- turn off lockmgr and remove lockmgr defs
[bacula/bacula] / bacula / src / dird / bsr.c
index 81e384314dda741e32720430cad63b09fa2055f4..24cabc3449998b1e2f823db3ad50f6ff92ad19ed 100644 (file)
@@ -254,14 +254,43 @@ bail_out:
    return count;
 }
 
-void display_bsr_info(UAContext *ua, RESTORE_CTX &rx)
+static void display_vol_info(UAContext *ua, RESTORE_CTX &rx, JobId_t JobId)
 {
-   char *p;
    POOL_MEM volmsg(PM_MESSAGE);
-   JobId_t JobId;
    char Device[MAX_NAME_LENGTH];
+   char online;
    RBSR *bsr;
 
+   for (bsr=rx.bsr; bsr; bsr=bsr->next) {
+      if (JobId && JobId != bsr->JobId) {
+         continue;
+      }
+
+      for (int i=0; i < bsr->VolCount; i++) {
+         if (bsr->VolParams[i].VolumeName[0]) {
+            if (!get_storage_device(Device, bsr->VolParams[i].Storage)) {
+               Device[0] = 0;
+            }
+            if (bsr->VolParams[i].InChanger && bsr->VolParams[i].Slot) {
+               online = '*';
+            } else {
+               online = ' ';
+            }
+            Mmsg(volmsg, "%c%-25.25s %-25.25s %-25.25s", 
+                 online, bsr->VolParams[i].VolumeName,
+                 bsr->VolParams[i].Storage,
+                 Device);
+            add_prompt(ua, volmsg.c_str());
+         }
+      }
+   }
+}
+
+void display_bsr_info(UAContext *ua, RESTORE_CTX &rx)
+{
+   char *p;
+   JobId_t JobId;
+
    /* Tell the user what he will need to mount */
    ua->send_msg("\n");
    ua->send_msg(_("The job will require the following\n"
@@ -271,38 +300,11 @@ void display_bsr_info(UAContext *ua, RESTORE_CTX &rx)
    start_prompt(ua, "");
    if (*rx.JobIds == 0) {
       /* Print Volumes in any order */
-      for (bsr=rx.bsr; bsr; bsr=bsr->next) {
-         for (int i=0; i < bsr->VolCount; i++) {
-            if (bsr->VolParams[i].VolumeName[0]) {
-               if (!get_storage_device(Device, bsr->VolParams[i].Storage)) {
-                  Device[0] = 0;
-               }
-               Mmsg(volmsg, "%-25.25s %-25.25s %-25.25s", 
-                    bsr->VolParams[i].VolumeName, 
-                    bsr->VolParams[i].Storage, Device);
-               add_prompt(ua, volmsg.c_str());
-            }
-         }
-      }
+      display_vol_info(ua, rx, 0);
    } else {
       /* Ensure that the volumes are printed in JobId order */
       for (p=rx.JobIds; get_next_jobid_from_list(&p, &JobId) > 0; ) {
-         for (bsr=rx.bsr; bsr; bsr=bsr->next) {
-            if (JobId != bsr->JobId) {
-               continue;
-            }
-            for (int i=0; i < bsr->VolCount; i++) {
-               if (bsr->VolParams[i].VolumeName[0]) {
-                  if (!get_storage_device(Device, bsr->VolParams[i].Storage)) {
-                     Device[0] = 0;
-                  }
-                  Mmsg(volmsg, "%-25.25s %-25.25s %-25.25s", 
-                       bsr->VolParams[i].VolumeName, 
-                       bsr->VolParams[i].Storage, Device);
-                  add_prompt(ua, volmsg.c_str());
-               }
-            }
-         }
+         display_vol_info(ua, rx, JobId);
       }
    }
    for (int i=0; i < ua->num_prompts; i++) {
@@ -311,6 +313,8 @@ void display_bsr_info(UAContext *ua, RESTORE_CTX &rx)
    }
    if (ua->num_prompts == 0) {
       ua->send_msg(_("No Volumes found to restore.\n"));
+   } else {
+      ua->send_msg(_("\nVolumes marked with \"*\" are online.\n"));
    }
    ua->num_prompts = 0;
    ua->send_msg("\n");