-
Notifications
You must be signed in to change notification settings - Fork 256
/
dird.h
215 lines (175 loc) · 5.88 KB
/
dird.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
BAREOS® - Backup Archiving REcovery Open Sourced
Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
Copyright (C) 2011-2016 Planets Communications B.V.
Copyright (C) 2013-2016 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
/*
* Kern Sibbald, December MM
*/
/**
* @file
* Includes specific to the Director
*/
#include "lib/connection_pool.h"
#include "lib/runscript.h"
#include "lib/breg.h"
#include "lib/bsr.h"
#include "dird_conf.h"
#define DIRECTOR_DAEMON 1
#include "dir_plugins.h"
#include "cats/cats.h"
#include "jcr.h"
#include "bsr.h"
#include "ua.h"
#include "jobq.h"
/* Globals that dird.c exports */
extern DIRRES *me; /**< Our Global resource */
extern CONFIG *my_config; /**< Our Global config */
/* Used in ua_prune.c and ua_purge.c */
struct s_count_ctx {
int count;
};
#define MAX_DEL_LIST_LEN 2000000
struct del_ctx {
JobId_t *JobId; /**< array of JobIds */
char *PurgedFiles; /**< Array of PurgedFile flags */
int num_ids; /**< ids stored */
int max_ids; /**< size of array */
int num_del; /**< number deleted */
int tot_ids; /**< total to process */
};
/* Flags for find_next_volume_for_append() */
enum {
fnv_create_vol = true,
fnv_no_create_vol = false,
fnv_prune = true,
fnv_no_prune = false
};
enum e_enabled_val {
VOL_NOT_ENABLED = 0,
VOL_ENABLED = 1,
VOL_ARCHIVED = 2
};
enum e_prtmsg {
DISPLAY_ERROR,
NO_DISPLAY
};
enum e_pool_op {
POOL_OP_UPDATE,
POOL_OP_CREATE
};
enum e_move_op {
VOLUME_IMPORT,
VOLUME_EXPORT,
VOLUME_MOVE
};
enum e_slot_flag {
can_import = 0x01,
can_export = 0x02,
by_oper = 0x04,
by_mte = 0x08
};
typedef enum {
VOL_LIST_ALL,
VOL_LIST_PARTIAL
} vol_list_type;
typedef enum {
slot_type_unknown, /**< Unknown slot type */
slot_type_drive, /**< Drive slot */
slot_type_storage, /**< Storage slot */
slot_type_import, /**< Import/export slot */
slot_type_picker /**< Robotics */
} slot_type;
typedef enum {
slot_status_unknown, /**< Slot status is unknown */
slot_status_empty, /**< Slot is empty */
slot_status_full /**< Slot is full */
} slot_status;
enum s_mapping_type {
LOGICAL_TO_PHYSICAL,
PHYSICAL_TO_LOGICAL
};
/*
* Slot list definition
*/
struct vol_list_t {
dlink link; /** Link for list */
slot_number_t PhysicalSlotNumber; /**< Unique Slot Number */
slot_number_t LogicalDriveNumber; /**< Drive number when slot_type_drive or actual slot number */
slot_number_t CurrentlyLoadedSlot;/**< Volume loaded in drive when slot_type_drive */
slot_flags_t Flags; /**< Slot specific flags see e_slot_flag enum */
slot_type Type; /**< See slot_type_* */
slot_status SlotStatus; /**< See slot_status_* */
char *VolName; /**< Actual Volume Name */
};
struct changer_vol_list_t {
int16_t reference_count; /**< Number of references to this vol_list */
vol_list_type type; /**< Type of vol_list see vol_list_type enum */
utime_t timestamp; /**< When was this vol_list created */
dlist *contents; /**< SlotStatuss of autochanger */
};
/**
* same as smc_element_address_assignment
* from ndmp/smc.h
*/
struct smc_elem_aa {
unsigned mte_addr; /* media transport element */
unsigned mte_count;
unsigned se_addr; /* storage element */
unsigned se_count;
unsigned iee_addr; /* import/export element */
unsigned iee_count;
unsigned dte_addr; /* data transfer element */
unsigned dte_count;
};
#if HAVE_NDMP
struct ndmp_deviceinfo_t {
std::string device;
std::string model;
JobId_t JobIdUsingDevice;
};
#endif
struct runtime_storage_status_t {
int32_t NumConcurrentJobs; /**< Number of concurrent jobs running */
int32_t NumConcurrentReadJobs; /**< Number of jobs reading */
drive_number_t drives; /**< Number of drives in autochanger */
slot_number_t slots; /**< Number of slots in autochanger */
pthread_mutex_t changer_lock; /**< Any access to the autochanger is controlled by this lock */
unsigned char smc_ident[32]; /**< smc ident info = changer name */
smc_elem_aa storage_mapping; /**< smc element assignment */
changer_vol_list_t *vol_list; /**< Cached content of autochanger */
std::list<ndmp_deviceinfo_t> *ndmp_deviceinfo; /**< NDMP device info for devices in this Storage */
pthread_mutex_t ndmp_deviceinfo_lock; /**< Any access to the list devices is controlled by this lock */
};
struct runtime_client_status_t {
int32_t NumConcurrentJobs; /**< Number of concurrent jobs running */
};
struct runtime_job_status_t {
int32_t NumConcurrentJobs; /**< Number of concurrent jobs running */
};
#define INDEX_DRIVE_OFFSET 0
#define INDEX_MAX_DRIVES 100
#define INDEX_SLOT_OFFSET 100
#define FD_VERSION_1 1
#define FD_VERSION_2 2
#define FD_VERSION_3 3
#define FD_VERSION_4 4
#define FD_VERSION_5 5
#define FD_VERSION_51 51
#define FD_VERSION_52 52
#define FD_VERSION_53 53
#define FD_VERSION_54 54
#include "protos.h"