8 Copyright (C) 2000-2005 Kern Sibbald
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2 of
13 the License, or (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public
21 License along with this program; if not, write to the Free
22 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 uint32_t new_VolSessionId();
31 DCR *acquire_device_for_append(DCR *dcr);
32 DCR *acquire_device_for_read(DCR *dcr);
33 bool release_device(DCR *dcr);
34 DCR *new_dcr(JCR *jcr, DEVICE *dev);
35 void free_dcr(DCR *dcr);
38 enum get_vol_info_rw {
39 GET_VOL_INFO_FOR_WRITE,
42 bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw);
43 bool dir_find_next_appendable_volume(DCR *dcr);
44 bool dir_update_volume_info(DCR *dcr, bool label);
45 bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr);
46 bool dir_ask_sysop_to_mount_volume(DCR *dcr);
47 bool dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec);
48 bool dir_send_job_status(JCR *jcr);
49 bool dir_create_jobmedia_record(DCR *dcr);
50 bool dir_update_device(JCR *jcr, DEVICE *dev);
51 bool dir_update_changer(JCR *jcr, AUTOCHANGER *changer);
54 int authenticate_director(JCR *jcr);
55 int authenticate_filed(JCR *jcr);
57 /* From autochanger.c */
58 int autoload_device(DCR *dcr, int writing, BSOCK *dir);
59 bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd);
60 char *edit_device_codes(DCR *dcr, char *omsg, const char *imsg, const char *cmd);
63 void dump_block(DEV_BLOCK *b, const char *msg);
64 DEV_BLOCK *new_block(DEVICE *dev);
65 DEV_BLOCK *dup_block(DEV_BLOCK *eblock);
66 void init_block_write(DEV_BLOCK *block);
67 void empty_block(DEV_BLOCK *block);
68 void free_block(DEV_BLOCK *block);
69 bool write_block_to_device(DCR *dcr);
70 bool write_block_to_dev(DCR *dcr);
71 void print_block_read_errors(JCR *jcr, DEV_BLOCK *block);
72 void ser_block_header(DEV_BLOCK *block);
74 #define CHECK_BLOCK_NUMBERS true
75 #define NO_BLOCK_NUMBER_CHECK false
76 bool read_block_from_device(DCR *dcr, bool check_block_numbers);
77 bool read_block_from_dev(DCR *dcr, bool check_block_numbers);
79 /* From butil.c -- utilities for SD tool programs */
80 void print_ls_output(const char *fname, const char *link, int type, struct stat *statp);
81 JCR *setup_jcr(const char *name, char *dev_name, BSR *bsr,
82 const char *VolumeName, int mode);
83 void display_tape_error_status(JCR *jcr, DEVICE *dev);
87 DEVICE *init_dev(JCR *jcr, DEVICE *dev, DEVRES *device);
88 int open_dev(DEVICE *dev, char *VolName, int mode);
89 off_t lseek_dev(DEVICE *dev, off_t offset, int whence);
90 int open_first_part(DEVICE *dev);
91 int open_next_part(DEVICE *dev);
92 int open_guess_name_dev(DEVICE *dev);
93 void close_dev(DEVICE *dev);
94 void force_close_dev(DEVICE *dev);
95 bool truncate_dev(DEVICE *dev);
96 void term_dev(DEVICE *dev);
97 char * strerror_dev(DEVICE *dev);
98 void clrerror_dev(DEVICE *dev, int func);
99 bool update_pos_dev(DEVICE *dev);
100 bool rewind_dev(DEVICE *dev);
101 bool load_dev(DEVICE *dev);
102 bool offline_dev(DEVICE *dev);
103 int flush_dev(DEVICE *dev);
104 int weof_dev(DEVICE *dev, int num);
105 int write_block(DEVICE *dev);
106 uint32_t status_dev(DEVICE *dev);
107 bool eod_dev(DEVICE *dev);
108 bool fsf_dev(DEVICE *dev, int num);
109 bool bsf_dev(DEVICE *dev, int num);
110 bool bsr_dev(DEVICE *dev, int num);
111 void attach_jcr_to_device(DEVICE *dev, JCR *jcr);
112 void detach_jcr_from_device(DEVICE *dev, JCR *jcr);
113 JCR *next_attached_jcr(DEVICE *dev, JCR *jcr);
114 bool offline_or_rewind_dev(DEVICE *dev);
115 bool reposition_dev(DEVICE *dev, uint32_t file, uint32_t block);
116 void init_device_wait_timers(DCR *dcr);
117 void init_jcr_device_wait_timers(JCR *jcr);
118 bool double_dev_wait_time(DEVICE *dev);
120 /* Get info about device */
121 char * dev_vol_name(DEVICE *dev);
122 uint32_t dev_block(DEVICE *dev);
123 uint32_t dev_file(DEVICE *dev);
126 bool dvd_close_job(DCR *dcr);
130 bool open_device(DCR *dcr);
131 bool first_open_device(DEVICE *dev);
132 bool fixup_device_block_write_error(DCR *dcr);
133 void _lock_device(const char *file, int line, DEVICE *dev);
134 void _unlock_device(const char *file, int line, DEVICE *dev);
135 void _block_device(const char *file, int line, DEVICE *dev, int state);
136 void _unblock_device(const char *file, int line, DEVICE *dev);
137 void _steal_device_lock(const char *file, int line, DEVICE *dev, bsteal_lock_t *hold, int state);
138 void _give_back_device_lock(const char *file, int line, DEVICE *dev, bsteal_lock_t *hold);
139 void set_new_volume_parameters(DCR *dcr);
140 void set_new_file_parameters(DCR *dcr);
141 bool device_is_unmounted(DEVICE *dev);
142 void dev_lock(DEVICE *dev);
143 void dev_unlock(DEVICE *dev);
144 const char *edit_blocked_reason(DEVICE *dev);
147 void *handle_connection_request(void *arg);
151 void run_job(JCR *jcr);
152 bool bootstrap_cmd(JCR *jcr);
155 void stored_free_jcr(JCR *jcr);
156 void connection_from_filed(void *arg);
157 void handle_filed_connection(BSOCK *fd, char *job_name);
160 int read_dev_volume_label(DCR *dcr);
161 int read_dev_volume_label_guess(DCR *dcr, bool write);
162 void create_session_label(DCR *dcr, DEV_RECORD *rec, int label);
163 void create_volume_label(DEVICE *dev, const char *VolName, const char *PoolName);
164 bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, const char *PoolName);
165 #define ANSI_VOL_LABEL 0
166 #define ANSI_EOF_LABEL 1
167 #define ANSI_EOV_LABEL 2
168 bool write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName);
169 int read_ansi_ibm_label(DCR *dcr);
170 bool write_session_label(DCR *dcr, int label);
171 bool write_volume_label_to_block(DCR *dcr);
172 bool rewrite_volume_label(DCR *dcr, bool recycle);
173 void dump_volume_label(DEVICE *dev);
174 void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose);
175 bool unser_volume_label(DEVICE *dev, DEV_RECORD *rec);
176 bool unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
178 /* From match_bsr.c */
179 int match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec,
180 SESSION_LABEL *sesrec);
181 int match_bsr_block(BSR *bsr, DEV_BLOCK *block);
182 void position_bsr_block(BSR *bsr, DEV_BLOCK *block);
183 BSR *find_next_bsr(BSR *root_bsr, DEVICE *dev);
184 bool match_set_eof(BSR *bsr, DEV_RECORD *rec);
187 bool mount_next_write_volume(DCR *dcr, bool release);
188 bool mount_next_read_volume(DCR *dcr);
189 void release_volume(DCR *ddr);
190 void mark_volume_in_error(DCR *dcr);
192 /* From parse_bsr.c */
193 BSR *parse_bsr(JCR *jcr, char *lf);
194 void dump_bsr(BSR *bsr, bool recurse);
195 void free_bsr(BSR *bsr);
197 int add_vol(JCR *jcr, VOL_LIST *vol);
198 void free_vol_list(JCR *jcr);
199 void create_vol_list(JCR *jcr);
202 const char *FI_to_ascii(int fi);
203 const char *stream_to_ascii(int stream, int fi);
204 bool write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
205 bool can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
206 bool read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec);
207 DEV_RECORD *new_record();
208 void free_record(DEV_RECORD *rec);
209 void empty_record(DEV_RECORD *rec);
211 /* From read_record.c */
212 bool read_records(DCR *dcr,
213 bool record_cb(DCR *dcr, DEV_RECORD *rec),
214 bool mount_cb(DCR *dcr));
217 bool begin_data_spool (DCR *dcr);
218 bool discard_data_spool (DCR *dcr);
219 bool commit_data_spool (DCR *dcr);
220 bool are_attributes_spooled (JCR *jcr);
221 bool begin_attribute_spool (JCR *jcr);
222 bool discard_attribute_spool (JCR *jcr);
223 bool commit_attribute_spool (JCR *jcr);
224 bool write_block_to_spool_file (DCR *dcr);
225 void list_spool_stats (BSOCK *bs);
228 int wait_for_sysop(DCR *dcr);
229 bool wait_for_device(JCR *jcr, bool first);