]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/protos.h
Implement .bvfs_versions command to display all file versions for a client
[bacula/bacula] / bacula / src / stored / protos.h
index 490355a3375fe2e1a6a0f197e5eda5b77493f07b..9aaee10d718098bafaa184163c29bb4eb2ae9f6a 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2010 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 two of the GNU General Public
+   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.
 
    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 General Public License
+   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.
 
-   Bacula® is a registered trademark of John Walker.
+   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.
@@ -28,7 +28,6 @@
 /*
  * Protypes for stored -- Kern Sibbald MM  
  *
- *   Version $Id$
  */
 
 /* From stored.c */
@@ -41,7 +40,9 @@ bool     release_device(DCR *dcr);
 bool     clean_device(DCR *dcr);
 DCR     *new_dcr(JCR *jcr, DCR *dcr, DEVICE *dev);
 void     free_dcr(DCR *dcr);
-void     detach_dcr_from_dev(DCR *dcr);
+
+/* From append.c */
+bool send_attrs_to_dir(JCR *jcr, DEV_RECORD *rec);
 
 /* From askdir.c */
 enum get_vol_info_rw {
@@ -55,7 +56,7 @@ bool    dir_ask_sysop_to_create_appendable_volume(DCR *dcr);
 bool    dir_ask_sysop_to_mount_volume(DCR *dcr, int mode);
 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    dir_create_jobmedia_record(DCR *dcr, bool zero=false);
 bool    dir_update_device(JCR *jcr, DEVICE *dev);
 bool    dir_update_changer(JCR *jcr, AUTOCHANGER *changer);
 
@@ -127,11 +128,10 @@ void    dvd_remove_empty_part(DCR *dcr);
 /* From device.c */
 bool     open_device(DCR *dcr);
 bool     first_open_device(DCR *dcr);
-bool     fixup_device_block_write_error(DCR *dcr);
+bool     fixup_device_block_write_error(DCR *dcr, int retries=4);
 void     set_start_vol_position(DCR *dcr);
 void     set_new_volume_parameters(DCR *dcr);
 void     set_new_file_parameters(DCR *dcr);
-bool     is_device_unmounted(DEVICE *dev);
 
 /* From dircmd.c */
 void     *handle_connection_request(void *arg);
@@ -139,7 +139,6 @@ void     *handle_connection_request(void *arg);
 
 /* From fd_cmds.c */
 void     run_job(JCR *jcr);
-bool     get_bootstrap_file(JCR *jcr, BSOCK *bsock);
 void     do_fd_commands(JCR *jcr);
 
 /* From job.c */
@@ -178,11 +177,15 @@ void     _give_back_device_lock(const char *file, int line, DEVICE *dev, bsteal_
 
 /* From match_bsr.c */
 int      match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec,
-              SESSION_LABEL *sesrec);
+              SESSION_LABEL *sesrec, JCR *jcr);
 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, 
+                            uint32_t *file=NULL,
+                            uint32_t *block=NULL);
+
 
 /* From mount.c */
 bool     mount_next_read_volume(DCR *dcr);
@@ -191,8 +194,6 @@ bool     mount_next_read_volume(DCR *dcr);
 BSR     *parse_bsr(JCR *jcr, char *lf);
 void     dump_bsr(BSR *bsr, bool recurse);
 void     free_bsr(BSR *bsr);
-VOL_LIST *new_restore_volume();
-int      add_restore_volume(JCR *jcr, VOL_LIST *vol);
 void     free_restore_volume_list(JCR *jcr);
 void     create_restore_volume_list(JCR *jcr);
 
@@ -205,6 +206,7 @@ bool        read_record_from_block(DCR *dcr, DEV_BLOCK *block, 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);
 
 /* From read_record.c */
 bool read_records(DCR *dcr,
@@ -214,68 +216,73 @@ bool read_records(DCR *dcr,
 /* From reserve.c */
 void    init_reservations_lock();
 void    term_reservations_lock();
-void    _lock_reservations();
+void    _lock_reservations(const char *file="**Unknown**", int line=0);
 void    _unlock_reservations();
-void    _lock_volumes();
+void    _lock_volumes(const char *file="**Unknown**", int line=0);
 void    _unlock_volumes();
-void    release_volume(DCR *dcr);
-VOLRES *reserve_volume(DCR *dcr, const char *VolumeName);
-VOLRES *find_volume(const char *VolumeName);
-bool    free_volume(DEVICE *dev);
 void    unreserve_device(DCR *dcr);
-bool    volume_unused(DCR *dcr);
-void    create_volume_list();
-void    free_volume_list();
-void    list_volumes(void sendit(const char *msg, int len, void *sarg), void *arg);
-bool    is_volume_in_use(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);
 void    release_reserve_messages(JCR *jcr);
 
 extern int reservations_lock_count;
-extern int vol_list_lock_count;
 
 #ifdef  SD_DEBUG_LOCK
 
 #define lock_reservations() \
-         do { Dmsg4(sd_dbglvl, "lock_reservations at %s:%d precnt=%d JobId=%u\n", \
+         do { Dmsg3(sd_dbglvl, "lock_reservations at %s:%d precnt=%d\n", \
               __FILE__, __LINE__, \
-              reservations_lock_count, get_jobid_from_tid(pthread_self())); \
-              _lock_reservations(); \
-              Dmsg1(sd_dbglvl, "lock_reservations: got lock JobId=%u\n", \
-               get_jobid_from_tid(pthread_self())); \
+              reservations_lock_count); \
+              _lock_reservations(__FILE__, __LINE__); \
+              Dmsg0(sd_dbglvl, "lock_reservations: got lock\n"); \
          } while (0)
 #define unlock_reservations() \
-         do { Dmsg4(sd_dbglvl, "unlock_reservations at %s:%d precnt=%d JobId=%u\n", \
+         do { Dmsg3(sd_dbglvl, "unlock_reservations at %s:%d precnt=%d\n", \
               __FILE__, __LINE__, \
-              reservations_lock_count, get_jobid_from_tid(pthread_self())); \
+              reservations_lock_count); \
                    _unlock_reservations(); } while (0)
 
 #define lock_volumes() \
-         do { Dmsg4(sd_dbglvl, "lock_volumes at %s:%d precnt=%d JobId=%u\n", \
+         do { Dmsg3(sd_dbglvl, "lock_volumes at %s:%d precnt=%d\n", \
               __FILE__, __LINE__, \
-              vol_list_lock_count, get_jobid_from_tid(pthread_self())); \
-              _lock_volumes(); \
-              Dmsg1(sd_dbglvl, "lock_volumes: got lock JobId=%u\n", \
-               get_jobid_from_tid(pthread_self())); \
+              vol_list_lock_count); \
+              _lock_volumes(__FILE__, __LINE__); \
+              Dmsg0(sd_dbglvl, "lock_volumes: got lock\n"); \
          } while (0)
 
 #define unlock_volumes() \
-         do { Dmsg4(sd_dbglvl, "unlock_volumes at %s:%d precnt=%d JobId=%u\n", \
+         do { Dmsg3(sd_dbglvl, "unlock_volumes at %s:%d precnt=%d\n", \
               __FILE__, __LINE__, \
-              vol_list_lock_count, get_jobid_from_tid(pthread_self())); \
+              vol_list_lock_count); \
                    _unlock_volumes(); } while (0)
 
 #else
 
-#define lock_reservations() _lock_reservations()
+#define lock_reservations() _lock_reservations(__FILE__, __LINE__)
 #define unlock_reservations() _unlock_reservations()
-#define lock_volumes() _lock_volumes()
+#define lock_volumes() _lock_volumes(__FILE__, __LINE__)
 #define unlock_volumes() _unlock_volumes()
 
 #endif
 
+/* 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);
+void    free_temp_vol_list(dlist *temp_vol_list);
+bool    volume_unused(DCR *dcr);
+void    create_volume_lists();
+void    free_volume_lists();
+void    list_volumes(void sendit(const char *msg, int len, void *sarg), void *arg);
+bool    is_volume_in_use(DCR *dcr);
+extern  int vol_list_lock_count;
+void    add_read_volume(JCR *jcr, const char *VolumeName);
+void    remove_read_volume(JCR *jcr, const char *VolumeName);
 
 
 /* From spool.c */