Lines Matching refs:hdr

1185         uint8_t* hdr = NULL;  in gpt_get_header()  local
1218 hdr = (uint8_t*)malloc(block_size); in gpt_get_header()
1219 if (!hdr) { in gpt_get_header()
1233 if (blk_rw(fd, 0, hdr_offset, hdr, block_size)) { in gpt_get_header()
1239 return hdr; in gpt_get_header()
1243 if (hdr) in gpt_get_header()
1244 free(hdr); in gpt_get_header()
1252 static uint8_t* gpt_get_pentry_arr(uint8_t *hdr, int fd) in gpt_get_pentry_arr() argument
1260 if (!hdr) { in gpt_get_pentry_arr()
1274 pentries_start = GET_8_BYTES(hdr + PENTRIES_OFFSET) * block_size; in gpt_get_pentry_arr()
1275 pentry_size = GET_4_BYTES(hdr + PENTRY_SIZE_OFFSET); in gpt_get_pentry_arr()
1277 GET_4_BYTES(hdr + PARTITION_COUNT_OFFSET) * pentry_size; in gpt_get_pentry_arr()
1300 static int gpt_set_pentry_arr(uint8_t *hdr, int fd, uint8_t* arr) in gpt_set_pentry_arr() argument
1307 if (!hdr || fd < 0 || !arr) { in gpt_set_pentry_arr()
1318 pentries_start = GET_8_BYTES(hdr + PENTRIES_OFFSET) * block_size; in gpt_set_pentry_arr()
1319 pentry_size = GET_4_BYTES(hdr + PENTRY_SIZE_OFFSET); in gpt_set_pentry_arr()
1321 GET_4_BYTES(hdr + PARTITION_COUNT_OFFSET) * pentry_size; in gpt_set_pentry_arr()
1361 if (disk->hdr) in gpt_disk_free()
1362 free(disk->hdr); in gpt_disk_free()
1386 disk->hdr = gpt_get_header(dev, PRIMARY_GPT); in gpt_disk_get_disk_info()
1387 if (!disk->hdr) { in gpt_disk_get_disk_info()
1391 gpt_header_size = GET_4_BYTES(disk->hdr + HEADER_SIZE_OFFSET); in gpt_disk_get_disk_info()
1392 disk->hdr_crc = crc32(0, disk->hdr, gpt_header_size); in gpt_disk_get_disk_info()
1418 disk->pentry_arr = gpt_get_pentry_arr(disk->hdr, fd); in gpt_disk_get_disk_info()
1430 disk->pentry_size = GET_4_BYTES(disk->hdr + PENTRY_SIZE_OFFSET); in gpt_disk_get_disk_info()
1432 GET_4_BYTES(disk->hdr + PARTITION_COUNT_OFFSET) * in gpt_disk_get_disk_info()
1434 disk->pentry_arr_crc = GET_4_BYTES(disk->hdr + PARTITION_CRC_OFFSET); in gpt_disk_get_disk_info()
1486 PUT_4_BYTES(disk->hdr + PARTITION_CRC_OFFSET, disk->pentry_arr_crc); in gpt_disk_update_crc()
1491 gpt_header_size = GET_4_BYTES(disk->hdr + HEADER_SIZE_OFFSET); in gpt_disk_update_crc()
1493 PUT_4_BYTES(disk->hdr + HEADER_CRC_OFFSET, 0); in gpt_disk_update_crc()
1495 disk->hdr_crc = crc32(0, disk->hdr, gpt_header_size); in gpt_disk_update_crc()
1497 PUT_4_BYTES(disk->hdr + HEADER_CRC_OFFSET, disk->hdr_crc); in gpt_disk_update_crc()
1522 if(gpt_set_header(disk->hdr, fd, PRIMARY_GPT) != 0) { in gpt_disk_commit()
1529 if (gpt_set_pentry_arr(disk->hdr, fd, disk->pentry_arr)) { in gpt_disk_commit()