summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1995-05-08 02:08:33 +0000
committerphk <phk@FreeBSD.org>1995-05-08 02:08:33 +0000
commit021b1e61da72a756bc8f87b139948c264ab03d85 (patch)
tree49a69fca0481e33683fc291aae3110bec91f9897 /lib
parentb2a9651ad8912e10ed56deb485129ad3d59e3ebe (diff)
downloadFreeBSD-src-021b1e61da72a756bc8f87b139948c264ab03d85.zip
FreeBSD-src-021b1e61da72a756bc8f87b139948c264ab03d85.tar.gz
Recognize slice type #6 as dos
handle OnTrack Disk manager correctly.
Diffstat (limited to 'lib')
-rw-r--r--lib/libdisk/chunk.c6
-rw-r--r--lib/libdisk/disk.c11
-rw-r--r--lib/libdisk/libdisk.h6
-rw-r--r--lib/libdisk/write_disk.c17
4 files changed, 28 insertions, 12 deletions
diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c
index 77bcc00..54630be 100644
--- a/lib/libdisk/chunk.c
+++ b/lib/libdisk/chunk.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: chunk.c,v 1.9 1995/05/07 01:25:22 jkh Exp $
+ * $Id: chunk.c,v 1.10 1995/05/07 01:28:16 jkh Exp $
*
*/
@@ -173,7 +173,7 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, char *name, chunk_e t
}
int
-Add_Chunk(struct disk *d, u_long offset, u_long size, char *name, chunk_e type,
+Add_Chunk(struct disk *d, long offset, u_long size, char *name, chunk_e type,
int subtype, u_long flags)
{
struct chunk *c1,*c2,ct;
@@ -264,7 +264,7 @@ Print_Chunk(struct chunk *c1,int offset)
for(;i<offset;i++) putchar('-');
putchar('>');
for(;i<10;i++) putchar(' ');
- printf("%p %8lu %8lu %8lu %-8s %-8s 0x%02x ",
+ printf("%p %8ld %8lu %8lu %-8s %-8s 0x%02x ",
c1, c1->offset, c1->size, c1->end, c1->name,
chunk_n[c1->type],c1->subtype);
if (c1->flags & CHUNK_ALIGN) putchar('=');
diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c
index 1912fdc..f38a99f 100644
--- a/lib/libdisk/disk.c
+++ b/lib/libdisk/disk.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: disk.c,v 1.16 1995/05/04 07:00:54 phk Exp $
+ * $Id: disk.c,v 1.17 1995/05/06 03:28:29 phk Exp $
*
*/
@@ -53,6 +53,7 @@ Int_Open_Disk(char *name, u_long size)
struct disk *d;
struct dos_partition *dp;
void *p;
+ u_long offset = 0;
strcpy(device,"/dev/r");
strcat(device,name);
@@ -94,8 +95,10 @@ Int_Open_Disk(char *name, u_long size)
if (dp->dp_start+dp->dp_size >= size) continue;
if (!dp->dp_size) continue;
- if (dp->dp_typ == DOSPTYP_ONTRACK)
+ if (dp->dp_typ == DOSPTYP_ONTRACK) {
d->flags |= DISK_ON_TRACK;
+ offset = 63;
+ }
}
free(p);
@@ -109,7 +112,7 @@ Int_Open_Disk(char *name, u_long size)
if (dl.d_ntracks && dl.d_nsectors)
d->bios_cyl = size/(dl.d_ntracks*dl.d_nsectors);
- if (Add_Chunk(d, 0, size, name,whole,0,0))
+ if (Add_Chunk(d, -offset, size, name,whole,0,0))
warn("Failed to add 'whole' chunk");
for(i=BASE_SLICE;i<ds.dss_nslices;i++) {
@@ -119,6 +122,7 @@ Int_Open_Disk(char *name, u_long size)
int subtype=0;
if (! ds.dss_slices[i].ds_size)
continue;
+ ds.dss_slices[i].ds_offset -= offset;
sprintf(sname,"%ss%d",name,i-1);
subtype = ds.dss_slices[i].ds_type;
switch (ds.dss_slices[i].ds_type) {
@@ -126,6 +130,7 @@ Int_Open_Disk(char *name, u_long size)
ce = freebsd;
break;
case 0x1:
+ case 0x6:
case 0x4:
ce = fat;
break;
diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h
index c20454e..728fc24 100644
--- a/lib/libdisk/libdisk.h
+++ b/lib/libdisk/libdisk.h
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: libdisk.h,v 1.12 1995/05/04 07:00:55 phk Exp $
+ * $Id: libdisk.h,v 1.13 1995/05/06 03:28:30 phk Exp $
*
*/
@@ -44,7 +44,7 @@ struct disk {
struct chunk {
struct chunk *next;
struct chunk *part;
- u_long offset;
+ long offset;
u_long size;
u_long end;
char *name;
@@ -206,7 +206,7 @@ Prev_Track_Aligned(struct disk *d, u_long offset);
void Debug_Chunk(struct chunk *);
void Free_Chunk(struct chunk *);
struct chunk * Clone_Chunk(struct chunk *);
-int Add_Chunk(struct disk *, u_long , u_long , char *, chunk_e, int , u_long);
+int Add_Chunk(struct disk *, long , u_long , char *, chunk_e, int , u_long);
void Bios_Limit_Chunk(struct chunk *, u_long);
void * read_block(int, daddr_t );
void write_block(int fd, daddr_t block, void *foo);
diff --git a/lib/libdisk/write_disk.c b/lib/libdisk/write_disk.c
index 669fcdf..9d32ea9 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.7 1995/05/04 07:00:57 phk Exp $
+ * $Id: write_disk.c,v 1.8 1995/05/06 03:28:32 phk Exp $
*
*/
@@ -64,7 +64,6 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
dl->d_partitions[j].p_size = c2->size;
dl->d_partitions[j].p_offset = c2->offset;
dl->d_partitions[j].p_fstype = c2->subtype;
-
}
dl->d_bbsize = BBSIZE;
@@ -84,6 +83,10 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
dl->d_partitions[RAW_PART].p_size = c1->size;
dl->d_partitions[RAW_PART].p_offset = c1->offset;
+ if(new->flags & DISK_ON_TRACK)
+ for(i=0;i<MAXPARTITIONS;i++)
+ if (dl->d_partitions[i].p_size)
+ dl->d_partitions[i].p_offset += 63;
dl->d_magic = DISKMAGIC;
dl->d_magic2 = DISKMAGIC;
dl->d_checksum = dkcksum(dl);
@@ -189,9 +192,17 @@ Write_Disk(struct disk *d1)
else
dp[j].dp_flag = 0;
}
- for(i=0;i<NDOSPART;i++)
+ j = 0;
+ for(i=0;i<NDOSPART;i++) {
if (!s[i])
memset(dp+i,0,sizeof *dp);
+ if (dp[i].dp_flag)
+ j++;
+ }
+ if (!j)
+ for(i=0;i<NDOSPART;i++)
+ if (dp[j].dp_typ == 0xa5)
+ dp[i].dp_flag = 0x80;
mbr = read_block(fd,0);
if (d1->bootmgr)
OpenPOWER on IntegriCloud