static struct res_items store_items[] = {
{"name", store_name, ITEM(res_store.hdr.name), 0, ITEM_REQUIRED, 0},
{"description", store_str, ITEM(res_dir.hdr.desc), 0, 0, 0},
- {"address", store_str, ITEM(res_store.address), 0, ITEM_REQUIRED, 0},
+ {"address", store_str, ITEM(res_store.address), 0, 0, 0}, /* deprecated */
+ {"sdaddress", store_str, ITEM(res_store.SDaddr), 0, 0, 0},
{"messages", store_res, ITEM(res_store.messages), 0, R_MSGS, 0},
- {"sdport", store_int, ITEM(res_store.SDport), 0, ITEM_REQUIRED, 0},
- {"sddport", store_int, ITEM(res_store.SDDport), 0, 0, 0}, /* depricated */
+ {"sdport", store_int, ITEM(res_store.SDport), 0, ITEM_DEFAULT, 9103},
+ {"sddport", store_int, ITEM(res_store.SDDport), 0, 0, 0}, /* deprecated */
{"workingdirectory", store_dir, ITEM(res_store.working_directory), 0, ITEM_REQUIRED, 0},
{"piddirectory", store_dir, ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
{"subsysdirectory", store_dir, ITEM(res_store.subsys_directory), 0, ITEM_REQUIRED, 0},
- {"maximumconcurrentjobs", store_int, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 1},
+ {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 3},
{NULL, NULL, 0, 0, 0, 0}
};
{"labelmedia", store_yesno, ITEM(res_dev.cap_bits), CAP_LABEL, ITEM_DEFAULT, 0},
{"mountanonymousvolumes", store_yesno, ITEM(res_dev.cap_bits), CAP_ANONVOLS, ITEM_DEFAULT, 0},
{"alwaysopen", store_yesno, ITEM(res_dev.cap_bits), CAP_ALWAYSOPEN, ITEM_DEFAULT, 1},
+ {"autochanger", store_yesno, ITEM(res_dev.cap_bits), CAP_AUTOCHANGER, ITEM_DEFAULT, 0},
+ {"changerdevice", store_strname,ITEM(res_dev.changer_name), 0, 0, 0},
+ {"changercommand", store_strname,ITEM(res_dev.changer_command), 0, 0, 0},
+ {"maximumchangerwait", store_pint, ITEM(res_dev.max_changer_wait), 0, ITEM_DEFAULT, 2 * 60},
+ {"maximumopenwait", store_pint, ITEM(res_dev.max_open_wait), 0, ITEM_DEFAULT, 5 * 60},
+ {"offlineonunmount", store_yesno, ITEM(res_dev.cap_bits), CAP_OFFLINEUNMOUNT, ITEM_DEFAULT, 0},
{"maximumrewindwait", store_pint, ITEM(res_dev.max_rewind_wait), 0, ITEM_DEFAULT, 5 * 60},
{"minimumblocksize", store_pint, ITEM(res_dev.min_block_size), 0, 0, 0},
{"maximumblocksize", store_pint, ITEM(res_dev.max_block_size), 0, 0, 0},
sendit(sock, "Director: name=%s\n", res->res_dir.hdr.name);
break;
case R_STORAGE:
- sendit(sock, "Storage: name=%s address=%s SDport=%d SDDport=%d\n",
- res->res_store.hdr.name, res->res_store.address,
+ sendit(sock, "Storage: name=%s SDaddr=%s SDport=%d SDDport=%d\n",
+ res->res_store.hdr.name, res->res_store.SDaddr,
res->res_store.SDport, res->res_store.SDDport);
break;
case R_DEVICE:
/* common stuff -- free the resource name */
nres = (URES *)res->res_dir.hdr.next;
- if (res->res_dir.hdr.name)
+ if (res->res_dir.hdr.name) {
free(res->res_dir.hdr.name);
+ }
+ if (res->res_dir.hdr.desc) {
+ free(res->res_dir.hdr.desc);
+ }
+
switch (type) {
case R_DIRECTOR:
- if (res->res_dir.password)
+ if (res->res_dir.password) {
free(res->res_dir.password);
- if (res->res_dir.address)
+ }
+ if (res->res_dir.address) {
free(res->res_dir.address);
+ }
break;
case R_STORAGE:
- if (res->res_store.address)
+ if (res->res_store.address) { /* ***FIXME*** deprecated */
free(res->res_store.address);
- if (res->res_store.working_directory)
+ }
+ if (res->res_store.SDaddr) {
+ free(res->res_store.SDaddr);
+ }
+ if (res->res_store.working_directory) {
free(res->res_store.working_directory);
- if (res->res_store.pid_directory)
+ }
+ if (res->res_store.pid_directory) {
free(res->res_store.pid_directory);
- if (res->res_store.subsys_directory)
+ }
+ if (res->res_store.subsys_directory) {
free(res->res_store.subsys_directory);
+ }
break;
case R_DEVICE:
- if (res->res_dev.media_type)
+ if (res->res_dev.media_type) {
free(res->res_dev.media_type);
- if (res->res_dev.device_name)
+ }
+ if (res->res_dev.device_name) {
free(res->res_dev.device_name);
+ }
+ if (res->res_dev.changer_name) {
+ free(res->res_dev.changer_name);
+ }
+ if (res->res_dev.changer_command) {
+ free(res->res_dev.changer_command);
+ }
break;
case R_MSGS:
- if (res->res_msgs.mail_cmd)
+ if (res->res_msgs.mail_cmd) {
free(res->res_msgs.mail_cmd);
- if (res->res_msgs.operator_cmd)
+ }
+ if (res->res_msgs.operator_cmd) {
free(res->res_msgs.operator_cmd);
+ }
free_msgs_res((MSGS *)res); /* free message resource */
res = NULL;
break;
return;
}
+ /* The following code is only executed on pass 1 */
switch (type) {
case R_DIRECTOR:
size = sizeof(DIRRES);
default:
printf("Unknown resource type %d\n", type);
error = 1;
+ size = 1;
break;
}
/* Common */
if (!error) {
- res = (URES *) malloc(size);
+ res = (URES *)malloc(size);
memcpy(res, &res_all, size);
- res->res_dir.hdr.next = resources[rindex].res_head;
- resources[rindex].res_head = (RES *)res;
+ if (!resources[rindex].res_head) {
+ resources[rindex].res_head = (RES *)res; /* store first entry */
+ } else {
+ RES *next;
+ /* Add new res to end of chain */
+ for (next=resources[rindex].res_head; next->next; next=next->next)
+ { }
+ next->next = (RES *)res;
+ Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type),
+ res->res_dir.hdr.name);
+ }
}
}