Do not truncate available disk space to the closest track boundary.

This commit is contained in:
Andrey V. Elsukov 2011-05-25 09:32:19 +00:00
parent 67900914ff
commit db48d4a92e

View File

@ -253,15 +253,14 @@ g_part_mbr_create(struct g_part_table *basetable, struct g_part_parms *gpp)
{
struct g_provider *pp;
struct g_part_mbr_table *table;
uint32_t msize;
pp = gpp->gpp_provider;
if (pp->sectorsize < MBRSIZE)
return (ENOSPC);
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
basetable->gpt_first = basetable->gpt_sectors;
basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
basetable->gpt_last = MIN(pp->mediasize / pp->sectorsize,
UINT32_MAX) - 1;
table = (struct g_part_mbr_table *)basetable;
le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC);
@ -470,7 +469,7 @@ g_part_mbr_read(struct g_part_table *basetable, struct g_consumer *cp)
basetable->gpt_entries = NDOSPART;
basetable->gpt_first = basetable->gpt_sectors;
basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
basetable->gpt_last = msize - 1;
g_free(buf);
return (0);