From 40cda51553df6f8224eba40ac32f1be90ec6e6b8 Mon Sep 17 00:00:00 2001 From: pjd Date: Fri, 8 Sep 2006 09:21:21 +0000 Subject: - Split failure probability configuration into read failure probability and write failure probability. - Allow to specify an error number to return of failure. MFC after: 3 days --- sbin/geom/class/nop/geom_nop.c | 19 +++++++++++++------ sbin/geom/class/nop/gnop.8 | 22 +++++++++++++++------- 2 files changed, 28 insertions(+), 13 deletions(-) (limited to 'sbin/geom/class') diff --git a/sbin/geom/class/nop/geom_nop.c b/sbin/geom/class/nop/geom_nop.c index c1c16b5..0de2856 100644 --- a/sbin/geom/class/nop/geom_nop.c +++ b/sbin/geom/class/nop/geom_nop.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004 Pawel Jakub Dawidek + * Copyright (c) 2004-2006 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_NOP_VERSION; -static intmax_t failprob = 0; +static intmax_t error = -1; +static intmax_t rfailprob = -1; +static intmax_t wfailprob = -1; static intmax_t offset = 0; static intmax_t secsize = 0; static intmax_t size = 0; @@ -46,20 +48,25 @@ static intmax_t size = 0; struct g_command class_commands[] = { { "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, { - { 'f', "failprob", &failprob, G_TYPE_NUMBER }, + { 'e', "error", &error, G_TYPE_NUMBER }, { 'o', "offset", &offset, G_TYPE_NUMBER }, + { 'r', "rfailprob", &rfailprob, G_TYPE_NUMBER }, { 's', "size", &size, G_TYPE_NUMBER }, { 'S', "secsize", &secsize, G_TYPE_NUMBER }, + { 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-v] [-f failprob] [-o offset] [-s size] [-S secsize] dev ..." + "[-v] [-e error] [-o offset] [-r rfailprob] [-s size] [-S secsize] " + "[-w wfailprob] dev ..." }, { "configure", G_FLAG_VERBOSE, NULL, { - { 'f', "failprob", &failprob, G_TYPE_NUMBER }, + { 'e', "error", &error, G_TYPE_NUMBER }, + { 'r', "rfailprob", &rfailprob, G_TYPE_NUMBER }, + { 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - "[-v] [-f failprob] prov ..." + "[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..." }, { "destroy", G_FLAG_VERBOSE, NULL, { diff --git a/sbin/geom/class/nop/gnop.8 b/sbin/geom/class/nop/gnop.8 index 64c04ca..2ec29fa 100644 --- a/sbin/geom/class/nop/gnop.8 +++ b/sbin/geom/class/nop/gnop.8 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004-2005 Pawel Jakub Dawidek +.\" Copyright (c) 2004-2006 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 21, 2004 +.Dd September 8, 2006 .Dt GNOP 8 .Os .Sh NAME @@ -34,15 +34,19 @@ .Nm .Cm create .Op Fl v -.Op Fl f Ar failprob +.Op Fl e Ar error .Op Fl o Ar offset +.Op Fl r Ar rfailprob .Op Fl s Ar size .Op Fl S Ar secsize +.Op Fl w Ar wfailprob .Ar dev ... .Nm .Cm configure .Op Fl v -.Op Fl f Ar failprob +.Op Fl e Ar error +.Op Fl r Ar rfailprob +.Op Fl w Ar wfailprob .Ar prov ... .Nm .Cm destroy @@ -104,17 +108,21 @@ See .El .Pp Additional options: -.Bl -tag -width ".Fl f Ar failprob" +.Bl -tag -width ".Fl f Ar rfailprob" +.It Fl e Ar error +Specifies the error number to return on failure. .It Fl f Force the removal of the specified provider. -.It Fl f Ar failprob -Specifies failure probability in percentage. .It Fl o Ar offset Where to begin on the original provider. +.It Fl r Ar rfailprob +Specifies read failure probability in percent. .It Fl s Ar size Size of the transparent provider. .It Fl S Ar secsize Sector size of the transparent provider. +.It Fl w Ar wfailprob +Specifies write failure probability in percent. .It Fl v Be more verbose. .El -- cgit v1.1