2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/kernel.h>
35 #include <sys/module.h>
37 #include <sys/mutex.h>
40 #include <sys/sysctl.h>
41 #include <sys/malloc.h>
42 #include <geom/geom.h>
43 #include <geom/geom_dbg.h>
44 #include <geom/nop/g_nop.h>
47 SYSCTL_DECL(_kern_geom);
48 static SYSCTL_NODE(_kern_geom, OID_AUTO, nop, CTLFLAG_RW, 0, "GEOM_NOP stuff");
49 static u_int g_nop_debug = 0;
50 SYSCTL_UINT(_kern_geom_nop, OID_AUTO, debug, CTLFLAG_RW, &g_nop_debug, 0,
53 static int g_nop_destroy(struct g_geom *gp, boolean_t force);
54 static int g_nop_destroy_geom(struct gctl_req *req, struct g_class *mp,
56 static void g_nop_config(struct gctl_req *req, struct g_class *mp,
58 static g_access_t g_nop_access;
59 static g_dumpconf_t g_nop_dumpconf;
60 static g_orphan_t g_nop_orphan;
61 static g_provgone_t g_nop_providergone;
62 static g_resize_t g_nop_resize;
63 static g_start_t g_nop_start;
65 struct g_class g_nop_class = {
66 .name = G_NOP_CLASS_NAME,
68 .ctlreq = g_nop_config,
69 .destroy_geom = g_nop_destroy_geom,
70 .access = g_nop_access,
71 .dumpconf = g_nop_dumpconf,
72 .orphan = g_nop_orphan,
73 .providergone = g_nop_providergone,
74 .resize = g_nop_resize,
79 struct callout dl_cal;
81 TAILQ_ENTRY(g_nop_delay) dl_next;
85 g_nop_orphan(struct g_consumer *cp)
89 g_nop_destroy(cp->geom, 1);
93 g_nop_resize(struct g_consumer *cp)
95 struct g_nop_softc *sc;
97 struct g_provider *pp;
105 if (sc->sc_explicitsize != 0)
107 if (cp->provider->mediasize < sc->sc_offset) {
108 g_nop_destroy(gp, 1);
111 size = cp->provider->mediasize - sc->sc_offset;
112 LIST_FOREACH(pp, &gp->provider, provider)
113 g_resize_provider(pp, size);
117 g_nop_dumper(void *priv, void *virtual, vm_offset_t physical, off_t offset,
125 g_nop_kerneldump(struct bio *bp, struct g_nop_softc *sc)
127 struct g_kerneldump *gkd;
129 struct g_provider *pp;
131 gkd = (struct g_kerneldump *)bp->bio_data;
132 gp = bp->bio_to->geom;
133 g_trace(G_T_TOPOLOGY, "%s(%s, %jd, %jd)", __func__, gp->name,
134 (intmax_t)gkd->offset, (intmax_t)gkd->length);
136 pp = LIST_FIRST(&gp->provider);
138 gkd->di.dumper = g_nop_dumper;
140 gkd->di.blocksize = pp->sectorsize;
141 gkd->di.maxiosize = DFLTPHYS;
142 gkd->di.mediaoffset = sc->sc_offset + gkd->offset;
143 if (gkd->offset > sc->sc_explicitsize) {
144 g_io_deliver(bp, ENODEV);
147 if (gkd->offset + gkd->length > sc->sc_explicitsize)
148 gkd->length = sc->sc_explicitsize - gkd->offset;
149 gkd->di.mediasize = gkd->length;
154 g_nop_pass(struct bio *cbp, struct g_geom *gp)
157 G_NOP_LOGREQ(cbp, "Sending request.");
158 g_io_request(cbp, LIST_FIRST(&gp->consumer));
162 g_nop_pass_timeout(void *data)
164 struct g_nop_softc *sc;
166 struct g_nop_delay *gndelay;
168 gndelay = (struct g_nop_delay *)data;
170 gp = gndelay->dl_bio->bio_to->geom;
173 mtx_lock(&sc->sc_lock);
174 TAILQ_REMOVE(&sc->sc_head_delay, gndelay, dl_next);
175 mtx_unlock(&sc->sc_lock);
177 g_nop_pass(gndelay->dl_bio, gp);
183 g_nop_start(struct bio *bp)
185 struct g_nop_softc *sc;
187 struct g_provider *pp;
189 u_int failprob, delayprob, delaytime;
191 failprob = delayprob = 0;
193 gp = bp->bio_to->geom;
196 G_NOP_LOGREQ(bp, "Request received.");
197 mtx_lock(&sc->sc_lock);
198 if (sc->sc_count_until_fail != 0 && --sc->sc_count_until_fail == 0) {
199 sc->sc_rfailprob = 100;
200 sc->sc_wfailprob = 100;
202 switch (bp->bio_cmd) {
205 sc->sc_readbytes += bp->bio_length;
206 failprob = sc->sc_rfailprob;
207 delayprob = sc->sc_rdelayprob;
208 delaytime = sc->sc_delaymsec;
212 sc->sc_wrotebytes += bp->bio_length;
213 failprob = sc->sc_wfailprob;
214 delayprob = sc->sc_wdelayprob;
215 delaytime = sc->sc_delaymsec;
222 if (sc->sc_physpath &&
223 g_handleattr_str(bp, "GEOM::physpath", sc->sc_physpath))
225 else if (strcmp(bp->bio_attribute, "GEOM::kerneldump") == 0)
226 g_nop_kerneldump(bp, sc);
229 * Fallthrough to forwarding the GETATTR down to the
230 * lower level device.
233 mtx_unlock(&sc->sc_lock);
248 mtx_unlock(&sc->sc_lock);
252 rval = arc4random() % 100;
253 if (rval < failprob) {
254 G_NOP_LOGREQLVL(1, bp, "Returning error=%d.", sc->sc_error);
255 g_io_deliver(bp, sc->sc_error);
260 cbp = g_clone_bio(bp);
262 g_io_deliver(bp, ENOMEM);
265 cbp->bio_done = g_std_done;
266 cbp->bio_offset = bp->bio_offset + sc->sc_offset;
267 pp = LIST_FIRST(&gp->provider);
268 KASSERT(pp != NULL, ("NULL pp"));
272 struct g_nop_delay *gndelay;
275 rval = arc4random() % 100;
276 if (rval < delayprob) {
277 gndelay = g_malloc(sizeof(*gndelay), M_NOWAIT | M_ZERO);
278 if (gndelay != NULL) {
279 callout_init(&gndelay->dl_cal, 1);
281 gndelay->dl_bio = cbp;
283 mtx_lock(&sc->sc_lock);
284 TAILQ_INSERT_TAIL(&sc->sc_head_delay, gndelay,
286 mtx_unlock(&sc->sc_lock);
288 callout_reset(&gndelay->dl_cal,
289 MSEC_2_TICKS(delaytime), g_nop_pass_timeout,
300 g_nop_access(struct g_provider *pp, int dr, int dw, int de)
303 struct g_consumer *cp;
307 cp = LIST_FIRST(&gp->consumer);
308 error = g_access(cp, dr, dw, de);
314 g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
315 int ioerror, u_int count_until_fail, u_int rfailprob, u_int wfailprob,
316 u_int delaymsec, u_int rdelayprob, u_int wdelayprob, off_t offset,
317 off_t size, u_int secsize, off_t stripesize, off_t stripeoffset,
318 const char *physpath)
320 struct g_nop_softc *sc;
322 struct g_provider *newpp;
323 struct g_consumer *cp;
334 if ((offset % pp->sectorsize) != 0) {
335 gctl_error(req, "Invalid offset for provider %s.", pp->name);
338 if ((size % pp->sectorsize) != 0) {
339 gctl_error(req, "Invalid size for provider %s.", pp->name);
342 if (offset >= pp->mediasize) {
343 gctl_error(req, "Invalid offset for provider %s.", pp->name);
348 size = pp->mediasize - offset;
349 if (offset + size > pp->mediasize) {
350 gctl_error(req, "Invalid size for provider %s.", pp->name);
354 secsize = pp->sectorsize;
355 else if ((secsize % pp->sectorsize) != 0) {
356 gctl_error(req, "Invalid secsize for provider %s.", pp->name);
359 if (secsize > MAXPHYS) {
360 gctl_error(req, "secsize is too big.");
363 size -= size % secsize;
364 if ((stripesize % pp->sectorsize) != 0) {
365 gctl_error(req, "Invalid stripesize for provider %s.", pp->name);
368 if ((stripeoffset % pp->sectorsize) != 0) {
369 gctl_error(req, "Invalid stripeoffset for provider %s.", pp->name);
372 if (stripesize != 0 && stripeoffset >= stripesize) {
373 gctl_error(req, "stripeoffset is too big.");
376 snprintf(name, sizeof(name), "%s%s", pp->name, G_NOP_SUFFIX);
377 LIST_FOREACH(gp, &mp->geom, geom) {
378 if (strcmp(gp->name, name) == 0) {
379 gctl_error(req, "Provider %s already exists.", name);
383 gp = g_new_geomf(mp, "%s", name);
384 sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
385 sc->sc_offset = offset;
386 sc->sc_explicitsize = explicitsize;
387 sc->sc_stripesize = stripesize;
388 sc->sc_stripeoffset = stripeoffset;
389 if (physpath && strcmp(physpath, G_NOP_PHYSPATH_PASSTHROUGH)) {
390 sc->sc_physpath = strndup(physpath, MAXPATHLEN, M_GEOM);
392 sc->sc_physpath = NULL;
393 sc->sc_error = ioerror;
394 sc->sc_count_until_fail = count_until_fail;
395 sc->sc_rfailprob = rfailprob;
396 sc->sc_wfailprob = wfailprob;
397 sc->sc_delaymsec = delaymsec;
398 sc->sc_rdelayprob = rdelayprob;
399 sc->sc_wdelayprob = wdelayprob;
408 sc->sc_readbytes = 0;
409 sc->sc_wrotebytes = 0;
410 TAILQ_INIT(&sc->sc_head_delay);
411 mtx_init(&sc->sc_lock, "gnop lock", NULL, MTX_DEF);
414 newpp = g_new_providerf(gp, "%s", gp->name);
415 newpp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
416 newpp->mediasize = size;
417 newpp->sectorsize = secsize;
418 newpp->stripesize = stripesize;
419 newpp->stripeoffset = stripeoffset;
421 cp = g_new_consumer(gp);
422 cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
423 error = g_attach(cp, pp);
425 gctl_error(req, "Cannot attach to provider %s.", pp->name);
429 newpp->flags |= pp->flags & G_PF_ACCEPT_UNMAPPED;
430 g_error_provider(newpp, 0);
431 G_NOP_DEBUG(0, "Device %s created.", gp->name);
434 if (cp->provider != NULL)
436 g_destroy_consumer(cp);
437 g_destroy_provider(newpp);
438 mtx_destroy(&sc->sc_lock);
439 free(sc->sc_physpath, M_GEOM);
446 g_nop_providergone(struct g_provider *pp)
448 struct g_geom *gp = pp->geom;
449 struct g_nop_softc *sc = gp->softc;
451 KASSERT(TAILQ_EMPTY(&sc->sc_head_delay),
452 ("delayed request list is not empty"));
455 free(sc->sc_physpath, M_GEOM);
456 mtx_destroy(&sc->sc_lock);
461 g_nop_destroy(struct g_geom *gp, boolean_t force)
463 struct g_nop_softc *sc;
464 struct g_provider *pp;
470 pp = LIST_FIRST(&gp->provider);
471 if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) {
473 G_NOP_DEBUG(0, "Device %s is still open, so it "
474 "can't be definitely removed.", pp->name);
476 G_NOP_DEBUG(1, "Device %s is still open (r%dw%de%d).",
477 pp->name, pp->acr, pp->acw, pp->ace);
481 G_NOP_DEBUG(0, "Device %s removed.", gp->name);
484 g_wither_geom(gp, ENXIO);
490 g_nop_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp)
493 return (g_nop_destroy(gp, 0));
497 g_nop_ctl_create(struct gctl_req *req, struct g_class *mp)
499 struct g_provider *pp;
500 intmax_t *val, error, rfailprob, wfailprob, count_until_fail, offset,
501 secsize, size, stripesize, stripeoffset, delaymsec,
502 rdelayprob, wdelayprob;
503 const char *name, *physpath;
512 count_until_fail = -1;
522 nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
524 gctl_error(req, "No '%s' argument", "nargs");
528 gctl_error(req, "Missing device(s).");
531 val = gctl_get_paraml_opt(req, "error", sizeof(*val));
535 val = gctl_get_paraml_opt(req, "rfailprob", sizeof(*val));
538 if (rfailprob < -1 || rfailprob > 100) {
539 gctl_error(req, "Invalid '%s' argument", "rfailprob");
543 val = gctl_get_paraml_opt(req, "wfailprob", sizeof(*val));
546 if (wfailprob < -1 || wfailprob > 100) {
547 gctl_error(req, "Invalid '%s' argument", "wfailprob");
551 val = gctl_get_paraml_opt(req, "delaymsec", sizeof(*val));
554 if (delaymsec < 1 && delaymsec != -1) {
555 gctl_error(req, "Invalid '%s' argument", "delaymsec");
559 val = gctl_get_paraml_opt(req, "rdelayprob", sizeof(*val));
562 if (rdelayprob < -1 || rdelayprob > 100) {
563 gctl_error(req, "Invalid '%s' argument", "rdelayprob");
567 val = gctl_get_paraml_opt(req, "wdelayprob", sizeof(*val));
570 if (wdelayprob < -1 || wdelayprob > 100) {
571 gctl_error(req, "Invalid '%s' argument", "wdelayprob");
575 val = gctl_get_paraml_opt(req, "count_until_fail", sizeof(*val));
577 count_until_fail = *val;
578 if (count_until_fail < -1) {
579 gctl_error(req, "Invalid '%s' argument",
584 val = gctl_get_paraml_opt(req, "offset", sizeof(*val));
588 gctl_error(req, "Invalid '%s' argument", "offset");
592 val = gctl_get_paraml_opt(req, "size", sizeof(*val));
596 gctl_error(req, "Invalid '%s' argument", "size");
600 val = gctl_get_paraml_opt(req, "secsize", sizeof(*val));
604 gctl_error(req, "Invalid '%s' argument", "secsize");
608 val = gctl_get_paraml_opt(req, "stripesize", sizeof(*val));
611 if (stripesize < 0) {
612 gctl_error(req, "Invalid '%s' argument", "stripesize");
616 val = gctl_get_paraml_opt(req, "stripeoffset", sizeof(*val));
619 if (stripeoffset < 0) {
620 gctl_error(req, "Invalid '%s' argument",
625 physpath = gctl_get_asciiparam(req, "physpath");
627 for (i = 0; i < *nargs; i++) {
628 snprintf(param, sizeof(param), "arg%d", i);
629 name = gctl_get_asciiparam(req, param);
631 gctl_error(req, "No 'arg%d' argument", i);
634 if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
635 name += strlen("/dev/");
636 pp = g_provider_by_name(name);
638 G_NOP_DEBUG(1, "Provider %s is invalid.", name);
639 gctl_error(req, "Provider %s is invalid.", name);
642 if (g_nop_create(req, mp, pp,
643 error == -1 ? EIO : (int)error,
644 count_until_fail == -1 ? 0 : (u_int)count_until_fail,
645 rfailprob == -1 ? 0 : (u_int)rfailprob,
646 wfailprob == -1 ? 0 : (u_int)wfailprob,
647 delaymsec == -1 ? 1 : (u_int)delaymsec,
648 rdelayprob == -1 ? 0 : (u_int)rdelayprob,
649 wdelayprob == -1 ? 0 : (u_int)wdelayprob,
650 (off_t)offset, (off_t)size, (u_int)secsize,
651 (off_t)stripesize, (off_t)stripeoffset,
659 g_nop_ctl_configure(struct gctl_req *req, struct g_class *mp)
661 struct g_nop_softc *sc;
662 struct g_provider *pp;
663 intmax_t *val, delaymsec, error, rdelayprob, rfailprob, wdelayprob,
664 wfailprob, count_until_fail;
671 count_until_fail = -1;
679 nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
681 gctl_error(req, "No '%s' argument", "nargs");
685 gctl_error(req, "Missing device(s).");
688 val = gctl_get_paraml_opt(req, "error", sizeof(*val));
692 val = gctl_get_paraml_opt(req, "count_until_fail", sizeof(*val));
694 count_until_fail = *val;
696 val = gctl_get_paraml_opt(req, "rfailprob", sizeof(*val));
699 if (rfailprob < -1 || rfailprob > 100) {
700 gctl_error(req, "Invalid '%s' argument", "rfailprob");
704 val = gctl_get_paraml_opt(req, "wfailprob", sizeof(*val));
707 if (wfailprob < -1 || wfailprob > 100) {
708 gctl_error(req, "Invalid '%s' argument", "wfailprob");
712 val = gctl_get_paraml_opt(req, "delaymsec", sizeof(*val));
715 if (delaymsec < 1 && delaymsec != -1) {
716 gctl_error(req, "Invalid '%s' argument", "delaymsec");
720 val = gctl_get_paraml_opt(req, "rdelayprob", sizeof(*val));
723 if (rdelayprob < -1 || rdelayprob > 100) {
724 gctl_error(req, "Invalid '%s' argument", "rdelayprob");
728 val = gctl_get_paraml_opt(req, "wdelayprob", sizeof(*val));
731 if (wdelayprob < -1 || wdelayprob > 100) {
732 gctl_error(req, "Invalid '%s' argument", "wdelayprob");
737 for (i = 0; i < *nargs; i++) {
738 snprintf(param, sizeof(param), "arg%d", i);
739 name = gctl_get_asciiparam(req, param);
741 gctl_error(req, "No 'arg%d' argument", i);
744 if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
745 name += strlen("/dev/");
746 pp = g_provider_by_name(name);
747 if (pp == NULL || pp->geom->class != mp) {
748 G_NOP_DEBUG(1, "Provider %s is invalid.", name);
749 gctl_error(req, "Provider %s is invalid.", name);
752 sc = pp->geom->softc;
754 sc->sc_error = (int)error;
756 sc->sc_rfailprob = (u_int)rfailprob;
758 sc->sc_wfailprob = (u_int)wfailprob;
759 if (rdelayprob != -1)
760 sc->sc_rdelayprob = (u_int)rdelayprob;
761 if (wdelayprob != -1)
762 sc->sc_wdelayprob = (u_int)wdelayprob;
764 sc->sc_delaymsec = (u_int)delaymsec;
765 if (count_until_fail != -1)
766 sc->sc_count_until_fail = (u_int)count_until_fail;
770 static struct g_geom *
771 g_nop_find_geom(struct g_class *mp, const char *name)
775 LIST_FOREACH(gp, &mp->geom, geom) {
776 if (strcmp(gp->name, name) == 0)
783 g_nop_ctl_destroy(struct gctl_req *req, struct g_class *mp)
785 int *nargs, *force, error, i;
792 nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
794 gctl_error(req, "No '%s' argument", "nargs");
798 gctl_error(req, "Missing device(s).");
801 force = gctl_get_paraml(req, "force", sizeof(*force));
803 gctl_error(req, "No 'force' argument");
807 for (i = 0; i < *nargs; i++) {
808 snprintf(param, sizeof(param), "arg%d", i);
809 name = gctl_get_asciiparam(req, param);
811 gctl_error(req, "No 'arg%d' argument", i);
814 if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
815 name += strlen("/dev/");
816 gp = g_nop_find_geom(mp, name);
818 G_NOP_DEBUG(1, "Device %s is invalid.", name);
819 gctl_error(req, "Device %s is invalid.", name);
822 error = g_nop_destroy(gp, *force);
824 gctl_error(req, "Cannot destroy device %s (error=%d).",
832 g_nop_ctl_reset(struct gctl_req *req, struct g_class *mp)
834 struct g_nop_softc *sc;
835 struct g_provider *pp;
842 nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
844 gctl_error(req, "No '%s' argument", "nargs");
848 gctl_error(req, "Missing device(s).");
852 for (i = 0; i < *nargs; i++) {
853 snprintf(param, sizeof(param), "arg%d", i);
854 name = gctl_get_asciiparam(req, param);
856 gctl_error(req, "No 'arg%d' argument", i);
859 if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
860 name += strlen("/dev/");
861 pp = g_provider_by_name(name);
862 if (pp == NULL || pp->geom->class != mp) {
863 G_NOP_DEBUG(1, "Provider %s is invalid.", name);
864 gctl_error(req, "Provider %s is invalid.", name);
867 sc = pp->geom->softc;
876 sc->sc_readbytes = 0;
877 sc->sc_wrotebytes = 0;
882 g_nop_config(struct gctl_req *req, struct g_class *mp, const char *verb)
888 version = gctl_get_paraml(req, "version", sizeof(*version));
889 if (version == NULL) {
890 gctl_error(req, "No '%s' argument.", "version");
893 if (*version != G_NOP_VERSION) {
894 gctl_error(req, "Userland and kernel parts are out of sync.");
898 if (strcmp(verb, "create") == 0) {
899 g_nop_ctl_create(req, mp);
901 } else if (strcmp(verb, "configure") == 0) {
902 g_nop_ctl_configure(req, mp);
904 } else if (strcmp(verb, "destroy") == 0) {
905 g_nop_ctl_destroy(req, mp);
907 } else if (strcmp(verb, "reset") == 0) {
908 g_nop_ctl_reset(req, mp);
912 gctl_error(req, "Unknown verb.");
916 g_nop_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
917 struct g_consumer *cp, struct g_provider *pp)
919 struct g_nop_softc *sc;
921 if (pp != NULL || cp != NULL)
924 sbuf_printf(sb, "%s<Offset>%jd</Offset>\n", indent,
925 (intmax_t)sc->sc_offset);
926 sbuf_printf(sb, "%s<ReadFailProb>%u</ReadFailProb>\n", indent,
928 sbuf_printf(sb, "%s<WriteFailProb>%u</WriteFailProb>\n", indent,
930 sbuf_printf(sb, "%s<ReadDelayedProb>%u</ReadDelayedProb>\n", indent,
932 sbuf_printf(sb, "%s<WriteDelayedProb>%u</WriteDelayedProb>\n", indent,
934 sbuf_printf(sb, "%s<Delay>%d</Delay>\n", indent, sc->sc_delaymsec);
935 sbuf_printf(sb, "%s<CountUntilFail>%u</CountUntilFail>\n", indent,
936 sc->sc_count_until_fail);
937 sbuf_printf(sb, "%s<Error>%d</Error>\n", indent, sc->sc_error);
938 sbuf_printf(sb, "%s<Reads>%ju</Reads>\n", indent, sc->sc_reads);
939 sbuf_printf(sb, "%s<Writes>%ju</Writes>\n", indent, sc->sc_writes);
940 sbuf_printf(sb, "%s<Deletes>%ju</Deletes>\n", indent, sc->sc_deletes);
941 sbuf_printf(sb, "%s<Getattrs>%ju</Getattrs>\n", indent, sc->sc_getattrs);
942 sbuf_printf(sb, "%s<Flushes>%ju</Flushes>\n", indent, sc->sc_flushes);
943 sbuf_printf(sb, "%s<Cmd0s>%ju</Cmd0s>\n", indent, sc->sc_cmd0s);
944 sbuf_printf(sb, "%s<Cmd1s>%ju</Cmd1s>\n", indent, sc->sc_cmd1s);
945 sbuf_printf(sb, "%s<Cmd2s>%ju</Cmd2s>\n", indent, sc->sc_cmd2s);
946 sbuf_printf(sb, "%s<ReadBytes>%ju</ReadBytes>\n", indent,
948 sbuf_printf(sb, "%s<WroteBytes>%ju</WroteBytes>\n", indent,
952 DECLARE_GEOM_CLASS(g_nop_class, g_nop);
953 MODULE_VERSION(geom_nop, 0);