Changeset View
Changeset View
Standalone View
Standalone View
stand/libsa/gpt.c
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | gptupdate(const char *which, struct dsk *dskp, struct gpt_hdr *hdr, | ||||
if (drvwrite(dskp, secbuf, slba, 1)) { | if (drvwrite(dskp, secbuf, slba, 1)) { | ||||
printf("%s: unable to update %s GPT partition table\n", | printf("%s: unable to update %s GPT partition table\n", | ||||
BOOTPROG, which); | BOOTPROG, which); | ||||
return; | return; | ||||
} | } | ||||
hdr->hdr_crc_table = crc32(0, Z_NULL, 0); | hdr->hdr_crc_table = crc32(0, Z_NULL, 0); | ||||
hdr->hdr_crc_table = crc32(hdr->hdr_crc_table, (const Bytef *)table, | hdr->hdr_crc_table = crc32(hdr->hdr_crc_table, (const Bytef *)table, | ||||
hdr->hdr_entries * hdr->hdr_entsz); | hdr->hdr_entries * hdr->hdr_entsz); | ||||
hdr->hdr_crc_self = crc32(0, Z_NULL, 0);; | hdr->hdr_crc_self = crc32(0, Z_NULL, 0); | ||||
hdr->hdr_crc_self = crc32(hdr->hdr_crc_self, (const Bytef *)hdr, | hdr->hdr_crc_self = crc32(hdr->hdr_crc_self, (const Bytef *)hdr, | ||||
hdr->hdr_size); | hdr->hdr_size); | ||||
bzero(secbuf, DEV_BSIZE); | bzero(secbuf, DEV_BSIZE); | ||||
bcopy(hdr, secbuf, hdr->hdr_size); | bcopy(hdr, secbuf, hdr->hdr_size); | ||||
if (drvwrite(dskp, secbuf, hdr->hdr_lba_self, 1)) { | if (drvwrite(dskp, secbuf, hdr->hdr_lba_self, 1)) { | ||||
printf("%s: unable to update %s GPT header\n", BOOTPROG, which); | printf("%s: unable to update %s GPT header\n", BOOTPROG, which); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 295 Lines • Show Last 20 Lines |