*
*/
/*
- Copyright (C) 2000-2003 Kern Sibbald and John Walker
+ Copyright (C) 2000-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ 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,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- 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 along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
#ifndef __BLOCK_H
#define __BLOCK_H 1
-#define MAX_BLOCK_LENGTH 500001 /* this is a sort of sanity check */
+#define MAX_BLOCK_LENGTH (1024*1024 + 1) /* this is a sort of sanity check */
#define DEFAULT_BLOCK_SIZE (512 * 126) /* 64,512 N.B. do not use 65,636 here */
/* Block Header definitions. */
* Note, when written, it is serialized.
uint32_t CheckSum;
- uint32_t block_len;
+ uint32_t block_len;
uint32_t BlockNumber;
char Id[BLKHDR_ID_LENGTH];
uint32_t VolSessionTime;
*/
+class DEVICE; /* for forward reference */
+
/*
* DEV_BLOCK for reading and writing blocks.
* This is the basic unit that is written to the device, and
*/
struct DEV_BLOCK {
DEV_BLOCK *next; /* pointer to next one */
- void *dev; /* pointer to device (DEVICE not defined yet) */
+ DEVICE *dev; /* pointer to device */
/* 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 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 */
bool write_failed; /* set if write failed */
bool block_read; /* set when block read */
POOLMEM *buf; /* actual data buffer */
};
-#define block_is_empty(block) !((block)->read_len)
+#define block_is_empty(block) ((block)->read_len == 0)
#endif