/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
*
- * @(#)ufs_disksubr.c 7.11 (Berkeley) %G%
+ * %sccs.include.redist.c%
+ *
+ * @(#)ufs_disksubr.c 7.14 (Berkeley) %G%
*/
#include "param.h"
#include "buf.h"
#include "disklabel.h"
#include "syslog.h"
-
-#include "dir.h"
#include "user.h"
/*
bp->b_flags = B_BUSY | B_READ;
bp->b_cylin = LABELSECTOR / lp->d_secpercyl;
(*strat)(bp);
- biowait(bp);
- if (bp->b_flags & B_ERROR) {
- u.u_error = 0; /* XXX */
+ if (biowait(bp)) {
msg = "I/O error";
} else for (dlp = (struct disklabel *)bp->b_un.b_addr;
dlp <= (struct disklabel *)(bp->b_un.b_addr+DEV_BSIZE-sizeof(*dlp));
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
if (msg == NULL)
msg = "no disk label";
- } else if (dkcksum(dlp) != 0)
+ } else if (dlp->d_npartitions > MAXPARTITIONS ||
+ dkcksum(dlp) != 0)
msg = "disk label corrupted";
else {
*lp = *dlp;
break;
}
}
- if (lp->d_npartitions > MAXPARTITIONS)
- lp->d_npartitions = MAXPARTITIONS;
bp->b_flags = B_INVAL | B_AGE;
brelse(bp);
return (msg);
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_READ;
(*strat)(bp);
- biowait(bp);
- if (bp->b_flags & B_ERROR) {
- error = u.u_error; /* XXX */
- u.u_error = 0;
+ if (error = biowait(bp))
goto done;
- }
for (dlp = (struct disklabel *)bp->b_un.b_addr;
dlp <= (struct disklabel *)
(bp->b_un.b_addr + lp->d_secsize - sizeof(*dlp));
*dlp = *lp;
bp->b_flags = B_WRITE;
(*strat)(bp);
- biowait(bp);
- if (bp->b_flags & B_ERROR) {
- error = u.u_error; /* XXX */
- u.u_error = 0;
- }
+ error = biowait(bp);
goto done;
}
}