xref: /freebsd/lib/geom/union/geom_union.c (revision d5b0e70f7e04d971691517ce1304d86a1e367e2e)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2022 Marshall Kirk McKusick <mckusick@mckusick.com>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #include <stdio.h>
29 #include <stdint.h>
30 #include <libgeom.h>
31 #include <geom/union/g_union.h>
32 
33 #include "core/geom.h"
34 
35 uint32_t lib_version = G_LIB_VERSION;
36 uint32_t version = G_UNION_VERSION;
37 
38 struct g_command class_commands[] = {
39 	{ "create", G_FLAG_LOADKLD, NULL,
40 	    {
41 		{ 'o', "offset", "0", G_TYPE_NUMBER },
42 		{ 's', "size", "0", G_TYPE_NUMBER },
43 		{ 'S', "secsize", "0", G_TYPE_NUMBER },
44 		{ 'v', "verbose", NULL, G_TYPE_BOOL },
45 		{ 'Z', "gunionname", G_VAL_OPTIONAL, G_TYPE_STRING },
46 		G_OPT_SENTINEL
47 	    },
48 	    "[-v] [-o offset] [-s size] [-S secsize] [-Z gunionname] "
49 	    "upperdev lowerdev"
50 	},
51 	{ "destroy", 0, NULL,
52 	    {
53 		{ 'f', "force", NULL, G_TYPE_BOOL },
54 		{ 'v', "verbose", NULL, G_TYPE_BOOL },
55 		G_OPT_SENTINEL
56 	    },
57 	    "[-fv] prov ..."
58 	},
59 	{ "reset", 0, NULL,
60 	    {
61 		{ 'v', "verbose", NULL, G_TYPE_BOOL },
62 		G_OPT_SENTINEL
63 	    },
64 	    "[-v] prov ..."
65 	},
66 	{ "commit", 0, NULL,
67 	    {
68 		{ 'f', "force", NULL, G_TYPE_BOOL },
69 		{ 'r', "reboot", NULL, G_TYPE_BOOL },
70 		{ 'v', "verbose", NULL, G_TYPE_BOOL },
71 		G_OPT_SENTINEL
72 	    },
73 	    "[-frv] prov ..."
74 	},
75 	{ "revert", 0, NULL,
76 	    {
77 		{ 'v', "verbose", NULL, G_TYPE_BOOL },
78 		G_OPT_SENTINEL
79 	    },
80 	    "[-v] prov ..."
81 	},
82 	G_CMD_SENTINEL
83 };
84