]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/inc_conf.c
ebl Modify disk-changer to check if slot contains something before
[bacula/bacula] / bacula / src / dird / inc_conf.c
index 658c2f29d21e9fba4f0a695daa19a7713074033f..3dc445fd9d3a95cf2bbb09f4527884fe773b307a 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2008 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.
@@ -53,9 +53,12 @@ static void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_opts(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass);
+static void store_plugin_name(LEX *lc, RES_ITEM *item, int index, int pass);
 static void options_res(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_base(LEX *lc, RES_ITEM *item, int index, int pass);
+static void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_reader(LEX *lc, RES_ITEM *item, int index, int pass);
+static void store_ignoredir(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_writer(LEX *lc, RES_ITEM *item, int index, int pass);
 static void setup_current_opts(void);
 
@@ -82,8 +85,10 @@ static INCEXE res_incexe;
  *   name             handler     value    code flags default_value
  */
 static RES_ITEM newinc_items[] = {
-   {"file",            store_fname,   {0},      0, 0, 0},
-   {"options",         options_res,   {0},      0, 0, 0},
+   {"file",            store_fname,       {0},      0, 0, 0},
+   {"plugin",          store_plugin_name, {0},      0, 0, 0},
+   {"ignoredir",       store_ignoredir,   {0},      0, 0, 0},
+   {"options",         options_res,       {0},      0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -93,6 +98,7 @@ static RES_ITEM newinc_items[] = {
 static RES_ITEM options_items[] = {
    {"compression",     store_opts,    {0},     0, 0, 0},
    {"signature",       store_opts,    {0},     0, 0, 0},
+   {"accurate",        store_opts,    {0},     0, 0, 0},
    {"verify",          store_opts,    {0},     0, 0, 0},
    {"onefs",           store_opts,    {0},     0, 0, 0},
    {"recurse",         store_opts,    {0},     0, 0, 0},
@@ -112,6 +118,7 @@ static RES_ITEM options_items[] = {
    {"wildfile",        store_wild,    {0},     2, 0, 0},
    {"exclude",         store_opts,    {0},     0, 0, 0},
    {"aclsupport",      store_opts,    {0},     0, 0, 0},
+   {"plugin",          store_plugin,  {0},     0, 0, 0},
    {"reader",          store_reader,  {0},     0, 0, 0},
    {"writer",          store_writer,  {0},     0, 0, 0},
    {"ignorecase",      store_opts,    {0},     0, 0, 0},
@@ -122,6 +129,7 @@ static RES_ITEM options_items[] = {
    {"drivetype",       store_drivetype, {0},     0, 0, 0},
    {"checkfilechanges",store_opts,    {0},     0, 0, 0},
    {"strippath",       store_opts,    {0},     0, 0, 0},
+   {"honornodumpflag", store_opts,    {0},     0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -133,6 +141,7 @@ enum {
    INC_KW_DIGEST,
    INC_KW_ENCRYPTION,
    INC_KW_VERIFY,
+   INC_KW_ACCURATE,
    INC_KW_ONEFS,
    INC_KW_RECURSE,
    INC_KW_SPARSE,
@@ -149,7 +158,8 @@ enum {
    INC_KW_NOATIME,
    INC_KW_ENHANCEDWILD,
    INC_KW_CHKCHANGES,
-   INC_KW_STRIPPATH
+   INC_KW_STRIPPATH,
+   INC_KW_HONOR_NODUMP
 };
 
 /*
@@ -163,6 +173,7 @@ static struct s_kw FS_option_kw[] = {
    {"signature",   INC_KW_DIGEST},
    {"encryption",  INC_KW_ENCRYPTION},
    {"verify",      INC_KW_VERIFY},
+   {"accurate",    INC_KW_ACCURATE},
    {"onefs",       INC_KW_ONEFS},
    {"recurse",     INC_KW_RECURSE},
    {"sparse",      INC_KW_SPARSE},
@@ -180,6 +191,7 @@ static struct s_kw FS_option_kw[] = {
    {"enhancedwild", INC_KW_ENHANCEDWILD},
    {"checkfilechanges", INC_KW_CHKCHANGES},
    {"strippath",    INC_KW_STRIPPATH},
+   {"honornodumpflag",    INC_KW_HONOR_NODUMP},
    {NULL,          0}
 };
 
@@ -247,6 +259,8 @@ static struct s_fs_opt FS_options[] = {
    {"no",       INC_KW_ENHANCEDWILD,  "0"},
    {"yes",      INC_KW_CHKCHANGES,    "c"},
    {"no",       INC_KW_CHKCHANGES,    "0"},
+   {"yes",      INC_KW_HONOR_NODUMP,  "N"},
+   {"no",       INC_KW_HONOR_NODUMP,  "0"},
    {NULL,       0,                      0}
 };
 
@@ -274,6 +288,12 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
       bstrncat(opts, lc->str, optlen);
       bstrncat(opts, ":", optlen);         /* terminate it */
       Dmsg3(900, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen);
+   } else if (keyword == INC_KW_ACCURATE) { /* special case */
+      /* ***FIXME**** ensure these are in permitted set */
+      bstrncat(opts, "C", optlen);         /* indicate Accurate */
+      bstrncat(opts, lc->str, optlen);
+      bstrncat(opts, ":", optlen);         /* terminate it */
+      Dmsg3(900, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen);
    } else if (keyword == INC_KW_STRIPPATH) { /* another special case */
       if (!is_an_integer(lc->str)) {
          scan_err1(lc, _("Expected a strip path positive integer, got:%s:"), lc->str);
@@ -470,6 +490,22 @@ static void store_base(LEX *lc, RES_ITEM *item, int index, int pass)
    scan_to_eol(lc);
 }
 
+/* Store reader info */
+static void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+   int token;
+
+   token = lex_get_token(lc, T_NAME);
+   if (pass == 1) {
+      /*
+       * Pickup plugin command
+       */
+      res_incexe.current_opts->plugin = bstrdup(lc->str);
+   }
+   scan_to_eol(lc);
+}
+
+
 /* Store reader info */
 static void store_reader(LEX *lc, RES_ITEM *item, int index, int pass)
 {
@@ -570,6 +606,21 @@ static void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass)
    scan_to_eol(lc);
 }
 
+/* Store ignoredir info */
+static void store_ignoredir(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+   int token;
+
+   token = lex_get_token(lc, T_NAME);
+   if (pass == 1) {
+      /*
+       * Pickup reader command
+       */
+      res_incexe.current_opts->ignoredir = bstrdup(lc->str);
+   }
+   scan_to_eol(lc);
+}
+
 /* Store drivetype info */
 static void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass)
 {
@@ -632,6 +683,46 @@ static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass)
    scan_to_eol(lc);
 }
 
+/*
+ * Store Filename info. Note, for minor efficiency reasons, we
+ * always increase the name buffer by 10 items because we expect
+ * to add more entries.
+ */
+static void store_plugin_name(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+   int token;
+   INCEXE *incexe;
+
+   token = lex_get_token(lc, T_SKIP_EOL);
+   if (pass == 1) {
+      /* Pickup Filename string
+       */
+      switch (token) {
+      case T_IDENTIFIER:
+      case T_UNQUOTED_STRING:
+         if (strchr(lc->str, '\\')) {
+            scan_err1(lc, _("Backslash found. Use forward slashes or quote the string.: %s\n"), lc->str);
+            /* NOT REACHED */
+         }
+      case T_QUOTED_STRING:
+         if (res_all.res_fs.have_MD5) {
+            MD5Update(&res_all.res_fs.md5c, (unsigned char *)lc->str, lc->str_len);
+         }
+         incexe = &res_incexe;
+         if (incexe->plugin_list.size() == 0) {
+            incexe->plugin_list.init(10, true);
+         }
+         incexe->plugin_list.append(bstrdup(lc->str));
+         Dmsg1(900, "Add to plugin_list %s\n", lc->str);
+         break;
+      default:
+         scan_err1(lc, _("Expected a filename, got: %s"), lc->str);
+      }
+   }
+   scan_to_eol(lc);
+}
+
+
 
 /*
  * Come here when Options seen in Include/Exclude