/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2004 Pawel Jakub Dawidek <[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#ifndef _GEOM_H_29#define _GEOM_H_30#define G_LIB_VERSION 53132/*33* The G_FLAG_VERBOSE flag on a command specification means that the34* command will accept a -v option and the GEOM framework will print35* out status information after the command when it is run with -v.36* Additionally a GEOM command can explicitly specify a -v option and37* handle it as it would any other option. If both a -v option and38* G_FLAG_VERBOSE are specified for a command then both types of verbose39* information will be output when that command is run with -v.40*41* When the G_FLAG_LOADKLD is specified for a command, the GEOM kernel42* module will be loaded when that command is run if it has not yet been43* loaded. This flag is typically specified for the `create' command.44*/45#define G_FLAG_NONE 0x000046#define G_FLAG_VERBOSE 0x000147#define G_FLAG_LOADKLD 0x00024849#define G_TYPE_NONE 0x0050#define G_TYPE_BOOL 0x0151#define G_TYPE_STRING 0x0252#define G_TYPE_NUMBER 0x0353#define G_TYPE_MASK 0x0f54#define G_TYPE_DONE 0x1055#define G_TYPE_MULTI 0x2056#define G_TYPE_NUMMASK 0xff0057#define G_TYPE_NUMSHIFT 85859#define G_OPT_MAX 1660#define G_OPT_DONE(opt) do { (opt)->go_type |= G_TYPE_DONE; } while (0)61#define G_OPT_ISDONE(opt) ((opt)->go_type & G_TYPE_DONE)62#define G_OPT_ISMULTI(opt) ((opt)->go_type & G_TYPE_MULTI)63#define G_OPT_TYPE(opt) ((opt)->go_type & G_TYPE_MASK)64#define G_OPT_NUM(opt) (((opt)->go_type & G_TYPE_NUMMASK) >> G_TYPE_NUMSHIFT)65#define G_OPT_NUMINC(opt) ((opt)->go_type += (1 << G_TYPE_NUMSHIFT))6667#define G_VAL_OPTIONAL ((void *)-1)6869#define G_OPT_SENTINEL { '\0', NULL, NULL, G_TYPE_NONE }70#define G_NULL_OPTS { G_OPT_SENTINEL }71#define G_CMD_SENTINEL { NULL, 0, NULL, G_NULL_OPTS, NULL }7273struct g_option {74char go_char;75const char *go_name;76const void *go_val;77unsigned go_type;78};7980struct g_command {81const char *gc_name;82unsigned gc_flags;83void (*gc_func)(struct gctl_req *, unsigned);84struct g_option gc_options[G_OPT_MAX];85const char *gc_usage;86};87#endif /* !_GEOM_H_ */888990