* in the buffer should have already been reserved by
* init_block.
*/
-void ser_block_header(DEV_BLOCK *block)
+static void ser_block_header(DEV_BLOCK *block, bool do_checksum)
{
ser_declare;
uint32_t CheckSum = 0;
}
/* Checksum whole block except for the checksum */
- CheckSum = bcrc32((uint8_t *)block->buf+BLKHDR_CS_LENGTH,
- block_len-BLKHDR_CS_LENGTH);
+ if (do_checksum) {
+ CheckSum = bcrc32((uint8_t *)block->buf+BLKHDR_CS_LENGTH,
+ block_len-BLKHDR_CS_LENGTH);
+ }
Dmsg1(1390, "ser_bloc_header: checksum=%x\n", CheckSum);
ser_begin(block->buf, BLKHDR2_LENGTH);
ser_uint32(CheckSum); /* now add checksum to block header */
block->BlockNumber = BlockNumber;
Dmsg3(390, "Read binbuf = %d %d block_len=%d\n", block->binbuf,
bhl, block_len);
- if (block_len <= block->read_len) {
+ if (block_len <= block->read_len && dev->do_checksum()) {
BlockCheckSum = bcrc32((uint8_t *)block->buf+BLKHDR_CS_LENGTH,
block_len-BLKHDR_CS_LENGTH);
if (BlockCheckSum != CheckSum) {
}
}
- ser_block_header(block);
+ ser_block_header(block, dev->do_checksum());
/* Limit maximum Volume size to value specified by user */
hit_max1 = (dev->max_volume_size > 0) &&
#define CAP_MTIOCGET (1<<20) /* Basic support for fileno and blkno */
#define CAP_REQMOUNT (1<<21) /* Require mount to read files back (typically: DVD) */
#define CAP_CHECKLABELS (1<<22) /* Check for ANSI/IBM labels */
+#define CAP_BLOCKCHECKSUM (1<<23) /* Create/test block checksum */
/* Test state */
#define dev_state(dev, st_state) ((dev)->state & (st_state))
int has_cap(int cap) const { return capabilities & cap; }
void clear_cap(int cap) { capabilities &= ~cap; }
void set_cap(int cap) { capabilities |= cap; }
+ bool do_checksum() const { return (capabilities & CAP_BLOCKCHECKSUM) != 0; }
int is_autochanger() const { return capabilities & CAP_AUTOCHANGER; }
int requires_mount() const { return capabilities & CAP_REQMOUNT; }
int is_removable() const { return capabilities & CAP_REM; }
* Configuration file parser for Bacula Storage daemon
*
* Kern Sibbald, March MM
- *
- * Version $Id$
*/
#include "bacula.h"
{"checklabels", store_bit, ITEM(res_dev.cap_bits), CAP_CHECKLABELS, ITEM_DEFAULT, 0},
{"requiresmount", store_bit, ITEM(res_dev.cap_bits), CAP_REQMOUNT, ITEM_DEFAULT, 0},
{"offlineonunmount", store_bit, ITEM(res_dev.cap_bits), CAP_OFFLINEUNMOUNT, ITEM_DEFAULT, 0},
+ {"blockchecksum", store_bit, ITEM(res_dev.cap_bits), CAP_BLOCKCHECKSUM, ITEM_DEFAULT, 1},
{"autoselect", store_bool, ITEM(res_dev.autoselect), 1, ITEM_DEFAULT, 1},
{"changerdevice", store_strname,ITEM(res_dev.changer_name), 0, 0, 0},
{"changercommand", store_strname,ITEM(res_dev.changer_command), 0, 0, 0},
#undef VERSION
#define VERSION "3.0.3"
-#define BDATE "28 August 2009"
-#define LSMDATE "28Aug09"
+#define BDATE "04 September 2009"
+#define LSMDATE "04Sep09"
#define PROG_COPYRIGHT "Copyright (C) %d-2009 Free Software Foundation Europe e.V.\n"
#define BYEAR "2009" /* year for copyright messages in progs */
General:
+04Sep09
+kes Implement BlockChecksum in Device to be able to turn off checksum
+ for performance reasons
03Sep09
ebl Use MaxFileSize device configuration in btape
ebl Make less tweaks in random buffer in btape