Move setting CHS fields to mbr_chs() in preparation of ...

This commit is contained in:
marcel 2014-03-25 03:58:13 +00:00
parent cedbce4789
commit 572e125f42

15
mbr.c
View File

@ -54,6 +54,15 @@ mbr_metadata(u_int where)
return (secs);
}
static void
mbr_chs(u_char *cyl, u_char *hd, u_char *sec, uint32_t lba __unused)
{
*cyl = 0xff; /* XXX */
*hd = 0xff; /* XXX */
*sec = 0xff; /* XXX */
}
static int
mbr_write(int fd, lba_t imgsz __unused, void *bootcode)
{
@ -75,9 +84,11 @@ mbr_write(int fd, lba_t imgsz __unused, void *bootcode)
STAILQ_FOREACH(part, &partlist, link) {
dp = dpbase + part->index;
dp->dp_flag = (part->index == 0 && bootcode != NULL) ? 0x80 : 0;
dp->dp_shd = dp->dp_ssect = dp->dp_scyl = 0xff; /* XXX */
mbr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect,
part->block);
dp->dp_typ = ALIAS_TYPE2INT(part->type);
dp->dp_ehd = dp->dp_esect = dp->dp_ecyl = 0xff; /* XXX */
mbr_chs(&dp->dp_ecyl, &dp->dp_ehd, &dp->dp_esect,
part->block + part->size - 1);
le32enc(&dp[part->index].dp_start, part->block);
le32enc(&dp[part->index].dp_size, part->size);
}