Skip to content

Commit

Permalink
Merge pull request #246 from bareos/dev/arogge/master/newcrc32
Browse files Browse the repository at this point in the history
core: replace crc32 implementation
  • Loading branch information
franku committed Aug 28, 2019
2 parents 387ab70 + be5c868 commit beac60c
Show file tree
Hide file tree
Showing 10 changed files with 1,250 additions and 471 deletions.
13 changes: 13 additions & 0 deletions core/LICENSE
Expand Up @@ -292,6 +292,19 @@ File src/lib/backtrace.cc contains code with the following license:
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.

h)
Files core/src/stored/crc32/crc32.{cc,h} contain code with the following license:
zlib License

Copyright (c) 2011-2016 Stephan Brumme

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

===========================================

2.
Expand Down
3 changes: 3 additions & 0 deletions core/debian/copyright.footer
Expand Up @@ -182,6 +182,9 @@ Copyright: 2010 Zilvinas Krapavickas <zkrapavickas@gmail.com>
2013-2013 Bareos GmbH & Co. KG
License: AGPL-3.0

Files: core/src/stored/crc32/crc32.cc core/src/stored/crc32/crc32.h
Copyright: 2011-2016 Stephan Brumme
License: Zlib

License: AGPL-3.0
The full text of the
Expand Down
2 changes: 1 addition & 1 deletion core/src/stored/CMakeLists.txt
Expand Up @@ -75,7 +75,7 @@ ENDIF()

set (LIBBAREOSSD_SRCS acquire.cc ansi_label.cc askdir.cc autochanger.cc
autochanger_resource.cc block.cc bsr.cc
butil.cc crc32.cc dev.cc device.cc device_resource.cc
butil.cc crc32/crc32.cc dev.cc device.cc device_resource.cc
ebcdic.cc label.cc lock.cc
mount.cc read_record.cc record.cc reserve.cc scan.cc
sd_backends.cc sd_plugins.cc sd_stats.cc spool.cc
Expand Down
8 changes: 4 additions & 4 deletions core/src/stored/block.cc
Expand Up @@ -31,7 +31,7 @@

#include "include/bareos.h"
#include "stored/stored.h"
#include "stored/crc32.h"
#include "stored/crc32/crc32.h"
#include "stored/dev.h"
#include "stored/device.h"
#include "stored/label.h"
Expand Down Expand Up @@ -91,7 +91,7 @@ void DumpBlock(DeviceBlock* b, const char* msg)
}

BlockCheckSum =
bcrc32((uint8_t*)b->buf + BLKHDR_CS_LENGTH, block_len - BLKHDR_CS_LENGTH);
crc32_fast((uint8_t*)b->buf + BLKHDR_CS_LENGTH, block_len - BLKHDR_CS_LENGTH);
Pmsg6(000,
_("Dump block %s %x: size=%d BlkNum=%d\n"
" Hdrcksum=%x cksum=%x\n"),
Expand Down Expand Up @@ -222,7 +222,7 @@ static uint32_t SerBlockHeader(DeviceBlock* block, bool DoChecksum)
* Checksum whole block except for the checksum
*/
if (DoChecksum) {
CheckSum = bcrc32((uint8_t*)block->buf + BLKHDR_CS_LENGTH,
CheckSum = crc32_fast((uint8_t*)block->buf + BLKHDR_CS_LENGTH,
block_len - BLKHDR_CS_LENGTH);
}
Dmsg1(1390, "ser_bloc_header: checksum=%x\n", CheckSum);
Expand Down Expand Up @@ -339,7 +339,7 @@ static inline bool unSerBlockHeader(JobControlRecord* jcr,
Dmsg3(390, "Read binbuf = %d %d block_len=%d\n", block->binbuf, bhl,
block_len);
if (block_len <= block->read_len && dev->DoChecksum()) {
BlockCheckSum = bcrc32((uint8_t*)block->buf + BLKHDR_CS_LENGTH,
BlockCheckSum = crc32_fast((uint8_t*)block->buf + BLKHDR_CS_LENGTH,
block_len - BLKHDR_CS_LENGTH);
if (BlockCheckSum != CheckSum) {
dev->dev_errno = EIO;
Expand Down
460 changes: 0 additions & 460 deletions core/src/stored/crc32.cc

This file was deleted.

10 changes: 10 additions & 0 deletions core/src/stored/crc32/LICENSE
@@ -0,0 +1,10 @@
zlib License

Copyright (c) 2011-2016 Stephan Brumme

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

0 comments on commit beac60c

Please sign in to comment.