| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: fd.c,v 1.118 2015/07/11 10:32:46 kamil Exp $ */ | | 1 | /* $NetBSD: fd.c,v 1.119 2017/01/12 14:24:53 isaki Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998 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 Charles M. Hannum and Minoura Makoto. | | 8 | * by Charles M. Hannum and Minoura Makoto. |
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. |
| @@ -54,27 +54,27 @@ | | | @@ -54,27 +54,27 @@ |
54 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 54 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
61 | * SUCH DAMAGE. | | 61 | * SUCH DAMAGE. |
62 | * | | 62 | * |
63 | * @(#)fd.c 7.4 (Berkeley) 5/25/91 | | 63 | * @(#)fd.c 7.4 (Berkeley) 5/25/91 |
64 | */ | | 64 | */ |
65 | | | 65 | |
66 | #include <sys/cdefs.h> | | 66 | #include <sys/cdefs.h> |
67 | __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.118 2015/07/11 10:32:46 kamil Exp $"); | | 67 | __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.119 2017/01/12 14:24:53 isaki Exp $"); |
68 | | | 68 | |
69 | #include "opt_ddb.h" | | 69 | #include "opt_ddb.h" |
70 | #include "opt_m68k_arch.h" | | 70 | #include "opt_m68k_arch.h" |
71 | | | 71 | |
72 | #include <sys/param.h> | | 72 | #include <sys/param.h> |
73 | #include <sys/systm.h> | | 73 | #include <sys/systm.h> |
74 | #include <sys/bus.h> | | 74 | #include <sys/bus.h> |
75 | #include <sys/callout.h> | | 75 | #include <sys/callout.h> |
76 | #include <sys/kernel.h> | | 76 | #include <sys/kernel.h> |
77 | #include <sys/conf.h> | | 77 | #include <sys/conf.h> |
78 | #include <sys/file.h> | | 78 | #include <sys/file.h> |
79 | #include <sys/stat.h> | | 79 | #include <sys/stat.h> |
80 | #include <sys/ioctl.h> | | 80 | #include <sys/ioctl.h> |
| @@ -662,27 +662,27 @@ fdattach(device_t parent, device_t self, | | | @@ -662,27 +662,27 @@ fdattach(device_t parent, device_t self, |
662 | * with RB_ASKNAME and get selected as the boot device. | | 662 | * with RB_ASKNAME and get selected as the boot device. |
663 | */ | | 663 | */ |
664 | mountroothook_establish(fd_mountroot_hook, fd->sc_dev); | | 664 | mountroothook_establish(fd_mountroot_hook, fd->sc_dev); |
665 | | | 665 | |
666 | rnd_attach_source(&fd->rnd_source, device_xname(fd->sc_dev), | | 666 | rnd_attach_source(&fd->rnd_source, device_xname(fd->sc_dev), |
667 | RND_TYPE_DISK, RND_FLAG_DEFAULT); | | 667 | RND_TYPE_DISK, RND_FLAG_DEFAULT); |
668 | } | | 668 | } |
669 | | | 669 | |
670 | struct fd_type * | | 670 | struct fd_type * |
671 | fd_dev_to_type(struct fd_softc *fd, dev_t dev) | | 671 | fd_dev_to_type(struct fd_softc *fd, dev_t dev) |
672 | { | | 672 | { |
673 | size_t type = FDTYPE(dev); | | 673 | size_t type = FDTYPE(dev); |
674 | | | 674 | |
675 | if (type > __arraycount(fd_types)) | | 675 | if (type >= __arraycount(fd_types)) |
676 | return NULL; | | 676 | return NULL; |
677 | return &fd_types[type]; | | 677 | return &fd_types[type]; |
678 | } | | 678 | } |
679 | | | 679 | |
680 | void | | 680 | void |
681 | fdstrategy(struct buf *bp) | | 681 | fdstrategy(struct buf *bp) |
682 | { | | 682 | { |
683 | struct fd_softc *fd; | | 683 | struct fd_softc *fd; |
684 | int unit; | | 684 | int unit; |
685 | int sz; | | 685 | int sz; |
686 | int s; | | 686 | int s; |
687 | | | 687 | |
688 | unit = FDUNIT(bp->b_dev); | | 688 | unit = FDUNIT(bp->b_dev); |