Lines Matching refs:hdr

57 gptupdate(const char *which, struct dsk *dskp, struct gpt_hdr *hdr,
71 entries_per_sec = DEV_BSIZE / hdr->hdr_entsz;
75 slba += hdr->hdr_lba_table;
81 hdr->hdr_crc_table = crc32(table, hdr->hdr_entries * hdr->hdr_entsz);
82 hdr->hdr_crc_self = 0;
83 hdr->hdr_crc_self = crc32(hdr, hdr->hdr_size);
85 bcopy(hdr, secbuf, hdr->hdr_size);
86 if (drvwrite(dskp, secbuf, hdr->hdr_lba_self, 1)) {
185 gptread_hdr(const char *which, struct dsk *dskp, struct gpt_hdr *hdr,
194 bcopy(secbuf, hdr, sizeof(*hdr));
195 if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0 ||
196 hdr->hdr_lba_self != hdrlba || hdr->hdr_revision < 0x00010000 ||
197 hdr->hdr_entsz < sizeof(struct gpt_ent) ||
198 hdr->hdr_entries > MAXTBLENTS || DEV_BSIZE % hdr->hdr_entsz != 0) {
202 crc = hdr->hdr_crc_self;
203 hdr->hdr_crc_self = 0;
204 if (crc32(hdr, hdr->hdr_size) != crc) {
209 hdr->hdr_crc_self = crc;
233 gptbootconv(const char *which, struct dsk *dskp, struct gpt_hdr *hdr,
242 entries_per_sec = DEV_BSIZE / hdr->hdr_entsz;
243 for (nent = 0, slba = hdr->hdr_lba_table;
244 slba < hdr->hdr_lba_table + hdr->hdr_entries / entries_per_sec;
270 hdr->hdr_crc_table = crc32(table, hdr->hdr_entries * hdr->hdr_entsz);
271 hdr->hdr_crc_self = 0;
272 hdr->hdr_crc_self = crc32(hdr, hdr->hdr_size);
274 bcopy(hdr, secbuf, hdr->hdr_size);
275 if (drvwrite(dskp, secbuf, hdr->hdr_lba_self, 1))
281 struct gpt_hdr *hdr, struct gpt_ent *table)
288 if (hdr->hdr_entries == 0)
291 entries_per_sec = DEV_BSIZE / hdr->hdr_entsz;
292 slba = hdr->hdr_lba_table;
303 if (++nent >= hdr->hdr_entries)
306 if (nent >= hdr->hdr_entries)
310 if (crc32(table, nent * hdr->hdr_entsz) != hdr->hdr_crc_table) {