]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/match_bsr.c
update version
[bacula/bacula] / bacula / src / stored / match_bsr.c
index 9304c8886ebddc65e1607e8b8414cdefca38192e..2ba46e9c524ab7a270686f43ac71f3e013d28492 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2002-2010 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.
@@ -31,7 +31,6 @@
  *
  *     Kern Sibbald, June MMII
  *
- *   Version $Id$
  */
 
 /*
@@ -145,16 +144,18 @@ static int match_fileregex(BSR *bsr, DEV_RECORD *rec, JCR *jcr)
    if (bsr->fileregex_re == NULL)
       return 1;
 
-   if (bsr->attr == NULL)
+   if (bsr->attr == NULL) {
       bsr->attr = new_attr(jcr);
+   }
 
-   /* The code breaks if the first record associated with a file is
+   /*
+    * The code breaks if the first record associated with a file is
     * not of this type
     */
    if (rec->Stream == STREAM_UNIX_ATTRIBUTES ||
        rec->Stream == STREAM_UNIX_ATTRIBUTES_EX) {
       bsr->skip_file = false;
-      if (unpack_attributes_record(jcr, rec->Stream, rec->data, bsr->attr)) {
+      if (unpack_attributes_record(jcr, rec->Stream, rec->data, rec->data_len, bsr->attr)) {
          if (regexec(bsr->fileregex_re, bsr->attr->fname, 0, NULL, 0) == 0) {
             Dmsg2(dbglevel, "Matched pattern, fname=%s FI=%d\n",
                   bsr->attr->fname, rec->FileIndex);
@@ -386,7 +387,7 @@ bool is_this_bsr_done(BSR *bsr, DEV_RECORD *rec)
 static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec,
                      SESSION_LABEL *sessrec, bool done, JCR *jcr)
 {
-   Dmsg0(050, "Enter match_all\n");
+   Dmsg0(dbglevel, "Enter match_all\n");
    if (bsr->done) {
 //    Dmsg0(dbglevel, "bsr->done set\n");
       goto no_match;
@@ -409,7 +410,7 @@ static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec,
 
    if (!match_voladdr(bsr, bsr->voladdr, rec, 1)) {
       if (bsr->voladdr) {
-         Dmsg3(dbglevel, "Fail on Addr=%lld. bsr=%lld,%lld\n", 
+         Dmsg3(dbglevel, "Fail on Addr=%llu. bsr=%llu,%llu\n", 
                get_record_address(rec), bsr->voladdr->saddr, bsr->voladdr->eaddr);
       }
       goto no_match;
@@ -458,7 +459,7 @@ static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec,
     */
    if (bsr->count && bsr->FileIndex) {
       rec->bsr = bsr;
-      Dmsg0(050, "Leave match_all 1\n");
+      Dmsg0(dbglevel, "Leave match_all 1\n");
       return 1;                       /* this is a complete match */
    }
 
@@ -492,7 +493,6 @@ static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec,
       Dmsg0(dbglevel, "fail on stream\n");
       goto no_match;
    }
-   Dmsg0(050, "Leave match_all 1\n");
    return 1;
 
 no_match:
@@ -500,10 +500,10 @@ no_match:
       return match_all(bsr->next, rec, volrec, sessrec, bsr->done && done, jcr);
    }
    if (bsr->done && done) {
-      Dmsg0(050, "Leave match all -1\n");
+      Dmsg0(dbglevel, "Leave match all -1\n");
       return -1;
    }
-   Dmsg0(050, "Leave match all 0\n");
+   Dmsg0(dbglevel, "Leave match all 0\n");
    return 0;
 }
 
@@ -513,7 +513,7 @@ static int match_volume(BSR *bsr, BSR_VOLUME *volume, VOLUME_LABEL *volrec, bool
       return 0;                       /* Volume must match */
    }
    if (strcmp(volume->VolumeName, volrec->VolumeName) == 0) {
-      Dmsg1(050, "match_volume=%s\n", volrec->VolumeName);
+      Dmsg1(dbglevel, "match_volume=%s\n", volrec->VolumeName);
       return 1;
    }
    if (volume->next) {
@@ -636,13 +636,24 @@ static int match_voladdr(BSR *bsr, BSR_VOLADDR *voladdr, DEV_RECORD *rec, bool d
    if (!voladdr) {
       return 1;                       /* no specification matches all */
    }
+
+#ifdef xxx
+
    /* For the moment, these tests work only with disk. */
    if (rec->state & REC_ISTAPE) {
-      return 1;                       /* All File records OK for this match */
+      uint32_t sFile = (voladdr->saddr)>>32;
+      uint32_t eFile = (voladdr->eaddr)>>32;
+      if (sFile <= rec->File && eFile >= rec->File) {
+         return 1;
+      }
    }
+
+#endif
+
    uint64_t addr = get_record_address(rec);
-//  Dmsg3(dbglevel, "match_voladdr: saddr=%lld eaddr=%lld recaddr=%lld\n",
-//             volblock->saddr, volblock->eaddr, addr);
+   Dmsg6(dbglevel, "match_voladdr: saddr=%llu eaddr=%llu recaddr=%llu sfile=%u efile=%u recfile=%u\n",
+         voladdr->saddr, voladdr->eaddr, addr, voladdr->saddr>>32, voladdr->eaddr>>32, addr>>32);
+
    if (voladdr->saddr <= addr && voladdr->eaddr >= addr) {
       return 1;
    }
@@ -658,7 +669,7 @@ static int match_voladdr(BSR *bsr, BSR_VOLADDR *voladdr, DEV_RECORD *rec, bool d
    if (voladdr->done && done) {
       bsr->done = true;
       bsr->root->reposition = true;
-      Dmsg2(dbglevel, "bsr done from voladdr rec=%lld voleaddr=%lld\n",
+      Dmsg2(dbglevel, "bsr done from voladdr rec=%llu voleaddr=%llu\n",
             addr, voladdr->eaddr);
    }
    return 0;