xref: /freebsd/lib/geom/raid/geom_raid.c (revision a2f733abcff64628b7771a47089628b7327a88bd)
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/param.h>
30e4b0a90eSBrooks Davis #include <errno.h>
31e4b0a90eSBrooks Davis #include <paths.h>
32e4b0a90eSBrooks Davis #include <stdio.h>
33e4b0a90eSBrooks Davis #include <stdlib.h>
34e4b0a90eSBrooks Davis #include <stdint.h>
35e4b0a90eSBrooks Davis #include <string.h>
36e4b0a90eSBrooks Davis #include <strings.h>
37e4b0a90eSBrooks Davis #include <assert.h>
38e4b0a90eSBrooks Davis #include <libgeom.h>
39e4b0a90eSBrooks Davis #include <geom/raid/g_raid.h>
40e4b0a90eSBrooks Davis #include <core/geom.h>
41e4b0a90eSBrooks Davis #include <misc/subr.h>
42e4b0a90eSBrooks Davis 
43e4b0a90eSBrooks Davis uint32_t lib_version = G_LIB_VERSION;
44e4b0a90eSBrooks Davis uint32_t version = G_RAID_VERSION;
45e4b0a90eSBrooks Davis 
46e4b0a90eSBrooks Davis struct g_command class_commands[] = {
47e4b0a90eSBrooks Davis 	{ "label", G_FLAG_VERBOSE, NULL,
48e4b0a90eSBrooks Davis 	    {
49e4b0a90eSBrooks Davis 		{ 'f', "force", NULL, G_TYPE_BOOL },
50e4b0a90eSBrooks Davis 		{ 'o', "fmtopt", G_VAL_OPTIONAL, G_TYPE_STRING },
51e4b0a90eSBrooks Davis 		{ 'S', "size", G_VAL_OPTIONAL, G_TYPE_NUMBER },
52e4b0a90eSBrooks Davis 		{ 's', "strip", G_VAL_OPTIONAL, G_TYPE_NUMBER },
53e4b0a90eSBrooks Davis 		G_OPT_SENTINEL
54e4b0a90eSBrooks Davis 	    },
55e4b0a90eSBrooks Davis 	    "[-fv] [-o fmtopt] [-S size] [-s stripsize] format label level prov ..."
56e4b0a90eSBrooks Davis 	},
57e4b0a90eSBrooks Davis 	{ "add", G_FLAG_VERBOSE, NULL,
58e4b0a90eSBrooks Davis 	    {
59e4b0a90eSBrooks Davis 		{ 'f', "force", NULL, G_TYPE_BOOL },
60e4b0a90eSBrooks Davis 		{ 'S', "size", G_VAL_OPTIONAL, G_TYPE_NUMBER },
61e4b0a90eSBrooks Davis 		{ 's', "strip", G_VAL_OPTIONAL, G_TYPE_NUMBER },
62e4b0a90eSBrooks Davis 		G_OPT_SENTINEL
63e4b0a90eSBrooks Davis 	    },
64e4b0a90eSBrooks Davis 	    "[-fv] [-S size] [-s stripsize] name label level"
65e4b0a90eSBrooks Davis 	},
66e4b0a90eSBrooks Davis 	{ "delete", G_FLAG_VERBOSE, NULL,
67e4b0a90eSBrooks Davis 	    {
68e4b0a90eSBrooks Davis 		{ 'f', "force", NULL, G_TYPE_BOOL },
69e4b0a90eSBrooks Davis 		G_OPT_SENTINEL
70e4b0a90eSBrooks Davis 	    },
71e4b0a90eSBrooks Davis 	    "[-fv] name [label|num]"
72e4b0a90eSBrooks Davis 	},
73e4b0a90eSBrooks Davis 	{ "insert", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
74e4b0a90eSBrooks Davis 	    "[-v] name prov ..."
75e4b0a90eSBrooks Davis 	},
76e4b0a90eSBrooks Davis 	{ "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
77e4b0a90eSBrooks Davis 	    "[-v] name prov ..."
78e4b0a90eSBrooks Davis 	},
79e4b0a90eSBrooks Davis 	{ "fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
80e4b0a90eSBrooks Davis 	    "[-v] name prov ..."
81e4b0a90eSBrooks Davis 	},
82e4b0a90eSBrooks Davis 	{ "stop", G_FLAG_VERBOSE, NULL,
83e4b0a90eSBrooks Davis 	    {
84e4b0a90eSBrooks Davis 		{ 'f', "force", NULL, G_TYPE_BOOL },
85e4b0a90eSBrooks Davis 		G_OPT_SENTINEL
86e4b0a90eSBrooks Davis 	    },
87e4b0a90eSBrooks Davis 	    "[-fv] name"
88e4b0a90eSBrooks Davis 	},
89e4b0a90eSBrooks Davis 	G_CMD_SENTINEL
90e4b0a90eSBrooks Davis };
91e4b0a90eSBrooks Davis 
92