diff options
author | marcel <marcel@FreeBSD.org> | 2008-12-01 00:07:17 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2008-12-01 00:07:17 +0000 |
commit | c1d7ffc25e6ad608b9a9fc776fe3b5f97340051f (patch) | |
tree | 51f00ee526991c6876f648de4469a77f37b7579a /sys/geom/part/g_part_gpt.c | |
parent | 5c813d4376f9af5c59729208974ee620e3091b10 (diff) | |
download | FreeBSD-src-c1d7ffc25e6ad608b9a9fc776fe3b5f97340051f.zip FreeBSD-src-c1d7ffc25e6ad608b9a9fc776fe3b5f97340051f.tar.gz |
Allow boot code to be smaller than what the scheme expects.
This effectively changes the boot code size to be an upper
bound and makes the interface more flexible.
Diffstat (limited to 'sys/geom/part/g_part_gpt.c')
-rw-r--r-- | sys/geom/part/g_part_gpt.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c index 7bdfa07..13a4561 100644 --- a/sys/geom/part/g_part_gpt.c +++ b/sys/geom/part/g_part_gpt.c @@ -374,9 +374,14 @@ static int g_part_gpt_bootcode(struct g_part_table *basetable, struct g_part_parms *gpp) { struct g_part_gpt_table *table; + size_t codesz; + codesz = DOSPARTOFF; table = (struct g_part_gpt_table *)basetable; - bcopy(gpp->gpp_codeptr, table->mbr, DOSPARTOFF); + bzero(table->mbr, codesz); + codesz = MIN(codesz, gpp->gpp_codesize); + if (codesz > 0) + bcopy(gpp->gpp_codeptr, table->mbr, codesz); return (0); } |