Duplicate Job Proximity = <time-interval> (0)
+ My suggestion was to define it as the minimum guard time between
+ executions of a specific job -- ie, if a job was scheduled within Job
+ Proximity number of seconds, it would be considered a duplicate and
+ consolidated.
+
Skip = Do not allow two or more jobs with the same name to run
simultaneously within the proximity interval. The second and subsequent
jobs are skipped without further processing (other than to note the job
static char *runjob = NULL;
static int background = 1;
static void init_reload(void);
-
+static PARSER *parser;
+
/* Globals Exported */
DIRRES *director; /* Director resource */
int FDConnectTimeout;
extern RES_TABLE resources[];
extern RES **res_head;
extern RES_ITEM job_items[];
+extern int res_all_size;
#if defined(_MSC_VER)
extern "C" { // work around visual compiler mangling variables
configfile = bstrdup(CONFIG_FILE);
}
- parse_config(configfile);
+ parser = new_parser();
+ parser->init(configfile, NULL, M_ERROR_TERM, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ parser->parse_config();
if (init_crypto() != 0) {
Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Cryptography library initialization failed.\n"));
print_memory_pool_stats();
}
free_config_resources();
+ free(parser);
term_ua_server();
term_msg(); /* terminate message handler */
cleanup_crypto();
struct save_pkt sp;
bEvent event;
- bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
- event.eventType = bEventBackupCommand;
-
if (!plugin_list) {
return 1; /* Return if no plugins loaded */
}
+ bpContext *plugin_ctx_list = (bpContext *)jcr->plugin_ctx_list;
+ event.eventType = bEventBackupCommand;
+
/* Handle plugin command here backup */
Dmsg1(100, "plugin cmd=%s\n", cmd);
if (!(p = strchr(cmd, ':'))) {
* Initialize the static structure to zeros, then
* apply all the default values.
*/
-static void init_resource(int type, RES_ITEM *items, int pass)
+static void init_resource(PARSER *parser, int type, RES_ITEM *items, int pass)
{
int i;
int rindex = type - r_first;
- memset((char *)&res_all, 0, res_all_size);
+ memset(parser->m_res_all, 0, parser->m_res_all_size);
res_all.hdr.rcode = type;
res_all.hdr.refcnt = 1;
p_resource
};
+PARSER *new_parser()
+{
+ PARSER *parser;
+ parser = (PARSER *)malloc(sizeof(PARSER));
+ memset(parser, 0, sizeof(PARSER));
+ return parser;
+}
+
+void PARSER::init(
+ const char *cf,
+ LEX_ERROR_HANDLER *scan_error,
+ int err_type,
+ void *vres_all,
+ int res_all_size,
+ int r_first,
+ int r_last,
+ RES_TABLE *resources,
+ RES **res_head)
+{
+ m_cf = cf;
+ m_scan_error = scan_error;
+ m_err_type = err_type;
+ m_res_all = vres_all;
+ m_res_all_size = res_all_size;
+ m_r_first = r_first;
+ m_r_last = r_last;
+ m_resources = resources;
+ m_res_head = res_head;
+}
+
/*********************************************************************
*
* Parse configuration file
*/
int
parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error, int err_type)
+{
+ int ok;
+ PARSER *parser = new_parser();
+ parser->init(cf, scan_error, err_type, (void *)&res_all, res_all_size,
+ r_first, r_last, resources, res_head);
+ ok = parser->parse_config();
+ free(parser);
+ return ok;
+}
+
+
+bool PARSER::parse_config()
{
LEX *lc = NULL;
int token, i, pass;
int level = 0;
static bool first = true;
int errstat;
+ const char *cf = m_cf;
+ LEX_ERROR_HANDLER *scan_error = m_scan_error;
+ int err_type = m_err_type;
if (first && (errstat=rwl_init(&res_lock)) != 0) {
berrno be;
}
state = p_resource;
res_type = resources[i].rcode;
- init_resource(res_type, items, pass);
+ init_resource(this, res_type, items, pass);
break;
}
}
#endif
}
-bool
+static bool
find_config_file(const char *config_file, char *full_path, int max_path)
{
if (first_path_separator(config_file) != NULL) {
class RES; /* Declare forware referenced structure */
typedef void (MSG_RES_HANDLER)(LEX *lc, RES_ITEM *item, int index, int pass);
+
/* This is the structure that defines
* the record types (items) permitted within each
* resource. It is used to define the configuration
/* For storing name_addr items in res_items table */
#define ITEM(x) {(char **)&res_all.x}
-#define MAX_RES_ITEMS 70 /* maximum resource items per RES */
+#define MAX_RES_ITEMS 80 /* maximum resource items per RES */
/* This is the universal header that is
* at the beginning of every resource
int rcode; /* code if needed */
};
+class PARSER {
+public:
+ const char *m_cf; /* config file */
+ LEX_ERROR_HANDLER *m_scan_error; /* error handler if non-null */
+ int m_err_type; /* the way to terminate on failure */
+ void *m_res_all; /* pointer to res_all buffer */
+ int m_res_all_size; /* length of buffer */
+ /* The below are not yet implemented */
+ int m_r_first; /* first daemon resource type */
+ int m_r_last; /* last daemon resource type */
+ RES_TABLE *m_resources; /* pointer to table of permitted resources */
+ RES **m_res_head; /* pointer to defined resources */
+ brwlock_t m_res_lock; /* resource lock */
+
+ /* functions */
+ void init(
+ const char *cf,
+ LEX_ERROR_HANDLER *scan_error,
+ int err_type,
+ void *vres_all,
+ int res_all_size,
+ int r_first,
+ int r_last,
+ RES_TABLE *resources,
+ RES **res_head);
+
+ bool parse_config();
+};
+
+PARSER *new_parser();
+
+
/* Common Resource definitions */
#define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1 /* maximum resource name length */
inline char *MSGS::name() const { return hdr.name; }
/* Configuration routines */
+
int parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error = NULL, int err_type=M_ERROR_TERM);
void free_config_resources(void);
RES **save_config_resources(void);
#endif
-
+/*
+ * Standard global parsers defined in parse_config.c
+ */
void store_str(LEX *lc, RES_ITEM *item, int index, int pass);
void store_dir(LEX *lc, RES_ITEM *item, int index, int pass);
void store_password(LEX *lc, RES_ITEM *item, int index, int pass);
Technical notes on version 2.3
General:
+27Feb08
+kes Eliminate FORTIFY_CODE=2 bug, and make first cut at removing
+ daemon globals used by parser.
+kes Apply Joao's patch to separate DB_TYPE and DB_PROG in configure.
26Feb08
kes Fix free of plugin_list when none exists.
25Feb08