| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: subr_disk.c,v 1.121 2017/10/27 12:25:15 joerg Exp $ */ | | 1 | /* $NetBSD: subr_disk.c,v 1.122 2018/03/07 21:13:24 kre Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1996, 1997, 1999, 2000, 2009 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 Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center. | | 9 | * NASA Ames Research Center. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -57,27 +57,27 @@ | | | @@ -57,27 +57,27 @@ |
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
64 | * SUCH DAMAGE. | | 64 | * SUCH DAMAGE. |
65 | * | | 65 | * |
66 | * @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94 | | 66 | * @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94 |
67 | */ | | 67 | */ |
68 | | | 68 | |
69 | #include <sys/cdefs.h> | | 69 | #include <sys/cdefs.h> |
70 | __KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.121 2017/10/27 12:25:15 joerg Exp $"); | | 70 | __KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.122 2018/03/07 21:13:24 kre Exp $"); |
71 | | | 71 | |
72 | #include <sys/param.h> | | 72 | #include <sys/param.h> |
73 | #include <sys/kernel.h> | | 73 | #include <sys/kernel.h> |
74 | #include <sys/kmem.h> | | 74 | #include <sys/kmem.h> |
75 | #include <sys/buf.h> | | 75 | #include <sys/buf.h> |
76 | #include <sys/fcntl.h> | | 76 | #include <sys/fcntl.h> |
77 | #include <sys/syslog.h> | | 77 | #include <sys/syslog.h> |
78 | #include <sys/disklabel.h> | | 78 | #include <sys/disklabel.h> |
79 | #include <sys/disk.h> | | 79 | #include <sys/disk.h> |
80 | #include <sys/sysctl.h> | | 80 | #include <sys/sysctl.h> |
81 | #include <lib/libkern/libkern.h> | | 81 | #include <lib/libkern/libkern.h> |
82 | | | 82 | |
83 | /* | | 83 | /* |
| @@ -120,27 +120,27 @@ hp0g: hard error reading fsbn 12345 of 1 | | | @@ -120,27 +120,27 @@ hp0g: hard error reading fsbn 12345 of 1 |
120 | #ifndef PRIdaddr | | 120 | #ifndef PRIdaddr |
121 | #define PRIdaddr PRId64 | | 121 | #define PRIdaddr PRId64 |
122 | #endif | | 122 | #endif |
123 | void | | 123 | void |
124 | diskerr(const struct buf *bp, const char *dname, const char *what, int pri, | | 124 | diskerr(const struct buf *bp, const char *dname, const char *what, int pri, |
125 | int blkdone, const struct disklabel *lp) | | 125 | int blkdone, const struct disklabel *lp) |
126 | { | | 126 | { |
127 | int unit = DISKUNIT(bp->b_dev), part = DISKPART(bp->b_dev); | | 127 | int unit = DISKUNIT(bp->b_dev), part = DISKPART(bp->b_dev); |
128 | void (*pr)(const char *, ...) __printflike(1, 2); | | 128 | void (*pr)(const char *, ...) __printflike(1, 2); |
129 | char partname = 'a' + part; | | 129 | char partname = 'a' + part; |
130 | daddr_t sn; | | 130 | daddr_t sn; |
131 | | | 131 | |
132 | if (/*CONSTCOND*/0) | | 132 | if (/*CONSTCOND*/0) |
133 | /* Compiler will error this is the format is wrong... */ | | 133 | /* Compiler will error this if the format is wrong... */ |
134 | printf("%" PRIdaddr, bp->b_blkno); | | 134 | printf("%" PRIdaddr, bp->b_blkno); |
135 | | | 135 | |
136 | if (pri != LOG_PRINTF) { | | 136 | if (pri != LOG_PRINTF) { |
137 | static const char fmt[] = ""; | | 137 | static const char fmt[] = ""; |
138 | log(pri, fmt); | | 138 | log(pri, fmt); |
139 | pr = addlog; | | 139 | pr = addlog; |
140 | } else | | 140 | } else |
141 | pr = printf; | | 141 | pr = printf; |
142 | (*pr)("%s%d%c: %s %sing fsbn ", dname, unit, partname, what, | | 142 | (*pr)("%s%d%c: %s %sing fsbn ", dname, unit, partname, what, |
143 | bp->b_flags & B_READ ? "read" : "writ"); | | 143 | bp->b_flags & B_READ ? "read" : "writ"); |
144 | sn = bp->b_blkno; | | 144 | sn = bp->b_blkno; |
145 | if (bp->b_bcount <= DEV_BSIZE) | | 145 | if (bp->b_bcount <= DEV_BSIZE) |
146 | (*pr)("%" PRIdaddr, sn); | | 146 | (*pr)("%" PRIdaddr, sn); |