Pull up following revision(s) (requested by tsutsui in ticket #1139): sys/arch/sun3/dev/fd.c: revision 1.78 sys/arch/sparc/dev/fd.c: revision 1.155 sys/arch/sparc64/dev/fdc.c: revision 1.42 Fix panic() on opening fd(4), caused by a wrong pointer passed to memset(). I'm not sure why this 18 year old bug didn't cause problem before (at least my old 5.99.23 kernel worked), but probably it's triggered by new gcc 4.8 which might do more aggressive memory allocation. The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4). Should be pulled up to netbsd-7. Sync with sparc/dev/fd.c:1.155. Fix panic() on opening fd(4), caused by a wrong pointer passed to memset(). I'm not sure why this 18 year old bug didn't cause problem before (at least my old 5.99.23 kernel worked), but probably it's triggered by new gcc 4.8 which might do more aggressive memory allocation. The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4). Should be pulled up to netbsd-7. Sync with sparc/dev/fd.c rev 1.155. Fix panic() on opening fd(4), caused by a wrong pointer passed to memset(). Note sun3 still uses gcc 4.5.4 but also panicked by this old bug, so probably this problem was triggered by not gcc 4.8 but struct disk changes (struct disk_geom was added in <sys/disk.h> rev 1.58), which increased sizeof(struct fd_softc) from 248 bytes to 296 bytes. (i.e. now struct fd_softc could be allocated in a different pool block, probably near the wrong pointer of the struct disklabel) Anyway, this fix should be pullued up to netbsd-7. (probably I'm the only user of floppy on sun3 though)diff -r1.150 -r1.150.14.1 src/sys/arch/sparc/dev/fd.c
(msaitoh)
--- src/sys/arch/sparc/dev/fd.c 2011/07/17 23:18:23 1.150
+++ src/sys/arch/sparc/dev/fd.c 2014/11/03 16:47:29 1.150.14.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: fd.c,v 1.150 2011/07/17 23:18:23 mrg Exp $ */ | 1 | /* $NetBSD: fd.c,v 1.150.14.1 2014/11/03 16:47:29 msaitoh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Paul Kranenburg. | 8 | * by Paul Kranenburg. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -91,27 +91,27 @@ | @@ -91,27 +91,27 @@ | |||
91 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 91 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
92 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 92 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
93 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 93 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
94 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 94 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
95 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 95 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
96 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 96 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
97 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 97 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
98 | * SUCH DAMAGE. | 98 | * SUCH DAMAGE. | |
99 | * | 99 | * | |
100 | * @(#)fd.c 7.4 (Berkeley) 5/25/91 | 100 | * @(#)fd.c 7.4 (Berkeley) 5/25/91 | |
101 | */ | 101 | */ | |
102 | 102 | |||
103 | #include <sys/cdefs.h> | 103 | #include <sys/cdefs.h> | |
104 | __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.150 2011/07/17 23:18:23 mrg Exp $"); | 104 | __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.150.14.1 2014/11/03 16:47:29 msaitoh Exp $"); | |
105 | 105 | |||
106 | #include "opt_ddb.h" | 106 | #include "opt_ddb.h" | |
107 | #include "opt_md.h" | 107 | #include "opt_md.h" | |
108 | 108 | |||
109 | #include <sys/param.h> | 109 | #include <sys/param.h> | |
110 | #include <sys/systm.h> | 110 | #include <sys/systm.h> | |
111 | #include <sys/callout.h> | 111 | #include <sys/callout.h> | |
112 | #include <sys/kernel.h> | 112 | #include <sys/kernel.h> | |
113 | #include <sys/file.h> | 113 | #include <sys/file.h> | |
114 | #include <sys/ioctl.h> | 114 | #include <sys/ioctl.h> | |
115 | #include <sys/device.h> | 115 | #include <sys/device.h> | |
116 | #include <sys/disklabel.h> | 116 | #include <sys/disklabel.h> | |
117 | #include <sys/disk.h> | 117 | #include <sys/disk.h> | |
@@ -2217,27 +2217,27 @@ fdformat(dev_t dev, struct ne7_fd_formb | @@ -2217,27 +2217,27 @@ fdformat(dev_t dev, struct ne7_fd_formb | |||
2217 | putiobuf(bp); | 2217 | putiobuf(bp); | |
2218 | return (rv); | 2218 | return (rv); | |
2219 | } | 2219 | } | |
2220 | 2220 | |||
2221 | void | 2221 | void | |
2222 | fdgetdisklabel(dev_t dev) | 2222 | fdgetdisklabel(dev_t dev) | |
2223 | { | 2223 | { | |
2224 | int unit = FDUNIT(dev), i; | 2224 | int unit = FDUNIT(dev), i; | |
2225 | struct fd_softc *fd = device_lookup_private(&fd_cd, unit); | 2225 | struct fd_softc *fd = device_lookup_private(&fd_cd, unit); | |
2226 | struct disklabel *lp = fd->sc_dk.dk_label; | 2226 | struct disklabel *lp = fd->sc_dk.dk_label; | |
2227 | struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel; | 2227 | struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel; | |
2228 | 2228 | |||
2229 | memset(lp, 0, sizeof(struct disklabel)); | 2229 | memset(lp, 0, sizeof(struct disklabel)); | |
2230 | memset(lp, 0, sizeof(struct cpu_disklabel)); | 2230 | memset(clp, 0, sizeof(struct cpu_disklabel)); | |
2231 | 2231 | |||
2232 | lp->d_type = DTYPE_FLOPPY; | 2232 | lp->d_type = DTYPE_FLOPPY; | |
2233 | lp->d_secsize = FD_BSIZE(fd); | 2233 | lp->d_secsize = FD_BSIZE(fd); | |
2234 | lp->d_secpercyl = fd->sc_type->seccyl; | 2234 | lp->d_secpercyl = fd->sc_type->seccyl; | |
2235 | lp->d_nsectors = fd->sc_type->sectrac; | 2235 | lp->d_nsectors = fd->sc_type->sectrac; | |
2236 | lp->d_ncylinders = fd->sc_type->cylinders; | 2236 | lp->d_ncylinders = fd->sc_type->cylinders; | |
2237 | lp->d_ntracks = fd->sc_type->heads; /* Go figure... */ | 2237 | lp->d_ntracks = fd->sc_type->heads; /* Go figure... */ | |
2238 | lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders; | 2238 | lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders; | |
2239 | lp->d_rpm = 3600; /* XXX like it matters... */ | 2239 | lp->d_rpm = 3600; /* XXX like it matters... */ | |
2240 | 2240 | |||
2241 | strncpy(lp->d_typename, "floppy", sizeof(lp->d_typename)); | 2241 | strncpy(lp->d_typename, "floppy", sizeof(lp->d_typename)); | |
2242 | strncpy(lp->d_packname, "fictitious", sizeof(lp->d_packname)); | 2242 | strncpy(lp->d_packname, "fictitious", sizeof(lp->d_packname)); | |
2243 | lp->d_interleave = 1; | 2243 | lp->d_interleave = 1; |
--- src/sys/arch/sparc64/dev/fdc.c 2011/08/08 14:49:06 1.36
+++ src/sys/arch/sparc64/dev/fdc.c 2014/11/03 16:47:29 1.36.14.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: fdc.c,v 1.36 2011/08/08 14:49:06 jakllsch Exp $ */ | 1 | /* $NetBSD: fdc.c,v 1.36.14.1 2014/11/03 16:47:29 msaitoh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Paul Kranenburg. | 8 | * by Paul Kranenburg. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -91,27 +91,27 @@ | @@ -91,27 +91,27 @@ | |||
91 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 91 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
92 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 92 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
93 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 93 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
94 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 94 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
95 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 95 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
96 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 96 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
97 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 97 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
98 | * SUCH DAMAGE. | 98 | * SUCH DAMAGE. | |
99 | * | 99 | * | |
100 | * @(#)fd.c 7.4 (Berkeley) 5/25/91 | 100 | * @(#)fd.c 7.4 (Berkeley) 5/25/91 | |
101 | */ | 101 | */ | |
102 | 102 | |||
103 | #include <sys/cdefs.h> | 103 | #include <sys/cdefs.h> | |
104 | __KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.36 2011/08/08 14:49:06 jakllsch Exp $"); | 104 | __KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.36.14.1 2014/11/03 16:47:29 msaitoh Exp $"); | |
105 | 105 | |||
106 | #include "opt_ddb.h" | 106 | #include "opt_ddb.h" | |
107 | #include "opt_md.h" | 107 | #include "opt_md.h" | |
108 | 108 | |||
109 | #include <sys/param.h> | 109 | #include <sys/param.h> | |
110 | #include <sys/types.h> | 110 | #include <sys/types.h> | |
111 | #include <sys/systm.h> | 111 | #include <sys/systm.h> | |
112 | #include <sys/callout.h> | 112 | #include <sys/callout.h> | |
113 | #include <sys/kernel.h> | 113 | #include <sys/kernel.h> | |
114 | #include <sys/file.h> | 114 | #include <sys/file.h> | |
115 | #include <sys/ioctl.h> | 115 | #include <sys/ioctl.h> | |
116 | #include <sys/device.h> | 116 | #include <sys/device.h> | |
117 | #include <sys/disklabel.h> | 117 | #include <sys/disklabel.h> | |
@@ -2403,27 +2403,27 @@ fdformat(dev_t dev, struct ne7_fd_formb | @@ -2403,27 +2403,27 @@ fdformat(dev_t dev, struct ne7_fd_formb | |||
2403 | putiobuf(bp); | 2403 | putiobuf(bp); | |
2404 | return rv; | 2404 | return rv; | |
2405 | } | 2405 | } | |
2406 | 2406 | |||
2407 | void | 2407 | void | |
2408 | fdgetdisklabel(dev_t dev) | 2408 | fdgetdisklabel(dev_t dev) | |
2409 | { | 2409 | { | |
2410 | int i; | 2410 | int i; | |
2411 | struct fd_softc *fd = device_lookup_private(&fd_cd, FDUNIT(dev)); | 2411 | struct fd_softc *fd = device_lookup_private(&fd_cd, FDUNIT(dev)); | |
2412 | struct disklabel *lp = fd->sc_dk.dk_label; | 2412 | struct disklabel *lp = fd->sc_dk.dk_label; | |
2413 | struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel; | 2413 | struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel; | |
2414 | 2414 | |||
2415 | memset(lp, 0, sizeof(struct disklabel)); | 2415 | memset(lp, 0, sizeof(struct disklabel)); | |
2416 | memset(lp, 0, sizeof(struct cpu_disklabel)); | 2416 | memset(clp, 0, sizeof(struct cpu_disklabel)); | |
2417 | 2417 | |||
2418 | lp->d_type = DTYPE_FLOPPY; | 2418 | lp->d_type = DTYPE_FLOPPY; | |
2419 | lp->d_secsize = FD_BSIZE(fd); | 2419 | lp->d_secsize = FD_BSIZE(fd); | |
2420 | lp->d_secpercyl = fd->sc_type->seccyl; | 2420 | lp->d_secpercyl = fd->sc_type->seccyl; | |
2421 | lp->d_nsectors = fd->sc_type->sectrac; | 2421 | lp->d_nsectors = fd->sc_type->sectrac; | |
2422 | lp->d_ncylinders = fd->sc_type->cylinders; | 2422 | lp->d_ncylinders = fd->sc_type->cylinders; | |
2423 | lp->d_ntracks = fd->sc_type->heads; /* Go figure... */ | 2423 | lp->d_ntracks = fd->sc_type->heads; /* Go figure... */ | |
2424 | lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders; | 2424 | lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders; | |
2425 | lp->d_rpm = 300; /* XXX like it matters... */ | 2425 | lp->d_rpm = 300; /* XXX like it matters... */ | |
2426 | 2426 | |||
2427 | strncpy(lp->d_typename, "floppy disk", sizeof(lp->d_typename)); | 2427 | strncpy(lp->d_typename, "floppy disk", sizeof(lp->d_typename)); | |
2428 | strncpy(lp->d_packname, "fictitious", sizeof(lp->d_packname)); | 2428 | strncpy(lp->d_packname, "fictitious", sizeof(lp->d_packname)); | |
2429 | lp->d_interleave = 1; | 2429 | lp->d_interleave = 1; |
--- src/sys/arch/sun3/dev/fd.c 2011/07/16 20:25:28 1.72
+++ src/sys/arch/sun3/dev/fd.c 2014/11/03 16:47:29 1.72.14.1
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: fd.c,v 1.72 2011/07/16 20:25:28 mrg Exp $ */ | 1 | /* $NetBSD: fd.c,v 1.72.14.1 2014/11/03 16:47:29 msaitoh Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1990 The Regents of the University of California. | 4 | * Copyright (c) 1990 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * Don Ahn. | 8 | * Don Ahn. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -62,27 +62,27 @@ | @@ -62,27 +62,27 @@ | |||
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
69 | * SUCH DAMAGE. | 69 | * SUCH DAMAGE. | |
70 | * | 70 | * | |
71 | * @(#)fd.c 7.4 (Berkeley) 5/25/91 | 71 | * @(#)fd.c 7.4 (Berkeley) 5/25/91 | |
72 | */ | 72 | */ | |
73 | 73 | |||
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.72 2011/07/16 20:25:28 mrg Exp $"); | 75 | __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.72.14.1 2014/11/03 16:47:29 msaitoh Exp $"); | |
76 | 76 | |||
77 | #include "opt_ddb.h" | 77 | #include "opt_ddb.h" | |
78 | 78 | |||
79 | #include <sys/param.h> | 79 | #include <sys/param.h> | |
80 | #include <sys/systm.h> | 80 | #include <sys/systm.h> | |
81 | #include <sys/callout.h> | 81 | #include <sys/callout.h> | |
82 | #include <sys/kernel.h> | 82 | #include <sys/kernel.h> | |
83 | #include <sys/file.h> | 83 | #include <sys/file.h> | |
84 | #include <sys/ioctl.h> | 84 | #include <sys/ioctl.h> | |
85 | #include <sys/device.h> | 85 | #include <sys/device.h> | |
86 | #include <sys/disklabel.h> | 86 | #include <sys/disklabel.h> | |
87 | #include <sys/disk.h> | 87 | #include <sys/disk.h> | |
88 | #include <sys/fdio.h> | 88 | #include <sys/fdio.h> | |
@@ -1845,27 +1845,27 @@ fdformat(dev_t dev, struct ne7_fd_formb | @@ -1845,27 +1845,27 @@ fdformat(dev_t dev, struct ne7_fd_formb | |||
1845 | putiobuf(bp); | 1845 | putiobuf(bp); | |
1846 | return rv; | 1846 | return rv; | |
1847 | } | 1847 | } | |
1848 | 1848 | |||
1849 | void | 1849 | void | |
1850 | fdgetdisklabel(dev_t dev) | 1850 | fdgetdisklabel(dev_t dev) | |
1851 | { | 1851 | { | |
1852 | int unit = FDUNIT(dev), i; | 1852 | int unit = FDUNIT(dev), i; | |
1853 | struct fd_softc *fd = device_lookup_private(&fd_cd, unit); | 1853 | struct fd_softc *fd = device_lookup_private(&fd_cd, unit); | |
1854 | struct disklabel *lp = fd->sc_dk.dk_label; | 1854 | struct disklabel *lp = fd->sc_dk.dk_label; | |
1855 | struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel; | 1855 | struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel; | |
1856 | 1856 | |||
1857 | memset(lp, 0, sizeof(struct disklabel)); | 1857 | memset(lp, 0, sizeof(struct disklabel)); | |
1858 | memset(lp, 0, sizeof(struct cpu_disklabel)); | 1858 | memset(clp, 0, sizeof(struct cpu_disklabel)); | |
1859 | 1859 | |||
1860 | lp->d_type = DTYPE_FLOPPY; | 1860 | lp->d_type = DTYPE_FLOPPY; | |
1861 | lp->d_secsize = FDC_BSIZE; | 1861 | lp->d_secsize = FDC_BSIZE; | |
1862 | lp->d_secpercyl = fd->sc_type->seccyl; | 1862 | lp->d_secpercyl = fd->sc_type->seccyl; | |
1863 | lp->d_nsectors = fd->sc_type->sectrac; | 1863 | lp->d_nsectors = fd->sc_type->sectrac; | |
1864 | lp->d_ncylinders = fd->sc_type->tracks; | 1864 | lp->d_ncylinders = fd->sc_type->tracks; | |
1865 | lp->d_ntracks = fd->sc_type->heads; /* Go figure... */ | 1865 | lp->d_ntracks = fd->sc_type->heads; /* Go figure... */ | |
1866 | lp->d_rpm = 3600; /* XXX like it matters... */ | 1866 | lp->d_rpm = 3600; /* XXX like it matters... */ | |
1867 | 1867 | |||
1868 | strncpy(lp->d_typename, "floppy", sizeof(lp->d_typename)); | 1868 | strncpy(lp->d_typename, "floppy", sizeof(lp->d_typename)); | |
1869 | strncpy(lp->d_packname, "fictitious", sizeof(lp->d_packname)); | 1869 | strncpy(lp->d_packname, "fictitious", sizeof(lp->d_packname)); | |
1870 | lp->d_interleave = 1; | 1870 | lp->d_interleave = 1; | |
1871 | 1871 |