]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/record.c
Use SMARTALLOC+memset instead of overload new/delete that doesn't work in bat
[bacula/bacula] / bacula / src / stored / record.c
index d47d74ccd838b330b75ee5a2b0cefd4b6f2460e5..973518644702f692be66dcae1a3883600283e6e4 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2001-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.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   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.
 
    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 General Public License
+   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.
 
-   Bacula® is a registered trademark of John Walker.
+   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.
@@ -32,8 +32,6 @@
  *              Kern Sibbald, April MMI
  *                added BB02 format October MMII
  *
- *   Version $Id$
- *
  */
 
 
@@ -67,6 +65,12 @@ const char *FI_to_ascii(char *buf, int fi)
    case EOT_LABEL:
       return "EOT_LABEL";
       break;
+   case SOB_LABEL:
+      return "SOB_LABEL";
+      break;
+   case EOB_LABEL:
+      return "EOB_LABEL";
+      break;
    default:
      sprintf(buf, _("unknown: %d"), fi);
      return buf;
@@ -108,6 +112,8 @@ const char *stream_to_ascii(char *buf, int stream, int fi)
        return "GZIP";
     case STREAM_UNIX_ATTRIBUTES_EX:
        return "UNIX-ATTR-EX";
+    case STREAM_RESTORE_OBJECT:
+       return "RESTORE-OBJECT";
     case STREAM_SPARSE_DATA:
        return "SPARSE-DATA";
     case STREAM_SPARSE_GZIP_DATA:
@@ -116,6 +122,8 @@ const char *stream_to_ascii(char *buf, int stream, int fi)
        return "PROG-NAMES";
     case STREAM_PROGRAM_DATA:
        return "PROG-DATA";
+    case STREAM_PLUGIN_NAME:
+       return "PLUGIN-NAME";
     case STREAM_MACOS_FORK_DATA:
        return "MACOS-RSRC";
     case STREAM_HFSPLUS_ATTRIBUTES:
@@ -154,6 +162,8 @@ const char *stream_to_ascii(char *buf, int stream, int fi)
        return "contGZIP";
     case -STREAM_UNIX_ATTRIBUTES_EX:
        return "contUNIX-ATTR-EX";
+    case -STREAM_RESTORE_OBJECT:
+       return "contRESTORE-OBJECT";
     case -STREAM_SPARSE_DATA:
        return "contSPARSE-DATA";
     case -STREAM_SPARSE_GZIP_DATA:
@@ -184,6 +194,9 @@ const char *stream_to_ascii(char *buf, int stream, int fi)
        return "contENCRYPTED-WIN32-GZIP";
     case -STREAM_ENCRYPTED_MACOS_FORK_DATA:
        return "contENCRYPTED-MACOS-RSRC";
+    case -STREAM_PLUGIN_NAME:
+       return "contPLUGIN-NAME";
+
     default:
        sprintf(buf, "%d", stream);
        return buf;
@@ -417,6 +430,10 @@ bool can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
    return true;
 }
 
+uint64_t get_record_address(DEV_RECORD *rec)
+{
+   return ((uint64_t)rec->File)<<32 | rec->Block;
+}
 
 /*
  * Read a Record from the block
@@ -439,15 +456,14 @@ bool read_record_from_block(DCR *dcr, DEV_BLOCK *block, DEV_RECORD *rec)
    char buf1[100], buf2[100];
 
    remlen = block->binbuf;
-   rec->Block = block->BlockNumber;
-   rec->File = ((DEVICE *)block->dev)->file;
 
    /* Clear state flags */
    rec->state = 0;
    if (block->dev->is_tape()) {
       rec->state |= REC_ISTAPE;
    }
-
+   rec->Block = ((DEVICE *)block->dev)->EndBlock;
+   rec->File = ((DEVICE *)block->dev)->EndFile;
 
    /*
     * Get the header. There is always a full header,