diff options
Diffstat (limited to 'util-linux/fdisk_gpt.c')
-rw-r--r-- | util-linux/fdisk_gpt.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c index 98803ec88..4dfb5b227 100644 --- a/util-linux/fdisk_gpt.c +++ b/util-linux/fdisk_gpt.c | |||
@@ -46,8 +46,6 @@ static unsigned int n_parts; | |||
46 | static unsigned int part_array_len; | 46 | static unsigned int part_array_len; |
47 | static unsigned int part_entry_len; | 47 | static unsigned int part_entry_len; |
48 | 48 | ||
49 | static uint32_t *crc32_table; | ||
50 | |||
51 | static inline gpt_partition * | 49 | static inline gpt_partition * |
52 | gpt_part(int i) | 50 | gpt_part(int i) |
53 | { | 51 | { |
@@ -61,12 +59,7 @@ gpt_part(int i) | |||
61 | static uint32_t | 59 | static uint32_t |
62 | gpt_crc32(void *buf, int len) | 60 | gpt_crc32(void *buf, int len) |
63 | { | 61 | { |
64 | uint32_t crc = 0xffffffff; | 62 | return 0xffffffff ^ crc32_block_endian0(0xffffffff, buf, len, global_crc32_table); |
65 | |||
66 | for (; len > 0; len--, buf++) { | ||
67 | crc = crc32_table[(crc ^ *((char *)buf)) & 0xff] ^ (crc >> 8); | ||
68 | } | ||
69 | return crc ^ 0xffffffff; | ||
70 | } | 63 | } |
71 | 64 | ||
72 | static void | 65 | static void |
@@ -160,8 +153,8 @@ check_gpt_label(void) | |||
160 | return 0; | 153 | return 0; |
161 | } | 154 | } |
162 | 155 | ||
163 | if (!crc32_table) { | 156 | if (!global_crc32_table) { |
164 | crc32_table = crc32_filltable(NULL, 0); | 157 | global_crc32_table = crc32_filltable(NULL, 0); |
165 | } | 158 | } |
166 | 159 | ||
167 | crc = SWAP_LE32(gpt_hdr->hdr_crc32); | 160 | crc = SWAP_LE32(gpt_hdr->hdr_crc32); |