]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/inc_conf.c
kes Implement bsr block level checking for disk files. However,
[bacula/bacula] / bacula / src / dird / inc_conf.c
index 59d44e28e3d2d10474e1034f88b556e8feae6b91..c8a7dfa2a4d994afa274914a2b00c4551b92fed8 100644 (file)
@@ -52,16 +52,16 @@ static void store_wild(LEX *lc, RES_ITEM *item, int index, int pass);
 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);
 
+/* Include and Exclude items */
+static void store_fname(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
+static void store_plugin_name(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
+static void options_res(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
+static void store_excludedir(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude);
+
 
 /* We build the current resource here as we are
  * scanning the resource configuration definition,
@@ -75,7 +75,7 @@ extern "C" { // work around visual compiler mangling variables
 #else
 extern URES res_all;
 #endif
-extern int  res_all_size;
+extern int32_t  res_all_size;
 
 /* We build the current new Include and Exclude items here */
 static INCEXE res_incexe;
@@ -84,10 +84,10 @@ static INCEXE res_incexe;
  * new Include/Exclude items
  *   name             handler     value    code flags default_value
  */
-static RES_ITEM newinc_items[] = {
+static RES_ITEM2 newinc_items[] = {
    {"file",            store_fname,       {0},      0, 0, 0},
    {"plugin",          store_plugin_name, {0},      0, 0, 0},
-   {"ignoredir",       store_ignoredir,   {0},      0, 0, 0},
+   {"excludedircontaining", store_excludedir,  {0}, 0, 0, 0},
    {"options",         options_res,       {0},      0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
 };
@@ -119,15 +119,13 @@ static RES_ITEM options_items[] = {
    {"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},
    {"fstype",          store_fstype,  {0},     0, 0, 0},
    {"hfsplussupport",  store_opts,    {0},     0, 0, 0},
    {"noatime",         store_opts,    {0},     0, 0, 0},
    {"enhancedwild",    store_opts,    {0},     0, 0, 0},
-   {"drivetype",       store_drivetype, {0},     0, 0, 0},
-   {"checkfilechanges",store_opts,    {0},     0, 0, 0},
+   {"drivetype",       store_drivetype, {0},   0, 0, 0},
+   {"checkfilechanges",store_opts,    {0},     0, 0, 1},
    {"strippath",       store_opts,    {0},     0, 0, 0},
    {"honornodumpflag", store_opts,    {0},     0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
@@ -333,7 +331,7 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
 /*
  *
  * Store FileSet Include/Exclude info
- *  NEW style includes are handled in store_newinc()
+ *  new style includes are handled in store_newinc()
  */
 void store_inc(LEX *lc, RES_ITEM *item, int index, int pass)
 {
@@ -354,7 +352,7 @@ void store_inc(LEX *lc, RES_ITEM *item, int index, int pass)
 
 
 /*
- * Store NEW style FileSet FInclude/FExclude info
+ * Store new style FileSet Include/Exclude info
  *
  *  Note, when this routine is called, we are inside a FileSet
  *  resource.  We treat the Include/Execlude like a sort of
@@ -389,7 +387,7 @@ static void store_newinc(LEX *lc, RES_ITEM *item, int index, int pass)
                }
             }
             /* Call item handler */
-            newinc_items[i].handler(lc, &newinc_items[i], i, pass);
+            newinc_items[i].handler(lc, &newinc_items[i], i, pass, item->code);
             i = -1;
             break;
          }
@@ -506,38 +504,6 @@ static void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass)
 }
 
 
-/* Store reader info */
-static void store_reader(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->reader = bstrdup(lc->str);
-   }
-   scan_to_eol(lc);
-}
-
-/* Store writer innfo */
-static void store_writer(LEX *lc, RES_ITEM *item, int index, int pass)
-{
-   int token;
-
-   token = lex_get_token(lc, T_NAME);
-   if (pass == 1) {
-      /*
-       * Pickup writer command
-       */
-      res_incexe.current_opts->writer = bstrdup(lc->str);
-   }
-   scan_to_eol(lc);
-}
-
-
-
 /* Store Wild-card info */
 static void store_wild(LEX *lc, RES_ITEM *item, int index, int pass)
 {
@@ -606,16 +572,17 @@ 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)
+/* Store exclude directory containing  info */
+static void store_excludedir(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude)
 {
    int token;
 
+   if (exclude) {
+      scan_err0(lc, _("ExcludeDirContaining directive not permitted in Exclude.\n"));
+      /* NOT REACHED */
+   }
    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);
@@ -649,7 +616,7 @@ static void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass)
  * always increase the name buffer by 10 items because we expect
  * to add more entries.
  */
-static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass)
+static void store_fname(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude)
 {
    int token;
    INCEXE *incexe;
@@ -688,11 +655,15 @@ static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass)
  * 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)
+static void store_plugin_name(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude)
 {
    int token;
    INCEXE *incexe;
 
+   if (exclude) {
+      scan_err0(lc, _("Plugin directive not permitted in Exclude\n"));
+      /* NOT REACHED */
+   }
    token = lex_get_token(lc, T_SKIP_EOL);
    if (pass == 1) {
       /* Pickup Filename string
@@ -717,6 +688,7 @@ static void store_plugin_name(LEX *lc, RES_ITEM *item, int index, int pass)
          break;
       default:
          scan_err1(lc, _("Expected a filename, got: %s"), lc->str);
+         /* NOT REACHED */
       }
    }
    scan_to_eol(lc);
@@ -727,10 +699,14 @@ static void store_plugin_name(LEX *lc, RES_ITEM *item, int index, int pass)
 /*
  * Come here when Options seen in Include/Exclude
  */
-static void options_res(LEX *lc, RES_ITEM *item, int index, int pass)
+static void options_res(LEX *lc, RES_ITEM2 *item, int index, int pass, bool exclude)
 {
    int token, i;
 
+   if (exclude) {
+      scan_err0(lc, _("Options section not permitted in Exclude\n"));
+      /* NOT REACHED */
+   }
    token = lex_get_token(lc, T_SKIP_EOL);
    if (token != T_BOB) {
       scan_err1(lc, _("Expecting open brace. Got %s"), lc->str);