]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/stored/protos.h
- Tweak install chapter of French manual to add new paragraph
[bacula/bacula] / bacula / src / stored / protos.h
1 /*
2  * Protypes for stored
3  *
4  *   Version $Id$
5  */
6
7 /*
8    Copyright (C) 2000-2004 Kern Sibbald and John Walker
9
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.
14
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.
19
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,
23    MA 02111-1307, USA.
24
25  */
26    
27 /* From stored.c */
28 uint32_t new_VolSessionId();
29
30 /* From acquire.c */
31 DCR     *acquire_device_for_append(JCR *jcr);
32 DCR     *acquire_device_for_read(JCR *jcr);
33 bool     release_device(JCR *jcr);
34 DCR     *new_dcr(JCR *jcr, DEVICE *dev);
35 void     free_dcr(DCR *dcr);
36
37 /* From askdir.c */
38 enum get_vol_info_rw {
39    GET_VOL_INFO_FOR_WRITE,
40    GET_VOL_INFO_FOR_READ
41 };
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
51 /* authenticate.c */
52 int     authenticate_director(JCR *jcr);
53 int     authenticate_filed(JCR *jcr);
54
55 /* From autochanger.c */
56 int      autoload_device(DCR *dcr, int writing, BSOCK *dir);
57 bool     autochanger_list(DCR *dcr, BSOCK *dir);
58 void     invalidate_slot_in_catalog(DCR *dcr);
59 char    *edit_device_codes(JCR *jcr, char *omsg, const char *imsg, const char *cmd);
60
61 /* From block.c */
62 void    dump_block(DEV_BLOCK *b, const char *msg);
63 DEV_BLOCK *new_block(DEVICE *dev);
64 DEV_BLOCK *dup_block(DEV_BLOCK *eblock);
65 void    init_block_write(DEV_BLOCK *block);
66 void    empty_block(DEV_BLOCK *block);
67 void    free_block(DEV_BLOCK *block);
68 bool    write_block_to_device(DCR *dcr);
69 bool    write_block_to_dev(DCR *dcr);
70 void    print_block_read_errors(JCR *jcr, DEV_BLOCK *block);
71 void    ser_block_header(DEV_BLOCK *block);
72
73 #define CHECK_BLOCK_NUMBERS    true
74 #define NO_BLOCK_NUMBER_CHECK  false
75 bool    read_block_from_device(DCR *dcr, bool check_block_numbers);
76 bool    read_block_from_dev(DCR *dcr, bool check_block_numbers);
77
78 /* From butil.c -- utilities for SD tool programs */
79 void    print_ls_output(const char *fname, const char *link, int type, struct stat *statp);
80 JCR    *setup_jcr(const char *name, char *dev_name, BSR *bsr,
81                   const char *VolumeName, int mode);
82 void    display_tape_error_status(JCR *jcr, DEVICE *dev);
83
84
85 /* From dev.c */
86 DEVICE  *init_dev(DEVICE *dev, DEVRES *device);
87 int      open_dev(DEVICE *dev, char *VolName, int mode);
88 void     close_dev(DEVICE *dev);
89 void     force_close_dev(DEVICE *dev);
90 bool     truncate_dev(DEVICE *dev);
91 void     term_dev(DEVICE *dev);
92 char *   strerror_dev(DEVICE *dev);
93 void     clrerror_dev(DEVICE *dev, int func);
94 bool     update_pos_dev(DEVICE *dev);
95 int      rewind_dev(DEVICE *dev);
96 bool     load_dev(DEVICE *dev);
97 bool     offline_dev(DEVICE *dev);
98 int      flush_dev(DEVICE *dev);
99 int      weof_dev(DEVICE *dev, int num);
100 int      write_block(DEVICE *dev);
101 int      write_dev(DEVICE *dev, char *buf, size_t len);
102 int      read_dev(DEVICE *dev, char *buf, size_t len);
103 uint32_t status_dev(DEVICE *dev);
104 int      eod_dev(DEVICE *dev);
105 bool     fsf_dev(DEVICE *dev, int num);
106 bool     fsr_dev(DEVICE *dev, int num);
107 bool     bsf_dev(DEVICE *dev, int num);
108 bool     bsr_dev(DEVICE *dev, int num);
109 void     attach_jcr_to_device(DEVICE *dev, JCR *jcr);
110 void     detach_jcr_from_device(DEVICE *dev, JCR *jcr);
111 JCR     *next_attached_jcr(DEVICE *dev, JCR *jcr);
112 bool     dev_can_write(DEVICE *dev);
113 int      offline_or_rewind_dev(DEVICE *dev);
114 bool     reposition_dev(DEVICE *dev, uint32_t file, uint32_t block);
115 void     init_dev_wait_timers(DEVICE *dev);
116 bool     double_dev_wait_time(DEVICE *dev);
117
118
119 /* Get info about device */
120 char *   dev_name(DEVICE *dev);
121 char *   dev_vol_name(DEVICE *dev);
122 uint32_t dev_block(DEVICE *dev);
123 uint32_t dev_file(DEVICE *dev);
124 bool     dev_is_tape(DEVICE *dev);
125
126 /* From device.c */
127 bool     open_device(DCR *dcr);
128 bool     first_open_device(DEVICE *dev);
129 bool     fixup_device_block_write_error(DCR *dcr);
130 void     _lock_device(const char *file, int line, DEVICE *dev);
131 void     _unlock_device(const char *file, int line, DEVICE *dev);
132 void     _block_device(const char *file, int line, DEVICE *dev, int state);
133 void     _unblock_device(const char *file, int line, DEVICE *dev);
134 void     _steal_device_lock(const char *file, int line, DEVICE *dev, bsteal_lock_t *hold, int state);
135 void     _give_back_device_lock(const char *file, int line, DEVICE *dev, bsteal_lock_t *hold);
136 void     set_new_volume_parameters(DCR *dcr);
137 void     set_new_file_parameters(DCR *dcr);
138 bool     device_is_unmounted(DEVICE *dev);
139 void     dev_lock(DEVICE *dev);
140 void     dev_unlock(DEVICE *dev);
141 const char *edit_blocked_reason(DEVICE *dev);
142
143 /* From dircmd.c */
144 void     *handle_connection_request(void *arg); 
145
146
147 /* From fd_cmds.c */
148 void     run_job(JCR *jcr);
149 bool     bootstrap_cmd(JCR *jcr);
150
151 /* From job.c */
152 void     stored_free_jcr(JCR *jcr);
153 void     connection_from_filed(void *arg);     
154 void     handle_filed_connection(BSOCK *fd, char *job_name);
155
156 /* From label.c */
157 int      read_dev_volume_label(DCR *dcr);
158 void     create_session_label(DCR *dcr, DEV_RECORD *rec, int label);
159 void     create_volume_label(DEVICE *dev, const char *VolName, const char *PoolName);
160 bool     write_new_volume_label_to_dev(DCR *dcr, const char *VolName, const char *PoolName);
161 bool     write_session_label(DCR *dcr, int label);
162 bool     write_volume_label_to_block(DCR *dcr);
163 void     dump_volume_label(DEVICE *dev);
164 void     dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose);
165 bool     unser_volume_label(DEVICE *dev, DEV_RECORD *rec);
166 bool     unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
167
168 /* From match_bsr.c */
169 int      match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, 
170               SESSION_LABEL *sesrec);
171 int      match_bsr_block(BSR *bsr, DEV_BLOCK *block);
172 void     position_bsr_block(BSR *bsr, DEV_BLOCK *block);
173 BSR     *find_next_bsr(BSR *root_bsr, DEVICE *dev);
174 bool     match_set_eof(BSR *bsr, DEV_RECORD *rec);
175
176 /* From mount.c */
177 bool     mount_next_write_volume(DCR *dcr, bool release);
178 bool     mount_next_read_volume(DCR *dcr);
179 void     release_volume(DCR *ddr);
180 void     mark_volume_in_error(DCR *dcr);
181
182 /* From parse_bsr.c */
183 BSR     *parse_bsr(JCR *jcr, char *lf);
184 void     dump_bsr(BSR *bsr, bool recurse);
185 void     free_bsr(BSR *bsr);
186 VOL_LIST *new_vol();
187 int      add_vol(JCR *jcr, VOL_LIST *vol);
188 void     free_vol_list(JCR *jcr);
189 void     create_vol_list(JCR *jcr);
190
191 /* From record.c */
192 const char *FI_to_ascii(int fi);
193 const char *stream_to_ascii(int stream, int fi);
194 bool        write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
195 bool        can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
196 bool        read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec); 
197 DEV_RECORD *new_record();
198 void        free_record(DEV_RECORD *rec);
199 void        empty_record(DEV_RECORD *rec);
200
201 /* From read_record.c */
202 bool read_records(DCR *dcr,
203        bool record_cb(DCR *dcr, DEV_RECORD *rec),
204        bool mount_cb(DCR *dcr));
205
206 /* From spool.c */
207 bool    begin_data_spool          (JCR *jcr);
208 bool    discard_data_spool        (JCR *jcr);
209 bool    commit_data_spool         (JCR *jcr);
210 bool    are_attributes_spooled    (JCR *jcr);
211 bool    begin_attribute_spool     (JCR *jcr);
212 bool    discard_attribute_spool   (JCR *jcr);
213 bool    commit_attribute_spool    (JCR *jcr);
214 bool    write_block_to_spool_file (DCR *dcr);
215 void    list_spool_stats          (BSOCK *bs);