*/
/*
- Copyright (C) 2002-2005 Kern Sibbald
+ Copyright (C) 2002-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
}
}
+/*
+ * 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
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;
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.restore.%u.bsr", working_directory, my_name, uniq);
jcr->unlink_bsr = true;
}
+ if (jcr->RestoreBootstrap) {
+ free(jcr->RestoreBootstrap);
+ }
+ jcr->RestoreBootstrap = bstrdup(*fname);
}
/*
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) {
}
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) {
}
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) {