]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/stored_conf.c
Make Attr/record FI non-fatal if different -- possibly temp + add new session record...
[bacula/bacula] / bacula / src / stored / stored_conf.c
index dc141317afb20e38a94dc7df2e5f503af1839c2e..813a94c15106692923b74f42c5a0c83268b6256f 100644 (file)
@@ -1,7 +1,7 @@
 /*
    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.
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
  * Configuration file parser for Bacula Storage daemon
  *
  *     Kern Sibbald, March MM
- *
- *   Version $Id$
  */
 
 #include "bacula.h"
 #include "stored.h"
 
 /* First and last resource ids */
-int r_first = R_FIRST;
-int r_last  = R_LAST;
+int32_t r_first = R_FIRST;
+int32_t r_last  = R_LAST;
 static RES *sres_head[R_LAST - R_FIRST + 1];
 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,
@@ -56,7 +55,7 @@ extern "C" { // work around visual compiler mangling variables
 #else
 URES res_all;
 #endif
-int res_all_size = sizeof(res_all);
+int32_t res_all_size = sizeof(res_all);
 
 /* Definition of records permitted within each
  * resource with the routine to process the record
@@ -89,6 +88,7 @@ static RES_ITEM store_items[] = {
    {"tlsdhfile",             store_dir,       ITEM(res_store.tls_dhfile), 0, 0, 0},
    {"tlsallowedcn",          store_alist_str, ITEM(res_store.tls_allowed_cns), 0, 0, 0},
    {"clientconnectwait",     store_time,  ITEM(res_store.client_wait), 0, ITEM_DEFAULT, 30 * 60},
+   {"verid",                 store_str,       ITEM(res_store.verid), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -140,7 +140,8 @@ 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},
-   {"autoselect",            store_bit,  ITEM(res_dev.autoselect), 1, ITEM_DEFAULT, 1},
+   {"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},
    {"alertcommand",          store_strname,ITEM(res_dev.alert_command), 0, 0, 0},
@@ -148,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},
@@ -242,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)
@@ -483,6 +498,9 @@ void free_resource(RES *sres, int type)
       if (res->res_store.tls_allowed_cns) {
          delete res->res_store.tls_allowed_cns;
       }
+      if (res->res_store.verid) {
+         free(res->res_store.verid);
+      }
       break;
    case R_DEVICE:
       if (res->res_dev.media_type) {
@@ -681,3 +699,10 @@ void save_resource(int type, RES_ITEM *items, int pass)
       }
    }
 }
+
+bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code)
+{
+   config->init(configfile, NULL, exit_code, (void *)&res_all, res_all_size,
+      r_first, r_last, resources, res_head);
+   return config->parse_config();
+}