X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fprotos.h;h=3f9913711c193376d27a342343a1c72cadc9e473;hb=8ec0de6a73f09501ee0d8da46a40d46b4c41d26a;hp=3b8388e7a58e76afb419130f0e72bd00051ae16b;hpb=8a5ad4fc5f6d39bbae14b14061b9f15682f4d52c;p=bacula%2Fbacula diff --git a/bacula/src/stored/protos.h b/bacula/src/stored/protos.h index 3b8388e7a5..3f9913711c 100644 --- a/bacula/src/stored/protos.h +++ b/bacula/src/stored/protos.h @@ -1,8 +1,3 @@ -/* - * Protypes for stored -- Kern Sibbald MM - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution @@ -30,6 +25,11 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Protypes for stored -- Kern Sibbald MM + * + * Version $Id$ + */ /* From stored.c */ uint32_t new_VolSessionId(); @@ -135,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); @@ -212,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); @@ -228,6 +228,28 @@ 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(); \ + Dmsg1(sd_dbglvl, "lock_reservations: got lock JobId=%u\n", \ + get_jobid_from_tid()); \ + } 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); @@ -242,4 +264,4 @@ 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, bool first); +bool wait_for_device(JCR *jcr, int &retries);