]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/inc_conf.c
Fix typo
[bacula/bacula] / bacula / src / dird / inc_conf.c
index bacd5bbead282d35aeaadcc806b85ff6f5934889..5b1b5c66a542323c9c4e3e6dd7164e345da1cc60 100644 (file)
 
 /* Forward referenced subroutines */
 
-void store_inc(LEX *lc, struct res_items *item, int index, int pass);
+void store_inc(LEX *lc, RES_ITEM *item, int index, int pass);
 
-static void store_newinc(LEX *lc, struct res_items *item, int index, int pass);
-static void store_match(LEX *lc, struct res_items *item, int index, int pass);
-static void store_opts(LEX *lc, struct res_items *item, int index, int pass);
-static void store_fname(LEX *lc, struct res_items *item, int index, int pass);
-static void store_base(LEX *lc, struct res_items *item, int index, int pass);
+static void store_newinc(LEX *lc, RES_ITEM *item, int index, int pass);
+static void store_match(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_base(LEX *lc, RES_ITEM *item, int index, int pass);
 static void setup_current_opts(void);
 
 
@@ -56,7 +56,7 @@ static INCEXE res_incexe;
  * new Include/Exclude items
  *   name            handler     value                        code flags default_value
  */
-static struct res_items newinc_items[] = {
+static RES_ITEM newinc_items[] = {
    {"compression",     store_opts,    NULL,     0, 0, 0},
    {"signature",       store_opts,    NULL,     0, 0, 0},
    {"verify",          store_opts,    NULL,     0, 0, 0},
@@ -85,6 +85,8 @@ static struct res_items newinc_items[] = {
 #define INC_KW_REPLACE     8         /* restore options */
 #define INC_KW_READFIFO     9        /* Causes fifo data to be read */
 #define INC_KW_PORTABLE    10
+#define INC_KW_MTIMEONLY   11
+#define INC_KW_KEEPATIME   12
 
 /* Include keywords -- these are keywords that can appear
  *    in the options lists of an old include ( Include = compression= ...)
@@ -100,6 +102,8 @@ static struct s_kw FS_option_kw[] = {
    {"replace",     INC_KW_REPLACE},
    {"readfifo",    INC_KW_READFIFO},
    {"portable",    INC_KW_PORTABLE},
+   {"mtimeonly",   INC_KW_MTIMEONLY},
+   {"keepatime",   INC_KW_KEEPATIME},
    {NULL,         0}
 };
 
@@ -145,14 +149,19 @@ static struct s_fs_opt FS_options[] = {
    {"no",       INC_KW_READFIFO,      "0"},
    {"yes",      INC_KW_PORTABLE,      "p"},
    {"no",       INC_KW_PORTABLE,      "0"},
+   {"yes",      INC_KW_MTIMEONLY,     "m"},
+   {"no",       INC_KW_MTIMEONLY,     "0"},
+   {"yes",      INC_KW_KEEPATIME,     "k"},
+   {"no",       INC_KW_KEEPATIME,     "0"},
    {NULL,      0,                   0}
 };
 
 
 
 /* 
- * Scan for old Include options (keyword=option) is converted into one or
- *  two characters. Verifyopts=xxxx is Vxxxx:
+ * Scan for right hand side of Include options (keyword=option) is 
+ *    converted into one or two characters. Verifyopts=xxxx is Vxxxx:
+ *    Whatever is found is concatenated to the opts string.
  */
 static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
 {
@@ -167,6 +176,7 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
       bstrncat(opts, "V", optlen);         /* indicate Verify */
       bstrncat(opts, lc->str, optlen);
       bstrncat(opts, ":", optlen);         /* terminate it */
+      Dmsg3(100, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen);
 
    /*
     * Standard keyword options for Include/Exclude 
@@ -185,7 +195,7 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
          scan_err1(lc, "Expected a FileSet option keyword, got:%s:", lc->str);
       } else { /* add option */
         bstrncat(opts, option, optlen);
-         Dmsg3(200, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen);
+         Dmsg3(100, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen);
       }
    }
 
@@ -196,7 +206,7 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
 }
 
 /* Store FileSet Include/Exclude info */
-void store_inc(LEX *lc, struct res_items *item, int index, int pass)
+void store_inc(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token, i;
    int options = lc->options;
@@ -238,6 +248,7 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass)
       if ((token=lex_get_token(lc, T_ALL)) != T_EQUALS) {
          scan_err1(lc, _("expected an = following keyword, got: %s"), lc->str);
       } else {
+        /* Scan right hand side of option */
         scan_include_options(lc, keyword, inc_opts, sizeof(inc_opts));
       }
       if (token == T_BOB) {
@@ -258,7 +269,7 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass)
       }
       setup_current_opts();
       bstrncpy(res_incexe.current_opts->opts, inc_opts, MAX_FOPTS);
-      Dmsg1(200, "incexe opts=%s\n", res_incexe.current_opts->opts);
+      Dmsg2(100, "old pass=%d incexe opts=%s\n", pass, res_incexe.current_opts->opts);
 
       /* Create incexe structure */
       Dmsg0(200, "Create INCEXE structure\n");
@@ -290,24 +301,24 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass)
        */
       while ((token = lex_get_token(lc, T_ALL)) != T_EOB) {
         switch (token) {
-           case T_COMMA:
-           case T_EOL:
-              continue;
-
-           case T_IDENTIFIER:
-           case T_UNQUOTED_STRING:
-           case T_QUOTED_STRING:
-              if (res_all.res_fs.have_MD5) {
-                 MD5Update(&res_all.res_fs.md5c, (unsigned char *)lc->str, lc->str_len);
-              }
-              if (incexe->name_list.size() == 0) {
-                 incexe->name_list.init(10, true);
-              }
-              incexe->name_list.append(bstrdup(lc->str));
-               Dmsg1(200, "Add to name_list %s\n", lc->str);
-              break;
-           default:
-               scan_err1(lc, "Expected a filename, got: %s", lc->str);
+        case T_COMMA:
+        case T_EOL:
+           continue;
+
+        case T_IDENTIFIER:
+        case T_UNQUOTED_STRING:
+        case T_QUOTED_STRING:
+           if (res_all.res_fs.have_MD5) {
+              MD5Update(&res_all.res_fs.md5c, (unsigned char *)lc->str, lc->str_len);
+           }
+           if (incexe->name_list.size() == 0) {
+              incexe->name_list.init(10, true);
+           }
+           incexe->name_list.append(bstrdup(lc->str));
+            Dmsg1(200, "Add to name_list %s\n", lc->str);
+           break;
+        default:
+            scan_err1(lc, "Expected a filename, got: %s", lc->str);
         }                                 
       }
       /* Note, MD5Final is done in backup.c */
@@ -327,7 +338,7 @@ void store_inc(LEX *lc, struct res_items *item, int index, int pass)
  *  resource.  We treat the Finclude/Fexeclude like a sort of
  *  mini-resource within the FileSet resource.
  */
-static void store_newinc(LEX *lc, struct res_items *item, int index, int pass)
+static void store_newinc(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token, i;
    INCEXE *incexe;
@@ -394,7 +405,7 @@ static void store_newinc(LEX *lc, struct res_items *item, int index, int pass)
 
 
 /* Store Match info */
-static void store_match(LEX *lc, struct res_items *item, int index, int pass)
+static void store_match(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token;
 
@@ -419,7 +430,7 @@ static void store_match(LEX *lc, struct res_items *item, int index, int pass)
 }
 
 /* Store Base info */
-static void store_base(LEX *lc, struct res_items *item, int index, int pass)
+static void store_base(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token;
 
@@ -440,7 +451,7 @@ static void store_base(LEX *lc, struct res_items *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, struct res_items *item, int index, int pass)
+static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int token;
    INCEXE *incexe;
@@ -472,8 +483,10 @@ static void store_fname(LEX *lc, struct res_items *item, int index, int pass)
    scan_to_eol(lc);
 }
 
-
-static void store_opts(LEX *lc, struct res_items *item, int index, int pass)
+/*
+ * New style options come here
+ */
+static void store_opts(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int i;
    int keyword;
@@ -481,6 +494,7 @@ static void store_opts(LEX *lc, struct res_items *item, int index, int pass)
 
    inc_opts[0] = 0;
    keyword = INC_KW_NONE;
+   /* Look up the keyword */
    for (i=0; FS_option_kw[i].name; i++) {
       if (strcasecmp(item->name, FS_option_kw[i].name) == 0) {
         keyword = FS_option_kw[i].token;
@@ -490,14 +504,13 @@ static void store_opts(LEX *lc, struct res_items *item, int index, int pass)
    if (keyword == INC_KW_NONE) {
       scan_err1(lc, "Expected a FileSet keyword, got: %s", lc->str);
    }
-   Dmsg2(200, "keyword=%d %s\n", keyword, FS_option_kw[keyword].name);
+   /* Now scan for the value */
    scan_include_options(lc, keyword, inc_opts, sizeof(inc_opts));
-
    if (pass == 1) {
       setup_current_opts();
-      bstrncat(res_incexe.current_opts->opts, inc_opts, MAX_FOPTS);
+      bstrncpy(res_incexe.current_opts->opts, inc_opts, MAX_FOPTS);
+      Dmsg2(100, "new pass=%d incexe opts=%s\n", pass, res_incexe.current_opts->opts);
    }
-
    scan_to_eol(lc);
 }