-/*
- * BootStrap record definition -- for restoring files.
- *
- * Kern Sibbald, June 2002
- *
- * Version $Id$
- *
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * BootStrap record definition -- for restoring files.
+ *
+ * Kern Sibbald, June 2002
+ *
+ * Version $Id$
+ *
+ */
#ifndef __BSR_H
};
struct BSR {
+ /* NOTE!!! next must be the first item */
BSR *next; /* pointer to next one */
+ BSR *prev; /* pointer to previous one */
BSR *root; /* root bsr */
bool reposition; /* set when any bsr is marked done */
bool mount_next_volume; /* set when next volume should be mounted */
}
if (bsr->volume) {
bsr->next = new_bsr();
+ bsr->next->prev = bsr;
bsr = bsr->next;
}
/* This may actually be more than one volume separated by a |
}
}
-void free_bsr(BSR *bsr)
+/*
+ * Remove a single item from the bsr tree
+ */
+void remove_bsr(BSR *bsr)
{
- if (!bsr) {
- return;
- }
free_bsr_item((BSR *)bsr->volume);
free_bsr_item((BSR *)bsr->client);
free_bsr_item((BSR *)bsr->sessid);
free_bsr_item((BSR *)bsr->FileIndex);
free_bsr_item((BSR *)bsr->JobType);
free_bsr_item((BSR *)bsr->JobLevel);
- if (bsr->fileregex) bfree(bsr->fileregex);
+ if (bsr->fileregex) {
+ bfree(bsr->fileregex);
+ }
if (bsr->fileregex_re) {
regfree(bsr->fileregex_re);
free(bsr->fileregex_re);
}
- if (bsr->attr) free_attr(bsr->attr);
-
- free_bsr(bsr->next);
+ if (bsr->attr) {
+ free_attr(bsr->attr);
+ }
+ if (bsr->next) {
+ bsr->next->prev = bsr->prev;
+ }
+ if (bsr->prev) {
+ bsr->prev->next = bsr->next;
+ }
free(bsr);
}
+/*
+ * Free all bsrs in chain
+ */
+void free_bsr(BSR *bsr)
+{
+ BSR *next_bsr;
+
+ if (!bsr) {
+ return;
+ }
+ next_bsr = bsr->next;
+ /* Remove (free) current bsr */
+ remove_bsr(bsr);
+ /* Now get the next one */
+ free_bsr(next_bsr);
+}
+
/*****************************************************************
* Routines for handling volumes
*/
mixed priorities
General:
+19Nov08
+kes Use doubly linked bsr list so that consumed bsrs may be
+ removed. Removing not yet implemented.
18Nov08
kes Implement a fix that very likely fixes the undesired volume
purge reported by Graham Keeling.