Lines Matching refs:hdr

1187         uint8_t* hdr = NULL;  in gpt_get_header()  local
1220 hdr = (uint8_t*)malloc(block_size); in gpt_get_header()
1221 if (!hdr) { in gpt_get_header()
1235 if (blk_rw(fd, 0, hdr_offset, hdr, block_size)) { in gpt_get_header()
1241 return hdr; in gpt_get_header()
1245 if (hdr) in gpt_get_header()
1246 free(hdr); in gpt_get_header()
1254 static uint8_t* gpt_get_pentry_arr(uint8_t *hdr, int fd) in gpt_get_pentry_arr() argument
1262 if (!hdr) { in gpt_get_pentry_arr()
1276 pentries_start = GET_8_BYTES(hdr + PENTRIES_OFFSET) * block_size; in gpt_get_pentry_arr()
1277 pentry_size = GET_4_BYTES(hdr + PENTRY_SIZE_OFFSET); in gpt_get_pentry_arr()
1279 GET_4_BYTES(hdr + PARTITION_COUNT_OFFSET) * pentry_size; in gpt_get_pentry_arr()
1302 static int gpt_set_pentry_arr(uint8_t *hdr, int fd, uint8_t* arr) in gpt_set_pentry_arr() argument
1309 if (!hdr || fd < 0 || !arr) { in gpt_set_pentry_arr()
1320 pentries_start = GET_8_BYTES(hdr + PENTRIES_OFFSET) * block_size; in gpt_set_pentry_arr()
1321 pentry_size = GET_4_BYTES(hdr + PENTRY_SIZE_OFFSET); in gpt_set_pentry_arr()
1323 GET_4_BYTES(hdr + PARTITION_COUNT_OFFSET) * pentry_size; in gpt_set_pentry_arr()
1363 if (disk->hdr) in gpt_disk_free()
1364 free(disk->hdr); in gpt_disk_free()
1388 disk->hdr = gpt_get_header(dev, PRIMARY_GPT); in gpt_disk_get_disk_info()
1389 if (!disk->hdr) { in gpt_disk_get_disk_info()
1393 gpt_header_size = GET_4_BYTES(disk->hdr + HEADER_SIZE_OFFSET); in gpt_disk_get_disk_info()
1394 disk->hdr_crc = crc32(0, disk->hdr, gpt_header_size); in gpt_disk_get_disk_info()
1420 disk->pentry_arr = gpt_get_pentry_arr(disk->hdr, fd); in gpt_disk_get_disk_info()
1432 disk->pentry_size = GET_4_BYTES(disk->hdr + PENTRY_SIZE_OFFSET); in gpt_disk_get_disk_info()
1434 GET_4_BYTES(disk->hdr + PARTITION_COUNT_OFFSET) * in gpt_disk_get_disk_info()
1436 disk->pentry_arr_crc = GET_4_BYTES(disk->hdr + PARTITION_CRC_OFFSET); in gpt_disk_get_disk_info()
1488 PUT_4_BYTES(disk->hdr + PARTITION_CRC_OFFSET, disk->pentry_arr_crc); in gpt_disk_update_crc()
1493 gpt_header_size = GET_4_BYTES(disk->hdr + HEADER_SIZE_OFFSET); in gpt_disk_update_crc()
1495 PUT_4_BYTES(disk->hdr + HEADER_CRC_OFFSET, 0); in gpt_disk_update_crc()
1497 disk->hdr_crc = crc32(0, disk->hdr, gpt_header_size); in gpt_disk_update_crc()
1499 PUT_4_BYTES(disk->hdr + HEADER_CRC_OFFSET, disk->hdr_crc); in gpt_disk_update_crc()
1524 if(gpt_set_header(disk->hdr, fd, PRIMARY_GPT) != 0) { in gpt_disk_commit()
1531 if (gpt_set_pentry_arr(disk->hdr, fd, disk->pentry_arr)) { in gpt_disk_commit()