Make sure that an unlabeled device gets at least RAW_PART
in the default in-core disklabel, instead of only a single partition, so that applying a new disklabel can work normally. bcopy() -> memcpy(), bzero() -> memset()
This commit is contained in:
parent
da1e437744
commit
66e0981854
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: disksubr.c,v 1.1 2001/06/14 13:08:11 fredette Exp $ */
|
||||
/* $NetBSD: disksubr.c,v 1.2 2001/11/30 16:11:10 fredette Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Gordon W. Ross
|
||||
@ -87,7 +87,7 @@ readdisklabel(dev, strat, lp, clp)
|
||||
/* minimal requirements for archtypal disk label */
|
||||
if (lp->d_secperunit == 0)
|
||||
lp->d_secperunit = 0x1fffffff;
|
||||
lp->d_npartitions = 1;
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
if (lp->d_partitions[0].p_size == 0)
|
||||
lp->d_partitions[0].p_size = 0x1fffffff;
|
||||
lp->d_partitions[0].p_offset = 0;
|
||||
@ -107,7 +107,7 @@ readdisklabel(dev, strat, lp, clp)
|
||||
error = biowait(bp);
|
||||
if (!error) {
|
||||
/* Save the whole block in case it has info we need. */
|
||||
bcopy(bp->b_data, clp->cd_block, sizeof(clp->cd_block));
|
||||
memcpy(clp->cd_block, bp->b_data, sizeof(clp->cd_block));
|
||||
}
|
||||
brelse(bp);
|
||||
if (error)
|
||||
@ -145,7 +145,7 @@ readdisklabel(dev, strat, lp, clp)
|
||||
}
|
||||
#endif
|
||||
|
||||
bzero(clp->cd_block, sizeof(clp->cd_block));
|
||||
memset(clp->cd_block, 0, sizeof(clp->cd_block));
|
||||
return("no disk label");
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ writedisklabel(dev, strat, lp, clp)
|
||||
|
||||
/* Get a buffer and copy the new label into it. */
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bcopy(clp->cd_block, bp->b_data, sizeof(clp->cd_block));
|
||||
memcpy(bp->b_data, clp->cd_block, sizeof(clp->cd_block));
|
||||
|
||||
/* Write out the updated label. */
|
||||
bp->b_dev = dev;
|
||||
|
Loading…
Reference in New Issue
Block a user