From 3c6b40ec805a515831c82141a5de8add08f44d56 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 7 Jun 2017 10:37:36 +0200 Subject: [PATCH] Remove vestiges of crc32_bad -- fixes Solaris build --- bacula/src/lib/protos.h | 1 - bacula/src/stored/block_util.c | 37 +++------------------------------- bacula/src/stored/dev.h | 1 - 3 files changed, 3 insertions(+), 36 deletions(-) diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h index cbad42ddc8..f76d790f45 100644 --- a/bacula/src/lib/protos.h +++ b/bacula/src/lib/protos.h @@ -154,7 +154,6 @@ void hmac_md5(uint8_t* text, int text_len, uint8_t* key, int key_len, uint8_t *h /* crc32.c */ uint32_t bcrc32(unsigned char *buf, int len); -uint32_t bcrc32_bad(unsigned char *buf, int len); /* crypto.c */ diff --git a/bacula/src/stored/block_util.c b/bacula/src/stored/block_util.c index 5ca251ad09..e18605345f 100644 --- a/bacula/src/stored/block_util.c +++ b/bacula/src/stored/block_util.c @@ -234,36 +234,6 @@ void print_block_read_errors(JCR *jcr, DEV_BLOCK *block) } } -/* We had a problem on some solaris platforms with the CRC32 library, some - * 8.4.x jobs uses a bad crc32 algorithm. We just try one then the - * other to not create false problems - */ -uint32_t DCR::crc32(unsigned char *buf, int len, uint32_t expected_crc) -{ -#if defined(HAVE_SUN_OS) && defined(HAVE_LITTLE_ENDIAN) - uint32_t crc = 0; - if (crc32_type) { - crc = bcrc32_bad(buf, len); - - } else { - crc = bcrc32(buf, len); - } - if (expected_crc != crc) { - crc32_type = !crc32_type; /* Next time, do it well right away */ - - if (crc32_type) { - crc = bcrc32_bad(buf, len); - - } else { - crc = bcrc32(buf, len); - } - } - return crc; -#else - return bcrc32(buf, len); -#endif -} - void DEVICE::free_dcr_blocks(DCR *dcr) { if (dcr->block == dcr->ameta_block) { @@ -385,7 +355,7 @@ bool unser_block_header(DCR *dcr, DEVICE *dev, DEV_BLOCK *block) if (block->adata) { /* Checksum the whole block */ if (block->block_len <= block->read_len && dev->do_checksum()) { - BlockCheckSum = dcr->crc32((uint8_t *)block->buf, block->block_len, block->CheckSum); + BlockCheckSum = bcrc32((uint8_t *)block->buf, block->block_len); if (BlockCheckSum != block->CheckSum) { dev->dev_errno = EIO; Mmsg5(dev->errmsg, _("Volume data error at %lld!\n" @@ -489,9 +459,8 @@ bool unser_block_header(DCR *dcr, DEVICE *dev, DEV_BLOCK *block) Dmsg3(390, "Read binbuf = %d %d block_len=%d\n", block->binbuf, bhl, block_len); if (block_len <= block->read_len && dev->do_checksum()) { - BlockCheckSum = dcr->crc32((uint8_t *)block->buf+BLKHDR_CS_LENGTH, - block_len-BLKHDR_CS_LENGTH, - block->CheckSum); + BlockCheckSum = bcrc32((uint8_t *)block->buf+BLKHDR_CS_LENGTH, + block_len-BLKHDR_CS_LENGTH); if (BlockCheckSum != block->CheckSum) { dev->dev_errno = EIO; diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 5ead2a508c..918d88023e 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -732,7 +732,6 @@ public: int Copy; /* identical copy number */ int Stripe; /* RAIT stripe */ VOLUME_CAT_INFO VolCatInfo; /* Catalog info for desired volume */ - uint32_t crc32(unsigned char *buf, int len, uint32_t expected_crc); /* Methods */ void set_no_mount_request() { no_mount_request = true; }; /* Just fail in case of mount request */ -- 2.39.5