job_items[i].handler == store_jobtype ||
job_items[i].handler == store_level ||
job_items[i].handler == store_int32 ||
+ job_items[i].handler == store_size32 ||
job_items[i].handler == store_migtype ||
job_items[i].handler == store_replace) {
def_ivalue = (uint32_t *)((char *)(job->jobdefs) + offset);
* Handle 64 bit integer fields
*/
} else if (job_items[i].handler == store_time ||
- job_items[i].handler == store_size ||
+ job_items[i].handler == store_size64 ||
job_items[i].handler == store_int64) {
def_lvalue = (int64_t *)((char *)(job->jobdefs) + offset);
Dmsg5(400, "Job \"%s\", field \"%s\" def_lvalue=%" lld " item %d offset=%u\n",
{"enabled", store_bool, ITEM(res_job.enabled), 0, ITEM_DEFAULT, true},
{"spoolattributes",store_bool, ITEM(res_job.SpoolAttributes), 0, ITEM_DEFAULT, false},
{"spooldata", store_bool, ITEM(res_job.spool_data), 0, ITEM_DEFAULT, false},
- {"spoolsize", store_size, ITEM(res_job.spool_size), 0, 0, 0},
+ {"spoolsize", store_size64, ITEM(res_job.spool_size), 0, 0, 0},
{"rerunfailedlevels", store_bool, ITEM(res_job.rerun_failed_levels), 0, ITEM_DEFAULT, false},
{"prefermountedvolumes", store_bool, ITEM(res_job.PreferMountedVolumes), 0, ITEM_DEFAULT, true},
{"runbeforejob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
{"maximumvolumes", store_pint32, ITEM(res_pool.max_volumes), 0, 0, 0},
{"maximumvolumejobs", store_pint32, ITEM(res_pool.MaxVolJobs), 0, 0, 0},
{"maximumvolumefiles", store_pint32, ITEM(res_pool.MaxVolFiles), 0, 0, 0},
- {"maximumvolumebytes", store_size, ITEM(res_pool.MaxVolBytes), 0, 0, 0},
+ {"maximumvolumebytes", store_size64, ITEM(res_pool.MaxVolBytes), 0, 0, 0},
{"catalogfiles", store_bool, ITEM(res_pool.catalog_files), 0, ITEM_DEFAULT, true},
{"volumeretention", store_time, ITEM(res_pool.VolRetention), 0, ITEM_DEFAULT, 60*60*24*365},
{"volumeuseduration", store_time, ITEM(res_pool.VolUseDuration), 0, 0, 0},
{"migrationtime", store_time, ITEM(res_pool.MigrationTime), 0, 0, 0},
- {"migrationhighbytes", store_size, ITEM(res_pool.MigrationHighBytes), 0, 0, 0},
- {"migrationlowbytes", store_size, ITEM(res_pool.MigrationLowBytes), 0, 0, 0},
+ {"migrationhighbytes", store_size64, ITEM(res_pool.MigrationHighBytes), 0, 0, 0},
+ {"migrationlowbytes", store_size64, ITEM(res_pool.MigrationLowBytes), 0, 0, 0},
{"nextpool", store_res, ITEM(res_pool.NextPool), R_POOL, 0, 0},
{"storage", store_alist_res, ITEM(res_pool.storage), R_STORAGE, 0, 0},
{"autoprune", store_bool, ITEM(res_pool.AutoPrune), 0, ITEM_DEFAULT, true},
} else if (items[i].handler == store_bool) {
*(bool *)(items[i].value) = items[i].default_value != 0;
} else if (items[i].handler == store_pint32 ||
- items[i].handler == store_int32) {
+ items[i].handler == store_int32 ||
+ items[i].handler == store_size32) {
*(uint32_t *)(items[i].value) = items[i].default_value;
} else if (items[i].handler == store_int64) {
*(int64_t *)(items[i].value) = items[i].default_value;
- } else if (items[i].handler == store_size) {
+ } else if (items[i].handler == store_size64) {
*(uint64_t *)(items[i].value) = (uint64_t)items[i].default_value;
} else if (items[i].handler == store_time) {
*(utime_t *)(items[i].value) = (utime_t)items[i].default_value;
}
/* Store a size in bytes */
-void store_size(LEX *lc, RES_ITEM *item, int index, int pass)
+static void store_size(LEX *lc, RES_ITEM *item, int index, int pass, bool size32)
{
int token;
uint64_t uvalue;
scan_err1(lc, _("expected a size number, got: %s"), lc->str);
return;
}
- *(uint64_t *)(item->value) = uvalue;
+ if (size32) {
+ *(uint32_t *)(item->value) = (uint32_t)uvalue;
+ } else {
+ *(uint64_t *)(item->value) = uvalue;
+ }
break;
default:
scan_err1(lc, _("expected a size, got: %s"), lc->str);
Dmsg0(900, "Leave store_size\n");
}
+/* Store a size in bytes */
+void store_size32(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+ store_size(lc, item, index, pass, true /* 32 bit */);
+}
+
+/* Store a size in bytes */
+void store_size64(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+ store_size(lc, item, index, pass, false /* not 32 bit */);
+}
+
/* Store a time period in seconds */
void store_time(LEX *lc, RES_ITEM *item, int index, int pass)
void store_bit(LEX *lc, RES_ITEM *item, int index, int pass);
void store_bool(LEX *lc, RES_ITEM *item, int index, int pass);
void store_time(LEX *lc, RES_ITEM *item, int index, int pass);
-void store_size(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_size64(LEX *lc, RES_ITEM *item, int index, int pass);
+void store_size32(LEX *lc, RES_ITEM *item, int index, int pass);
void store_defs(LEX *lc, RES_ITEM *item, int index, int pass);
void store_label(LEX *lc, RES_ITEM *item, int index, int pass);
{"maximumrewindwait", store_time, ITEM(res_dev.max_rewind_wait), 0, ITEM_DEFAULT, 5 * 60},
{"minimumblocksize", store_pint32, ITEM(res_dev.min_block_size), 0, 0, 0},
{"maximumblocksize", store_maxblocksize, ITEM(res_dev.max_block_size), 0, 0, 0},
- {"maximumvolumesize", store_size, ITEM(res_dev.max_volume_size), 0, 0, 0},
- {"maximumfilesize", store_size, ITEM(res_dev.max_file_size), 0, ITEM_DEFAULT, 1000000000},
- {"volumecapacity", store_size, ITEM(res_dev.volume_capacity), 0, 0, 0},
+ {"maximumvolumesize", store_size64, ITEM(res_dev.max_volume_size), 0, 0, 0},
+ {"maximumfilesize", store_size64, ITEM(res_dev.max_file_size), 0, ITEM_DEFAULT, 1000000000},
+ {"volumecapacity", store_size64, ITEM(res_dev.volume_capacity), 0, 0, 0},
{"maximumconcurrentjobs", store_pint32, ITEM(res_dev.max_concurrent_jobs), 0, 0, 0},
{"spooldirectory", store_dir, ITEM(res_dev.spool_directory), 0, 0, 0},
- {"maximumspoolsize", store_size, ITEM(res_dev.max_spool_size), 0, 0, 0},
- {"maximumjobspoolsize", store_size, ITEM(res_dev.max_job_spool_size), 0, 0, 0},
+ {"maximumspoolsize", store_size64, ITEM(res_dev.max_spool_size), 0, 0, 0},
+ {"maximumjobspoolsize", store_size64, ITEM(res_dev.max_job_spool_size), 0, 0, 0},
{"driveindex", store_pint32, ITEM(res_dev.drive_index), 0, 0, 0},
- {"maximumpartsize", store_size, ITEM(res_dev.max_part_size), 0, ITEM_DEFAULT, 0},
+ {"maximumpartsize", store_size64, ITEM(res_dev.max_part_size), 0, ITEM_DEFAULT, 0},
{"mountpoint", store_strname,ITEM(res_dev.mount_point), 0, 0, 0},
{"mountcommand", store_strname,ITEM(res_dev.mount_command), 0, 0, 0},
{"unmountcommand", store_strname,ITEM(res_dev.unmount_command), 0, 0, 0},
*/
static void store_maxblocksize(LEX *lc, RES_ITEM *item, int index, int pass)
{
- lex_get_token(lc, T_PINT32);
- if (lc->pint32_val <= MAX_BLOCK_LENGTH) {
- *(uint32_t *)(item->value) = lc->pint32_val;
- scan_to_eol(lc);
- set_bit(index, res_all.hdr.item_present);
- } else {
- scan_err2(lc, _("Maximum Block Size configured value %u is greater than allowed maximum: %u"), lc->pint32_val, MAX_BLOCK_LENGTH );
+ store_size32(lc, item, index, pass);
+ if (*(uint32_t *)(item->value) > MAX_BLOCK_LENGTH) {
+ scan_err2(lc, _("Maximum Block Size configured value %u is greater than allowed maximum: %u"),
+ *(uint32_t *)(item->value), MAX_BLOCK_LENGTH );
}
}