lib/crc32: prefix public functions
Make the publicly-visible crc32 library functions prefixed by ul_, such as crc32() -> ul_crc32(). This is because it clashes with the crc32() function from zlib. For newer versions of glib (2.50+) zlib and libblkid are required dependencies and otherwise results in build failure when building statically. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
This commit is contained in:
parent
6a9aaf5491
commit
7f0d4d56a2
7 changed files with 18 additions and 18 deletions
|
@ -214,7 +214,7 @@ static void test_crc(int start)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
crc = crc32(0L, Z_NULL, 0);
|
crc = ul_crc32(0L, Z_NULL, 0);
|
||||||
|
|
||||||
buf =
|
buf =
|
||||||
mmap(NULL, super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
mmap(NULL, super.size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||||
|
@ -231,8 +231,8 @@ static void test_crc(int start)
|
||||||
}
|
}
|
||||||
if (buf != MAP_FAILED) {
|
if (buf != MAP_FAILED) {
|
||||||
((struct cramfs_super *)((unsigned char *) buf + start))->fsid.crc =
|
((struct cramfs_super *)((unsigned char *) buf + start))->fsid.crc =
|
||||||
crc32(0L, Z_NULL, 0);
|
ul_crc32(0L, Z_NULL, 0);
|
||||||
crc = crc32(crc, (unsigned char *) buf + start, super.size - start);
|
crc = ul_crc32(crc, (unsigned char *) buf + start, super.size - start);
|
||||||
munmap(buf, super.size);
|
munmap(buf, super.size);
|
||||||
} else {
|
} else {
|
||||||
int retval;
|
int retval;
|
||||||
|
@ -249,15 +249,15 @@ static void test_crc(int start)
|
||||||
break;
|
break;
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
((struct cramfs_super *)buf)->fsid.crc =
|
((struct cramfs_super *)buf)->fsid.crc =
|
||||||
crc32(0L, Z_NULL, 0);
|
ul_crc32(0L, Z_NULL, 0);
|
||||||
length += retval;
|
length += retval;
|
||||||
if (length > (super.size - start)) {
|
if (length > (super.size - start)) {
|
||||||
crc = crc32(crc, buf,
|
crc = ul_crc32(crc, buf,
|
||||||
retval - (length -
|
retval - (length -
|
||||||
(super.size - start)));
|
(super.size - start)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
crc = crc32(crc, buf, retval);
|
crc = ul_crc32(crc, buf, retval);
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,7 +406,7 @@ static unsigned int write_superblock(struct entry *root, char *base, int size)
|
||||||
super->size = size;
|
super->size = size;
|
||||||
memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature));
|
memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature));
|
||||||
|
|
||||||
super->fsid.crc = crc32(0L, Z_NULL, 0);
|
super->fsid.crc = ul_crc32(0L, Z_NULL, 0);
|
||||||
super->fsid.edition = opt_edition;
|
super->fsid.edition = opt_edition;
|
||||||
super->fsid.blocks = total_blocks;
|
super->fsid.blocks = total_blocks;
|
||||||
super->fsid.files = total_nodes;
|
super->fsid.files = total_nodes;
|
||||||
|
@ -700,7 +700,7 @@ int main(int argc, char **argv)
|
||||||
loff_t fslen_ub = sizeof(struct cramfs_super);
|
loff_t fslen_ub = sizeof(struct cramfs_super);
|
||||||
unsigned int fslen_max;
|
unsigned int fslen_max;
|
||||||
char const *dirname, *outfile;
|
char const *dirname, *outfile;
|
||||||
uint32_t crc = crc32(0L, Z_NULL, 0);
|
uint32_t crc = ul_crc32(0L, Z_NULL, 0);
|
||||||
int c;
|
int c;
|
||||||
cramfs_is_big_endian = HOST_IS_BIG_ENDIAN; /* default is to use host order */
|
cramfs_is_big_endian = HOST_IS_BIG_ENDIAN; /* default is to use host order */
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ int main(int argc, char **argv)
|
||||||
sizeof(struct cramfs_super));
|
sizeof(struct cramfs_super));
|
||||||
|
|
||||||
/* Put the checksum in. */
|
/* Put the checksum in. */
|
||||||
crc = crc32(crc, (unsigned char *) (rom_image+opt_pad), (offset-opt_pad));
|
crc = ul_crc32(crc, (unsigned char *) (rom_image+opt_pad), (offset-opt_pad));
|
||||||
((struct cramfs_super *) (rom_image+opt_pad))->fsid.crc = u32_toggle_endianness(cramfs_is_big_endian, crc);
|
((struct cramfs_super *) (rom_image+opt_pad))->fsid.crc = u32_toggle_endianness(cramfs_is_big_endian, crc);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf(_("CRC: %x\n"), crc);
|
printf(_("CRC: %x\n"), crc);
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
extern uint32_t crc32(uint32_t seed, const unsigned char *buf, size_t len);
|
extern uint32_t ul_crc32(uint32_t seed, const unsigned char *buf, size_t len);
|
||||||
extern uint32_t crc32_exclude_offset(uint32_t seed, const unsigned char *buf, size_t len,
|
extern uint32_t ul_crc32_exclude_offset(uint32_t seed, const unsigned char *buf, size_t len,
|
||||||
size_t exclude_off, size_t exclude_len);
|
size_t exclude_off, size_t exclude_len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -108,7 +108,7 @@ static inline uint32_t crc32_add_char(uint32_t crc, unsigned char c)
|
||||||
* and does __not__ xor at the end. Then individual users can do
|
* and does __not__ xor at the end. Then individual users can do
|
||||||
* whatever they need.
|
* whatever they need.
|
||||||
*/
|
*/
|
||||||
uint32_t crc32(uint32_t seed, const unsigned char *buf, size_t len)
|
uint32_t ul_crc32(uint32_t seed, const unsigned char *buf, size_t len)
|
||||||
{
|
{
|
||||||
uint32_t crc = seed;
|
uint32_t crc = seed;
|
||||||
const unsigned char *p = buf;
|
const unsigned char *p = buf;
|
||||||
|
@ -121,7 +121,7 @@ uint32_t crc32(uint32_t seed, const unsigned char *buf, size_t len)
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t crc32_exclude_offset(uint32_t seed, const unsigned char *buf, size_t len,
|
uint32_t ul_crc32_exclude_offset(uint32_t seed, const unsigned char *buf, size_t len,
|
||||||
size_t exclude_off, size_t exclude_len)
|
size_t exclude_off, size_t exclude_len)
|
||||||
{
|
{
|
||||||
uint32_t crc = seed;
|
uint32_t crc = seed;
|
||||||
|
|
|
@ -105,7 +105,7 @@ struct gpt_entry {
|
||||||
static inline uint32_t count_crc32(const unsigned char *buf, size_t len,
|
static inline uint32_t count_crc32(const unsigned char *buf, size_t len,
|
||||||
size_t exclude_off, size_t exclude_len)
|
size_t exclude_off, size_t exclude_len)
|
||||||
{
|
{
|
||||||
return (crc32_exclude_offset(~0L, buf, len, exclude_off, exclude_len) ^ ~0L);
|
return (ul_crc32_exclude_offset(~0L, buf, len, exclude_off, exclude_len) ^ ~0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned char *get_lba_buffer(blkid_probe pr,
|
static inline unsigned char *get_lba_buffer(blkid_probe pr,
|
||||||
|
|
|
@ -89,9 +89,9 @@ static int nilfs_valid_sb(blkid_probe pr, struct nilfs_super_block *sb, int is_b
|
||||||
if (bytes < crc_start || bytes > sizeof(struct nilfs_super_block))
|
if (bytes < crc_start || bytes > sizeof(struct nilfs_super_block))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
crc = crc32(le32_to_cpu(sb->s_crc_seed), (unsigned char *)sb, sumoff);
|
crc = ul_crc32(le32_to_cpu(sb->s_crc_seed), (unsigned char *)sb, sumoff);
|
||||||
crc = crc32(crc, sum, 4);
|
crc = ul_crc32(crc, sum, 4);
|
||||||
crc = crc32(crc, (unsigned char *)sb + crc_start, bytes - crc_start);
|
crc = ul_crc32(crc, (unsigned char *)sb + crc_start, bytes - crc_start);
|
||||||
|
|
||||||
return blkid_probe_verify_csum(pr, crc, le32_to_cpu(sb->s_sum));
|
return blkid_probe_verify_csum(pr, crc, le32_to_cpu(sb->s_sum));
|
||||||
}
|
}
|
||||||
|
|
|
@ -850,7 +850,7 @@ fail:
|
||||||
static inline uint32_t count_crc32(const unsigned char *buf, size_t len,
|
static inline uint32_t count_crc32(const unsigned char *buf, size_t len,
|
||||||
size_t ex_off, size_t ex_len)
|
size_t ex_off, size_t ex_len)
|
||||||
{
|
{
|
||||||
return (crc32_exclude_offset(~0L, buf, len, ex_off, ex_len) ^ ~0L);
|
return (ul_crc32_exclude_offset(~0L, buf, len, ex_off, ex_len) ^ ~0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t gpt_header_count_crc32(struct gpt_header *header)
|
static inline uint32_t gpt_header_count_crc32(struct gpt_header *header)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue