Cleanup pointer casting in code to use macros.
This commit is contained in:
parent
38c0869f5c
commit
fa78621cbf
9 changed files with 82 additions and 76 deletions
|
@ -249,7 +249,7 @@ valouti32(bsize_t x, u_char *buf)
|
||||||
{
|
{
|
||||||
int32_t val;
|
int32_t val;
|
||||||
val = x;
|
val = x;
|
||||||
*((int32_t *)buf) = htonl(val);
|
I32_P(buf) = htonl(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
bsize_t
|
bsize_t
|
||||||
|
|
|
@ -69,7 +69,7 @@ __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:
|
||||||
static int32_t
|
static int32_t
|
||||||
valini32(u_char *buf)
|
valini32(u_char *buf)
|
||||||
{
|
{
|
||||||
return ntohl(*((int32_t *)buf));
|
return ntohl(I32_P(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
bsize_t
|
bsize_t
|
||||||
|
|
|
@ -53,13 +53,13 @@ zero_rle_encode(const void *ibuf, const unsigned int ilen,
|
||||||
* We have a run of zeroes. Count them and store only the count.
|
* We have a run of zeroes. Count them and store only the count.
|
||||||
*/
|
*/
|
||||||
while (pos1 < (ilen - sz) && count < (COUNT_MAX - sz)) {
|
while (pos1 < (ilen - sz) && count < (COUNT_MAX - sz)) {
|
||||||
val = *((uint64_t *)(ib+pos1));
|
val = U64_P(ib+pos1);
|
||||||
if (val) break;
|
if (val) break;
|
||||||
pos1 += sizeof (val); count += sizeof (val);
|
pos1 += sizeof (val); count += sizeof (val);
|
||||||
}
|
}
|
||||||
for (;pos1<ilen && ib[pos1]==0 && count<COUNT_MAX; pos1++) ++count;
|
for (;pos1<ilen && ib[pos1]==0 && count<COUNT_MAX; pos1++) ++count;
|
||||||
count |= ZERO_MASK;
|
count |= ZERO_MASK;
|
||||||
*((unsigned short *)(ob + pos2)) = htons(count);
|
U16_P(ob + pos2) = htons(count);
|
||||||
pos2 += 2;
|
pos2 += 2;
|
||||||
if (pos2 > *olen) break;
|
if (pos2 > *olen) break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,7 +82,7 @@ zero_rle_encode(const void *ibuf, const unsigned int ilen,
|
||||||
ob[pos2++] = ib[pos1++];
|
ob[pos2++] = ib[pos1++];
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
*((unsigned short *)(ob + pos3)) = htons(count);
|
U16_P(ob + pos3) = htons(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*olen = pos2;
|
*olen = pos2;
|
||||||
|
@ -105,7 +105,7 @@ zero_rle_decode(const void* ibuf, unsigned int ilen,
|
||||||
pos2 = 0;
|
pos2 = 0;
|
||||||
pos1 = 0;
|
pos1 = 0;
|
||||||
for (; pos1<ilen && pos2<*olen;) {
|
for (; pos1<ilen && pos2<*olen;) {
|
||||||
count = ntohs(*((unsigned short *)(ib + pos1)));
|
count = ntohs(U16_P(ib + pos1));
|
||||||
pos1 += 2;
|
pos1 += 2;
|
||||||
if (count & ZERO_MASK) {
|
if (count & ZERO_MASK) {
|
||||||
count &= DATA_MASK;
|
count &= DATA_MASK;
|
||||||
|
|
|
@ -782,16 +782,16 @@ init_crypto(crypto_ctx_t *cctx, uchar_t *pwd, int pwd_len, int crypto_alg,
|
||||||
} else {
|
} else {
|
||||||
uint64_t v;
|
uint64_t v;
|
||||||
v = tp.tv_sec * 1000UL + tp.tv_nsec;
|
v = tp.tv_sec * 1000UL + tp.tv_nsec;
|
||||||
*((uint64_t *)&sb[b]) = v;
|
U64_P(&sb[b]) = v;
|
||||||
b += 8;
|
b += 8;
|
||||||
}
|
}
|
||||||
*((uint32_t *)&sb[b]) = rand();
|
U32_P(&sb[b]) = rand();
|
||||||
b += 4;
|
b += 4;
|
||||||
*((uint32_t *)&sb[b]) = getpid();
|
U32_P(&sb[b]) = getpid();
|
||||||
b += 4;
|
b += 4;
|
||||||
compute_checksum(&sb[b], CKSUM_SHA256, sb, b, 0, 0);
|
compute_checksum(&sb[b], CKSUM_SHA256, sb, b, 0, 0);
|
||||||
b = 8 + 4;
|
b = 8 + 4;
|
||||||
*((uint32_t *)&sb[b]) = rand();
|
U32_P(&sb[b]) = rand();
|
||||||
compute_checksum(salt, CKSUM_SHA256, &sb[b], 32 + 4, 0, 0);
|
compute_checksum(salt, CKSUM_SHA256, &sb[b], 32 + 4, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -825,7 +825,7 @@ init_crypto(crypto_ctx_t *cctx, uchar_t *pwd, int pwd_len, int crypto_alg,
|
||||||
memcpy(cctx->salt, salt, saltlen);
|
memcpy(cctx->salt, salt, saltlen);
|
||||||
|
|
||||||
if (crypto_alg == CRYPTO_ALG_AES) {
|
if (crypto_alg == CRYPTO_ALG_AES) {
|
||||||
if (aes_init(actx, cctx->salt, saltlen, pwd, pwd_len, *((uint64_t *)nonce),
|
if (aes_init(actx, cctx->salt, saltlen, pwd, pwd_len, U64_P(nonce),
|
||||||
enc_dec) != 0) {
|
enc_dec) != 0) {
|
||||||
fprintf(stderr, "Failed to initialize AES context\n");
|
fprintf(stderr, "Failed to initialize AES context\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
|
@ -128,7 +128,7 @@ delta2_encode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen, int
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
hdr_ovr = 0;
|
hdr_ovr = 0;
|
||||||
*((uint64_t *)dst) = LE64(srclen);
|
U64_P(dst) = LE64(srclen);
|
||||||
dst += MAIN_HDR;
|
dst += MAIN_HDR;
|
||||||
rv = delta2_encode_real(src, srclen, dst, dstlen, rle_thresh, 1, &hdr_ovr);
|
rv = delta2_encode_real(src, srclen, dst, dstlen, rle_thresh, 1, &hdr_ovr);
|
||||||
if (rv == -1)
|
if (rv == -1)
|
||||||
|
@ -147,7 +147,7 @@ delta2_encode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen, int
|
||||||
dstend = dst + *dstlen;
|
dstend = dst + *dstlen;
|
||||||
slen = srclen;
|
slen = srclen;
|
||||||
pending = 0;
|
pending = 0;
|
||||||
*((uint64_t *)dstpos) = LE64(srclen);
|
U64_P(dstpos) = LE64(srclen);
|
||||||
dstpos += MAIN_HDR;
|
dstpos += MAIN_HDR;
|
||||||
lastdst = dstpos;
|
lastdst = dstpos;
|
||||||
lastsrc = srcpos;
|
lastsrc = srcpos;
|
||||||
|
@ -178,7 +178,7 @@ delta2_encode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen, int
|
||||||
} else {
|
} else {
|
||||||
if (pending) {
|
if (pending) {
|
||||||
pending &= MSB_SETZERO_MASK;
|
pending &= MSB_SETZERO_MASK;
|
||||||
*((uint64_t *)lastdst) = LE64(pending);
|
U64_P(lastdst) = LE64(pending);
|
||||||
lastdst += sizeof (uint64_t);
|
lastdst += sizeof (uint64_t);
|
||||||
memcpy(lastdst, lastsrc, pending);
|
memcpy(lastdst, lastsrc, pending);
|
||||||
pending = 0;
|
pending = 0;
|
||||||
|
@ -194,7 +194,7 @@ delta2_encode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen, int
|
||||||
}
|
}
|
||||||
if (pending) {
|
if (pending) {
|
||||||
pending &= MSB_SETZERO_MASK;
|
pending &= MSB_SETZERO_MASK;
|
||||||
*((uint64_t *)lastdst) = LE64(pending);
|
U64_P(lastdst) = LE64(pending);
|
||||||
lastdst += sizeof (uint64_t);
|
lastdst += sizeof (uint64_t);
|
||||||
if (lastdst + pending > dstend) {
|
if (lastdst + pending > dstend) {
|
||||||
DEBUG_STAT_EN(fprintf(stderr, "No Delta\n"));
|
DEBUG_STAT_EN(fprintf(stderr, "No Delta\n"));
|
||||||
|
@ -248,7 +248,7 @@ delta2_encode_real(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen
|
||||||
sval |= (sval - 1);
|
sval |= (sval - 1);
|
||||||
val = 0;
|
val = 0;
|
||||||
for (cnt = 0; cnt < (srclen - sizeof (cnt)); cnt += st1) {
|
for (cnt = 0; cnt < (srclen - sizeof (cnt)); cnt += st1) {
|
||||||
vl2 = *((uint64_t *)pos);
|
vl2 = U64_P(pos);
|
||||||
vl2 = LE64(vl2);
|
vl2 = LE64(vl2);
|
||||||
vl2 &= sval;
|
vl2 &= sval;
|
||||||
vld2 = vl2 - vl1;
|
vld2 = vl2 - vl1;
|
||||||
|
@ -314,7 +314,7 @@ delta2_encode_real(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen
|
||||||
pos = src;
|
pos = src;
|
||||||
pos2 = dst;
|
pos2 = dst;
|
||||||
|
|
||||||
vl2 = *((uint64_t *)pos);
|
vl2 = U64_P(pos);
|
||||||
vl2 = LE64(vl2);
|
vl2 = LE64(vl2);
|
||||||
val = stride;
|
val = stride;
|
||||||
val = ((val << 3) - 1);
|
val = ((val << 3) - 1);
|
||||||
|
@ -324,7 +324,7 @@ delta2_encode_real(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen
|
||||||
sval = vl2;
|
sval = vl2;
|
||||||
|
|
||||||
for (cnt = 0; cnt < (srclen - sizeof (cnt)); cnt += stride) {
|
for (cnt = 0; cnt < (srclen - sizeof (cnt)); cnt += stride) {
|
||||||
vl2 = *((uint64_t *)pos);
|
vl2 = U64_P(pos);
|
||||||
vl2 = LE64(vl2);
|
vl2 = LE64(vl2);
|
||||||
vl2 &= val;
|
vl2 &= val;
|
||||||
vld2 = vl2 - vl1;
|
vld2 = vl2 - vl1;
|
||||||
|
@ -337,7 +337,7 @@ delta2_encode_real(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen
|
||||||
*/
|
*/
|
||||||
if (gtot1 > 0) {
|
if (gtot1 > 0) {
|
||||||
gtot1 &= MSB_SETZERO_MASK;
|
gtot1 &= MSB_SETZERO_MASK;
|
||||||
*((uint64_t *)pos2) = LE64(gtot1);
|
U64_P(pos2) = LE64(gtot1);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
DEBUG_STAT_EN(*hdr_ovr += LIT_HDR);
|
DEBUG_STAT_EN(*hdr_ovr += LIT_HDR);
|
||||||
memcpy(pos2, pos - (gtot1+snum), gtot1);
|
memcpy(pos2, pos - (gtot1+snum), gtot1);
|
||||||
|
@ -353,11 +353,11 @@ delta2_encode_real(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen
|
||||||
gtot2 = stride;
|
gtot2 = stride;
|
||||||
gtot2 <<= MSB_SHIFT;
|
gtot2 <<= MSB_SHIFT;
|
||||||
gtot2 |= (snum & MSB_SETZERO_MASK);
|
gtot2 |= (snum & MSB_SETZERO_MASK);
|
||||||
*((uint64_t *)pos2) = LE64(gtot2);
|
U64_P(pos2) = LE64(gtot2);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
*((uint64_t *)pos2) = LE64(sval);
|
U64_P(pos2) = LE64(sval);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
*((uint64_t *)pos2) = LE64(vld1);
|
U64_P(pos2) = LE64(vld1);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
DEBUG_STAT_EN(*hdr_ovr += DELTA_HDR);
|
DEBUG_STAT_EN(*hdr_ovr += DELTA_HDR);
|
||||||
} else {
|
} else {
|
||||||
|
@ -379,7 +379,7 @@ delta2_encode_real(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen
|
||||||
if (snum > rle_thresh) {
|
if (snum > rle_thresh) {
|
||||||
if (gtot1 > 0) {
|
if (gtot1 > 0) {
|
||||||
gtot1 &= MSB_SETZERO_MASK;
|
gtot1 &= MSB_SETZERO_MASK;
|
||||||
*((uint64_t *)pos2) = LE64(gtot1);
|
U64_P(pos2) = LE64(gtot1);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
DEBUG_STAT_EN(*hdr_ovr += LIT_HDR);
|
DEBUG_STAT_EN(*hdr_ovr += LIT_HDR);
|
||||||
memcpy(pos2, pos - (gtot1+snum), gtot1);
|
memcpy(pos2, pos - (gtot1+snum), gtot1);
|
||||||
|
@ -389,18 +389,18 @@ delta2_encode_real(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen
|
||||||
gtot2 = stride;
|
gtot2 = stride;
|
||||||
gtot2 <<= MSB_SHIFT;
|
gtot2 <<= MSB_SHIFT;
|
||||||
gtot2 |= (snum & MSB_SETZERO_MASK);
|
gtot2 |= (snum & MSB_SETZERO_MASK);
|
||||||
*((uint64_t *)pos2) = LE64(gtot2);
|
U64_P(pos2) = LE64(gtot2);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
*((uint64_t *)pos2) = LE64(sval);
|
U64_P(pos2) = LE64(sval);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
*((uint64_t *)pos2) = LE64(vld1);
|
U64_P(pos2) = LE64(vld1);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
DEBUG_STAT_EN(*hdr_ovr += DELTA_HDR);
|
DEBUG_STAT_EN(*hdr_ovr += DELTA_HDR);
|
||||||
|
|
||||||
} else if (last_encode) {
|
} else if (last_encode) {
|
||||||
gtot1 += snum;
|
gtot1 += snum;
|
||||||
gtot1 &= MSB_SETZERO_MASK;
|
gtot1 &= MSB_SETZERO_MASK;
|
||||||
*((uint64_t *)pos2) = LE64(gtot1);
|
U64_P(pos2) = LE64(gtot1);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
DEBUG_STAT_EN(*hdr_ovr += LIT_HDR);
|
DEBUG_STAT_EN(*hdr_ovr += LIT_HDR);
|
||||||
memcpy(pos2, pos - gtot1, gtot1);
|
memcpy(pos2, pos - gtot1, gtot1);
|
||||||
|
@ -418,7 +418,7 @@ delta2_encode_real(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen
|
||||||
* literal run.
|
* literal run.
|
||||||
*/
|
*/
|
||||||
val &= MSB_SETZERO_MASK;
|
val &= MSB_SETZERO_MASK;
|
||||||
*((uint64_t *)pos2) = LE64(val);
|
U64_P(pos2) = LE64(val);
|
||||||
pos2 += sizeof (uint64_t);
|
pos2 += sizeof (uint64_t);
|
||||||
for (cnt = 0; cnt < val; cnt++) {
|
for (cnt = 0; cnt < val; cnt++) {
|
||||||
*pos2 = *pos;
|
*pos2 = *pos;
|
||||||
|
@ -447,7 +447,7 @@ delta2_decode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen)
|
||||||
|
|
||||||
DEBUG_STAT_EN(strt = get_wtime_millis());
|
DEBUG_STAT_EN(strt = get_wtime_millis());
|
||||||
last = pos + srclen;
|
last = pos + srclen;
|
||||||
olen = LE64(*((uint64_t *)pos));
|
olen = LE64(U64_P(pos));
|
||||||
if (*dstlen < olen) {
|
if (*dstlen < olen) {
|
||||||
fprintf(stderr, "DELTA2 Decode: Destination buffer too small.\n");
|
fprintf(stderr, "DELTA2 Decode: Destination buffer too small.\n");
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -457,7 +457,7 @@ delta2_decode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen)
|
||||||
pos += MAIN_HDR;
|
pos += MAIN_HDR;
|
||||||
|
|
||||||
while (pos < last) {
|
while (pos < last) {
|
||||||
val = *((uint64_t *)pos);
|
val = U64_P(pos);
|
||||||
val = LE64(val);
|
val = LE64(val);
|
||||||
flags = (val >> MSB_SHIFT) & 0xff;
|
flags = (val >> MSB_SHIFT) & 0xff;
|
||||||
|
|
||||||
|
@ -480,9 +480,9 @@ delta2_decode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen)
|
||||||
stride = flags;
|
stride = flags;
|
||||||
rcnt = val & MSB_SETZERO_MASK;
|
rcnt = val & MSB_SETZERO_MASK;
|
||||||
pos += sizeof (rcnt);
|
pos += sizeof (rcnt);
|
||||||
sval = LE64(*((uint64_t *)pos));
|
sval = LE64(U64_P(pos));
|
||||||
pos += sizeof (sval);
|
pos += sizeof (sval);
|
||||||
delta = LE64(*((uint64_t *)pos));
|
delta = LE64(U64_P(pos));
|
||||||
pos += sizeof (delta);
|
pos += sizeof (delta);
|
||||||
if (out + rcnt > *dstlen) {
|
if (out + rcnt > *dstlen) {
|
||||||
fprintf(stderr, "DELTA2 Decode(delta): Destination buffer overflow. Corrupt data.\n");
|
fprintf(stderr, "DELTA2 Decode(delta): Destination buffer overflow. Corrupt data.\n");
|
||||||
|
@ -500,7 +500,7 @@ delta2_decode(uchar_t *src, uint64_t srclen, uchar_t *dst, uint64_t *dstlen)
|
||||||
*/
|
*/
|
||||||
for (cnt = 0; cnt < rcnt/stride; cnt++) {
|
for (cnt = 0; cnt < rcnt/stride; cnt++) {
|
||||||
val = (sval & vl);
|
val = (sval & vl);
|
||||||
*((uint64_t *)pos1) = LE64(val);
|
U64_P(pos1) = LE64(val);
|
||||||
out += stride;
|
out += stride;
|
||||||
sval += delta;
|
sval += delta;
|
||||||
pos1 += stride;
|
pos1 += stride;
|
||||||
|
|
14
pcompress.c
14
pcompress.c
|
@ -288,7 +288,7 @@ preproc_compress(pc_ctx_t *pctx, compress_func_ptr cmp_func, void *src, uint64_t
|
||||||
}
|
}
|
||||||
|
|
||||||
*dest = type;
|
*dest = type;
|
||||||
*((uint64_t *)(dest + 1)) = htonll(srclen);
|
U64_P(dest + 1) = htonll(srclen);
|
||||||
_dstlen = srclen;
|
_dstlen = srclen;
|
||||||
DEBUG_STAT_EN(strt = get_wtime_millis());
|
DEBUG_STAT_EN(strt = get_wtime_millis());
|
||||||
result = cmp_func(src, srclen, dest+9, &_dstlen, level, chdr, data);
|
result = cmp_func(src, srclen, dest+9, &_dstlen, level, chdr, data);
|
||||||
|
@ -328,7 +328,7 @@ preproc_decompress(pc_ctx_t *pctx, compress_func_ptr dec_func, void *src, uint64
|
||||||
++sorc;
|
++sorc;
|
||||||
--srclen;
|
--srclen;
|
||||||
if (type & PREPROC_COMPRESSED) {
|
if (type & PREPROC_COMPRESSED) {
|
||||||
*dstlen = ntohll(*((uint64_t *)(sorc)));
|
*dstlen = ntohll(U64_P(sorc));
|
||||||
sorc += 8;
|
sorc += 8;
|
||||||
srclen -= 8;
|
srclen -= 8;
|
||||||
DEBUG_STAT_EN(strt = get_wtime_millis());
|
DEBUG_STAT_EN(strt = get_wtime_millis());
|
||||||
|
@ -482,7 +482,7 @@ redo:
|
||||||
*/
|
*/
|
||||||
uint32_t crc1, crc2;
|
uint32_t crc1, crc2;
|
||||||
|
|
||||||
crc1 = htonl(*((uint32_t *)(tdat->compressed_chunk + pctx->cksum_bytes)));
|
crc1 = htonl(U32_P(tdat->compressed_chunk + pctx->cksum_bytes));
|
||||||
memset(tdat->compressed_chunk + pctx->cksum_bytes, 0, pctx->mac_bytes);
|
memset(tdat->compressed_chunk + pctx->cksum_bytes, 0, pctx->mac_bytes);
|
||||||
crc2 = lzma_crc32((uchar_t *)&tdat->len_cmp_be, sizeof (tdat->len_cmp_be), 0);
|
crc2 = lzma_crc32((uchar_t *)&tdat->len_cmp_be, sizeof (tdat->len_cmp_be), 0);
|
||||||
crc2 = lzma_crc32(tdat->compressed_chunk,
|
crc2 = lzma_crc32(tdat->compressed_chunk,
|
||||||
|
@ -927,7 +927,7 @@ start_decompress(pc_ctx_t *pctx, const char *filename, const char *to_filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pctx->encrypt_type == CRYPTO_ALG_AES) {
|
if (pctx->encrypt_type == CRYPTO_ALG_AES) {
|
||||||
*((uint64_t *)nonce) = ntohll(*((uint64_t *)n1));
|
U64_P(nonce) = ntohll(U64_P(n1));
|
||||||
|
|
||||||
} else if (pctx->encrypt_type == CRYPTO_ALG_SALSA20) {
|
} else if (pctx->encrypt_type == CRYPTO_ALG_SALSA20) {
|
||||||
deserialize_checksum(nonce, n1, noncelen);
|
deserialize_checksum(nonce, n1, noncelen);
|
||||||
|
@ -1641,7 +1641,7 @@ plain_index:
|
||||||
if (type & CHSIZE_MASK)
|
if (type & CHSIZE_MASK)
|
||||||
crc = lzma_crc32(tdat->cmp_seg + tdat->len_cmp - ORIGINAL_CHUNKSZ,
|
crc = lzma_crc32(tdat->cmp_seg + tdat->len_cmp - ORIGINAL_CHUNKSZ,
|
||||||
ORIGINAL_CHUNKSZ, crc);
|
ORIGINAL_CHUNKSZ, crc);
|
||||||
*((uint32_t *)mac_ptr) = htonl(crc);
|
U32_P(mac_ptr) = htonl(crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_post(&tdat->cmp_done_sem);
|
sem_post(&tdat->cmp_done_sem);
|
||||||
|
@ -2122,7 +2122,7 @@ start_compress(pc_ctx_t *pctx, const char *filename, uint64_t chunksize, int lev
|
||||||
serialize_checksum(pctx->crypto_ctx.salt, pos, pctx->crypto_ctx.saltlen);
|
serialize_checksum(pctx->crypto_ctx.salt, pos, pctx->crypto_ctx.saltlen);
|
||||||
pos += pctx->crypto_ctx.saltlen;
|
pos += pctx->crypto_ctx.saltlen;
|
||||||
if (pctx->encrypt_type == CRYPTO_ALG_AES) {
|
if (pctx->encrypt_type == CRYPTO_ALG_AES) {
|
||||||
*((uint64_t *)pos) = htonll(*((uint64_t *)crypto_nonce(&(pctx->crypto_ctx))));
|
U64_P(pos) = htonll(U64_P(crypto_nonce(&(pctx->crypto_ctx))));
|
||||||
pos += 8;
|
pos += 8;
|
||||||
|
|
||||||
} else if (pctx->encrypt_type == CRYPTO_ALG_SALSA20) {
|
} else if (pctx->encrypt_type == CRYPTO_ALG_SALSA20) {
|
||||||
|
@ -2168,7 +2168,7 @@ start_compress(pc_ctx_t *pctx, const char *filename, uint64_t chunksize, int lev
|
||||||
* Compute header CRC32 and store that. Only archive version 5 and above.
|
* Compute header CRC32 and store that. Only archive version 5 and above.
|
||||||
*/
|
*/
|
||||||
uint32_t crc = lzma_crc32(cread_buf, pos - cread_buf, 0);
|
uint32_t crc = lzma_crc32(cread_buf, pos - cread_buf, 0);
|
||||||
*((uint32_t *)cread_buf) = htonl(crc);
|
U32_P(cread_buf) = htonl(crc);
|
||||||
if (Write(compfd, cread_buf, sizeof (uint32_t)) != sizeof (uint32_t)) {
|
if (Write(compfd, cread_buf, sizeof (uint32_t)) != sizeof (uint32_t)) {
|
||||||
perror("Write ");
|
perror("Write ");
|
||||||
COMP_BAIL;
|
COMP_BAIL;
|
||||||
|
|
|
@ -328,8 +328,8 @@ db_segcache_write(archive_config_t *cfg, int tid, uchar_t *buf, uint32_t len, ui
|
||||||
int64_t w;
|
int64_t w;
|
||||||
uchar_t hdr[SEGCACHE_HDR_SZ];
|
uchar_t hdr[SEGCACHE_HDR_SZ];
|
||||||
|
|
||||||
*((uint32_t *)(hdr)) = blknum;
|
U32_P(hdr) = blknum;
|
||||||
*((uint64_t *)(hdr + 4)) = file_offset;
|
U64_P(hdr + 4) = file_offset;
|
||||||
|
|
||||||
w = Write(cfg->seg_fd_w, hdr, sizeof (hdr));
|
w = Write(cfg->seg_fd_w, hdr, sizeof (hdr));
|
||||||
if (w < sizeof (hdr)) {
|
if (w < sizeof (hdr)) {
|
||||||
|
@ -382,8 +382,8 @@ db_segcache_map(archive_config_t *cfg, int tid, uint32_t *blknum, uint64_t *offs
|
||||||
adj = *offset % cfg->pagesize;
|
adj = *offset % cfg->pagesize;
|
||||||
if (*offset == cfg->seg_fd_r[tid].cache_offset && cfg->seg_fd_r[tid].mapping) {
|
if (*offset == cfg->seg_fd_r[tid].cache_offset && cfg->seg_fd_r[tid].mapping) {
|
||||||
hdr = (uchar_t *)(cfg->seg_fd_r[tid].mapping) + adj;
|
hdr = (uchar_t *)(cfg->seg_fd_r[tid].mapping) + adj;
|
||||||
*blknum = *((uint32_t *)(hdr));
|
*blknum = U32_P(hdr);
|
||||||
*offset = *((uint64_t *)(hdr + 4));
|
*offset = U64_P(hdr + 4);
|
||||||
*blocks = hdr + SEGCACHE_HDR_SZ;
|
*blocks = hdr + SEGCACHE_HDR_SZ;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -416,8 +416,8 @@ db_segcache_map(archive_config_t *cfg, int tid, uint32_t *blknum, uint64_t *offs
|
||||||
|
|
||||||
cfg->seg_fd_r[tid].cache_offset = *offset;
|
cfg->seg_fd_r[tid].cache_offset = *offset;
|
||||||
hdr = mapbuf + adj;
|
hdr = mapbuf + adj;
|
||||||
*blknum = *((uint32_t *)(hdr));
|
*blknum = U32_P(hdr);
|
||||||
*offset = *((uint64_t *)(hdr + 4));
|
*offset = U64_P(hdr + 4);
|
||||||
*blocks = hdr + SEGCACHE_HDR_SZ;
|
*blocks = hdr + SEGCACHE_HDR_SZ;
|
||||||
dummy = *(hdr + SEGCACHE_HDR_SZ);
|
dummy = *(hdr + SEGCACHE_HDR_SZ);
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ db_lookup_insert_s(archive_config_t *cfg, uchar_t *sim_cksum, int interval,
|
||||||
* there is no need to re-hash the keys here.
|
* there is no need to re-hash the keys here.
|
||||||
*/
|
*/
|
||||||
if (cfg->similarity_cksum_sz == 8) {
|
if (cfg->similarity_cksum_sz == 8) {
|
||||||
htab_entry = *((uint32_t *)sim_cksum);
|
htab_entry = U32_P(sim_cksum);
|
||||||
} else {
|
} else {
|
||||||
htab_entry = XXH32(sim_cksum, cfg->similarity_cksum_sz, 0);
|
htab_entry = XXH32(sim_cksum, cfg->similarity_cksum_sz, 0);
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,7 @@ db_lookup_insert_s(archive_config_t *cfg, uchar_t *sim_cksum, int interval,
|
||||||
// The following two cases are for Segmented Dedupe approximate matching
|
// The following two cases are for Segmented Dedupe approximate matching
|
||||||
} else if (cfg->similarity_cksum_sz == 8) {// Fast path for 64-bit keys
|
} else if (cfg->similarity_cksum_sz == 8) {// Fast path for 64-bit keys
|
||||||
while (ent) {
|
while (ent) {
|
||||||
if (*((uint64_t *)sim_cksum) == *((uint64_t *)ent->cksum)) {
|
if (U64_P(sim_cksum) == U64_P(ent->cksum)) {
|
||||||
return (ent);
|
return (ent);
|
||||||
}
|
}
|
||||||
pent = &(ent->next);
|
pent = &(ent->next);
|
||||||
|
|
|
@ -792,7 +792,7 @@ process_blocks:
|
||||||
* First entry in table is the original file offset where this
|
* First entry in table is the original file offset where this
|
||||||
* data segment begins.
|
* data segment begins.
|
||||||
*/
|
*/
|
||||||
*((uint64_t *)g_dedupe_idx) = LE64(ctx->file_offset);
|
U64_P(g_dedupe_idx) = LE64(ctx->file_offset);
|
||||||
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
||||||
dedupe_index_sz += 2;
|
dedupe_index_sz += 2;
|
||||||
matchlen = 0;
|
matchlen = 0;
|
||||||
|
@ -825,7 +825,7 @@ process_blocks:
|
||||||
* Block was added to index. Merge this block.
|
* Block was added to index. Merge this block.
|
||||||
*/
|
*/
|
||||||
if (length + ctx->g_blocks[i].length >= RABIN_MAX_BLOCK_SIZE) {
|
if (length + ctx->g_blocks[i].length >= RABIN_MAX_BLOCK_SIZE) {
|
||||||
*((uint32_t *)g_dedupe_idx) = LE32(length);
|
U32_P(g_dedupe_idx) = LE32(length);
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
length = 0;
|
length = 0;
|
||||||
dedupe_index_sz++;
|
dedupe_index_sz++;
|
||||||
|
@ -839,7 +839,7 @@ process_blocks:
|
||||||
/*
|
/*
|
||||||
* Write pending accumulated block length value.
|
* Write pending accumulated block length value.
|
||||||
*/
|
*/
|
||||||
*((uint32_t *)g_dedupe_idx) = LE32(length);
|
U32_P(g_dedupe_idx) = LE32(length);
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
length = 0;
|
length = 0;
|
||||||
dedupe_index_sz++;
|
dedupe_index_sz++;
|
||||||
|
@ -848,10 +848,10 @@ process_blocks:
|
||||||
/*
|
/*
|
||||||
* Add a reference entry to the dedupe array.
|
* Add a reference entry to the dedupe array.
|
||||||
*/
|
*/
|
||||||
*((uint32_t *)g_dedupe_idx) = LE32((he->item_size | RABIN_INDEX_FLAG) &
|
U32_P(g_dedupe_idx) = LE32((he->item_size | RABIN_INDEX_FLAG) &
|
||||||
CLEAR_SIMILARITY_FLAG);
|
CLEAR_SIMILARITY_FLAG);
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
*((uint64_t *)g_dedupe_idx) = LE64(he->item_offset);
|
U64_P(g_dedupe_idx) = LE64(he->item_offset);
|
||||||
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
||||||
matchlen += he->item_size;
|
matchlen += he->item_size;
|
||||||
dedupe_index_sz += 3;
|
dedupe_index_sz += 3;
|
||||||
|
@ -867,7 +867,7 @@ process_blocks:
|
||||||
* Write final pending block length value (if any).
|
* Write final pending block length value (if any).
|
||||||
*/
|
*/
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
*((uint32_t *)g_dedupe_idx) = LE32(length);
|
U32_P(g_dedupe_idx) = LE32(length);
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
length = 0;
|
length = 0;
|
||||||
dedupe_index_sz++;
|
dedupe_index_sz++;
|
||||||
|
@ -948,7 +948,7 @@ process_blocks:
|
||||||
tgt += cfg->chunk_cksum_sz;
|
tgt += cfg->chunk_cksum_sz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*((uint32_t *)src) = blks;
|
U32_P(src) = blks;
|
||||||
src += sizeof (blks);
|
src += sizeof (blks);
|
||||||
blks = j+i;
|
blks = j+i;
|
||||||
|
|
||||||
|
@ -965,14 +965,14 @@ process_blocks:
|
||||||
tgt = seg_heap;
|
tgt = seg_heap;
|
||||||
sub_i = 0;
|
sub_i = 0;
|
||||||
|
|
||||||
*((uint64_t *)sim_ck) = 0;
|
U64_P(sim_ck) = 0;
|
||||||
a = 0;
|
a = 0;
|
||||||
for (j = 0; j < length && sub_i < cfg->sub_intervals;) {
|
for (j = 0; j < length && sub_i < cfg->sub_intervals;) {
|
||||||
b = *((uint64_t *)tgt);
|
b = U64_P(tgt);
|
||||||
tgt += sizeof (uint64_t);
|
tgt += sizeof (uint64_t);
|
||||||
j += sizeof (uint64_t);
|
j += sizeof (uint64_t);
|
||||||
if (b != a) {
|
if (b != a) {
|
||||||
*((uint64_t *)sim_ck) = b;
|
U64_P(sim_ck) = b;
|
||||||
sim_ck += sizeof (uint64_t);
|
sim_ck += sizeof (uint64_t);
|
||||||
a = b;
|
a = b;
|
||||||
sub_i++;
|
sub_i++;
|
||||||
|
@ -1013,9 +1013,9 @@ process_blocks:
|
||||||
hash_entry_t *he = NULL;
|
hash_entry_t *he = NULL;
|
||||||
he = db_lookup_insert_s(cfg, sim_ck, 0, seg_offset, 0, 1);
|
he = db_lookup_insert_s(cfg, sim_ck, 0, seg_offset, 0, 1);
|
||||||
if (he) {
|
if (he) {
|
||||||
*((uint64_t *)tgt) = he->item_offset;
|
U64_P(tgt) = he->item_offset;
|
||||||
} else {
|
} else {
|
||||||
*((uint64_t *)tgt) = UINT64_MAX;
|
U64_P(tgt) = UINT64_MAX;
|
||||||
}
|
}
|
||||||
sim_ck += cfg->similarity_cksum_sz;
|
sim_ck += cfg->similarity_cksum_sz;
|
||||||
tgt += cfg->similarity_cksum_sz;
|
tgt += cfg->similarity_cksum_sz;
|
||||||
|
@ -1034,9 +1034,9 @@ process_blocks:
|
||||||
*/
|
*/
|
||||||
sim_ck = tgt;
|
sim_ck = tgt;
|
||||||
for (j=0; j < sub_i; j++) {
|
for (j=0; j < sub_i; j++) {
|
||||||
if (off1 != *((uint64_t *)sim_ck) && *((uint64_t *)sim_ck) != UINT64_MAX) {
|
if (off1 != U64_P(sim_ck) && U64_P(sim_ck) != UINT64_MAX) {
|
||||||
off1 = *((uint64_t *)sim_ck);
|
off1 = U64_P(sim_ck);
|
||||||
*((uint64_t *)tgt) = off1;
|
U64_P(tgt) = off1;
|
||||||
tgt += cfg->similarity_cksum_sz;
|
tgt += cfg->similarity_cksum_sz;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
@ -1058,7 +1058,7 @@ process_blocks:
|
||||||
*/
|
*/
|
||||||
src = sim_offsets;
|
src = sim_offsets;
|
||||||
for (i=0; i<blknum;) {
|
for (i=0; i<blknum;) {
|
||||||
blks = *((uint32_t *)src) + i;
|
blks = U32_P(src) + i;
|
||||||
src += sizeof (blks);
|
src += sizeof (blks);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1120,7 +1120,7 @@ process_blocks:
|
||||||
* Load segment metadata from disk and perform identity deduplication
|
* Load segment metadata from disk and perform identity deduplication
|
||||||
* with the segment chunks.
|
* with the segment chunks.
|
||||||
*/
|
*/
|
||||||
offset = *((uint64_t *)sim_ck);
|
offset = U64_P(sim_ck);
|
||||||
if (db_segcache_map(cfg, ctx->id, &o_blks, &offset,
|
if (db_segcache_map(cfg, ctx->id, &o_blks, &offset,
|
||||||
(uchar_t **)&seg_blocks) == -1) {
|
(uchar_t **)&seg_blocks) == -1) {
|
||||||
fprintf(stderr, "** Segment cache mmap failed.\n");
|
fprintf(stderr, "** Segment cache mmap failed.\n");
|
||||||
|
@ -1181,7 +1181,7 @@ next_ent:
|
||||||
* Block was added to index. Merge this block.
|
* Block was added to index. Merge this block.
|
||||||
*/
|
*/
|
||||||
if (length + ctx->g_blocks[i].length > RABIN_MAX_BLOCK_SIZE) {
|
if (length + ctx->g_blocks[i].length > RABIN_MAX_BLOCK_SIZE) {
|
||||||
*((uint32_t *)g_dedupe_idx) = LE32(length);
|
U32_P(g_dedupe_idx) = LE32(length);
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
length = 0;
|
length = 0;
|
||||||
dedupe_index_sz++;
|
dedupe_index_sz++;
|
||||||
|
@ -1195,7 +1195,7 @@ next_ent:
|
||||||
/*
|
/*
|
||||||
* Write pending accumulated block length value.
|
* Write pending accumulated block length value.
|
||||||
*/
|
*/
|
||||||
*((uint32_t *)g_dedupe_idx) = LE32(length);
|
U32_P(g_dedupe_idx) = LE32(length);
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
length = 0;
|
length = 0;
|
||||||
dedupe_index_sz++;
|
dedupe_index_sz++;
|
||||||
|
@ -1203,9 +1203,9 @@ next_ent:
|
||||||
/*
|
/*
|
||||||
* Add a reference entry to the dedupe array.
|
* Add a reference entry to the dedupe array.
|
||||||
*/
|
*/
|
||||||
*((uint32_t *)g_dedupe_idx) = LE32(ctx->g_blocks[i].length);
|
U32_P(g_dedupe_idx) = LE32(ctx->g_blocks[i].length);
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
*((uint64_t *)g_dedupe_idx) = LE64(ctx->g_blocks[i].offset);
|
U64_P(g_dedupe_idx) = LE64(ctx->g_blocks[i].offset);
|
||||||
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
||||||
matchlen += (ctx->g_blocks[i].length & RABIN_INDEX_VALUE);
|
matchlen += (ctx->g_blocks[i].length & RABIN_INDEX_VALUE);
|
||||||
dedupe_index_sz += 3;
|
dedupe_index_sz += 3;
|
||||||
|
@ -1216,7 +1216,7 @@ next_ent:
|
||||||
* Write final pending block length value (if any).
|
* Write final pending block length value (if any).
|
||||||
*/
|
*/
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
*((uint32_t *)g_dedupe_idx) = LE32(length);
|
U32_P(g_dedupe_idx) = LE32(length);
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
length = 0;
|
length = 0;
|
||||||
dedupe_index_sz++;
|
dedupe_index_sz++;
|
||||||
|
@ -1246,7 +1246,7 @@ next_ent:
|
||||||
* Now copy the block data;
|
* Now copy the block data;
|
||||||
*/
|
*/
|
||||||
for (i=0; i<blknum-2;) {
|
for (i=0; i<blknum-2;) {
|
||||||
length = LE32(*((uint32_t *)g_dedupe_idx));
|
length = LE32(U32_P(g_dedupe_idx));
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
|
@ -1483,7 +1483,7 @@ dedupe_done:
|
||||||
uint64_t *entries;
|
uint64_t *entries;
|
||||||
DEBUG_STAT_EN(uint64_t sz);
|
DEBUG_STAT_EN(uint64_t sz);
|
||||||
DEBUG_STAT_EN(sz = *size);
|
DEBUG_STAT_EN(sz = *size);
|
||||||
*((uint32_t *)cbuf) = htonl(blknum);
|
U32_P(cbuf) = htonl(blknum);
|
||||||
cbuf += sizeof (uint32_t);
|
cbuf += sizeof (uint32_t);
|
||||||
entries = (uint64_t *)cbuf;
|
entries = (uint64_t *)cbuf;
|
||||||
entries[0] = htonll(*size);
|
entries[0] = htonll(*size);
|
||||||
|
@ -1524,7 +1524,7 @@ parse_dedupe_hdr(uchar_t *buf, uint32_t *blknum, uint64_t *dedupe_index_sz,
|
||||||
{
|
{
|
||||||
uint64_t *entries;
|
uint64_t *entries;
|
||||||
|
|
||||||
*blknum = ntohl(*((uint32_t *)(buf)));
|
*blknum = ntohl(U32_P(buf));
|
||||||
buf += sizeof (uint32_t);
|
buf += sizeof (uint32_t);
|
||||||
|
|
||||||
entries = (uint64_t *)buf;
|
entries = (uint64_t *)buf;
|
||||||
|
@ -1561,14 +1561,14 @@ dedupe_decompress(dedupe_context_t *ctx, uchar_t *buf, uint64_t *size)
|
||||||
|
|
||||||
blknum &= CLEAR_GLOBAL_FLAG;
|
blknum &= CLEAR_GLOBAL_FLAG;
|
||||||
g_dedupe_idx = buf + RABIN_HDR_SIZE;
|
g_dedupe_idx = buf + RABIN_HDR_SIZE;
|
||||||
offset = LE64(*((uint64_t *)g_dedupe_idx));
|
offset = LE64(U64_P(g_dedupe_idx));
|
||||||
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
||||||
blknum -= 2;
|
blknum -= 2;
|
||||||
src1 = buf + RABIN_HDR_SIZE + dedupe_index_sz;
|
src1 = buf + RABIN_HDR_SIZE + dedupe_index_sz;
|
||||||
|
|
||||||
sem_wait(ctx->index_sem);
|
sem_wait(ctx->index_sem);
|
||||||
for (blk=0; blk<blknum;) {
|
for (blk=0; blk<blknum;) {
|
||||||
len = LE32(*((uint32_t *)g_dedupe_idx));
|
len = LE32(U32_P(g_dedupe_idx));
|
||||||
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
g_dedupe_idx += RABIN_ENTRY_SIZE;
|
||||||
++blk;
|
++blk;
|
||||||
flag = len & RABIN_INDEX_FLAG;
|
flag = len & RABIN_INDEX_FLAG;
|
||||||
|
@ -1585,7 +1585,7 @@ dedupe_decompress(dedupe_context_t *ctx, uchar_t *buf, uint64_t *size)
|
||||||
src1 += len;
|
src1 += len;
|
||||||
sz += len;
|
sz += len;
|
||||||
} else {
|
} else {
|
||||||
pos1 = LE64(*((uint64_t *)g_dedupe_idx));
|
pos1 = LE64(U64_P(g_dedupe_idx));
|
||||||
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
g_dedupe_idx += (RABIN_ENTRY_SIZE * 2);
|
||||||
blk += 2;
|
blk += 2;
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,12 @@ typedef int32_t bsize_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BYTES_TO_MB(x) ((x) / (1024 * 1024))
|
#define BYTES_TO_MB(x) ((x) / (1024 * 1024))
|
||||||
|
#define U64_P(x) *((uint64_t *)(x))
|
||||||
|
#define U32_P(x) *((uint32_t *)(x))
|
||||||
|
#define U16_P(x) *((uint16_t *)(x))
|
||||||
|
#define I64_P(x) *((int64_t *)(x))
|
||||||
|
#define I32_P(x) *((int32_t *)(x))
|
||||||
|
#define I16_P(x) *((int16_t *)(x))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public checksum properties. CKSUM_MAX_BYTES must be updated if a
|
* Public checksum properties. CKSUM_MAX_BYTES must be updated if a
|
||||||
|
|
Loading…
Reference in a new issue