]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/stored_conf.c
Backport from BEE
[bacula/bacula] / bacula / src / stored / stored_conf.c
index f659d16b3bbeadb84dd7d8cd77996ff4e3cb4cd8..dce408b9b630396656e805f6a929d66791d02e98 100644 (file)
@@ -1,29 +1,17 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2014 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 three of the GNU Affero General Public
-   License as published by the Free Software Foundation and included
-   in the file LICENSE.
+   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 distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   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 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.
+   You may use this file and others of this release according to the
+   license defined in the LICENSE file, which includes the Affero General
+   Public License, v3.0 ("AGPLv3") and some additional permissions and
+   terms pursuant to its AGPLv3 Section 7.
 
    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
@@ -41,11 +29,6 @@ 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,
  * then move it to dynamic memory */
 #if defined(_MSC_VER)
@@ -142,12 +125,12 @@ static RES_ITEM dev_items[] = {
    {"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},
+   {"readonly",              store_bool, ITEM(res_dev.read_only), 1, 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},
    {"alertcommand",          store_strname,ITEM(res_dev.alert_command), 0, 0, 0},
    {"maximumchangerwait",    store_time,   ITEM(res_dev.max_changer_wait), 0, ITEM_DEFAULT, 5 * 60},
    {"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, ITEM_DEFAULT, 5 * 60},
    {"maximumrewindwait",     store_time,   ITEM(res_dev.max_rewind_wait), 0, ITEM_DEFAULT, 5 * 60},
@@ -224,7 +207,7 @@ static s_kw dev_types[] = {
  * Store Device Type (File, FIFO, Tape, DVD)
  *
  */
-static void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass)
+void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int i;
 
@@ -248,11 +231,11 @@ static void store_devtype(LEX *lc, RES_ITEM *item, int index, int pass)
  * 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)
+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"), 
+      scan_err2(lc, _("Maximum Block Size configured value %u is greater than allowed maximum: %u"),
          *(uint32_t *)(item->value), MAX_BLOCK_LENGTH );
    }
 }
@@ -425,7 +408,7 @@ void free_resource(RES *sres, int type)
       if (res->res_dir.address) {
          free(res->res_dir.address);
       }
-      if (res->res_dir.tls_ctx) { 
+      if (res->res_dir.tls_ctx) {
          free_tls_context(res->res_dir.tls_ctx);
       }
       if (res->res_dir.tls_ca_certfile) {
@@ -458,7 +441,7 @@ void free_resource(RES *sres, int type)
          delete res->res_changer.device;
       }
       rwl_destroy(&res->res_changer.changer_lock);
-      break; 
+      break;
    case R_STORAGE:
       if (res->res_store.sdaddrs) {
          free_addresses(res->res_store.sdaddrs);
@@ -481,7 +464,7 @@ void free_resource(RES *sres, int type)
       if (res->res_store.scripts_directory) {
          free(res->res_store.scripts_directory);
       }
-      if (res->res_store.tls_ctx) { 
+      if (res->res_store.tls_ctx) {
          free_tls_context(res->res_store.tls_ctx);
       }
       if (res->res_store.tls_ca_certfile) {
@@ -566,7 +549,7 @@ void free_resource(RES *sres, int type)
 
 /* Save the new resource by chaining it into the head list for
  * the resource. If this is pass 2, we update any resource
- * or alist pointers.  
+ * or alist pointers.
  */
 void save_resource(int type, RES_ITEM *items, int pass)
 {
@@ -627,17 +610,17 @@ void save_resource(int type, RES_ITEM *items, int pass)
          /* we must explicitly copy the device alist pointer */
          res->res_changer.device   = res_all.res_changer.device;
          /*
-          * Now update each device in this resource to point back 
+          * Now update each device in this resource to point back
           *  to the changer resource.
           */
          foreach_alist(dev, res->res_changer.device) {
             dev->changer_res = (AUTOCHANGER *)&res->res_changer;
          }
-         if ((errstat = rwl_init(&res->res_changer.changer_lock, 
+         if ((errstat = rwl_init(&res->res_changer.changer_lock,
                                  PRIO_SD_ACH_ACCESS)) != 0)
          {
             berrno be;
-            Jmsg1(NULL, M_ERROR_TERM, 0, _("Unable to init lock: ERR=%s\n"), 
+            Jmsg1(NULL, M_ERROR_TERM, 0, _("Unable to init lock: ERR=%s\n"),
                   be.bstrerror(errstat));
          }
          break;