*/
int r_first = R_FIRST;
int r_last = R_LAST;
+static RES *sres_head[R_LAST - R_FIRST + 1];
+RES **res_head = sres_head;
/* Imported subroutines */
extern void store_run(LEX *lc, RES_ITEM *item, int index, int pass);
{"name", store_name, ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
{"description", store_str, ITEM(res_dir.hdr.desc), 0, 0, 0},
{"messages", store_res, ITEM(res_dir.messages), R_MSGS, 0, 0},
- {"dirport", store_pint, ITEM(res_dir.DIRport), 0, ITEM_DEFAULT, 9101},
- {"diraddress", store_str, ITEM(res_dir.DIRaddr), 0, 0, 0},
+ {"dirport", store_addresses_port, ITEM(res_dir.DIRaddrs), 0, ITEM_DEFAULT, 9101},
+ {"diraddress", store_addresses_address, ITEM(res_dir.DIRaddrs), 0, ITEM_DEFAULT, 9101},
+ {"diraddresses",store_addresses, ITEM(res_dir.DIRaddrs), 0, ITEM_DEFAULT, 9101},
{"queryfile", store_dir, ITEM(res_dir.query_file), 0, ITEM_REQUIRED, 0},
{"workingdirectory", store_dir, ITEM(res_dir.working_directory), 0, ITEM_REQUIRED, 0},
{"piddirectory",store_dir, ITEM(res_dir.pid_directory), 0, ITEM_REQUIRED, 0},
* name items rcode res_head
*/
RES_TABLE resources[] = {
- {"director", dir_items, R_DIRECTOR, NULL},
- {"client", cli_items, R_CLIENT, NULL},
- {"job", job_items, R_JOB, NULL},
- {"storage", store_items, R_STORAGE, NULL},
- {"catalog", cat_items, R_CATALOG, NULL},
- {"schedule", sch_items, R_SCHEDULE, NULL},
- {"fileset", fs_items, R_FILESET, NULL},
- {"pool", pool_items, R_POOL, NULL},
- {"messages", msgs_items, R_MSGS, NULL},
- {"counter", counter_items, R_COUNTER, NULL},
- {"console", con_items, R_CONSOLE, NULL},
- {"jobdefs", job_items, R_JOBDEFS, NULL},
- {NULL, NULL, 0, NULL}
+ {"director", dir_items, R_DIRECTOR},
+ {"client", cli_items, R_CLIENT},
+ {"job", job_items, R_JOB},
+ {"storage", store_items, R_STORAGE},
+ {"catalog", cat_items, R_CATALOG},
+ {"schedule", sch_items, R_SCHEDULE},
+ {"fileset", fs_items, R_FILESET},
+ {"pool", pool_items, R_POOL},
+ {"messages", msgs_items, R_MSGS},
+ {"counter", counter_items, R_COUNTER},
+ {"console", con_items, R_CONSOLE},
+ {"jobdefs", job_items, R_JOBDEFS},
+ {NULL, NULL, 0}
};
{"Data", L_VERIFY_DATA, JT_VERIFY},
{" ", L_NONE, JT_ADMIN},
{" ", L_NONE, JT_RESTORE},
- {NULL, 0}
+ {NULL, 0, 0}
};
/* Keywords (RHS) permitted in Job type records
{NULL, 0}
};
-char *level_to_str(int level)
+const char *level_to_str(int level)
{
int i;
static char level_no[30];
- char *str = level_no;
+ const char *str = level_no;
bsnprintf(level_no, sizeof(level_no), "%d", level); /* default if not found */
for (i=0; joblevels[i].level_name; i++) {
}
/* Dump contents of resource */
-void dump_resource(int type, RES *reshdr, void sendit(void *sock, char *fmt, ...), void *sock)
+void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fmt, ...), void *sock)
{
URES *res = (URES *)reshdr;
bool recurse = true;
res->res_client.hdr.name, res->res_client.address, res->res_client.FDport,
res->res_client.MaxConcurrentJobs);
sendit(sock, " JobRetention=%s FileRetention=%s AutoPrune=%d\n",
- edit_utime(res->res_client.JobRetention, ed1),
- edit_utime(res->res_client.FileRetention, ed2),
+ edit_utime(res->res_client.JobRetention, ed1, sizeof(ed1)),
+ edit_utime(res->res_client.FileRetention, ed2, sizeof(ed2)),
res->res_client.AutoPrune);
if (res->res_client.catalog) {
sendit(sock, " --> ");
for (j=0; j<incexe->num_opts; j++) {
FOPTS *fo = incexe->opts_list[j];
sendit(sock, " O %s\n", fo->opts);
- for (k=0; k<fo->match.size(); k++) {
- sendit(sock, " W %s\n", fo->match.get(j));
+ for (k=0; k<fo->regex.size(); k++) {
+ sendit(sock, " R %s\n", fo->regex.get(k));
+ }
+ for (k=0; k<fo->wild.size(); k++) {
+ sendit(sock, " W %s\n", fo->wild.get(k));
+ }
+ for (k=0; k<fo->base.size(); k++) {
+ sendit(sock, " B %s\n", fo->base.get(k));
+ }
+ if (fo->reader) {
+ sendit(sock, " D %s\n", fo->reader);
+ }
+ if (fo->writer) {
+ sendit(sock, " T %s\n", fo->writer);
}
sendit(sock, " N\n");
}
res->res_pool.accept_any_volume, res->res_pool.catalog_files);
sendit(sock, " max_vols=%d auto_prune=%d VolRetention=%s\n",
res->res_pool.max_volumes, res->res_pool.AutoPrune,
- edit_utime(res->res_pool.VolRetention, ed1));
+ edit_utime(res->res_pool.VolRetention, ed1, sizeof(ed1)));
sendit(sock, " VolUse=%s recycle=%d LabelFormat=%s\n",
- edit_utime(res->res_pool.VolUseDuration, ed1),
+ edit_utime(res->res_pool.VolUseDuration, ed1, sizeof(ed1)),
res->res_pool.Recycle,
NPRT(res->res_pool.label_format));
sendit(sock, " CleaningPrefix=%s\n",
incexe->name_list.destroy();
for (int i=0; i<incexe->num_opts; i++) {
FOPTS *fopt = incexe->opts_list[i];
- fopt->match.destroy();
- fopt->base_list.destroy();
+ fopt->regex.destroy();
+ fopt->wild.destroy();
+ fopt->base.destroy();
+ if (fopt->reader) {
+ free(fopt->reader);
+ }
+ if (fopt->writer) {
+ free(fopt->writer);
+ }
free(fopt);
}
if (incexe->opts_list) {
if (res->res_dir.query_file) {
free(res->res_dir.query_file);
}
- if (res->res_dir.DIRaddr) {
- free(res->res_dir.DIRaddr);
+ if (res->res_dir.DIRaddrs) {
+ free_addresses(res->res_dir.DIRaddrs);
}
break;
case R_COUNTER:
}
/* Common */
if (!error) {
- if (type == R_JOBDEFS) {
- Dmsg0(200, "Storing JobDefs definition.\n");
- }
res = (URES *)malloc(size);
memcpy(res, &res_all, size);
- if (!resources[rindex].res_head) {
- resources[rindex].res_head = (RES *)res; /* store first entry */
- Dmsg3(200, "Inserting first %s res: %s index=%d\n", res_to_str(type),
+ if (!res_head[rindex]) {
+ res_head[rindex] = (RES *)res; /* store first entry */
+ Dmsg3(900, "Inserting first %s res: %s index=%d\n", res_to_str(type),
res->res_dir.hdr.name, rindex);
} else {
RES *next;
/* Add new res to end of chain */
- for (next=resources[rindex].res_head; next->next; next=next->next) {
+ for (next=res_head[rindex]; next->next; next=next->next) {
if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
Emsg2(M_ERROR_TERM, 0,
_("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
}
}
next->next = (RES *)res;
- Dmsg4(200, "Inserting %s res: %s index=%d pass=%d\n", res_to_str(type),
+ Dmsg4(900, "Inserting %s res: %s index=%d pass=%d\n", res_to_str(type),
res->res_dir.hdr.name, rindex, pass);
}
}
token = lex_get_token(lc, T_NAME);
if (pass == 1) {
if (((alist **)item->value)[item->code] == NULL) {
- ((alist **)item->value)[item->code] = new alist(10, owned_by_alist);
-// Dmsg1(400, "Defined new ACL alist at %d\n", item->code);
+ ((alist **)item->value)[item->code] = New(alist(10, owned_by_alist));
+// Dmsg1(900, "Defined new ACL alist at %d\n", item->code);
}
((alist **)item->value)[item->code]->append(bstrdup(lc->str));
-// Dmsg2(400, "Appended to %d %s\n", item->code, lc->str);
+// Dmsg2(900, "Appended to %d %s\n", item->code, lc->str);
}
token = lex_get_token(lc, T_ALL);
if (token == T_COMMA) {
while ((token = lex_get_token(lc, T_ALL)) != T_EOL) {
bool found = false;
- Dmsg1(150, "store_backup got token=%s\n", lex_tok_to_str(token));
+ Dmsg1(900, "store_backup got token=%s\n", lex_tok_to_str(token));
if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
scan_err1(lc, "Expected a backup/verify keyword, got: %s", lc->str);
}
- Dmsg1(190, "Got keyword: %s\n", lc->str);
+ Dmsg1(900, "Got keyword: %s\n", lc->str);
for (i=0; BakVerFields[i].name; i++) {
if (strcasecmp(lc->str, BakVerFields[i].name) == 0) {
found = true;
scan_err1(lc, "Expected an equals, got: %s", lc->str);
}
token = lex_get_token(lc, T_NAME);
- Dmsg1(190, "Got value: %s\n", lc->str);
+ Dmsg1(900, "Got value: %s\n", lc->str);
switch (BakVerFields[i].token) {
case 'C':
/* Find Client Resource */
lc->options |= LOPT_NO_IDENT; /* make spaces significant */
- Dmsg0(190, "Enter store_restore()\n");
+ Dmsg0(900, "Enter store_restore()\n");
((JOB *)(item->value))->JobType = item->code;
while ((token = lex_get_token(lc, T_ALL)) != T_EOL) {
scan_err1(lc, "expected a name, got: %s", lc->str);
}
for (i=0; RestoreFields[i].name; i++) {
- Dmsg1(190, "Restore kw=%s\n", lc->str);
+ Dmsg1(900, "Restore kw=%s\n", lc->str);
if (strcasecmp(lc->str, RestoreFields[i].name) == 0) {
found = true;
if (lex_get_token(lc, T_ALL) != T_EQUALS) {
scan_err1(lc, "Expected an equals, got: %s", lc->str);
}
token = lex_get_token(lc, T_ALL);
- Dmsg1(190, "Restore value=%s\n", lc->str);
+ Dmsg1(900, "Restore value=%s\n", lc->str);
switch (RestoreFields[i].token) {
case 'B':
/* Bootstrap */
}
errno = 0;
res_all.res_job.RestoreJobId = strtol(lc->str, NULL, 0);
- Dmsg1(190, "RestorJobId=%d\n", res_all.res_job.RestoreJobId);
+ Dmsg1(900, "RestorJobId=%d\n", res_all.res_job.RestoreJobId);
if (errno != 0) {
scan_err1(lc, "expected an integer number, got: %s", lc->str);
}