geom_nop.c revision 143586
1251886Speter/*-
2251886Speter * Copyright (c) 2004 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3251886Speter * All rights reserved.
4251886Speter *
5251886Speter * Redistribution and use in source and binary forms, with or without
6251886Speter * modification, are permitted provided that the following conditions
7269847Speter * are met:
8251886Speter * 1. Redistributions of source code must retain the above copyright
9251886Speter *    notice, this list of conditions and the following disclaimer.
10251886Speter * 2. Redistributions in binary form must reproduce the above copyright
11251886Speter *    notice, this list of conditions and the following disclaimer in the
12251886Speter *    documentation and/or other materials provided with the distribution.
13251886Speter *
14251886Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
15251886Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16251886Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17251886Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
18251886Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19251886Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20251886Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21269847Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22251886Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23251886Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24251886Speter * SUCH DAMAGE.
25251886Speter */
26251886Speter
27251886Speter#include <sys/cdefs.h>
28251886Speter__FBSDID("$FreeBSD: head/sbin/geom/class/nop/geom_nop.c 143586 2005-03-14 14:25:47Z pjd $");
29251886Speter
30251886Speter#include <stdio.h>
31251886Speter#include <stdint.h>
32251886Speter#include <libgeom.h>
33251886Speter#include <geom/nop/g_nop.h>
34251886Speter
35251886Speter#include "core/geom.h"
36251886Speter
37
38uint32_t lib_version = G_LIB_VERSION;
39uint32_t version = G_NOP_VERSION;
40
41static intmax_t failprob = 0;
42static intmax_t offset = 0;
43static intmax_t secsize = 0;
44static intmax_t size = 0;
45
46struct g_command class_commands[] = {
47	{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
48	    {
49		{ 'f', "failprob", &failprob, G_TYPE_NUMBER },
50		{ 'o', "offset", &offset, G_TYPE_NUMBER },
51		{ 's', "size", &size, G_TYPE_NUMBER },
52		{ 'S', "secsize", &secsize, G_TYPE_NUMBER },
53		G_OPT_SENTINEL
54	    },
55	    "[-v] [-f failprob] [-o offset] [-s size] [-S secsize] dev ..."
56	},
57	{ "configure", G_FLAG_VERBOSE, NULL,
58	    {
59		{ 'f', "failprob", &failprob, G_TYPE_NUMBER },
60		G_OPT_SENTINEL
61	    },
62	    "[-v] [-f failprob] prov ..."
63	},
64	{ "destroy", G_FLAG_VERBOSE, NULL,
65	    {
66		{ 'f', "force", NULL, G_TYPE_NONE },
67		G_OPT_SENTINEL
68	    },
69	    "[-fv] prov ..."
70	},
71	G_CMD_SENTINEL
72};
73