diff options
author | jkh <jkh@FreeBSD.org> | 1995-05-24 08:59:40 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-05-24 08:59:40 +0000 |
commit | 33ee1a22eddb8029d1051a4c04f35b72dcc1e6da (patch) | |
tree | 540c17fff92c76ed5ebab2195bb3b459f0f7950f /lib | |
parent | 206d10d33f0d45afde92ec0556a726d8e36b10c7 (diff) | |
download | FreeBSD-src-33ee1a22eddb8029d1051a4c04f35b72dcc1e6da.zip FreeBSD-src-33ee1a22eddb8029d1051a4c04f35b72dcc1e6da.tar.gz |
Align slices to cylinder boundries.
Submitted By: phk
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libdisk/change.c | 7 | ||||
-rw-r--r-- | lib/libdisk/create_chunk.c | 9 | ||||
-rw-r--r-- | lib/libdisk/write_disk.c | 9 |
3 files changed, 18 insertions, 7 deletions
diff --git a/lib/libdisk/change.c b/lib/libdisk/change.c index cd78f45..80ce1f2 100644 --- a/lib/libdisk/change.c +++ b/lib/libdisk/change.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: change.c,v 1.3 1995/04/29 04:00:53 phk Exp $ + * $Id: change.c,v 1.5 1995/05/01 04:05:23 phk Exp $ * */ @@ -55,5 +55,10 @@ All_FreeBSD(struct disk *d) goto again; } c=d->chunks; + if (d->flags & DISK_ON_TRACK) { + c->offset += 63; + c->part->offset += 63; + d->flags &= ~DISK_ON_TRACK; + } Create_Chunk(d,c->offset,c->size,freebsd,0xa5,0); } diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index ab1f082..f7bca32 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: create_chunk.c,v 1.17 1995/05/15 19:03:08 phk Exp $ + * $Id: create_chunk.c,v 1.18 1995/05/20 19:11:44 phk Exp $ * */ @@ -155,11 +155,18 @@ int Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subtype, u_long flags) { int i; + u_long l; + /* Never use the first track */ if (!offset) { offset += d->bios_sect; size -= d->bios_sect; } + + /* Always end on cylinder boundary */ + l = (offset+size) % (d->bios_sect * d->bios_hd); + size -= l; + i = Add_Chunk(d,offset,size,"X",type,subtype,flags); Fixup_Names(d); return i; diff --git a/lib/libdisk/write_disk.c b/lib/libdisk/write_disk.c index a0eb8d2..3b9a163 100644 --- a/lib/libdisk/write_disk.c +++ b/lib/libdisk/write_disk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: write_disk.c,v 1.10 1995/05/18 22:25:37 phk Exp $ + * $Id: write_disk.c,v 1.11 1995/05/21 07:47:24 phk Exp $ * */ @@ -24,7 +24,6 @@ #include "libdisk.h" #define DOSPTYP_EXTENDED 5 -#define DOSPTYP_ONTRACK 84 #define BBSIZE 8192 #define WHERE(offset,disk) (disk->flags & DISK_ON_TRACK ? offset + 63 : offset) @@ -38,7 +37,7 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1) u_char buf[BBSIZE]; for(i=0;i<BBSIZE/512;i++) { - p = read_block(fd,i + c1->offset); + p = read_block(fd,WHERE(i + c1->offset,new)); memcpy(buf+512*i,p,512); free(p); } @@ -124,7 +123,7 @@ Write_Disk(struct disk *d1) } memset(s,0,sizeof s); - mbr = read_block(fd,0); + mbr = read_block(fd,WHERE(0,d1)); dp = (struct dos_partition*) (mbr + DOSPARTOFF); memcpy(work,dp,sizeof work); dp = work; @@ -201,7 +200,7 @@ Write_Disk(struct disk *d1) if (dp[i].dp_typ == 0xa5) dp[i].dp_flag = 0x80; - mbr = read_block(fd,0); + mbr = read_block(fd,WHERE(0,d1)); if (d1->bootmgr) memcpy(mbr,d1->bootmgr,DOSPARTOFF); memcpy(mbr+DOSPARTOFF,dp,sizeof *dp * NDOSPART); |