]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/jcr.h
Add SD heartbeat
[bacula/bacula] / bacula / src / jcr.h
index 368b39319ad7c1a9dbe694934d5881c311b2a37a..ed4d390a5a08da3d5b773bdef107060718603539 100644 (file)
@@ -36,7 +36,6 @@
 #define L_FULL                   'F'
 #define L_INCREMENTAL            'I'  /* since last backup */
 #define L_DIFFERENTIAL           'D'  /* since last full backup */
-#define L_LEVEL                  'L'
 #define L_SINCE                  'S'
 #define L_VERIFY_CATALOG         'C'  /* verify from catalog */
 #define L_VERIFY_INIT            'V'  /* verify save (init DB) */
 #define JS_Error                 'e'  /* Non-fatal error */
 #define JS_FatalError            'f'  /* Fatal error */
 #define JS_Differences           'D'  /* Verify differences */
-#define JS_Cancelled             'A'  /* cancelled by user */
+#define JS_Canceled              'A'  /* canceled by user */
 #define JS_WaitFD                'F'  /* waiting on File daemon */
 #define JS_WaitSD                'S'  /* waiting on the Storage daemon */
 #define JS_WaitMedia             'm'  /* waiting for new media */
 #define JS_WaitMount             'M'  /* waiting for Mount */
+#define JS_WaitStoreRes          's'  /* Waiting for storage resource */
+#define JS_WaitJobRes            'j'  /* Waiting for job resource */
+#define JS_WaitClientRes         'c'  /* Waiting for Client resource */
+#define JS_WaitMaxJobs           'd'  /* Waiting for maximum jobs */
+#define JS_WaitStartTime         't'  /* Waiting for start time */
 
-#define job_cancelled(jcr) \
-  (jcr->JobStatus == JS_Cancelled || \
+#define job_canceled(jcr) \
+  (jcr->JobStatus == JS_Canceled || \
    jcr->JobStatus == JS_ErrorTerminated || \
    jcr->JobStatus == JS_FatalError)
 
+
 typedef void (JCR_free_HANDLER)(struct s_jcr *jcr);
 
 /* Job Control Record (JCR) */
@@ -118,6 +123,7 @@ struct s_jcr {
    /* Director Daemon specific part of JCR */
    pthread_t SD_msg_chan;             /* Message channel thread id */
    pthread_cond_t term_wait;          /* Wait for job termination */
+   workq_ele_t *work_item;            /* Work queue item if scheduled */
    int msg_thread_done;               /* Set when Storage message thread terms */
    BSOCK *ua;                         /* User agent */
    JOB *job;                          /* Job resource */
@@ -128,6 +134,7 @@ struct s_jcr {
    CAT *catalog;                      /* Catalog resource */
    MSGS *messages;                    /* Default message handler */
    int SDJobStatus;                   /* Storage Job Status */
+   int FDJobStatus;                   /* File daemon Job Status */
    int mode;                          /* manual/auto run */
    B_DB *db;                          /* database pointer */
    uint32_t MediaId;                  /* DB record IDs associated with this job */
@@ -144,6 +151,7 @@ struct s_jcr {
    int replace;                       /* Replace option */
 #endif /* DIRECTOR_DAEMON */
 
+
 #ifdef FILE_DAEMON
    /* File Daemon specific part of JCR */
    uint32_t num_files_examined;       /* files examined this job */
@@ -160,15 +168,20 @@ struct s_jcr {
    int32_t compress_buf_size;         /* Length of compression buffer */
    POOLMEM *where;                    /* Root where to restore */
    int replace;                       /* Replace options */
+   int prefix_links;                  /* Prefix links with Where path */
    int buf_size;                      /* length of buffer */
-   FF_PKT *ff;                        /* Find Files packet */
+   void *ff;                          /* Find Files packet */
    char stored_addr[MAX_NAME_LENGTH]; /* storage daemon address */
    uint32_t StartFile;
    uint32_t EndFile;
    uint32_t StartBlock;
    uint32_t EndBlock;
+   int use_win_backup_api;            /* set to use native Win API */
+   pthread_t heartbeat_id;            /* id of heartbeat thread */
+   BSOCK *duped_sd;                   /* duped SD socket */
 #endif /* FILE_DAEMON */
 
+
 #ifdef STORAGE_DAEMON
    /* Storage Daemon specific part of JCR */
    struct s_jcr *next_dev;            /* next JCR attached to device */
@@ -216,6 +229,8 @@ struct s_jcr {
 
 }; 
 
+
+
 /* 
  * Structure for all daemons that keeps some summary
  *  info on the last job run.
@@ -242,7 +257,6 @@ typedef struct s_jcr JCR;
 
 /* The following routines are found in lib/jcr.c */
 extern JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr);
-extern void free_jcr(JCR *jcr);
 extern void free_locked_jcr(JCR *jcr);
 extern JCR *get_jcr_by_id(uint32_t JobId);
 extern JCR *get_jcr_by_session(uint32_t SessionId, uint32_t SessionTime);
@@ -251,5 +265,13 @@ extern JCR *get_jcr_by_full_name(char *Job);
 extern JCR *get_next_jcr(JCR *jcr);
 extern void lock_jcr_chain();
 extern void unlock_jcr_chain();
+extern void set_jcr_job_status(JCR *jcr, int JobStatus);
+
+#ifdef DEBUG
+extern void b_free_jcr(char *file, int line, JCR *jcr);
+#define free_jcr(jcr) b_free_jcr(__FILE__, __LINE__, (jcr))
+#else
+extern void free_jcr(JCR *jcr);
+#endif
 
 #endif /* __JCR_H_ */