]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/protos.h
11Apr07
[bacula/bacula] / bacula / src / stored / protos.h
index 84ef598d074f114fb92d2fd7d10d84f49122ff5c..b26eb2a5c938bf644efb3e3f7dbaf88befe93be7 100644 (file)
@@ -1,21 +1,34 @@
 /*
- * Protypes for stored
- *
- *   Version $Id$
- */
-/*
-   Copyright (C) 2000-2006 Kern Sibbald
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2000-2007 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
+   License as published by the Free Software Foundation plus additions
+   that are listed in the file LICENSE.
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   version 2 as amended with additional clauses defined in the
-   file LICENSE in the main source directory.
+   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.
 
-   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 
-   the file LICENSE for additional details.
+   You should have received a copy of the GNU 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.
+   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  
+ *
+ *   Version $Id$
  */
 
 /* From stored.c */
@@ -101,15 +114,12 @@ char *   dev_vol_name(DEVICE *dev);
 int     dvd_open_next_part(DCR *dcr);
 bool    dvd_write_part(DCR *dcr); 
 bool    dvd_close_job(DCR *dcr);
-bool    mount_dvd(DEVICE* dev, int timeout);
-bool    unmount_dvd(DEVICE* dev, int timeout);
-bool    update_free_space_dev(DEVICE *dev);
 void    make_mounted_dvd_filename(DEVICE *dev, POOL_MEM &archive_name);
 void    make_spooled_dvd_filename(DEVICE *dev, POOL_MEM &archive_name);
 bool    truncate_dvd(DCR *dcr);
 bool    check_can_write_on_non_blank_dvd(DCR *dcr);
 int     find_num_dvd_parts(DCR *dcr);
-off_t   lseek_dvd(DCR *dcr, off_t offset, int whence);
+boffset_t   lseek_dvd(DCR *dcr, boffset_t offset, int whence);
 void    dvd_remove_empty_part(DCR *dcr);
 
 /* From device.c */
@@ -125,8 +135,7 @@ void     _give_back_device_lock(const char *file, int line, DEVICE *dev, bsteal_
 void     set_new_volume_parameters(DCR *dcr);
 void     set_new_file_parameters(DCR *dcr);
 bool     is_device_unmounted(DEVICE *dev);
-void     dev_lock(DEVICE *dev);
-void     dev_unlock(DEVICE *dev);
+uint32_t get_jobid_from_tid();
 
 /* From dircmd.c */
 void     *handle_connection_request(void *arg);
@@ -134,7 +143,8 @@ void     *handle_connection_request(void *arg);
 
 /* From fd_cmds.c */
 void     run_job(JCR *jcr);
-bool get_bootstrap_file(JCR *jcr, BSOCK *bsock);
+bool     get_bootstrap_file(JCR *jcr, BSOCK *bsock);
+void     do_fd_commands(JCR *jcr);
 
 /* From job.c */
 void     stored_free_jcr(JCR *jcr);
@@ -146,7 +156,8 @@ 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);
-bool     write_new_volume_label_to_dev(DCR *dcr, const char *VolName, const char *PoolName, bool dvdnow);
+bool     write_new_volume_label_to_dev(DCR *dcr, const char *VolName, 
+           const char *PoolName, bool relabel, bool dvdnow);
 #define ANSI_VOL_LABEL 0
 #define ANSI_EOF_LABEL 1
 #define ANSI_EOV_LABEL 2
@@ -187,7 +198,7 @@ const char *FI_to_ascii(char *buf, int fi);
 const char *stream_to_ascii(char *buf, int stream, int fi);
 bool        write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
 bool        can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
-bool        read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec);
+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);
@@ -200,13 +211,14 @@ bool read_records(DCR *dcr,
 /* From reserve.c */
 void    init_reservations_lock();
 void    term_reservations_lock();
-void    lock_reservations();
-void    unlock_reservations();
+void    _lock_reservations();
+void    _unlock_reservations();
 void    release_volume(DCR *dcr);
-VOLRES *new_volume(DCR *dcr, const char *VolumeName);
+VOLRES *reserve_volume(DCR *dcr, const char *VolumeName);
 VOLRES *find_volume(const char *VolumeName);
 bool    free_volume(DEVICE *dev);
-void    free_unused_volume(DCR *dcr);
+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);
@@ -216,6 +228,25 @@ bool    find_suitable_device_for_job(JCR *jcr, RCTX &rctx);
 int     search_res_for_device(RCTX &rctx);
 void    release_msgs(JCR *jcr);
 
+extern int reservations_lock_count;
+
+#ifdef  SD_DEBUG_LOCK
+#define lock_reservations() \
+         do { Dmsg4(sd_dbglvl, "lock_reservations at %s:%d precnt=%d JobId=%u\n", \
+              __FILE__, __LINE__, \
+              reservations_lock_count, get_jobid_from_tid()); \
+                   _lock_reservations(); } while (0)
+#define unlock_reservations() \
+         do { Dmsg4(sd_dbglvl, "unlock_reservations at %s:%d precnt=%d JobId=%u\n", \
+              __FILE__, __LINE__, \
+              reservations_lock_count, get_jobid_from_tid()); \
+                   _unlock_reservations(); } while (0)
+#else
+#define lock_reservations() _lock_reservations()
+#define unlock_reservations() _unlock_reservations()
+#endif
+
+
 
 /* From spool.c */
 bool    begin_data_spool          (DCR *dcr);