]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/stored/bsr.h
Fix truncate race bug #1382
[bacula/bacula] / bacula / src / stored / bsr.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2015 Kern Sibbald
5    Copyright (C) 2002-2014 Free Software Foundation Europe e.V.
6
7    The original author of Bacula is Kern Sibbald, with contributions
8    from many others, a complete list can be found in the file AUTHORS.
9
10    You may use this file and others of this release according to the
11    license defined in the LICENSE file, which includes the Affero General
12    Public License, v3.0 ("AGPLv3") and some additional permissions and
13    terms pursuant to its AGPLv3 Section 7.
14
15    This notice must be preserved when any source code is 
16    conveyed and/or propagated.
17
18    Bacula(R) is a registered trademark of Kern Sibbald.
19 */
20 /*
21  * BootStrap record definition -- for restoring files.
22  *
23  *    Kern Sibbald, June 2002
24  *
25  */
26
27
28 #ifndef __BSR_H
29 #define __BSR_H 1
30
31 #ifndef HAVE_REGEX_H
32 #include "lib/bregex.h"
33 #else
34 #include <regex.h>
35 #endif
36
37 /*
38  * List of Volume names to be read by Storage daemon.
39  *  Formed by Storage daemon from BSR
40  */
41 struct VOL_LIST {
42    VOL_LIST *next;
43    char VolumeName[MAX_NAME_LENGTH];
44    char MediaType[MAX_NAME_LENGTH];
45    char device[MAX_NAME_LENGTH];   /* ***FIXME*** use alist here */
46    int Slot;
47    uint32_t start_file;
48 };
49
50
51 /*
52  * !!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
53  * !!!                                               !!!
54  * !!!   All records must have a pointer to          !!!
55  * !!!   the next item as the first item defined.    !!!
56  * !!!                                               !!!
57  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
58  */
59
60 struct BSR_VOLUME {
61    BSR_VOLUME *next;
62    char VolumeName[MAX_NAME_LENGTH];
63    char MediaType[MAX_NAME_LENGTH];
64    char device[MAX_NAME_LENGTH];   /* ***FIXME*** use alist here */
65    int32_t       Slot;                /* Slot */
66 };
67
68 struct BSR_CLIENT {
69    BSR_CLIENT *next;
70    char ClientName[MAX_NAME_LENGTH];
71 };
72
73 struct BSR_SESSID {
74    BSR_SESSID *next;
75    uint32_t sessid;
76    uint32_t sessid2;
77 };
78
79 struct BSR_SESSTIME {
80    BSR_SESSTIME *next;
81    uint32_t sesstime;
82    bool done;                         /* local done */
83 };
84
85 struct BSR_VOLFILE {
86    BSR_VOLFILE *next;
87    uint32_t sfile;                    /* start file */
88    uint32_t efile;                    /* end file */
89    bool done;                         /* local done */
90 };
91
92 struct BSR_VOLBLOCK {
93    BSR_VOLBLOCK *next;
94    uint32_t sblock;                   /* start block */
95    uint32_t eblock;                   /* end block */
96    bool done;                         /* local done */
97 };
98
99 struct BSR_VOLADDR {
100    BSR_VOLADDR *next;
101    uint64_t saddr;                   /* start address */
102    uint64_t eaddr;                   /* end address */
103    bool done;                        /* local done */
104 };
105
106 struct BSR_FINDEX {
107    BSR_FINDEX *next;
108    int32_t findex;                    /* start file index */
109    int32_t findex2;                   /* end file index */
110    bool done;                         /* local done */
111 };
112
113 struct BSR_JOBID {
114    BSR_JOBID *next;
115    uint32_t JobId;
116    uint32_t JobId2;
117 };
118
119 struct BSR_JOBTYPE {
120    BSR_JOBTYPE *next;
121    uint32_t JobType;
122 };
123
124 struct BSR_JOBLEVEL {
125    BSR_JOBLEVEL *next;
126    uint32_t JobLevel;
127 };
128
129 struct BSR_JOB {
130    BSR_JOB *next;
131    char Job[MAX_NAME_LENGTH];
132    bool done;                         /* local done */
133 };
134
135 struct BSR_STREAM {
136    BSR_STREAM *next;
137    int32_t stream;                    /* stream desired */
138 };
139
140 struct BSR {
141    /* NOTE!!! next must be the first item */
142    BSR          *next;                /* pointer to next one */
143    BSR          *prev;                /* pointer to previous one */
144    BSR          *root;                /* root bsr */
145    BSR          *cur_bsr;
146    bool          reposition;          /* set when any bsr is marked done */
147    bool          mount_next_volume;   /* set when next volume should be mounted */
148    bool          done;                /* set when everything found for this bsr */
149    bool          use_fast_rejection;  /* set if fast rejection can be used */
150    bool          use_positioning;     /* set if we can position the archive */
151    bool          skip_file;           /* skip all records for current file */
152    BSR_VOLUME   *volume;
153    uint32_t      count;               /* count of files to restore this bsr */
154    uint32_t      found;               /* count of restored files this bsr */
155    int32_t       LastFI;              /* LastFI seen by this bsr */
156    BSR_VOLFILE  *volfile;
157    BSR_VOLBLOCK *volblock;
158    BSR_VOLADDR  *voladdr;
159    BSR_SESSTIME *sesstime;
160    BSR_SESSID   *sessid;
161    BSR_JOBID    *JobId;
162    BSR_JOB      *job;
163    BSR_CLIENT   *client;
164    BSR_FINDEX   *FileIndex;
165    BSR_JOBTYPE  *JobType;
166    BSR_JOBLEVEL *JobLevel;
167    BSR_STREAM   *stream;
168    char         *fileregex;           /* set if restore is filtered on filename */
169    regex_t      *fileregex_re;
170    ATTR         *attr;                /* scratch space for unpacking */
171 };
172
173
174 #endif