From: Kern Sibbald Date: Mon, 19 Aug 2002 16:53:57 +0000 (+0000) Subject: new version X-Git-Tag: Release-1.25~36 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f01675e9756f85c621d98aab2f1c7fda8a7ab435;p=bacula%2Fbacula new version git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@107 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 62345c095f..26e24a99d0 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -167,6 +167,8 @@ struct s_jcr { #ifdef STORAGE_DAEMON /* Storage Daemon specific part of JCR */ + struct s_jcr *next_dev; /* next JCR attached to device */ + struct s_jcr *prev_dev; /* previous JCR attached to device */ pthread_cond_t job_start_wait; /* Wait for FD to start Job */ int type; DEVRES *device; /* device to use */ diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 6b9bcf45eb..6c7720e41f 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -110,7 +110,6 @@ int main (int argc, char *argv[]) static void do_scan(char *devname) { - int n; char VolName[100]; char *p; struct stat statp; @@ -184,7 +183,8 @@ static void do_scan(char *devname) else if (!(status & MT_ONLINE)) Emsg0(M_ABORT, 0, "Unexpected Tape is Off-line\n"); else - Emsg3(M_ABORT, 0, "Read error %d on Record Header %s: %s\n", n, dev_name(dev), strerror(errno)); + Emsg3(M_ABORT, 0, "Read error %d on Record Header %s: %s\n", + status, dev_name(dev), strerror(errno)); } diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index 72a08ca96e..43aa5c0264 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -864,7 +864,7 @@ static void scancmd() static void statcmd() { - int stat; + int stat = 0; int debug; uint32_t status; diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index e9e3425d28..c8561dd333 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -1075,3 +1075,32 @@ term_dev(DEVICE *dev) free_pool_memory((POOLMEM *)dev); } } + +#define attached_jcrs ((JCR *)(dev->attached_jcrs)) + +void dev_attach_jcr(DEVICE *dev, JCR *jcr) +{ + + P(dev->mutex); + jcr->prev_dev = NULL; + jcr->next_dev = attached_jcrs; + if (attached_jcrs) { + attached_jcrs->prev_dev = jcr; + } + attached_jcrs = jcr; + V(dev->mutex); +} + +void dev_remove_jcr(DEVICE *dev, JCR *jcr) +{ + P(dev->mutex); + if (!jcr->prev_dev) { + attached_jcrs = jcr->next_dev; + } else { + jcr->prev_dev->next_dev = jcr->next_dev; + } + if (jcr->next_dev) { + jcr->next_dev->prev_dev = jcr->prev_dev; + } + V(dev->mutex); +} diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index fe8ff6d49f..908ea0201d 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -107,6 +107,7 @@ typedef struct s_volume_catalog_info { /* Device structure definition */ typedef struct s_device { struct s_device *next; /* pointer to next open device */ + void *attached_jcrs; /* attached JCR list */ pthread_mutex_t mutex; /* access control */ pthread_cond_t wait; /* thread wait variable */ pthread_cond_t wait_next_vol; /* wait for tape to be mounted */ diff --git a/bacula/src/stored/protos.h b/bacula/src/stored/protos.h index 95eb7e6b33..5e008231be 100644 --- a/bacula/src/stored/protos.h +++ b/bacula/src/stored/protos.h @@ -28,104 +28,107 @@ uint32_t new_VolSessionId(); /* From askdir.c */ -int dir_get_volume_info(JCR *jcr); -int dir_find_next_appendable_volume(JCR *jcr); -int dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel); -int dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev); -int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev); -int dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec); -int dir_send_job_status(JCR *jcr); -int dir_create_job_media_record(JCR *jcr); +int dir_get_volume_info(JCR *jcr); +int dir_find_next_appendable_volume(JCR *jcr); +int dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel); +int dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev); +int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev); +int dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec); +int dir_send_job_status(JCR *jcr); +int dir_create_job_media_record(JCR *jcr); /* authenticate.c */ -int authenticate_director(JCR *jcr); -int authenticate_filed(JCR *jcr); +int authenticate_director(JCR *jcr); +int authenticate_filed(JCR *jcr); /* From block.c */ -void dump_block(DEV_BLOCK *b, char *msg); +void dump_block(DEV_BLOCK *b, char *msg); DEV_BLOCK *new_block(DEVICE *dev); -void init_block_write(DEV_BLOCK *block); -void empty_block(DEV_BLOCK *block); -void free_block(DEV_BLOCK *block); -int write_block_to_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); -int write_block_to_dev(DEVICE *dev, DEV_BLOCK *block); -int read_block_from_device(DEVICE *dev, DEV_BLOCK *block); -int read_block_from_dev(DEVICE *dev, DEV_BLOCK *block); +void init_block_write(DEV_BLOCK *block); +void empty_block(DEV_BLOCK *block); +void free_block(DEV_BLOCK *block); +int write_block_to_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); +int write_block_to_dev(DEVICE *dev, DEV_BLOCK *block); +int read_block_from_device(DEVICE *dev, DEV_BLOCK *block); +int read_block_from_dev(DEVICE *dev, DEV_BLOCK *block); /* From dev.c */ -DEVICE *init_dev(DEVICE *dev, char *device); -int open_dev(DEVICE *dev, char *VolName, int mode); -void close_dev(DEVICE *dev); -void force_close_dev(DEVICE *dev); -int truncate_dev(DEVICE *dev); -void term_dev(DEVICE *dev); -char * strerror_dev(DEVICE *dev); -void clrerror_dev(DEVICE *dev, int func); -int update_pos_dev(DEVICE *dev); -int rewind_dev(DEVICE *dev); -int load_dev(DEVICE *dev); -int offline_dev(DEVICE *dev); -int flush_dev(DEVICE *dev); -int weof_dev(DEVICE *dev, int num); -int write_block(DEVICE *dev); -int write_dev(DEVICE *dev, char *buf, size_t len); -int read_dev(DEVICE *dev, char *buf, size_t len); -int status_dev(DEVICE *dev, uint32_t *status); -int eod_dev(DEVICE *dev); -int fsf_dev(DEVICE *dev, int num); -int fsr_dev(DEVICE *dev, int num); -int bsf_dev(DEVICE *dev, int num); -int bsr_dev(DEVICE *dev, int num); +DEVICE *init_dev(DEVICE *dev, char *device); +int open_dev(DEVICE *dev, char *VolName, int mode); +void close_dev(DEVICE *dev); +void force_close_dev(DEVICE *dev); +int truncate_dev(DEVICE *dev); +void term_dev(DEVICE *dev); +char * strerror_dev(DEVICE *dev); +void clrerror_dev(DEVICE *dev, int func); +int update_pos_dev(DEVICE *dev); +int rewind_dev(DEVICE *dev); +int load_dev(DEVICE *dev); +int offline_dev(DEVICE *dev); +int flush_dev(DEVICE *dev); +int weof_dev(DEVICE *dev, int num); +int write_block(DEVICE *dev); +int write_dev(DEVICE *dev, char *buf, size_t len); +int read_dev(DEVICE *dev, char *buf, size_t len); +int status_dev(DEVICE *dev, uint32_t *status); +int eod_dev(DEVICE *dev); +int fsf_dev(DEVICE *dev, int num); +int fsr_dev(DEVICE *dev, int num); +int bsf_dev(DEVICE *dev, int num); +int bsr_dev(DEVICE *dev, int num); +void dev_attach_jcr(DEVICE *dev, JCR *jcr); +void dev_remove_jcr(DEVICE *dev, JCR *jcr); + /* Get info about device */ -char * dev_name(DEVICE *dev); -char * dev_vol_name(DEVICE *dev); +char * dev_name(DEVICE *dev); +char * dev_vol_name(DEVICE *dev); uint32_t dev_block(DEVICE *dev); uint32_t dev_file(DEVICE *dev); -int dev_is_tape(DEVICE *dev); +int dev_is_tape(DEVICE *dev); /* From device.c */ -int open_device(DEVICE *dev); -int acquire_device_for_append(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); -int acquire_device_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); -int ready_dev_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); -int release_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); -void block_device(DEVICE *dev, int state); -void unblock_device(DEVICE *dev); -void lock_device(DEVICE *dev); -void unlock_device(DEVICE *dev); -int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); +int open_device(DEVICE *dev); +int acquire_device_for_append(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); +int acquire_device_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); +int ready_dev_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); +int release_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); +void block_device(DEVICE *dev, int state); +void unblock_device(DEVICE *dev); +void lock_device(DEVICE *dev); +void unlock_device(DEVICE *dev); +int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); /* From dircmd.c */ -void connection_request(void *arg); +void connection_request(void *arg); /* From fd_cmds.c */ -void run_job(JCR *jcr); +void run_job(JCR *jcr); /* From fdmsg.c */ -int bget_msg(BSOCK *sock); +int bget_msg(BSOCK *sock); /* 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 stored_free_jcr(JCR *jcr); +void connection_from_filed(void *arg); +void handle_filed_connection(BSOCK *fd, char *job_name); /* From label.c */ -int read_dev_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); -void create_session_label(JCR *jcr, DEV_RECORD *rec, int label); -int write_volume_label_to_dev(JCR *jcr, DEVRES *device, char *VolName, char *PoolName); -int write_session_label(JCR *jcr, DEV_BLOCK *block, int label); -int write_volume_label_to_block(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); -void dump_volume_label(DEVICE *dev); -void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose); -int unser_volume_label(DEVICE *dev, DEV_RECORD *rec); -int unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec); +int read_dev_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); +void create_session_label(JCR *jcr, DEV_RECORD *rec, int label); +int write_volume_label_to_dev(JCR *jcr, DEVRES *device, char *VolName, char *PoolName); +int write_session_label(JCR *jcr, DEV_BLOCK *block, int label); +int write_volume_label_to_block(JCR *jcr, DEVICE *dev, DEV_BLOCK *block); +void dump_volume_label(DEVICE *dev); +void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose); +int unser_volume_label(DEVICE *dev, DEV_RECORD *rec); +int unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec); /* From match_bsr.c */ int match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, - SESSION_LABEL *sesrec); + SESSION_LABEL *sesrec); /* From parse_bsr.c */ extern BSR *parse_bsr(JCR *jcr, char *lf); @@ -139,9 +142,9 @@ extern void create_vol_list(JCR *jcr); /* From record.c */ char *FI_to_ascii(int fi); char *stream_to_ascii(int stream); -int write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec); -int read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec); +int write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec); +int read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec); DEV_RECORD *new_record(); -void free_record(DEV_RECORD *rec); -int read_record(DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record); -int write_record_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record); +void free_record(DEV_RECORD *rec); +int read_record(DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record); +int write_record_device(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *record); diff --git a/bacula/src/version.h b/bacula/src/version.h index 415253ed28..37e1d0340b 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #define VERSION "1.25" #define VSTRING "1" -#define DATE "18 August 2002" -#define LSMDATE "18Aug02" +#define DATE "19 August 2002" +#define LSMDATE "19Aug02" /* Debug flags */ #define DEBUG 1