readdisklabel(): fabricate sane default disklabel in case there isn't
any on the disk Implemented by Christian Limpach, sent in port-next68k/16929.
This commit is contained in:
parent
f02ecb7d7a
commit
9caf54f80a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: disksubr.c,v 1.7 2002/03/05 09:40:41 simonb Exp $ */
|
||||
/* $NetBSD: disksubr.c,v 1.8 2002/05/20 20:49:16 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988, 1993
|
||||
|
@ -67,13 +67,21 @@ readdisklabel(dev, strat, lp, osdep)
|
|||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
char *msg = NULL;
|
||||
int i;
|
||||
|
||||
/* minimal requirements for archtypal disk label */
|
||||
if (lp->d_secsize == 0)
|
||||
lp->d_secsize = DEV_BSIZE;
|
||||
if (lp->d_secperunit == 0)
|
||||
lp->d_secperunit = 0x1fffffff;
|
||||
lp->d_npartitions = 1;
|
||||
if (lp->d_partitions[0].p_size == 0)
|
||||
lp->d_partitions[0].p_size = 0x1fffffff;
|
||||
lp->d_partitions[0].p_offset = 0;
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
for (i = 0; i < RAW_PART; i++) {
|
||||
lp->d_partitions[i].p_size = 0;
|
||||
lp->d_partitions[i].p_offset = 0;
|
||||
}
|
||||
if (lp->d_partitions[i].p_size == 0)
|
||||
lp->d_partitions[i].p_size = 0x1fffffff;
|
||||
lp->d_partitions[i].p_offset = 0;
|
||||
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dev;
|
||||
|
|
Loading…
Reference in New Issue