General sanitation and cleanup. Killed the "reserved" type, it wasn't.
This commit is contained in:
parent
5d77b2037b
commit
3f92c42b37
@ -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.6 1995/05/03 22:36:49 phk Exp $
|
||||
* $Id: chunk.c,v 1.7 1995/05/05 07:07:43 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -52,30 +52,28 @@ Find_Mother_Chunk(struct chunk *chunks, u_long offset, u_long end, chunk_e type)
|
||||
return c1;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case freebsd:
|
||||
for(c1=chunks->part;c1;c1=c1->next) {
|
||||
if (c1->type == type)
|
||||
if (Chunk_Inside(c1,&ct))
|
||||
return c1;
|
||||
if (c1->type == extended) {
|
||||
for(c2=c1->part;c2;c2=c2->next)
|
||||
if (c2->type == type)
|
||||
if (Chunk_Inside(c2,&ct))
|
||||
return c2;
|
||||
}
|
||||
if (c1->type != extended)
|
||||
continue;
|
||||
for(c2=c1->part;c2;c2=c2->next)
|
||||
if (c2->type == type
|
||||
&& Chunk_Inside(c2,&ct))
|
||||
return c2;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
err(1,"Mumble!");
|
||||
warn("Unsupported mother (0x%x) in Find_Mother_Chunk");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Free_Chunk(struct chunk *c1)
|
||||
{
|
||||
/* XXX remove all chunks which "ref" us */
|
||||
if(!c1) return;
|
||||
if(c1->private && c1->private_free)
|
||||
(*c1->private_free)(c1->private);
|
||||
@ -97,7 +95,7 @@ Clone_Chunk(struct chunk *c1)
|
||||
if (!c2) err(1,"malloc failed");
|
||||
*c2 = *c1;
|
||||
if (c1->private && c1->private_clone)
|
||||
c2->private_clone(c2->private);
|
||||
c2->private = c2->private_clone(c2->private);
|
||||
c2->name = strdup(c2->name);
|
||||
c2->next = Clone_Chunk(c2->next);
|
||||
c2->part = Clone_Chunk(c2->part);
|
||||
@ -109,6 +107,10 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, char *name, chunk_e t
|
||||
{
|
||||
struct chunk *ct,*cs;
|
||||
|
||||
/* We will only insert into empty spaces */
|
||||
if (c2->type != unused)
|
||||
return __LINE__;
|
||||
|
||||
ct = new_chunk();
|
||||
if (!ct) err(1,"malloc failed");
|
||||
memset(ct,0,sizeof *ct);
|
||||
@ -120,6 +122,11 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, char *name, chunk_e t
|
||||
ct->subtype = subtype;
|
||||
ct->flags = flags;
|
||||
|
||||
if (!Chunk_Inside(c2,ct)) {
|
||||
Free_Chunk(ct);
|
||||
return __LINE__;
|
||||
}
|
||||
|
||||
if(type==freebsd || type==extended) {
|
||||
cs = new_chunk();
|
||||
if (!cs) err(1,"malloc failed");
|
||||
@ -129,47 +136,42 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, char *name, chunk_e t
|
||||
cs->end = offset + size - 1;
|
||||
cs->type = unused;
|
||||
cs->name = strdup("-");
|
||||
cs->next = 0;
|
||||
cs->part = 0;
|
||||
ct->part = cs;
|
||||
}
|
||||
|
||||
if (c2->type != unused)
|
||||
return __LINE__;
|
||||
if (Chunk_Inside(c2,ct)) {
|
||||
if (c2->end > ct->end) {
|
||||
cs = new_chunk();
|
||||
if (!cs) err(1,"malloc failed");
|
||||
*cs = *c2;
|
||||
cs->offset = ct->end + 1;
|
||||
cs->size = c2->end - ct->end;
|
||||
if(c2->name)
|
||||
cs->name = strdup(c2->name);
|
||||
c2->next = cs;
|
||||
c2->size -= c2->end - ct->end;
|
||||
c2->end = ct->end;
|
||||
}
|
||||
if (c2->offset == ct->offset) {
|
||||
c2->name = ct->name;
|
||||
c2->type = ct->type;
|
||||
c2->part = ct->part;
|
||||
c2->subtype = ct->subtype;
|
||||
c2->flags = ct->flags;
|
||||
ct->name = 0;
|
||||
ct->part = 0;
|
||||
Free_Chunk(ct);
|
||||
return 0;
|
||||
}
|
||||
c2->end = ct->offset - 1;
|
||||
c2->size -= ct->size;
|
||||
ct->next = c2->next;
|
||||
c2->next = ct;
|
||||
/* Make a new chunk for any trailing unused space */
|
||||
if (c2->end > ct->end) {
|
||||
cs = new_chunk();
|
||||
if (!cs) err(1,"malloc failed");
|
||||
*cs = *c2;
|
||||
cs->offset = ct->end + 1;
|
||||
cs->size = c2->end - ct->end;
|
||||
if(c2->name)
|
||||
cs->name = strdup(c2->name);
|
||||
c2->next = cs;
|
||||
c2->size -= c2->end - ct->end;
|
||||
c2->end = ct->end;
|
||||
}
|
||||
/* If no leading unused space just occupy the old chunk */
|
||||
if (c2->offset == ct->offset) {
|
||||
c2->name = ct->name;
|
||||
c2->type = ct->type;
|
||||
c2->part = ct->part;
|
||||
c2->subtype = ct->subtype;
|
||||
c2->flags = ct->flags;
|
||||
ct->name = 0;
|
||||
ct->part = 0;
|
||||
Free_Chunk(ct);
|
||||
return 0;
|
||||
}
|
||||
return __LINE__;
|
||||
/* else insert new chunk and adjust old one */
|
||||
c2->end = ct->offset - 1;
|
||||
c2->size -= ct->size;
|
||||
ct->next = c2->next;
|
||||
c2->next = ct;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Add_Chunk(struct disk *d, u_long offset, u_long size, char *name, chunk_e type,
|
||||
int subtype, u_long flags)
|
||||
@ -207,10 +209,6 @@ Add_Chunk(struct disk *d, u_long offset, u_long size, char *name, chunk_e type,
|
||||
c1 = Find_Mother_Chunk(d->chunks,offset,end,whole);
|
||||
if(!c1 && type == part)
|
||||
c1 = Find_Mother_Chunk(d->chunks,offset,end,freebsd);
|
||||
if(!c1 && type == reserved)
|
||||
c1 = Find_Mother_Chunk(d->chunks,offset,end,extended);
|
||||
if(!c1 && type == reserved)
|
||||
c1 = Find_Mother_Chunk(d->chunks,offset,end,whole);
|
||||
if(!c1)
|
||||
return __LINE__;
|
||||
for(c2=c1->part;c2;c2=c2->next) {
|
||||
@ -262,11 +260,19 @@ Print_Chunk(struct chunk *c1,int offset)
|
||||
{
|
||||
int i;
|
||||
if(!c1) return;
|
||||
for(i=0;i<offset;i++) putchar('>');
|
||||
for(i=0;i<offset-2;i++) putchar(' ');
|
||||
for(;i<offset;i++) putchar('-');
|
||||
putchar('>');
|
||||
for(;i<10;i++) putchar(' ');
|
||||
printf("%p %10lu %10lu %10lu %-8s %d %-8s %d %lx\n",
|
||||
printf("%p %8lu %8lu %8lu %-8s %-8s 0x%02x ",
|
||||
c1, c1->offset, c1->size, c1->end, c1->name,
|
||||
c1->type, chunk_n[c1->type],c1->subtype,c1->flags);
|
||||
chunk_n[c1->type],c1->subtype);
|
||||
if (c1->flags & CHUNK_ALIGN) putchar('=');
|
||||
if (c1->flags & CHUNK_PAST_1024) putchar('>');
|
||||
if (c1->flags & CHUNK_IS_ROOT) putchar('R');
|
||||
if (c1->flags & CHUNK_BAD144) putchar('B');
|
||||
if (c1->flags & CHUNK_BSD_COMPAT) putchar('C');
|
||||
putchar('\n');
|
||||
Print_Chunk(c1->part,offset + 2);
|
||||
Print_Chunk(c1->next,offset);
|
||||
}
|
||||
|
@ -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.8 1995/05/03 22:36:50 phk Exp $
|
||||
* $Id: create_chunk.c,v 1.9 1995/05/04 07:00:53 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -40,7 +40,6 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c)
|
||||
/* Allocate the first swap-partition we find */
|
||||
for (c1 = c->part; c1 ; c1 = c1->next) {
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (c1->subtype != FS_SWAP) continue;
|
||||
sprintf(c1->name,"%s%c",c->name,SWAP_PART+'a');
|
||||
break;
|
||||
@ -49,7 +48,6 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c)
|
||||
/* Allocate the first root-partition we find */
|
||||
for (c1 = c->part; c1 ; c1 = c1->next) {
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (!(c1->flags & CHUNK_IS_ROOT)) continue;
|
||||
sprintf(c1->name,"%s%c",c->name,0+'a');
|
||||
break;
|
||||
@ -70,7 +68,6 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c)
|
||||
for (c1 = c->part; c1 ; c1 = c1->next) {
|
||||
const char order[] = "efghabd";
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (strcmp("X",c1->name)) continue;
|
||||
|
||||
for(j=0;j<strlen(order);j++) {
|
||||
@ -101,7 +98,6 @@ Fixup_Extended_Names(struct disk *d, struct chunk *c)
|
||||
if (c1->type == freebsd)
|
||||
Fixup_FreeBSD_Names(d,c1);
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (strcmp(c1->name, "X")) continue;
|
||||
for(j=5;j<=29;j++) {
|
||||
p = malloc(12);
|
||||
@ -137,8 +133,6 @@ Fixup_Names(struct disk *d)
|
||||
Fixup_Extended_Names(d,c2);
|
||||
if (c2->type == unused)
|
||||
continue;
|
||||
if (c2->type == reserved)
|
||||
continue;
|
||||
p = malloc(12);
|
||||
if(!p) err(1,"malloc failed");
|
||||
for(j=1;j<=NDOSPART;j++) {
|
||||
|
@ -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.15 1995/05/03 22:36:51 phk Exp $
|
||||
* $Id: disk.c,v 1.16 1995/05/04 07:00:54 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -34,7 +34,6 @@ char *chunk_n[] = {
|
||||
"extended",
|
||||
"part",
|
||||
"unused",
|
||||
"reserved",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -6,14 +6,22 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: libdisk.h,v 1.11 1995/05/03 22:36:52 phk Exp $
|
||||
* $Id: libdisk.h,v 1.12 1995/05/04 07:00:55 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#define MAX_NO_DISKS 20
|
||||
/* Max # of disks Disk_Names() will return */
|
||||
|
||||
typedef enum {whole, unknown, fat, freebsd, extended, part, unused, reserved} chunk_e;
|
||||
typedef enum {
|
||||
whole,
|
||||
unknown,
|
||||
fat,
|
||||
freebsd,
|
||||
extended,
|
||||
part,
|
||||
unused,
|
||||
} chunk_e;
|
||||
|
||||
extern char *chunk_n[];
|
||||
|
||||
@ -240,8 +248,7 @@ void Fixup_Names(struct disk *);
|
||||
* >>>>>> 0x3d1c0 172032 409600 581631 wd0s1e 5 part 0 0
|
||||
* >>>>>> 0x3d200 581632 378488 960119 wd0s1f 5 part 0 0
|
||||
* >>>> 0x3d140 960120 5670 965789 wd0s2 4 extended 0 8
|
||||
* >>>>>> 0x3d240 960120 1 960120 - 7 reserved 0 8
|
||||
* >>>>>> 0x3d2c0 960121 62 960182 - 6 unused 0 0
|
||||
* >>>>>> 0x3d2c0 960120 63 960182 - 6 unused 0 0
|
||||
* >>>>>> 0x3d0c0 960183 5607 965789 wd0s5 2 fat 0 8
|
||||
* >>>> 0x3d280 965790 1890 967679 wd0s3 1 foo -2 8
|
||||
* >>>> 0x3d300 967680 443520 1411199 wd0s4 3 freebsd 0 8
|
||||
@ -269,10 +276,7 @@ void Fixup_Names(struct disk *);
|
||||
* | <wd0s1f>
|
||||
* |
|
||||
* v
|
||||
* <wd0s2> --> <reserved>
|
||||
* | |
|
||||
* | v
|
||||
* | <unused>
|
||||
* <wd0s2> --> <unused>
|
||||
* | |
|
||||
* | v
|
||||
* | <wd0s5>
|
||||
|
@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: rules.c,v 1.6 1995/05/04 07:00:56 phk Exp $
|
||||
* $Id: rules.c,v 1.7 1995/05/05 07:07:45 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -87,7 +87,6 @@ Rule_000(struct disk *d, struct chunk *c, char *msg)
|
||||
return;
|
||||
for (c1=c->part; c1; c1=c1->next) {
|
||||
if (c1->type != unused) continue;
|
||||
if (c1->type != reserved) continue;
|
||||
if (c1->flags & CHUNK_ACTIVE)
|
||||
j++;
|
||||
i++;
|
||||
@ -115,10 +114,7 @@ Rule_001(struct disk *d, struct chunk *c, char *msg)
|
||||
if (c->type != whole && c->type != extended)
|
||||
return;
|
||||
for (i=0, c1=c->part; c1; c1=c1->next) {
|
||||
if (c1->type == reserved)
|
||||
continue;
|
||||
if (c1->type == unused)
|
||||
continue;
|
||||
if (c1->type == unused) continue;
|
||||
c1->flags |= CHUNK_ALIGN;
|
||||
if (!Track_Aligned(d,c1->offset))
|
||||
sprintf(msg+strlen(msg),
|
||||
|
@ -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.6 1995/05/01 04:05:27 phk Exp $
|
||||
* $Id: write_disk.c,v 1.7 1995/05/04 07:00:57 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -55,7 +55,6 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
|
||||
|
||||
for(c2=c1->part;c2;c2=c2->next) {
|
||||
if (c2->type == unused) continue;
|
||||
if (c2->type == reserved) continue;
|
||||
if (!strcmp(c2->name,"X")) continue;
|
||||
j = c2->name[5] - 'a';
|
||||
if (j < 0 || j >= MAXPARTITIONS || j == RAW_PART) {
|
||||
@ -132,7 +131,6 @@ Write_Disk(struct disk *d1)
|
||||
free(mbr);
|
||||
for (c1=d1->chunks->part; c1 ; c1 = c1->next) {
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (!strcmp(c1->name,"X")) continue;
|
||||
j = c1->name[4] - '1';
|
||||
if (j < 0 || j > 3)
|
||||
|
@ -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.6 1995/05/03 22:36:49 phk Exp $
|
||||
* $Id: chunk.c,v 1.7 1995/05/05 07:07:43 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -52,30 +52,28 @@ Find_Mother_Chunk(struct chunk *chunks, u_long offset, u_long end, chunk_e type)
|
||||
return c1;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case freebsd:
|
||||
for(c1=chunks->part;c1;c1=c1->next) {
|
||||
if (c1->type == type)
|
||||
if (Chunk_Inside(c1,&ct))
|
||||
return c1;
|
||||
if (c1->type == extended) {
|
||||
for(c2=c1->part;c2;c2=c2->next)
|
||||
if (c2->type == type)
|
||||
if (Chunk_Inside(c2,&ct))
|
||||
return c2;
|
||||
}
|
||||
if (c1->type != extended)
|
||||
continue;
|
||||
for(c2=c1->part;c2;c2=c2->next)
|
||||
if (c2->type == type
|
||||
&& Chunk_Inside(c2,&ct))
|
||||
return c2;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
err(1,"Mumble!");
|
||||
warn("Unsupported mother (0x%x) in Find_Mother_Chunk");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Free_Chunk(struct chunk *c1)
|
||||
{
|
||||
/* XXX remove all chunks which "ref" us */
|
||||
if(!c1) return;
|
||||
if(c1->private && c1->private_free)
|
||||
(*c1->private_free)(c1->private);
|
||||
@ -97,7 +95,7 @@ Clone_Chunk(struct chunk *c1)
|
||||
if (!c2) err(1,"malloc failed");
|
||||
*c2 = *c1;
|
||||
if (c1->private && c1->private_clone)
|
||||
c2->private_clone(c2->private);
|
||||
c2->private = c2->private_clone(c2->private);
|
||||
c2->name = strdup(c2->name);
|
||||
c2->next = Clone_Chunk(c2->next);
|
||||
c2->part = Clone_Chunk(c2->part);
|
||||
@ -109,6 +107,10 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, char *name, chunk_e t
|
||||
{
|
||||
struct chunk *ct,*cs;
|
||||
|
||||
/* We will only insert into empty spaces */
|
||||
if (c2->type != unused)
|
||||
return __LINE__;
|
||||
|
||||
ct = new_chunk();
|
||||
if (!ct) err(1,"malloc failed");
|
||||
memset(ct,0,sizeof *ct);
|
||||
@ -120,6 +122,11 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, char *name, chunk_e t
|
||||
ct->subtype = subtype;
|
||||
ct->flags = flags;
|
||||
|
||||
if (!Chunk_Inside(c2,ct)) {
|
||||
Free_Chunk(ct);
|
||||
return __LINE__;
|
||||
}
|
||||
|
||||
if(type==freebsd || type==extended) {
|
||||
cs = new_chunk();
|
||||
if (!cs) err(1,"malloc failed");
|
||||
@ -129,47 +136,42 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, char *name, chunk_e t
|
||||
cs->end = offset + size - 1;
|
||||
cs->type = unused;
|
||||
cs->name = strdup("-");
|
||||
cs->next = 0;
|
||||
cs->part = 0;
|
||||
ct->part = cs;
|
||||
}
|
||||
|
||||
if (c2->type != unused)
|
||||
return __LINE__;
|
||||
if (Chunk_Inside(c2,ct)) {
|
||||
if (c2->end > ct->end) {
|
||||
cs = new_chunk();
|
||||
if (!cs) err(1,"malloc failed");
|
||||
*cs = *c2;
|
||||
cs->offset = ct->end + 1;
|
||||
cs->size = c2->end - ct->end;
|
||||
if(c2->name)
|
||||
cs->name = strdup(c2->name);
|
||||
c2->next = cs;
|
||||
c2->size -= c2->end - ct->end;
|
||||
c2->end = ct->end;
|
||||
}
|
||||
if (c2->offset == ct->offset) {
|
||||
c2->name = ct->name;
|
||||
c2->type = ct->type;
|
||||
c2->part = ct->part;
|
||||
c2->subtype = ct->subtype;
|
||||
c2->flags = ct->flags;
|
||||
ct->name = 0;
|
||||
ct->part = 0;
|
||||
Free_Chunk(ct);
|
||||
return 0;
|
||||
}
|
||||
c2->end = ct->offset - 1;
|
||||
c2->size -= ct->size;
|
||||
ct->next = c2->next;
|
||||
c2->next = ct;
|
||||
/* Make a new chunk for any trailing unused space */
|
||||
if (c2->end > ct->end) {
|
||||
cs = new_chunk();
|
||||
if (!cs) err(1,"malloc failed");
|
||||
*cs = *c2;
|
||||
cs->offset = ct->end + 1;
|
||||
cs->size = c2->end - ct->end;
|
||||
if(c2->name)
|
||||
cs->name = strdup(c2->name);
|
||||
c2->next = cs;
|
||||
c2->size -= c2->end - ct->end;
|
||||
c2->end = ct->end;
|
||||
}
|
||||
/* If no leading unused space just occupy the old chunk */
|
||||
if (c2->offset == ct->offset) {
|
||||
c2->name = ct->name;
|
||||
c2->type = ct->type;
|
||||
c2->part = ct->part;
|
||||
c2->subtype = ct->subtype;
|
||||
c2->flags = ct->flags;
|
||||
ct->name = 0;
|
||||
ct->part = 0;
|
||||
Free_Chunk(ct);
|
||||
return 0;
|
||||
}
|
||||
return __LINE__;
|
||||
/* else insert new chunk and adjust old one */
|
||||
c2->end = ct->offset - 1;
|
||||
c2->size -= ct->size;
|
||||
ct->next = c2->next;
|
||||
c2->next = ct;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Add_Chunk(struct disk *d, u_long offset, u_long size, char *name, chunk_e type,
|
||||
int subtype, u_long flags)
|
||||
@ -207,10 +209,6 @@ Add_Chunk(struct disk *d, u_long offset, u_long size, char *name, chunk_e type,
|
||||
c1 = Find_Mother_Chunk(d->chunks,offset,end,whole);
|
||||
if(!c1 && type == part)
|
||||
c1 = Find_Mother_Chunk(d->chunks,offset,end,freebsd);
|
||||
if(!c1 && type == reserved)
|
||||
c1 = Find_Mother_Chunk(d->chunks,offset,end,extended);
|
||||
if(!c1 && type == reserved)
|
||||
c1 = Find_Mother_Chunk(d->chunks,offset,end,whole);
|
||||
if(!c1)
|
||||
return __LINE__;
|
||||
for(c2=c1->part;c2;c2=c2->next) {
|
||||
@ -262,11 +260,19 @@ Print_Chunk(struct chunk *c1,int offset)
|
||||
{
|
||||
int i;
|
||||
if(!c1) return;
|
||||
for(i=0;i<offset;i++) putchar('>');
|
||||
for(i=0;i<offset-2;i++) putchar(' ');
|
||||
for(;i<offset;i++) putchar('-');
|
||||
putchar('>');
|
||||
for(;i<10;i++) putchar(' ');
|
||||
printf("%p %10lu %10lu %10lu %-8s %d %-8s %d %lx\n",
|
||||
printf("%p %8lu %8lu %8lu %-8s %-8s 0x%02x ",
|
||||
c1, c1->offset, c1->size, c1->end, c1->name,
|
||||
c1->type, chunk_n[c1->type],c1->subtype,c1->flags);
|
||||
chunk_n[c1->type],c1->subtype);
|
||||
if (c1->flags & CHUNK_ALIGN) putchar('=');
|
||||
if (c1->flags & CHUNK_PAST_1024) putchar('>');
|
||||
if (c1->flags & CHUNK_IS_ROOT) putchar('R');
|
||||
if (c1->flags & CHUNK_BAD144) putchar('B');
|
||||
if (c1->flags & CHUNK_BSD_COMPAT) putchar('C');
|
||||
putchar('\n');
|
||||
Print_Chunk(c1->part,offset + 2);
|
||||
Print_Chunk(c1->next,offset);
|
||||
}
|
||||
|
@ -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.8 1995/05/03 22:36:50 phk Exp $
|
||||
* $Id: create_chunk.c,v 1.9 1995/05/04 07:00:53 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -40,7 +40,6 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c)
|
||||
/* Allocate the first swap-partition we find */
|
||||
for (c1 = c->part; c1 ; c1 = c1->next) {
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (c1->subtype != FS_SWAP) continue;
|
||||
sprintf(c1->name,"%s%c",c->name,SWAP_PART+'a');
|
||||
break;
|
||||
@ -49,7 +48,6 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c)
|
||||
/* Allocate the first root-partition we find */
|
||||
for (c1 = c->part; c1 ; c1 = c1->next) {
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (!(c1->flags & CHUNK_IS_ROOT)) continue;
|
||||
sprintf(c1->name,"%s%c",c->name,0+'a');
|
||||
break;
|
||||
@ -70,7 +68,6 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c)
|
||||
for (c1 = c->part; c1 ; c1 = c1->next) {
|
||||
const char order[] = "efghabd";
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (strcmp("X",c1->name)) continue;
|
||||
|
||||
for(j=0;j<strlen(order);j++) {
|
||||
@ -101,7 +98,6 @@ Fixup_Extended_Names(struct disk *d, struct chunk *c)
|
||||
if (c1->type == freebsd)
|
||||
Fixup_FreeBSD_Names(d,c1);
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (strcmp(c1->name, "X")) continue;
|
||||
for(j=5;j<=29;j++) {
|
||||
p = malloc(12);
|
||||
@ -137,8 +133,6 @@ Fixup_Names(struct disk *d)
|
||||
Fixup_Extended_Names(d,c2);
|
||||
if (c2->type == unused)
|
||||
continue;
|
||||
if (c2->type == reserved)
|
||||
continue;
|
||||
p = malloc(12);
|
||||
if(!p) err(1,"malloc failed");
|
||||
for(j=1;j<=NDOSPART;j++) {
|
||||
|
@ -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.15 1995/05/03 22:36:51 phk Exp $
|
||||
* $Id: disk.c,v 1.16 1995/05/04 07:00:54 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -34,7 +34,6 @@ char *chunk_n[] = {
|
||||
"extended",
|
||||
"part",
|
||||
"unused",
|
||||
"reserved",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -6,14 +6,22 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: libdisk.h,v 1.11 1995/05/03 22:36:52 phk Exp $
|
||||
* $Id: libdisk.h,v 1.12 1995/05/04 07:00:55 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#define MAX_NO_DISKS 20
|
||||
/* Max # of disks Disk_Names() will return */
|
||||
|
||||
typedef enum {whole, unknown, fat, freebsd, extended, part, unused, reserved} chunk_e;
|
||||
typedef enum {
|
||||
whole,
|
||||
unknown,
|
||||
fat,
|
||||
freebsd,
|
||||
extended,
|
||||
part,
|
||||
unused,
|
||||
} chunk_e;
|
||||
|
||||
extern char *chunk_n[];
|
||||
|
||||
@ -240,8 +248,7 @@ void Fixup_Names(struct disk *);
|
||||
* >>>>>> 0x3d1c0 172032 409600 581631 wd0s1e 5 part 0 0
|
||||
* >>>>>> 0x3d200 581632 378488 960119 wd0s1f 5 part 0 0
|
||||
* >>>> 0x3d140 960120 5670 965789 wd0s2 4 extended 0 8
|
||||
* >>>>>> 0x3d240 960120 1 960120 - 7 reserved 0 8
|
||||
* >>>>>> 0x3d2c0 960121 62 960182 - 6 unused 0 0
|
||||
* >>>>>> 0x3d2c0 960120 63 960182 - 6 unused 0 0
|
||||
* >>>>>> 0x3d0c0 960183 5607 965789 wd0s5 2 fat 0 8
|
||||
* >>>> 0x3d280 965790 1890 967679 wd0s3 1 foo -2 8
|
||||
* >>>> 0x3d300 967680 443520 1411199 wd0s4 3 freebsd 0 8
|
||||
@ -269,10 +276,7 @@ void Fixup_Names(struct disk *);
|
||||
* | <wd0s1f>
|
||||
* |
|
||||
* v
|
||||
* <wd0s2> --> <reserved>
|
||||
* | |
|
||||
* | v
|
||||
* | <unused>
|
||||
* <wd0s2> --> <unused>
|
||||
* | |
|
||||
* | v
|
||||
* | <wd0s5>
|
||||
|
@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: rules.c,v 1.6 1995/05/04 07:00:56 phk Exp $
|
||||
* $Id: rules.c,v 1.7 1995/05/05 07:07:45 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -87,7 +87,6 @@ Rule_000(struct disk *d, struct chunk *c, char *msg)
|
||||
return;
|
||||
for (c1=c->part; c1; c1=c1->next) {
|
||||
if (c1->type != unused) continue;
|
||||
if (c1->type != reserved) continue;
|
||||
if (c1->flags & CHUNK_ACTIVE)
|
||||
j++;
|
||||
i++;
|
||||
@ -115,10 +114,7 @@ Rule_001(struct disk *d, struct chunk *c, char *msg)
|
||||
if (c->type != whole && c->type != extended)
|
||||
return;
|
||||
for (i=0, c1=c->part; c1; c1=c1->next) {
|
||||
if (c1->type == reserved)
|
||||
continue;
|
||||
if (c1->type == unused)
|
||||
continue;
|
||||
if (c1->type == unused) continue;
|
||||
c1->flags |= CHUNK_ALIGN;
|
||||
if (!Track_Aligned(d,c1->offset))
|
||||
sprintf(msg+strlen(msg),
|
||||
|
@ -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.6 1995/05/01 04:05:27 phk Exp $
|
||||
* $Id: write_disk.c,v 1.7 1995/05/04 07:00:57 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -55,7 +55,6 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
|
||||
|
||||
for(c2=c1->part;c2;c2=c2->next) {
|
||||
if (c2->type == unused) continue;
|
||||
if (c2->type == reserved) continue;
|
||||
if (!strcmp(c2->name,"X")) continue;
|
||||
j = c2->name[5] - 'a';
|
||||
if (j < 0 || j >= MAXPARTITIONS || j == RAW_PART) {
|
||||
@ -132,7 +131,6 @@ Write_Disk(struct disk *d1)
|
||||
free(mbr);
|
||||
for (c1=d1->chunks->part; c1 ; c1 = c1->next) {
|
||||
if (c1->type == unused) continue;
|
||||
if (c1->type == reserved) continue;
|
||||
if (!strcmp(c1->name,"X")) continue;
|
||||
j = c1->name[4] - '1';
|
||||
if (j < 0 || j > 3)
|
||||
|
Loading…
Reference in New Issue
Block a user