subr_iostat.c revision 1.1.2.2 1 1.1.2.2 elad /* $NetBSD: subr_iostat.c,v 1.1.2.2 2006/04/19 05:14:00 elad Exp $ */
2 1.1.2.2 elad /* NetBSD: subr_disk.c,v 1.69 2005/05/29 22:24:15 christos Exp */
3 1.1.2.2 elad
4 1.1.2.2 elad /*-
5 1.1.2.2 elad * Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc.
6 1.1.2.2 elad * All rights reserved.
7 1.1.2.2 elad *
8 1.1.2.2 elad * This code is derived from software contributed to The NetBSD Foundation
9 1.1.2.2 elad * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
10 1.1.2.2 elad * NASA Ames Research Center.
11 1.1.2.2 elad *
12 1.1.2.2 elad * Redistribution and use in source and binary forms, with or without
13 1.1.2.2 elad * modification, are permitted provided that the following conditions
14 1.1.2.2 elad * are met:
15 1.1.2.2 elad * 1. Redistributions of source code must retain the above copyright
16 1.1.2.2 elad * notice, this list of conditions and the following disclaimer.
17 1.1.2.2 elad * 2. Redistributions in binary form must reproduce the above copyright
18 1.1.2.2 elad * notice, this list of conditions and the following disclaimer in the
19 1.1.2.2 elad * documentation and/or other materials provided with the distribution.
20 1.1.2.2 elad * 3. All advertising materials mentioning features or use of this software
21 1.1.2.2 elad * must display the following acknowledgement:
22 1.1.2.2 elad * This product includes software developed by the NetBSD
23 1.1.2.2 elad * Foundation, Inc. and its contributors.
24 1.1.2.2 elad * 4. Neither the name of The NetBSD Foundation nor the names of its
25 1.1.2.2 elad * contributors may be used to endorse or promote products derived
26 1.1.2.2 elad * from this software without specific prior written permission.
27 1.1.2.2 elad *
28 1.1.2.2 elad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29 1.1.2.2 elad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30 1.1.2.2 elad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 1.1.2.2 elad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32 1.1.2.2 elad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 1.1.2.2 elad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 1.1.2.2 elad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 1.1.2.2 elad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 1.1.2.2 elad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 1.1.2.2 elad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 1.1.2.2 elad * POSSIBILITY OF SUCH DAMAGE.
39 1.1.2.2 elad */
40 1.1.2.2 elad
41 1.1.2.2 elad /*
42 1.1.2.2 elad * Copyright (c) 1982, 1986, 1988, 1993
43 1.1.2.2 elad * The Regents of the University of California. All rights reserved.
44 1.1.2.2 elad * (c) UNIX System Laboratories, Inc.
45 1.1.2.2 elad * All or some portions of this file are derived from material licensed
46 1.1.2.2 elad * to the University of California by American Telephone and Telegraph
47 1.1.2.2 elad * Co. or Unix System Laboratories, Inc. and are reproduced herein with
48 1.1.2.2 elad * the permission of UNIX System Laboratories, Inc.
49 1.1.2.2 elad *
50 1.1.2.2 elad * Redistribution and use in source and binary forms, with or without
51 1.1.2.2 elad * modification, are permitted provided that the following conditions
52 1.1.2.2 elad * are met:
53 1.1.2.2 elad * 1. Redistributions of source code must retain the above copyright
54 1.1.2.2 elad * notice, this list of conditions and the following disclaimer.
55 1.1.2.2 elad * 2. Redistributions in binary form must reproduce the above copyright
56 1.1.2.2 elad * notice, this list of conditions and the following disclaimer in the
57 1.1.2.2 elad * documentation and/or other materials provided with the distribution.
58 1.1.2.2 elad * 3. Neither the name of the University nor the names of its contributors
59 1.1.2.2 elad * may be used to endorse or promote products derived from this software
60 1.1.2.2 elad * without specific prior written permission.
61 1.1.2.2 elad *
62 1.1.2.2 elad * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63 1.1.2.2 elad * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 1.1.2.2 elad * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65 1.1.2.2 elad * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66 1.1.2.2 elad * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67 1.1.2.2 elad * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 1.1.2.2 elad * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 1.1.2.2 elad * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 1.1.2.2 elad * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 1.1.2.2 elad * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 1.1.2.2 elad * SUCH DAMAGE.
73 1.1.2.2 elad *
74 1.1.2.2 elad * @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
75 1.1.2.2 elad */
76 1.1.2.2 elad
77 1.1.2.2 elad #include <sys/cdefs.h>
78 1.1.2.2 elad __KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.1.2.2 2006/04/19 05:14:00 elad Exp $");
79 1.1.2.2 elad
80 1.1.2.2 elad #include "opt_compat_netbsd.h"
81 1.1.2.2 elad
82 1.1.2.2 elad #include <sys/param.h>
83 1.1.2.2 elad #include <sys/kernel.h>
84 1.1.2.2 elad #include <sys/malloc.h>
85 1.1.2.2 elad #include <sys/buf.h>
86 1.1.2.2 elad #include <sys/bufq.h>
87 1.1.2.2 elad #include <sys/syslog.h>
88 1.1.2.2 elad #include <sys/disklabel.h>
89 1.1.2.2 elad #include <sys/disk.h>
90 1.1.2.2 elad #include <sys/sysctl.h>
91 1.1.2.2 elad #include <lib/libkern/libkern.h>
92 1.1.2.2 elad
93 1.1.2.2 elad /*
94 1.1.2.2 elad * Function prototypes for sysctl nodes
95 1.1.2.2 elad */
96 1.1.2.2 elad static int sysctl_hw_disknames(SYSCTLFN_PROTO);
97 1.1.2.2 elad static int sysctl_hw_iostatnames(SYSCTLFN_PROTO);
98 1.1.2.2 elad static int sysctl_hw_iostats(SYSCTLFN_PROTO);
99 1.1.2.2 elad
100 1.1.2.2 elad static int
101 1.1.2.2 elad iostati_getnames(int disk_only, char *oldp, size_t *oldlenp, const void *newp,
102 1.1.2.2 elad u_int namelen);
103 1.1.2.2 elad
104 1.1.2.2 elad /*
105 1.1.2.2 elad * A global list of all drives attached to the system. May grow or
106 1.1.2.2 elad * shrink over time.
107 1.1.2.2 elad */
108 1.1.2.2 elad struct iostatlist_head iostatlist = TAILQ_HEAD_INITIALIZER(iostatlist);
109 1.1.2.2 elad int iostat_count; /* number of drives in global drivelist */
110 1.1.2.2 elad struct simplelock iostatlist_slock = SIMPLELOCK_INITIALIZER;
111 1.1.2.2 elad
112 1.1.2.2 elad /*
113 1.1.2.2 elad * Searches the iostatlist for the iostat corresponding to the
114 1.1.2.2 elad * name provided.
115 1.1.2.2 elad */
116 1.1.2.2 elad struct io_stats *
117 1.1.2.2 elad iostat_find(char *name)
118 1.1.2.2 elad {
119 1.1.2.2 elad struct io_stats *iostatp;
120 1.1.2.2 elad
121 1.1.2.2 elad if ((name == NULL) || (iostat_count <= 0))
122 1.1.2.2 elad return (NULL);
123 1.1.2.2 elad
124 1.1.2.2 elad simple_lock(&iostatlist_slock);
125 1.1.2.2 elad for (iostatp = TAILQ_FIRST(&iostatlist); iostatp != NULL;
126 1.1.2.2 elad iostatp = TAILQ_NEXT(iostatp, link))
127 1.1.2.2 elad if (strcmp(iostatp->name, name) == 0) {
128 1.1.2.2 elad simple_unlock(&iostatlist_slock);
129 1.1.2.2 elad return (iostatp);
130 1.1.2.2 elad }
131 1.1.2.2 elad simple_unlock(&iostatlist_slock);
132 1.1.2.2 elad
133 1.1.2.2 elad return (NULL);
134 1.1.2.2 elad }
135 1.1.2.2 elad
136 1.1.2.2 elad /*
137 1.1.2.2 elad * Allocate and initialise memory for the i/o statistics.
138 1.1.2.2 elad */
139 1.1.2.2 elad struct
140 1.1.2.2 elad io_stats *iostat_alloc(int32_t type)
141 1.1.2.2 elad {
142 1.1.2.2 elad int s;
143 1.1.2.2 elad struct io_stats *stats;
144 1.1.2.2 elad
145 1.1.2.2 elad stats = malloc(sizeof(struct io_stats), M_DEVBUF, M_NOWAIT);
146 1.1.2.2 elad
147 1.1.2.2 elad if (stats == NULL)
148 1.1.2.2 elad panic("iostat_alloc: cannot allocate memory for stats "
149 1.1.2.2 elad "buffer");
150 1.1.2.2 elad
151 1.1.2.2 elad stats->type = type;
152 1.1.2.2 elad stats->rxfer = 0;
153 1.1.2.2 elad stats->rbytes = 0;
154 1.1.2.2 elad stats->wxfer = 0;
155 1.1.2.2 elad stats->wbytes = 0;
156 1.1.2.2 elad
157 1.1.2.2 elad /*
158 1.1.2.2 elad * Set the attached timestamp.
159 1.1.2.2 elad */
160 1.1.2.2 elad s = splclock();
161 1.1.2.2 elad stats->attachtime = mono_time;
162 1.1.2.2 elad splx(s);
163 1.1.2.2 elad
164 1.1.2.2 elad timerclear(&stats->time);
165 1.1.2.2 elad timerclear(&stats->timestamp);
166 1.1.2.2 elad
167 1.1.2.2 elad /*
168 1.1.2.2 elad * Link into the drivelist.
169 1.1.2.2 elad */
170 1.1.2.2 elad simple_lock(&iostatlist_slock);
171 1.1.2.2 elad TAILQ_INSERT_TAIL(&iostatlist, stats, link);
172 1.1.2.2 elad iostat_count++;
173 1.1.2.2 elad simple_unlock(&iostatlist_slock);
174 1.1.2.2 elad
175 1.1.2.2 elad return stats;
176 1.1.2.2 elad }
177 1.1.2.2 elad
178 1.1.2.2 elad /*
179 1.1.2.2 elad * Remove i/o from stats collection.
180 1.1.2.2 elad */
181 1.1.2.2 elad void
182 1.1.2.2 elad iostat_free(struct io_stats *stats)
183 1.1.2.2 elad {
184 1.1.2.2 elad
185 1.1.2.2 elad /*
186 1.1.2.2 elad * Remove from the iostat list.
187 1.1.2.2 elad */
188 1.1.2.2 elad if (iostat_count == 0)
189 1.1.2.2 elad panic("iostat_free: iostat_count == 0");
190 1.1.2.2 elad simple_lock(&iostatlist_slock);
191 1.1.2.2 elad TAILQ_REMOVE(&iostatlist, stats, link);
192 1.1.2.2 elad iostat_count--;
193 1.1.2.2 elad simple_unlock(&iostatlist_slock);
194 1.1.2.2 elad free(stats, M_DEVBUF);
195 1.1.2.2 elad }
196 1.1.2.2 elad
197 1.1.2.2 elad /*
198 1.1.2.2 elad * Increment a iostat busy counter. If the counter is going from
199 1.1.2.2 elad * 0 to 1, set the timestamp.
200 1.1.2.2 elad */
201 1.1.2.2 elad void
202 1.1.2.2 elad iostat_busy(struct io_stats *stats)
203 1.1.2.2 elad {
204 1.1.2.2 elad int s;
205 1.1.2.2 elad
206 1.1.2.2 elad /*
207 1.1.2.2 elad * XXX We'd like to use something as accurate as microtime(),
208 1.1.2.2 elad * but that doesn't depend on the system TOD clock.
209 1.1.2.2 elad */
210 1.1.2.2 elad if (stats->busy++ == 0) {
211 1.1.2.2 elad s = splclock();
212 1.1.2.2 elad stats->timestamp = mono_time;
213 1.1.2.2 elad splx(s);
214 1.1.2.2 elad }
215 1.1.2.2 elad }
216 1.1.2.2 elad
217 1.1.2.2 elad /*
218 1.1.2.2 elad * Decrement a iostat busy counter, increment the byte count, total busy
219 1.1.2.2 elad * time, and reset the timestamp.
220 1.1.2.2 elad */
221 1.1.2.2 elad void
222 1.1.2.2 elad iostat_unbusy(struct io_stats *stats, long bcount, int read)
223 1.1.2.2 elad {
224 1.1.2.2 elad int s;
225 1.1.2.2 elad struct timeval dv_time, diff_time;
226 1.1.2.2 elad
227 1.1.2.2 elad if (stats->busy-- == 0) {
228 1.1.2.2 elad printf("%s: busy < 0\n", stats->name);
229 1.1.2.2 elad panic("iostat_unbusy");
230 1.1.2.2 elad }
231 1.1.2.2 elad
232 1.1.2.2 elad s = splclock();
233 1.1.2.2 elad dv_time = mono_time;
234 1.1.2.2 elad splx(s);
235 1.1.2.2 elad
236 1.1.2.2 elad timersub(&dv_time, &stats->timestamp, &diff_time);
237 1.1.2.2 elad timeradd(&stats->time, &diff_time, &stats->time);
238 1.1.2.2 elad
239 1.1.2.2 elad stats->timestamp = dv_time;
240 1.1.2.2 elad if (bcount > 0) {
241 1.1.2.2 elad if (read) {
242 1.1.2.2 elad stats->rbytes += bcount;
243 1.1.2.2 elad stats->rxfer++;
244 1.1.2.2 elad } else {
245 1.1.2.2 elad stats->wbytes += bcount;
246 1.1.2.2 elad stats->wxfer++;
247 1.1.2.2 elad }
248 1.1.2.2 elad }
249 1.1.2.2 elad }
250 1.1.2.2 elad
251 1.1.2.2 elad /*
252 1.1.2.2 elad * Increment the seek counter. This does look almost redundant but it
253 1.1.2.2 elad * abstracts the stats gathering.
254 1.1.2.2 elad */
255 1.1.2.2 elad void
256 1.1.2.2 elad iostat_seek(struct io_stats *stats)
257 1.1.2.2 elad {
258 1.1.2.2 elad stats->seek++;
259 1.1.2.2 elad }
260 1.1.2.2 elad
261 1.1.2.2 elad static int
262 1.1.2.2 elad sysctl_hw_disknames(SYSCTLFN_ARGS)
263 1.1.2.2 elad {
264 1.1.2.2 elad return iostati_getnames(1, oldp, oldlenp, newp, namelen);
265 1.1.2.2 elad }
266 1.1.2.2 elad
267 1.1.2.2 elad static int
268 1.1.2.2 elad sysctl_hw_iostatnames(SYSCTLFN_ARGS)
269 1.1.2.2 elad {
270 1.1.2.2 elad return iostati_getnames(0, oldp, oldlenp, newp, namelen);
271 1.1.2.2 elad }
272 1.1.2.2 elad
273 1.1.2.2 elad static int
274 1.1.2.2 elad iostati_getnames(int disk_only, char *oldp, size_t *oldlenp, const void *newp,
275 1.1.2.2 elad u_int namelen)
276 1.1.2.2 elad {
277 1.1.2.2 elad char bf[IOSTATNAMELEN + 1];
278 1.1.2.2 elad char *where = oldp;
279 1.1.2.2 elad struct io_stats *stats;
280 1.1.2.2 elad size_t needed, left, slen;
281 1.1.2.2 elad int error, first;
282 1.1.2.2 elad
283 1.1.2.2 elad if (newp != NULL)
284 1.1.2.2 elad return (EPERM);
285 1.1.2.2 elad if (namelen != 0)
286 1.1.2.2 elad return (EINVAL);
287 1.1.2.2 elad
288 1.1.2.2 elad first = 1;
289 1.1.2.2 elad error = 0;
290 1.1.2.2 elad needed = 0;
291 1.1.2.2 elad left = *oldlenp;
292 1.1.2.2 elad
293 1.1.2.2 elad simple_lock(&iostatlist_slock);
294 1.1.2.2 elad for (stats = TAILQ_FIRST(&iostatlist); stats != NULL;
295 1.1.2.2 elad stats = TAILQ_NEXT(stats, link)) {
296 1.1.2.2 elad if ((disk_only == 1) && (stats->type != IOSTAT_DISK))
297 1.1.2.2 elad continue;
298 1.1.2.2 elad
299 1.1.2.2 elad if (where == NULL)
300 1.1.2.2 elad needed += strlen(stats->name) + 1;
301 1.1.2.2 elad else {
302 1.1.2.2 elad memset(bf, 0, sizeof(bf));
303 1.1.2.2 elad if (first) {
304 1.1.2.2 elad strncpy(bf, stats->name, sizeof(bf));
305 1.1.2.2 elad first = 0;
306 1.1.2.2 elad } else {
307 1.1.2.2 elad bf[0] = ' ';
308 1.1.2.2 elad strncpy(bf + 1, stats->name,
309 1.1.2.2 elad sizeof(bf) - 1);
310 1.1.2.2 elad }
311 1.1.2.2 elad bf[IOSTATNAMELEN] = '\0';
312 1.1.2.2 elad slen = strlen(bf);
313 1.1.2.2 elad if (left < slen + 1)
314 1.1.2.2 elad break;
315 1.1.2.2 elad /* +1 to copy out the trailing NUL byte */
316 1.1.2.2 elad error = copyout(bf, where, slen + 1);
317 1.1.2.2 elad if (error)
318 1.1.2.2 elad break;
319 1.1.2.2 elad where += slen;
320 1.1.2.2 elad needed += slen;
321 1.1.2.2 elad left -= slen;
322 1.1.2.2 elad }
323 1.1.2.2 elad }
324 1.1.2.2 elad simple_unlock(&iostatlist_slock);
325 1.1.2.2 elad *oldlenp = needed;
326 1.1.2.2 elad return (error);
327 1.1.2.2 elad }
328 1.1.2.2 elad
329 1.1.2.2 elad static int
330 1.1.2.2 elad sysctl_hw_iostats(SYSCTLFN_ARGS)
331 1.1.2.2 elad {
332 1.1.2.2 elad struct io_sysctl sdrive;
333 1.1.2.2 elad struct io_stats *stats;
334 1.1.2.2 elad char *where = oldp;
335 1.1.2.2 elad size_t tocopy, left;
336 1.1.2.2 elad int error;
337 1.1.2.2 elad
338 1.1.2.2 elad if (newp != NULL)
339 1.1.2.2 elad return (EPERM);
340 1.1.2.2 elad
341 1.1.2.2 elad /*
342 1.1.2.2 elad * The original hw.diskstats call was broken and did not require
343 1.1.2.2 elad * the userland to pass in it's size of struct disk_sysctl. This
344 1.1.2.2 elad * was fixed after NetBSD 1.6 was released, and any applications
345 1.1.2.2 elad * that do not pass in the size are given an error only, unless
346 1.1.2.2 elad * we care about 1.6 compatibility.
347 1.1.2.2 elad */
348 1.1.2.2 elad if (namelen == 0)
349 1.1.2.2 elad #ifdef COMPAT_16
350 1.1.2.2 elad tocopy = offsetof(struct io_sysctl, busy);
351 1.1.2.2 elad #else
352 1.1.2.2 elad return (EINVAL);
353 1.1.2.2 elad #endif
354 1.1.2.2 elad else
355 1.1.2.2 elad tocopy = name[0];
356 1.1.2.2 elad
357 1.1.2.2 elad if (where == NULL) {
358 1.1.2.2 elad *oldlenp = iostat_count * tocopy;
359 1.1.2.2 elad return (0);
360 1.1.2.2 elad }
361 1.1.2.2 elad
362 1.1.2.2 elad error = 0;
363 1.1.2.2 elad left = *oldlenp;
364 1.1.2.2 elad memset(&sdrive, 0, sizeof(sdrive));
365 1.1.2.2 elad *oldlenp = 0;
366 1.1.2.2 elad
367 1.1.2.2 elad simple_lock(&iostatlist_slock);
368 1.1.2.2 elad TAILQ_FOREACH(stats, &iostatlist, link) {
369 1.1.2.2 elad if (left < tocopy)
370 1.1.2.2 elad break;
371 1.1.2.2 elad strncpy(sdrive.name, stats->name, sizeof(sdrive.name));
372 1.1.2.2 elad sdrive.xfer = stats->rxfer + stats->wxfer;
373 1.1.2.2 elad sdrive.rxfer = stats->rxfer;
374 1.1.2.2 elad sdrive.wxfer = stats->wxfer;
375 1.1.2.2 elad sdrive.seek = stats->seek;
376 1.1.2.2 elad sdrive.bytes = stats->rbytes + stats->wbytes;
377 1.1.2.2 elad sdrive.rbytes = stats->rbytes;
378 1.1.2.2 elad sdrive.wbytes = stats->wbytes;
379 1.1.2.2 elad sdrive.attachtime_sec = stats->attachtime.tv_sec;
380 1.1.2.2 elad sdrive.attachtime_usec = stats->attachtime.tv_usec;
381 1.1.2.2 elad sdrive.timestamp_sec = stats->timestamp.tv_sec;
382 1.1.2.2 elad sdrive.timestamp_usec = stats->timestamp.tv_usec;
383 1.1.2.2 elad sdrive.time_sec = stats->time.tv_sec;
384 1.1.2.2 elad sdrive.time_usec = stats->time.tv_usec;
385 1.1.2.2 elad sdrive.busy = stats->busy;
386 1.1.2.2 elad
387 1.1.2.2 elad error = copyout(&sdrive, where, min(tocopy, sizeof(sdrive)));
388 1.1.2.2 elad if (error)
389 1.1.2.2 elad break;
390 1.1.2.2 elad where += tocopy;
391 1.1.2.2 elad *oldlenp += tocopy;
392 1.1.2.2 elad left -= tocopy;
393 1.1.2.2 elad }
394 1.1.2.2 elad simple_unlock(&iostatlist_slock);
395 1.1.2.2 elad return (error);
396 1.1.2.2 elad }
397 1.1.2.2 elad
398 1.1.2.2 elad SYSCTL_SETUP(sysctl_io_stats_setup, "sysctl i/o stats setup")
399 1.1.2.2 elad {
400 1.1.2.2 elad sysctl_createv(clog, 0, NULL, NULL,
401 1.1.2.2 elad CTLFLAG_PERMANENT,
402 1.1.2.2 elad CTLTYPE_STRING, "disknames",
403 1.1.2.2 elad SYSCTL_DESCR("List of disk drives present"),
404 1.1.2.2 elad sysctl_hw_disknames, 0, NULL, 0,
405 1.1.2.2 elad CTL_HW, HW_DISKNAMES, CTL_EOL);
406 1.1.2.2 elad sysctl_createv(clog, 0, NULL, NULL,
407 1.1.2.2 elad CTLFLAG_PERMANENT,
408 1.1.2.2 elad CTLTYPE_STRING, "iostatnames",
409 1.1.2.2 elad SYSCTL_DESCR("I/O stats are being collected for these"
410 1.1.2.2 elad " devices"),
411 1.1.2.2 elad sysctl_hw_iostatnames, 0, NULL, 0,
412 1.1.2.2 elad CTL_HW, HW_IOSTATNAMES, CTL_EOL);
413 1.1.2.2 elad sysctl_createv(clog, 0, NULL, NULL,
414 1.1.2.2 elad CTLFLAG_PERMANENT,
415 1.1.2.2 elad CTLTYPE_STRUCT, "drivestats",
416 1.1.2.2 elad SYSCTL_DESCR("Statistics on device I/O operations"),
417 1.1.2.2 elad sysctl_hw_iostats, 0, NULL, 0,
418 1.1.2.2 elad CTL_HW, HW_IOSTATS, CTL_EOL);
419 1.1.2.2 elad }
420