/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2010 Alexander Motin <[email protected]>4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#include <sys/param.h>29#include <errno.h>30#include <paths.h>31#include <stdio.h>32#include <stdlib.h>33#include <stdint.h>34#include <string.h>35#include <strings.h>36#include <assert.h>37#include <libgeom.h>38#include <geom/raid/g_raid.h>39#include <core/geom.h>40#include <misc/subr.h>4142uint32_t lib_version = G_LIB_VERSION;43uint32_t version = G_RAID_VERSION;4445struct g_command class_commands[] = {46{ "label", G_FLAG_VERBOSE, NULL,47{48{ 'f', "force", NULL, G_TYPE_BOOL },49{ 'o', "fmtopt", G_VAL_OPTIONAL, G_TYPE_STRING },50{ 'S', "size", G_VAL_OPTIONAL, G_TYPE_NUMBER },51{ 's', "strip", G_VAL_OPTIONAL, G_TYPE_NUMBER },52G_OPT_SENTINEL53},54"[-fv] [-o fmtopt] [-S size] [-s stripsize] format label level prov ..."55},56{ "add", G_FLAG_VERBOSE, NULL,57{58{ 'f', "force", NULL, G_TYPE_BOOL },59{ 'S', "size", G_VAL_OPTIONAL, G_TYPE_NUMBER },60{ 's', "strip", G_VAL_OPTIONAL, G_TYPE_NUMBER },61G_OPT_SENTINEL62},63"[-fv] [-S size] [-s stripsize] name label level"64},65{ "delete", G_FLAG_VERBOSE, NULL,66{67{ 'f', "force", NULL, G_TYPE_BOOL },68G_OPT_SENTINEL69},70"[-fv] name [label|num]"71},72{ "insert", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,73"[-v] name prov ..."74},75{ "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,76"[-v] name prov ..."77},78{ "fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,79"[-v] name prov ..."80},81{ "stop", G_FLAG_VERBOSE, NULL,82{83{ 'f', "force", NULL, G_TYPE_BOOL },84G_OPT_SENTINEL85},86"[-fv] name"87},88G_CMD_SENTINEL89};90919293