diff options
author | jhb <jhb@FreeBSD.org> | 2000-07-12 18:05:18 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2000-07-12 18:05:18 +0000 |
commit | b4c0d6aa68030b0d552c9dc5ca7eb8f0c83657ee (patch) | |
tree | bb22442a95d7324f2129888d91a7b8c5faed272e /lib/libdisk/disk.c | |
parent | 97196fa3a13e134bf65ff8bebbe8203fd3660634 (diff) | |
download | FreeBSD-src-b4c0d6aa68030b0d552c9dc5ca7eb8f0c83657ee.zip FreeBSD-src-b4c0d6aa68030b0d552c9dc5ca7eb8f0c83657ee.tar.gz |
- Allow support for MBR boot loaders that are longer than one sector. As
with fdisk, ensure that they are a multiple of the sector size in length.
- Axe all the 1024 cylinder checks as they are no longer relevant with the
fixed bootstrap.
Diffstat (limited to 'lib/libdisk/disk.c')
-rw-r--r-- | lib/libdisk/disk.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c index d625170..a61694d 100644 --- a/lib/libdisk/disk.c +++ b/lib/libdisk/disk.c @@ -361,9 +361,6 @@ pc98_mo_done: #endif close(fd); Fixup_Names(d); -#ifndef PC98 - Bios_Limit_Chunk(d->chunks,1024*d->bios_hd*d->bios_sect); -#endif return d; } @@ -412,8 +409,8 @@ Clone_Disk(struct disk *d) d2->name = strdup(d2->name); d2->chunks = Clone_Chunk(d2->chunks); if(d2->bootmgr) { - d2->bootmgr = malloc(DOSPARTOFF); - memcpy(d2->bootmgr,d->bootmgr,DOSPARTOFF); + d2->bootmgr = malloc(d2->bootmgr_size); + memcpy(d2->bootmgr,d->bootmgr,d2->bootmgr_size); } #if defined(__i386__) if(d2->boot1) { @@ -502,17 +499,21 @@ Disk_Names() } void -Set_Boot_Mgr(struct disk *d, const u_char *b) +Set_Boot_Mgr(struct disk *d, const u_char *b, const size_t s) { #ifndef PC98 + /* XXX - assumes sector size of 512 */ + if (s % 512 != 0) + return; if (d->bootmgr) free(d->bootmgr); if (!b) { - d->bootmgr = 0; + d->bootmgr = NULL; } else { - d->bootmgr = malloc(DOSPARTOFF); + d->bootmgr_size = s; + d->bootmgr = malloc(s); if(!d->bootmgr) err(1,"malloc failed"); - memcpy(d->bootmgr,b,DOSPARTOFF); + memcpy(d->bootmgr,b,s); } #endif } |