X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fstored_conf.c;h=a9fc44da5df02288e5bee45849b790a2694c0e6f;hb=8ec628bc2c18b136d3496203ebd9fa1a0cdc50d5;hp=5e1d84abfa41167711401ad880d5669fe2ad461e;hpb=d2120d58e588514c20380449ab9b0932289960d3;p=bacula%2Fbacula diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index 5e1d84abfa..a9fc44da5d 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -1,12 +1,12 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. This program is Free Software; you can redistribute it and/or - modify it under the terms of version two of the GNU General Public + modify it under the terms of version three of the GNU Affero General Public License as published by the Free Software Foundation and included in the file LICENSE. @@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Affero General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -29,8 +29,6 @@ * Configuration file parser for Bacula Storage daemon * * Kern Sibbald, March MM - * - * Version $Id$ */ #include "bacula.h" @@ -45,6 +43,7 @@ RES **res_head = sres_head; /* Forward referenced subroutines */ static void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass); +static void store_maxblocksize(LEX *lc, RES_ITEM *item, int index, int pass); /* We build the current resource here statically, @@ -141,6 +140,7 @@ static RES_ITEM dev_items[] = { {"checklabels", store_bit, ITEM(res_dev.cap_bits), CAP_CHECKLABELS, ITEM_DEFAULT, 0}, {"requiresmount", store_bit, ITEM(res_dev.cap_bits), CAP_REQMOUNT, ITEM_DEFAULT, 0}, {"offlineonunmount", store_bit, ITEM(res_dev.cap_bits), CAP_OFFLINEUNMOUNT, ITEM_DEFAULT, 0}, + {"blockchecksum", store_bit, ITEM(res_dev.cap_bits), CAP_BLOCKCHECKSUM, ITEM_DEFAULT, 1}, {"autoselect", store_bool, ITEM(res_dev.autoselect), 1, ITEM_DEFAULT, 1}, {"changerdevice", store_strname,ITEM(res_dev.changer_name), 0, 0, 0}, {"changercommand", store_strname,ITEM(res_dev.changer_command), 0, 0, 0}, @@ -149,18 +149,19 @@ static RES_ITEM dev_items[] = { {"maximumopenwait", store_time, ITEM(res_dev.max_open_wait), 0, ITEM_DEFAULT, 5 * 60}, {"maximumopenvolumes", store_pint32, ITEM(res_dev.max_open_vols), 0, ITEM_DEFAULT, 1}, {"maximumnetworkbuffersize", store_pint32, ITEM(res_dev.max_network_buffer_size), 0, 0, 0}, - {"volumepollinterval", store_time, ITEM(res_dev.vol_poll_interval), 0, 0, 0}, + {"volumepollinterval", store_time, ITEM(res_dev.vol_poll_interval), 0, ITEM_DEFAULT, 5 * 60}, {"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_pint32, 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}, + {"maximumblocksize", store_maxblocksize, ITEM(res_dev.max_block_size), 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}, @@ -243,6 +244,19 @@ static void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass) set_bit(index, res_all.hdr.item_present); } +/* + * Store Maximum Block Size, and check it is not greater than MAX_BLOCK_LENGTH + * + */ +static void store_maxblocksize(LEX *lc, RES_ITEM *item, int index, int pass) +{ + 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 ); + } +} + /* Dump contents of resource */ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fmt, ...), void *sock) @@ -443,6 +457,7 @@ void free_resource(RES *sres, int type) if (res->res_changer.device) { delete res->res_changer.device; } + rwl_destroy(&res->res_changer.changer_lock); break; case R_STORAGE: if (res->res_store.sdaddrs) { @@ -615,9 +630,9 @@ void save_resource(int type, RES_ITEM *items, int pass) foreach_alist(dev, res->res_changer.device) { dev->changer_res = (AUTOCHANGER *)&res->res_changer; } - if ((errstat = pthread_mutex_init(&res->res_changer.changer_mutex, NULL)) != 0) { + if ((errstat = rwl_init(&res->res_changer.changer_lock)) != 0) { berrno be; - Jmsg1(NULL, M_ERROR_TERM, 0, _("Unable to init mutex: ERR=%s\n"), + Jmsg1(NULL, M_ERROR_TERM, 0, _("Unable to init lock: ERR=%s\n"), be.bstrerror(errstat)); } break;