]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/protos.h
Backport from BEE
[bacula/bacula] / bacula / src / stored / protos.h
index ed9badf6ed052eada7b47b05d5787109c083475e..a0572acecd7ebdb6ced813c055a652a5b2cf4851 100644 (file)
@@ -1,33 +1,22 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2014 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.
-   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.
+   The main author of Bacula is Kern Sibbald, with contributions from many
+   others, a complete list can be found in the file AUTHORS.
 
-   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
-   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.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
    Bacula® is a registered trademark of Kern Sibbald.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf@fsfeurope.org.
 */
 /*
- * Protypes for stored -- Kern Sibbald MM  
+ * Protypes for stored
  *
+ *   Written by Kern Sibbald, MM
  */
 
 /* From stored.c */
@@ -38,7 +27,7 @@ DCR     *acquire_device_for_append(DCR *dcr);
 bool     acquire_device_for_read(DCR *dcr);
 bool     release_device(DCR *dcr);
 bool     clean_device(DCR *dcr);
-DCR     *new_dcr(JCR *jcr, DCR *dcr, DEVICE *dev);
+DCR     *new_dcr(JCR *jcr, DCR *dcr, DEVICE *dev, bool writing=true);
 void     free_dcr(DCR *dcr);
 
 /* From append.c */
@@ -53,7 +42,7 @@ bool    dir_get_volume_info(DCR *dcr, enum get_vol_info_rw);
 bool    dir_find_next_appendable_volume(DCR *dcr);
 bool    dir_update_volume_info(DCR *dcr, bool label, bool update_LastWritten);
 bool    dir_ask_sysop_to_create_appendable_volume(DCR *dcr);
-bool    dir_ask_sysop_to_mount_volume(DCR *dcr, int mode);
+bool    dir_ask_sysop_to_mount_volume(DCR *dcr, bool read_access);
 bool    dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec);
 bool    dir_send_job_status(JCR *jcr);
 bool    dir_create_jobmedia_record(DCR *dcr, bool zero=false);
@@ -63,10 +52,11 @@ bool    dir_update_changer(JCR *jcr, AUTOCHANGER *changer);
 /* authenticate.c */
 int     authenticate_director(JCR *jcr);
 int     authenticate_filed(JCR *jcr);
+bool    authenticate_storagedaemon(JCR *jcr, char *Job);
 
 /* From autochanger.c */
 bool     init_autochangers();
-int      autoload_device(DCR *dcr, int writing, BSOCK *dir);
+int      autoload_device(DCR *dcr, bool writing, BSOCK *dir);
 bool     autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd);
 bool     unload_autochanger(DCR *dcr, int loaded);
 bool     unload_dev(DCR *dcr, DEVICE *dev);
@@ -82,11 +72,19 @@ void    empty_block(DEV_BLOCK *block);
 void    free_block(DEV_BLOCK *block);
 void    print_block_read_errors(JCR *jcr, DEV_BLOCK *block);
 void    ser_block_header(DEV_BLOCK *block);
+bool    is_block_empty(DEV_BLOCK *block);
+bool    terminate_writing_volume(DCR *dcr);
+
+/* From block_util.c */
+bool    terminate_writing_volume(DCR *dcr);
+bool    user_volume_size_reached(DCR *dcr, bool quiet);
+bool    check_for_newvol_or_newfile(DCR *dcr);
 
 /* From butil.c -- utilities for SD tool programs */
+void    setup_me();
 void    print_ls_output(const char *fname, const char *link, int type, struct stat *statp);
 JCR    *setup_jcr(const char *name, char *dev_name, BSR *bsr,
-                  const char *VolumeName, int mode);
+                  const char *VolumeName, bool writing);
 void    display_tape_error_status(JCR *jcr, DEVICE *dev);
 
 
@@ -103,12 +101,9 @@ void     init_device_wait_timers(DCR *dcr);
 void     init_jcr_device_wait_timers(JCR *jcr);
 bool     double_dev_wait_time(DEVICE *dev);
 
-/* Get info about device */
-char *   dev_vol_name(DEVICE *dev);
-
 /* From dvd.c */
 int     dvd_open_next_part(DCR *dcr);
-bool    dvd_write_part(DCR *dcr); 
+bool    dvd_write_part(DCR *dcr);
 bool    dvd_close_job(DCR *dcr);
 void    make_mounted_dvd_filename(DEVICE *dev, POOL_MEM &archive_name);
 void    make_spooled_dvd_filename(DEVICE *dev, POOL_MEM &archive_name);
@@ -119,7 +114,7 @@ boffset_t   lseek_dvd(DCR *dcr, boffset_t offset, int whence);
 void    dvd_remove_empty_part(DCR *dcr);
 
 /* From device.c */
-bool     open_device(DCR *dcr);
+bool     open_dev(DCR *dcr);
 bool     first_open_device(DCR *dcr);
 bool     fixup_device_block_write_error(DCR *dcr, int retries=4);
 void     set_start_vol_position(DCR *dcr);
@@ -132,18 +127,19 @@ void     *handle_connection_request(void *arg);
 
 /* From fd_cmds.c */
 void     run_job(JCR *jcr);
-void     do_fd_commands(JCR *jcr);
+void     do_client_commands(JCR *jcr);
 
 /* From job.c */
 void     stored_free_jcr(JCR *jcr);
 void     connection_from_filed(void *arg);
-void     handle_filed_connection(BSOCK *fd, char *job_name);
+void     handle_filed_connection(BSOCK *fd, char *job_name,
+           int fdversion, int sdversion);
 
 /* From label.c */
 int      read_dev_volume_label(DCR *dcr);
 int      read_dvd_volume_label(DCR *dcr, bool write);
 void     create_session_label(DCR *dcr, DEV_RECORD *rec, int label);
-void     create_volume_label(DEVICE *dev, const char *VolName, const char *PoolName, bool dvdnow);
+void     create_volume_header(DEVICE *dev, const char *VolName, const char *PoolName, bool dvdnow);
 #define ANSI_VOL_LABEL 0
 #define ANSI_EOF_LABEL 1
 #define ANSI_EOV_LABEL 2
@@ -154,7 +150,7 @@ void     dump_volume_label(DEVICE *dev);
 void     dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose);
 bool     unser_volume_label(DEVICE *dev, DEV_RECORD *rec);
 bool     unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
-bool     write_new_volume_label_to_dev(DCR *dcr, const char *VolName, 
+bool     write_new_volume_label_to_dev(DCR *dcr, const char *VolName,
             const char *PoolName, bool relabel, bool dvdnow);
 
 /* From locks.c */
@@ -173,7 +169,7 @@ int      match_bsr_block(BSR *bsr, DEV_BLOCK *block);
 void     position_bsr_block(BSR *bsr, DEV_BLOCK *block);
 BSR     *find_next_bsr(BSR *root_bsr, DEVICE *dev);
 bool     is_this_bsr_done(BSR *bsr, DEV_RECORD *rec);
-uint64_t get_bsr_start_addr(BSR *bsr, 
+uint64_t get_bsr_start_addr(BSR *bsr,
                             uint32_t *file=NULL,
                             uint32_t *block=NULL);
 
@@ -197,7 +193,7 @@ bool        read_record_from_block(DCR *dcr, DEV_RECORD *rec);
 DEV_RECORD *new_record();
 void        free_record(DEV_RECORD *rec);
 void        empty_record(DEV_RECORD *rec);
-uint64_t get_record_address(DEV_RECORD *rec);
+uint64_t    get_record_address(DEV_RECORD *rec);
 
 /* From read_record.c */
 bool read_records(DCR *dcr,
@@ -207,11 +203,6 @@ bool read_records(DCR *dcr,
 /* From reserve.c */
 void    init_reservations_lock();
 void    term_reservations_lock();
-void    _lock_reservations(const char *file="**Unknown**", int line=0);
-void    _unlock_reservations();
-void    _lock_volumes(const char *file="**Unknown**", int line=0);
-void    _unlock_volumes();
-void    unreserve_device(DCR *dcr);
 void    send_drive_reserve_messages(JCR *jcr, void sendit(const char *msg, int len, void *sarg), void *arg);
 bool    find_suitable_device_for_job(JCR *jcr, RCTX &rctx);
 int     search_res_for_device(RCTX &rctx);
@@ -219,49 +210,15 @@ void    release_reserve_messages(JCR *jcr);
 
 extern int reservations_lock_count;
 
-#ifdef  SD_DEBUG_LOCK
-
-#define lock_reservations() \
-         do { Dmsg3(sd_dbglvl, "lock_reservations at %s:%d precnt=%d\n", \
-              __FILE__, __LINE__, \
-              reservations_lock_count); \
-              _lock_reservations(__FILE__, __LINE__); \
-              Dmsg0(sd_dbglvl, "lock_reservations: got lock\n"); \
-         } while (0)
-#define unlock_reservations() \
-         do { Dmsg3(sd_dbglvl, "unlock_reservations at %s:%d precnt=%d\n", \
-              __FILE__, __LINE__, \
-              reservations_lock_count); \
-                   _unlock_reservations(); } while (0)
-
-#define lock_volumes() \
-         do { Dmsg3(sd_dbglvl, "lock_volumes at %s:%d precnt=%d\n", \
-              __FILE__, __LINE__, \
-              vol_list_lock_count); \
-              _lock_volumes(__FILE__, __LINE__); \
-              Dmsg0(sd_dbglvl, "lock_volumes: got lock\n"); \
-         } while (0)
-
-#define unlock_volumes() \
-         do { Dmsg3(sd_dbglvl, "unlock_volumes at %s:%d precnt=%d\n", \
-              __FILE__, __LINE__, \
-              vol_list_lock_count); \
-                   _unlock_volumes(); } while (0)
-
-#else
-
-#define lock_reservations() _lock_reservations(__FILE__, __LINE__)
-#define unlock_reservations() _unlock_reservations()
-#define lock_volumes() _lock_volumes(__FILE__, __LINE__)
-#define unlock_volumes() _unlock_volumes()
-
-#endif
+/* From status.c */
+void    _dbg_list_one_device(DEVICE *dev, const char *f, int l);
+#define dbg_list_one_device(x, dev) if (chk_dbglvl(x))     \
+        _dbg_list_one_device(dev, __FILE__, __LINE__)
 
 /* From vol_mgr.c */
 void    init_vol_list_lock();
 void    term_vol_list_lock();
 VOLRES *reserve_volume(DCR *dcr, const char *VolumeName);
-VOLRES *find_volume(const char *VolumeName);
 bool    free_volume(DEVICE *dev);
 bool    is_vol_list_empty();
 dlist  *dup_vol_list(JCR *jcr);
@@ -289,4 +246,9 @@ void    list_spool_stats          (void sendit(const char *msg, int len, void *s
 
 /* From wait.c */
 int wait_for_sysop(DCR *dcr);
-bool wait_for_device(JCR *jcr, int &retries);
+bool wait_for_any_device(JCR *jcr, int &retries);
+bool wait_for_device(DCR *dcr, int &retries);
+
+/* stored_conf.c */
+void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_maxblocksize(LEX *lc, RES_ITEM *item, int index, int pass);