X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fblock.h;h=1c3c304bb0f140aa0622aeb3d65c4e6812d52ec6;hb=a64e57850ac943b84184f43e712ccf18b498ca30;hp=ca265dea7c41f642784abd05ac25ecf5e7206dd3;hpb=61985ad10389ae63b92bba34b35e095347520a5c;p=bacula%2Fbacula diff --git a/bacula/src/stored/block.h b/bacula/src/stored/block.h index ca265dea7c..1c3c304bb0 100644 --- a/bacula/src/stored/block.h +++ b/bacula/src/stored/block.h @@ -7,7 +7,7 @@ * */ /* - Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + Copyright (C) 2000-2003 Kern Sibbald and John Walker This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -41,18 +41,19 @@ #define BLKHDR1_LENGTH 16 /* Total length */ #define BLKHDR2_LENGTH 24 /* Total length */ -#define WRITE_BLKHDR_ID BLKHDR1_ID -#define WRITE_BLKHDR_LENGTH BLKHDR1_LENGTH -#define BLOCK_VER 1 +#define WRITE_BLKHDR_ID BLKHDR2_ID +#define WRITE_BLKHDR_LENGTH BLKHDR2_LENGTH +#define BLOCK_VER 2 /* Record header definitions */ #define RECHDR1_LENGTH 20 #define RECHDR2_LENGTH 12 -#define WRITE_RECHDR_LENGTH RECHDR1_LENGTH +#define WRITE_RECHDR_LENGTH RECHDR2_LENGTH /* Tape label and version definitions */ -#define BaculaId "Bacula 0.9 mortal\n" -#define BaculaTapeVersion 10 +#define BaculaId "Bacula 1.0 immortal\n" +#define OldBaculaId "Bacula 0.9 mortal\n" +#define BaculaTapeVersion 11 #define OldCompatibleBaculaTapeVersion1 10 #define OldCompatibleBaculaTapeVersion2 9 @@ -81,25 +82,30 @@ * * This is the memory structure for a device block. */ -typedef struct s_dev_block { - struct s_dev_block *next; /* pointer to next one */ - /* binbuf is the number of bytes remaining - * in the buffer. For writes, it is bytes not yet written. - * For reads, it is remaining bytes not yet read. +struct DEV_BLOCK { + DEV_BLOCK *next; /* pointer to next one */ + void *dev; /* pointer to device (DEVICE not defined yet) */ + /* binbuf is the number of bytes remaining in the buffer. + * For writes, it is bytes not yet written. + * For reads, it is remaining bytes not yet read. */ uint32_t binbuf; /* bytes in buffer */ uint32_t block_len; /* length of current block read */ uint32_t buf_len; /* max/default block length */ - uint32_t BlockNumber; /* sequential block number */ - uint32_t read_len; /* bytes read into buffer */ + uint32_t BlockNumber; /* sequential Bacula block number */ + uint32_t read_len; /* bytes read into buffer, if zero, block empty */ uint32_t VolSessionId; /* */ uint32_t VolSessionTime; /* */ + uint32_t read_errors; /* block errors (checksum, header, ...) */ int BlockVer; /* block version 1 or 2 */ - int failed_write; /* set if write failed */ - char *bufp; /* pointer into buffer */ - POOLMEM *buf; /* actual data buffer. This is a - * Pool buffer! - */ -} DEV_BLOCK; + bool write_failed; /* set if write failed */ + bool block_read; /* set when block read */ + int32_t FirstIndex; /* first index this block */ + int32_t LastIndex; /* last index this block */ + char *bufp; /* pointer into buffer */ + POOLMEM *buf; /* actual data buffer */ +}; + +#define block_is_empty(block) ((block)->read_len == 0) #endif