]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/record.c
Eliminate dependency on man2html.
[bacula/bacula] / bacula / src / stored / record.c
index 1ed09332e8cf240a4628946f603064d61aa0d715..8eb05094923dc0975f7ed6705c924f9d9a91dbad 100644 (file)
@@ -13,7 +13,7 @@
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
-   version 2 as ammended with additional clauses defined in the
+   version 2 as amended with additional clauses defined in the
    file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
@@ -27,8 +27,6 @@
 #include "bacula.h"
 #include "stored.h"
 
-extern int debug_level;
-
 /*
  * Convert a FileIndex into a printable
  *   ASCII string.  Not reentrant.
@@ -36,9 +34,8 @@ extern int debug_level;
  *   record as a Label, otherwise it is simply
  *   the FileIndex of the current file.
  */
-const char *FI_to_ascii(int fi)
+const char *FI_to_ascii(char *buf, int fi)
 {
-   static char buf[20];
    if (fi >= 0) {
       sprintf(buf, "%d", fi);
       return buf;
@@ -58,7 +55,7 @@ const char *FI_to_ascii(int fi)
       return "EOT_LABEL";
       break;
    default:
-     sprintf(buf, "unknown: %d", fi);
+     sprintf(buf, _("unknown: %d"), fi);
      return buf;
    }
 }
@@ -75,9 +72,8 @@ const char *FI_to_ascii(int fi)
  *   dealing with a Label, hence the
  *   stream is the JobId.
  */
-const char *stream_to_ascii(int stream, int fi)
+const char *stream_to_ascii(char *buf, int stream, int fi)
 {
-    static char buf[20];
     if (fi < 0) {
        sprintf(buf, "%d", stream);
        return buf;
@@ -91,9 +87,9 @@ const char *stream_to_ascii(int stream, int fi)
        return "WIN32-DATA";
     case STREAM_WIN32_GZIP_DATA:
        return "WIN32-GZIP";
-    case STREAM_MD5_SIGNATURE:
+    case STREAM_MD5_DIGEST:
        return "MD5";
-    case STREAM_SHA1_SIGNATURE:
+    case STREAM_SHA1_DIGEST:
        return "SHA1";
     case STREAM_GZIP_DATA:
        return "GZIP";
@@ -111,6 +107,24 @@ const char *stream_to_ascii(int stream, int fi)
        return "MACOS-RSRC";
     case STREAM_HFSPLUS_ATTRIBUTES:
        return "HFSPLUS-ATTR";
+    case STREAM_SHA256_DIGEST:
+       return "SHA256";
+    case STREAM_SHA512_DIGEST:
+       return "SHA512";
+    case STREAM_SIGNED_DIGEST:
+       return "SIGNED-DIGEST";
+    case STREAM_ENCRYPTED_SESSION_DATA:
+       return "ENCRYPTED-SESSION-DATA";
+    case STREAM_ENCRYPTED_FILE_DATA:
+       return "ENCRYPTED-FILE";
+    case STREAM_ENCRYPTED_FILE_GZIP_DATA:
+       return "ENCRYPTED-GZIP";
+    case STREAM_ENCRYPTED_WIN32_DATA:
+       return "ENCRYPTED-WIN32-DATA";
+    case STREAM_ENCRYPTED_WIN32_GZIP_DATA:
+       return "ENCRYPTED-WIN32-GZIP";
+    case STREAM_ENCRYPTED_MACOS_FORK_DATA:
+       return "ENCRYPTED-MACOS-RSRC";
     case -STREAM_UNIX_ATTRIBUTES:
        return "contUATTR";
     case -STREAM_FILE_DATA:
@@ -119,9 +133,9 @@ const char *stream_to_ascii(int stream, int fi)
        return "contWIN32-DATA";
     case -STREAM_WIN32_GZIP_DATA:
        return "contWIN32-GZIP";
-    case -STREAM_MD5_SIGNATURE:
+    case -STREAM_MD5_DIGEST:
        return "contMD5";
-    case -STREAM_SHA1_SIGNATURE:
+    case -STREAM_SHA1_DIGEST:
        return "contSHA1";
     case -STREAM_GZIP_DATA:
        return "contGZIP";
@@ -139,6 +153,24 @@ const char *stream_to_ascii(int stream, int fi)
        return "contMACOS-RSRC";
     case -STREAM_HFSPLUS_ATTRIBUTES:
        return "contHFSPLUS-ATTR";
+    case -STREAM_SHA256_DIGEST:
+       return "contSHA256";
+    case -STREAM_SHA512_DIGEST:
+       return "contSHA512";
+    case -STREAM_SIGNED_DIGEST:
+       return "contSIGNED-DIGEST";
+    case -STREAM_ENCRYPTED_SESSION_DATA:
+       return "contENCRYPTED-SESSION-DATA";
+    case -STREAM_ENCRYPTED_FILE_DATA:
+       return "contENCRYPTED-FILE";
+    case -STREAM_ENCRYPTED_FILE_GZIP_DATA:
+       return "contENCRYPTED-GZIP";
+    case -STREAM_ENCRYPTED_WIN32_DATA:
+       return "contENCRYPTED-WIN32-DATA";
+    case -STREAM_ENCRYPTED_WIN32_GZIP_DATA:
+       return "contENCRYPTED-WIN32-GZIP";
+    case -STREAM_ENCRYPTED_MACOS_FORK_DATA:
+       return "contENCRYPTED-MACOS-RSRC";
     default:
        sprintf(buf, "%d", stream);
        return buf;
@@ -201,6 +233,7 @@ bool write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
 {
    ser_declare;
    uint32_t remlen;
+   char buf1[100], buf2[100];
 
    remlen = block->buf_len - block->binbuf;
 
@@ -209,8 +242,8 @@ bool write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
 
    Dmsg6(890, "write_record_to_block() FI=%s SessId=%d Strm=%s len=%d\n"
 "rem=%d remainder=%d\n",
-      FI_to_ascii(rec->FileIndex), rec->VolSessionId,
-      stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len,
+      FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
+      stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len,
       remlen, rec->remainder);
 
    /*
@@ -320,8 +353,8 @@ bool write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
             /* We damaged a buffer */
             Dmsg6(0, "Damaged block FI=%s SessId=%d Strm=%s len=%d\n"
 "rem=%d remainder=%d\n",
-               FI_to_ascii(rec->FileIndex), rec->VolSessionId,
-               stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len,
+               FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
+               stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len,
                remlen, rec->remainder);
             Dmsg5(0, "Damaged block: bufp=%x binbuf=%d buf_len=%d rem=%d moved=%d\n",
                block->bufp, block->binbuf, block->buf_len, block->buf_len-block->binbuf,
@@ -329,7 +362,7 @@ bool write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
             Dmsg2(0, "Damaged block: buf=%x binbuffrombuf=%d \n",
                block->buf, block->bufp-block->buf);
 
-               Emsg0(M_ABORT, 0, "Damaged buffer\n");
+               Emsg0(M_ABORT, 0, _("Damaged buffer\n"));
          }
 #endif
 
@@ -390,6 +423,7 @@ bool read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec)
    int32_t  Stream;
    uint32_t data_bytes;
    uint32_t rhl;
+   char buf1[100], buf2[100];
 
    remlen = block->binbuf;
    rec->Block = block->BlockNumber;
@@ -473,8 +507,8 @@ bool read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec)
 
       Dmsg6(450, "rd_rec_blk() got FI=%s SessId=%d Strm=%s len=%u\n"
                  "remlen=%d data_len=%d\n",
-         FI_to_ascii(rec->FileIndex), rec->VolSessionId,
-         stream_to_ascii(rec->Stream, rec->FileIndex), data_bytes, remlen,
+         FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
+         stream_to_ascii(buf2, rec->Stream, rec->FileIndex), data_bytes, remlen,
          rec->data_len);
    } else {
       /*
@@ -522,7 +556,7 @@ bool read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec)
    }
    rec->remainder = 0;
    Dmsg4(450, "Rtn full rd_rec_blk FI=%s SessId=%d Strm=%s len=%d\n",
-      FI_to_ascii(rec->FileIndex), rec->VolSessionId,
-      stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len);
+      FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
+      stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len);
    return true;                       /* transferred full record */
 }