xref: /freebsd/lib/geom/raid/geom_raid.c (revision 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
1e4b0a90eSBrooks Davis /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3e4b0a90eSBrooks Davis  *
4e4b0a90eSBrooks Davis  * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>
5e4b0a90eSBrooks Davis  * All rights reserved.
6e4b0a90eSBrooks Davis  *
7e4b0a90eSBrooks Davis  * Redistribution and use in source and binary forms, with or without
8e4b0a90eSBrooks Davis  * modification, are permitted provided that the following conditions
9e4b0a90eSBrooks Davis  * are met:
10e4b0a90eSBrooks Davis  * 1. Redistributions of source code must retain the above copyright
11e4b0a90eSBrooks Davis  *    notice, this list of conditions and the following disclaimer.
12e4b0a90eSBrooks Davis  * 2. Redistributions in binary form must reproduce the above copyright
13e4b0a90eSBrooks Davis  *    notice, this list of conditions and the following disclaimer in the
14e4b0a90eSBrooks Davis  *    documentation and/or other materials provided with the distribution.
15e4b0a90eSBrooks Davis  *
16e4b0a90eSBrooks Davis  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
17e4b0a90eSBrooks Davis  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18e4b0a90eSBrooks Davis  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19e4b0a90eSBrooks Davis  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
20e4b0a90eSBrooks Davis  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21e4b0a90eSBrooks Davis  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22e4b0a90eSBrooks Davis  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23e4b0a90eSBrooks Davis  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24e4b0a90eSBrooks Davis  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25e4b0a90eSBrooks Davis  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26e4b0a90eSBrooks Davis  * SUCH DAMAGE.
27e4b0a90eSBrooks Davis  */
28e4b0a90eSBrooks Davis 
29e4b0a90eSBrooks Davis #include <sys/cdefs.h>
30e4b0a90eSBrooks Davis __FBSDID("$FreeBSD$");
31e4b0a90eSBrooks Davis 
32e4b0a90eSBrooks Davis #include <sys/param.h>
33e4b0a90eSBrooks Davis #include <errno.h>
34e4b0a90eSBrooks Davis #include <paths.h>
35e4b0a90eSBrooks Davis #include <stdio.h>
36e4b0a90eSBrooks Davis #include <stdlib.h>
37e4b0a90eSBrooks Davis #include <stdint.h>
38e4b0a90eSBrooks Davis #include <string.h>
39e4b0a90eSBrooks Davis #include <strings.h>
40e4b0a90eSBrooks Davis #include <assert.h>
41e4b0a90eSBrooks Davis #include <libgeom.h>
42e4b0a90eSBrooks Davis #include <geom/raid/g_raid.h>
43e4b0a90eSBrooks Davis #include <core/geom.h>
44e4b0a90eSBrooks Davis #include <misc/subr.h>
45e4b0a90eSBrooks Davis 
46e4b0a90eSBrooks Davis uint32_t lib_version = G_LIB_VERSION;
47e4b0a90eSBrooks Davis uint32_t version = G_RAID_VERSION;
48e4b0a90eSBrooks Davis 
49e4b0a90eSBrooks Davis struct g_command class_commands[] = {
50e4b0a90eSBrooks Davis 	{ "label", G_FLAG_VERBOSE, NULL,
51e4b0a90eSBrooks Davis 	    {
52e4b0a90eSBrooks Davis 		{ 'f', "force", NULL, G_TYPE_BOOL },
53e4b0a90eSBrooks Davis 		{ 'o', "fmtopt", G_VAL_OPTIONAL, G_TYPE_STRING },
54e4b0a90eSBrooks Davis 		{ 'S', "size", G_VAL_OPTIONAL, G_TYPE_NUMBER },
55e4b0a90eSBrooks Davis 		{ 's', "strip", G_VAL_OPTIONAL, G_TYPE_NUMBER },
56e4b0a90eSBrooks Davis 		G_OPT_SENTINEL
57e4b0a90eSBrooks Davis 	    },
58e4b0a90eSBrooks Davis 	    "[-fv] [-o fmtopt] [-S size] [-s stripsize] format label level prov ..."
59e4b0a90eSBrooks Davis 	},
60e4b0a90eSBrooks Davis 	{ "add", G_FLAG_VERBOSE, NULL,
61e4b0a90eSBrooks Davis 	    {
62e4b0a90eSBrooks Davis 		{ 'f', "force", NULL, G_TYPE_BOOL },
63e4b0a90eSBrooks Davis 		{ 'S', "size", G_VAL_OPTIONAL, G_TYPE_NUMBER },
64e4b0a90eSBrooks Davis 		{ 's', "strip", G_VAL_OPTIONAL, G_TYPE_NUMBER },
65e4b0a90eSBrooks Davis 		G_OPT_SENTINEL
66e4b0a90eSBrooks Davis 	    },
67e4b0a90eSBrooks Davis 	    "[-fv] [-S size] [-s stripsize] name label level"
68e4b0a90eSBrooks Davis 	},
69e4b0a90eSBrooks Davis 	{ "delete", G_FLAG_VERBOSE, NULL,
70e4b0a90eSBrooks Davis 	    {
71e4b0a90eSBrooks Davis 		{ 'f', "force", NULL, G_TYPE_BOOL },
72e4b0a90eSBrooks Davis 		G_OPT_SENTINEL
73e4b0a90eSBrooks Davis 	    },
74e4b0a90eSBrooks Davis 	    "[-fv] name [label|num]"
75e4b0a90eSBrooks Davis 	},
76e4b0a90eSBrooks Davis 	{ "insert", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
77e4b0a90eSBrooks Davis 	    "[-v] name prov ..."
78e4b0a90eSBrooks Davis 	},
79e4b0a90eSBrooks Davis 	{ "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
80e4b0a90eSBrooks Davis 	    "[-v] name prov ..."
81e4b0a90eSBrooks Davis 	},
82e4b0a90eSBrooks Davis 	{ "fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
83e4b0a90eSBrooks Davis 	    "[-v] name prov ..."
84e4b0a90eSBrooks Davis 	},
85e4b0a90eSBrooks Davis 	{ "stop", G_FLAG_VERBOSE, NULL,
86e4b0a90eSBrooks Davis 	    {
87e4b0a90eSBrooks Davis 		{ 'f', "force", NULL, G_TYPE_BOOL },
88e4b0a90eSBrooks Davis 		G_OPT_SENTINEL
89e4b0a90eSBrooks Davis 	    },
90e4b0a90eSBrooks Davis 	    "[-fv] name"
91e4b0a90eSBrooks Davis 	},
92e4b0a90eSBrooks Davis 	G_CMD_SENTINEL
93e4b0a90eSBrooks Davis };
94e4b0a90eSBrooks Davis 
95