diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2017-10-29 09:44:17 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2017-10-29 09:44:17 +0000 |
| commit | 631f17edc8aeb12916a6969e56a131cb1d0f28b1 (patch) | |
| tree | dd2f58f4a8d5c786ef11823c6085ae6c43d98ab9 /sys/dev | |
| parent | d467c630c86cabb38e49a7dbe0e925d416bddf34 (diff) | |
Use driver specific label code as fallback. This fixes the UDF label for CDs.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/dksubr.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sys/dev/dksubr.c b/sys/dev/dksubr.c index 29bd9038f2c..57269548aa6 100644 --- a/sys/dev/dksubr.c +++ b/sys/dev/dksubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: dksubr.c,v 1.99 2017/08/24 11:26:32 maya Exp $ */ +/* $NetBSD: dksubr.c,v 1.100 2017/10/29 09:44:17 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.99 2017/08/24 11:26:32 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.100 2017/10/29 09:44:17 mlelstv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -931,14 +931,28 @@ dk_getdisklabel(struct dk_softc *dksc, dev_t dev) } } +/* + * Heuristic to conjure a disklabel if reading a disklabel failed. + * + * This is to allow the raw partition to be used for a filesystem + * without caring about the write protected label sector. + * + * If the driver provides it's own callback, use that instead. + */ /* ARGSUSED */ static void dk_makedisklabel(struct dk_softc *dksc) { - struct disklabel *lp = dksc->sc_dkdev.dk_label; + const struct dkdriver *dkd = dksc->sc_dkdev.dk_driver; + struct disklabel *lp = dksc->sc_dkdev.dk_label; - lp->d_partitions[RAW_PART].p_fstype = FS_BSDFFS; strlcpy(lp->d_packname, "default label", sizeof(lp->d_packname)); + + if (dkd->d_label) + dkd->d_label(dksc->sc_dev, lp); + else + lp->d_partitions[RAW_PART].p_fstype = FS_BSDFFS; + lp->d_checksum = dkcksum(lp); } |
