]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/bsr.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / dird / bsr.c
index 2321580aa26ba71086b43590a7c954c2b5b8475a..4d26e22c0cf091a0525ad553c37dc6550ef82cf2 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 /*
-   Copyright (C) 2002-2006 Kern Sibbald
+   Copyright (C) 2002-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -53,27 +53,6 @@ static void free_findex(RBSR_FINDEX *fi)
    }
 }
 
-/* 
- * Get storage device name from Storage resource
- */
-static bool get_storage_device(char *device, char *storage)
-{
-   STORE *store;
-   if (storage[0] == 0) {
-      return false;
-   }
-   store = (STORE *)GetResWithName(R_STORAGE, storage);    
-   if (!store) {
-      return false;
-   }
-   DEVICE *dev = (DEVICE *)(store->device->first());
-   if (!dev) {
-      return false;
-   }
-   bstrncpy(device, dev->hdr.name, MAX_NAME_LENGTH);
-   return true;
-}
-
 /*
  * Our data structures were not designed completely
  *  correctly, so the file indexes cover the full
@@ -191,6 +170,9 @@ bool complete_bsr(UAContext *ua, RBSR *bsr)
    return true;
 }
 
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+static uint32_t uniq = 0;
 void make_unique_restore_filename(UAContext *ua, POOLMEM **fname)
 {
    JCR *jcr = ua->jcr;
@@ -199,10 +181,16 @@ void make_unique_restore_filename(UAContext *ua, POOLMEM **fname)
       Mmsg(fname, "%s", ua->argv[i]);              
       jcr->unlink_bsr = false;
    } else {
-      Mmsg(fname, "%s/%s.restore.%s.bsr", working_directory, my_name, 
-         jcr->Job);
+      P(mutex);
+      uniq++;
+      V(mutex);
+      Mmsg(fname, "%s/%s.%u.restore.bsr", working_directory, my_name, uniq);
       jcr->unlink_bsr = true;
    }
+   if (jcr->RestoreBootstrap) {
+      free(jcr->RestoreBootstrap);
+   }
+   jcr->RestoreBootstrap = bstrdup(*fname);
 }
 
 /*
@@ -299,7 +287,6 @@ static uint32_t write_bsr(UAContext *ua, RESTORE_CTX &rx, FILE *fd)
    bool first = true;
    char *p;
    JobId_t JobId;
-   char device[MAX_NAME_LENGTH];
    RBSR *bsr;
    if (*rx.JobIds == 0) {
       for (bsr=rx.bsr; bsr; bsr=bsr->next) {
@@ -315,12 +302,6 @@ static uint32_t write_bsr(UAContext *ua, RESTORE_CTX &rx, FILE *fd)
             }
             fprintf(fd, "Volume=\"%s\"\n", bsr->VolParams[i].VolumeName);
             fprintf(fd, "MediaType=\"%s\"\n", bsr->VolParams[i].MediaType);
-            if (get_storage_device(device, bsr->VolParams[i].Storage)) {
-               fprintf(fd, "Device=\"%s\"\n", device);
-            }
-            if (bsr->VolParams[i].Slot > 0) {
-               fprintf(fd, "Slot=%d\n", bsr->VolParams[i].Slot);
-            }
             fprintf(fd, "VolSessionId=%u\n", bsr->VolSessionId);
             fprintf(fd, "VolSessionTime=%u\n", bsr->VolSessionTime);
             if (bsr->VolParams[i].StartFile == bsr->VolParams[i].EndFile) {
@@ -374,12 +355,6 @@ static uint32_t write_bsr(UAContext *ua, RESTORE_CTX &rx, FILE *fd)
             }
             fprintf(fd, "Volume=\"%s\"\n", bsr->VolParams[i].VolumeName);
             fprintf(fd, "MediaType=\"%s\"\n", bsr->VolParams[i].MediaType);
-            if (get_storage_device(device, bsr->VolParams[i].Storage)) {
-               fprintf(fd, "Device=\"%s\"\n", device);
-            }
-            if (bsr->VolParams[i].Slot > 0) {
-               fprintf(fd, "Slot=%d\n", bsr->VolParams[i].Slot);
-            }
             fprintf(fd, "VolSessionId=%u\n", bsr->VolSessionId);
             fprintf(fd, "VolSessionTime=%u\n", bsr->VolSessionTime);
             if (bsr->VolParams[i].StartFile == bsr->VolParams[i].EndFile) {