2004-05-20 10:24:23 +00:00
|
|
|
/*-
|
2006-09-08 09:21:21 +00:00
|
|
|
* Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
2004-05-20 10:24:23 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2006-02-01 12:11:37 +00:00
|
|
|
*
|
2004-05-20 10:24:23 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <libgeom.h>
|
|
|
|
#include <geom/nop/g_nop.h>
|
|
|
|
|
|
|
|
#include "core/geom.h"
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t lib_version = G_LIB_VERSION;
|
|
|
|
uint32_t version = G_NOP_VERSION;
|
|
|
|
|
2006-09-08 09:21:21 +00:00
|
|
|
static intmax_t error = -1;
|
|
|
|
static intmax_t rfailprob = -1;
|
|
|
|
static intmax_t wfailprob = -1;
|
2004-07-19 07:52:56 +00:00
|
|
|
static intmax_t offset = 0;
|
2004-07-30 08:19:22 +00:00
|
|
|
static intmax_t secsize = 0;
|
2004-07-19 07:52:56 +00:00
|
|
|
static intmax_t size = 0;
|
2004-05-20 10:24:23 +00:00
|
|
|
|
|
|
|
struct g_command class_commands[] = {
|
|
|
|
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
|
|
|
|
{
|
2006-09-08 09:21:21 +00:00
|
|
|
{ 'e', "error", &error, G_TYPE_NUMBER },
|
2004-07-19 07:52:56 +00:00
|
|
|
{ 'o', "offset", &offset, G_TYPE_NUMBER },
|
2006-09-08 09:21:21 +00:00
|
|
|
{ 'r', "rfailprob", &rfailprob, G_TYPE_NUMBER },
|
2004-07-19 07:52:56 +00:00
|
|
|
{ 's', "size", &size, G_TYPE_NUMBER },
|
2004-07-30 08:19:22 +00:00
|
|
|
{ 'S', "secsize", &secsize, G_TYPE_NUMBER },
|
2006-09-08 09:21:21 +00:00
|
|
|
{ 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER },
|
2004-05-20 10:24:23 +00:00
|
|
|
G_OPT_SENTINEL
|
2005-03-14 14:25:47 +00:00
|
|
|
},
|
2007-05-15 20:25:18 +00:00
|
|
|
NULL, "[-v] [-e error] [-o offset] [-r rfailprob] [-s size] "
|
|
|
|
"[-S secsize] [-w wfailprob] dev ..."
|
2004-05-20 10:24:23 +00:00
|
|
|
},
|
2004-05-21 15:23:48 +00:00
|
|
|
{ "configure", G_FLAG_VERBOSE, NULL,
|
2004-05-20 10:24:23 +00:00
|
|
|
{
|
2006-09-08 09:21:21 +00:00
|
|
|
{ 'e', "error", &error, G_TYPE_NUMBER },
|
|
|
|
{ 'r', "rfailprob", &rfailprob, G_TYPE_NUMBER },
|
|
|
|
{ 'w', "wfailprob", &wfailprob, G_TYPE_NUMBER },
|
2004-05-20 10:24:23 +00:00
|
|
|
G_OPT_SENTINEL
|
2005-03-14 14:25:47 +00:00
|
|
|
},
|
2007-05-15 20:25:18 +00:00
|
|
|
NULL, "[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..."
|
2004-05-20 10:24:23 +00:00
|
|
|
},
|
|
|
|
{ "destroy", G_FLAG_VERBOSE, NULL,
|
|
|
|
{
|
2006-09-30 14:40:50 +00:00
|
|
|
{ 'f', "force", NULL, G_TYPE_BOOL },
|
2004-05-20 10:24:23 +00:00
|
|
|
G_OPT_SENTINEL
|
2005-03-14 14:25:47 +00:00
|
|
|
},
|
2007-05-15 20:25:18 +00:00
|
|
|
NULL, "[-fv] prov ..."
|
2004-05-20 10:24:23 +00:00
|
|
|
},
|
2007-05-15 20:25:18 +00:00
|
|
|
{ "reset", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL,
|
2005-12-08 23:00:31 +00:00
|
|
|
"[-v] prov ..."
|
|
|
|
},
|
2004-05-20 10:24:23 +00:00
|
|
|
G_CMD_SENTINEL
|
|
|
|
};
|