freebsd-dev/sbin
Kirk McKusick 68bff4a07e Allow GEOM utilities to specify a -v option.
Geom utilities (geli(8), glabel(8), gmirror(8), gpart(8), gmirror(8),
gmountver(8), etc) all use the geom(8) utility as their back end
to process their commands and pass them into the kernel. Creating
a new utility requires no more than filling out a template describing
the commands and arguments that the utility supports. Consider the
specification for the very simple gmountver(8) utility:

struct g_command class_commands[] = {
	{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
	    {
		G_OPT_SENTINEL
	    },
	    "[-v] prov ..."
	},
	{ "destroy", G_FLAG_VERBOSE, NULL,
	    {
		{ 'f', "force", NULL, G_TYPE_BOOL },
		G_OPT_SENTINEL
	    },
	    "[-fv] name"
	},
	G_CMD_SENTINEL
};

It has just two commands of its own: "create" and "destroy" along
with the four standard commands "list", "status", "load", and
"unload" provided by the base geom(8) utility. The base geom(8)
utility allows each command to use the G_FLAG_VERBOSE flag to specify
that a command should accept the -v flag and when the -v flag is
given the utility prints "Done." if the command completes successfully.
In the above example, both of the commands set the G_FLAG_VERBOSE,
so have the -v option available. In addition the "destroy" command
accepts the -f boolean flag to force the destruction.

If the "destroy" command wanted to also print out verbose information,
it would need to explicitly declare its intent by adding a line:

		{ 'v', "verbose", NULL, G_TYPE_BOOL },

Before this change, the geom utility would silently ignore the above
line in the configuration file, so it was impossible for the utility
to know that the -v flag had been set on the command. With this
change a geom command can explicitly specify a -v option with a
line as given above and handle it as it would any other option. If
both a -v option and G_FLAG_VERBOSE are specified for a command
then both types of verbose information will be output when that
command is run with -v.

MFC after:    1 week
Sponsored by: Netflix
2021-10-28 22:50:50 -07:00
..
adjkerntz various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
bectl bectl(8): don't allow creation of boot environments with spaces 2021-06-03 08:36:11 -08:00
bsdlabel Remove deprecated GEOM classes 2019-08-13 20:06:55 +00:00
camcontrol camcontrol(8): Clean up references to removed symbols 2021-10-20 00:32:54 -04:00
ccdconfig ccdconfig: Move VCS tags to be more consistent with our style. 2017-12-30 00:26:42 +00:00
clri In preparation for adding inode check-hashes, clean up and 2018-11-13 21:40:56 +00:00
comcontrol Remove sio(4). 2019-11-21 01:24:49 +00:00
conscontrol Remove sio(4). 2019-11-21 01:24:49 +00:00
ddb ddb: use 'textdump dump' instead of 'call doadump' 2019-10-18 12:32:01 +00:00
decryptcore decryptcore: do not include sys/sysctl.h 2021-03-07 17:29:03 -06:00
devd devd(8): Note default config file search locations 2021-10-19 00:37:40 -04:00
devfs add documentation that the rules need to be reloaded, and how to do it... 2020-12-01 23:25:21 +00:00
devmatch devmatch: Ignore the pnp fields tagged as ignore ('#') 2021-08-10 15:47:55 -06:00
dhclient dhclient: skip_to_semi() consumes semicolon already 2021-08-19 09:11:38 -04:00
dmesg
dump Correct assert added to dump program. 2021-05-17 16:34:53 -07:00
dumpfs dumpfs(8): add option to only print superblock information 2021-07-02 14:18:17 -08:00
dumpon dumpon: fix build on some architectures 2021-08-11 21:27:24 -05:00
etherswitchcfg etherswitch: Add a new striptagingress port flag 2021-08-03 12:07:48 +02:00
fdisk Remove deprecated GEOM classes 2019-08-13 20:06:55 +00:00
ffsinfo ffsinfo: Update example to avoid to-be-deprecated vinum 2021-04-03 16:29:14 -04:00
fsck Fix a few mandoc issues 2020-10-09 14:03:45 +00:00
fsck_ffs Avoid lost buffers in fsck_ffs. 2021-10-07 15:52:58 -07:00
fsck_msdosfs Use %ju and cast to (uintmax_t) to avoid using PRI* macros. 2020-09-28 04:30:31 +00:00
fsdb Revert "fsdb: add missing bufinit() call" 2021-05-28 18:51:25 -08:00
fsirand Filesystem utilities that modify the filesystem (growfs(8), tunefs(8), 2020-10-25 01:36:33 +00:00
gbde gbde(8) - simplify randomisation with arc4random_buf 2019-02-11 00:11:02 +00:00
geom Allow GEOM utilities to specify a -v option. 2021-10-28 22:50:50 -07:00
ggate pkgbase: Create a FreeBSD-ggate package 2021-09-07 10:17:28 +02:00
growfs add Xr to the rc.d script... 2021-04-06 16:32:57 -07:00
gvinum gvinum: add deprecation notice 2021-03-28 14:45:05 -04:00
hastctl various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
hastd hastd(8) assumes it has no extra file descriptors opened 2020-11-29 13:45:53 +00:00
ifconfig ifconfig: Minor documentation fix 2021-05-03 14:38:52 +03:00
init init: execute /etc/rc.final after all user processes have terminated 2021-07-22 23:26:11 -05:00
ipf ncurses: chase dependency changes in the source tree 2021-10-04 11:38:24 +02:00
ipfw ipfw: Introduce dnctl 2021-09-08 17:17:50 +02:00
kldconfig kldconfig(8): Add EXAMPLES to the man page 2020-09-29 17:52:15 +00:00
kldload kldload(8): Improve phrasing 2021-02-11 06:03:53 +01:00
kldstat kldstat(8): Add EXAMPLES to the man page 2020-09-02 18:15:57 +00:00
kldunload various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
ldconfig ldconfig(8): update manpage to reality 2021-05-21 19:51:18 +03:00
md5 md5(1): Fix a typo in the manual page 2021-08-14 14:48:39 +02:00
mdconfig md: Add MD_MUSTDEALLOC support 2021-09-11 20:04:52 +08:00
mdmfs mdmfs(8): Fix an issue reported by mandoc 2020-10-03 18:47:50 +00:00
mknod
mksnap_ffs Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
mount mount: make libxo support more locale-aware 2021-09-27 07:12:26 +02:00
mount_cd9660 Advise reader to also see mdconfig(8) in mount_cd9660(8). 2018-08-11 08:34:24 +00:00
mount_fusefs sbin/mount_fusefs/mount_fusefs.8: Fix typos 2021-10-09 09:02:39 -06:00
mount_msdosfs Fix a few mandoc issues 2020-10-09 14:03:45 +00:00
mount_nfs mount_nfs.8: Add information for "nconnect" to man page 2021-07-11 13:34:16 -07:00
mount_nullfs mount_nullfs: rename a local variable 2021-02-12 11:30:52 -07:00
mount_udf
mount_unionfs
natd
newfs Explain the newfs naming convention 2021-04-17 23:16:17 +02:00
newfs_msdos Fix makefs bootstrap on macOS after D25563 2020-08-25 13:30:24 +00:00
nfsiod pkgbase: Add nfsiod to the FreeBSD-nfs package 2021-08-06 14:37:35 +02:00
nos-tun pkgbase: Create a FreeBSD-utilities package and make it the default one 2019-09-05 14:15:47 +00:00
nvmecontrol nvmecontrol: Display Metadata and Sanitize capabilities of the device 2021-09-21 21:15:55 +00:00
pfctl pfctl: delay label macro expansion until after rule optimisation 2021-10-15 22:19:45 +02:00
pfilctl pfilctl: improve formatting of "hooks" and "heads" command output. 2021-03-19 11:18:05 -07:00
pflogd
ping ping: fix parsing of options including '4' and '6' 2021-10-20 18:05:43 -06:00
ping6 Merge ping6 to ping 2020-11-26 04:29:30 +00:00
quotacheck Normally when an attempt is made to mount a UFS/FFS filesystem whose 2018-12-06 00:09:39 +00:00
rcorder [rcorder] [crunch] Fix C function declarations to include void 2020-09-21 17:59:45 +00:00
reboot nextboot: Improve the shell code used to figure out the zpool name 2021-06-05 14:32:18 +00:00
recoverdisk Register the bad read before bailing on terminal errors. 2021-02-02 12:01:38 +00:00
resolvconf
restore Clean up global variable declarations in the dump and restore 2020-04-04 00:56:56 +00:00
route socket: Implement SO_RERROR 2021-07-28 09:35:09 -07:00
routed sbin/routed: Remove unused code for sgi and NetBSD. 2020-12-25 17:42:47 -08:00
rtsol Update Makefile.depend files 2019-12-11 17:37:53 +00:00
savecore savecore: bail on write error even when decompressing 2020-12-11 22:52:12 +00:00
sconfig Fix sconfig(8) build. 2021-10-22 13:28:44 -07:00
setkey setkey: drop an unused argument from postproc 2021-07-08 14:00:55 +00:00
shutdown shutdown.8: Fix typo 2020-07-05 13:08:17 +00:00
swapon The -F flag of swapon(8) requires -a to work. 2020-05-19 12:16:44 +00:00
sysctl Fix building sysctl(8) after c78ad20 2021-05-01 11:10:03 +00:00
tests
tunefs Remove #define _KERNEL hacks from libprocstat 2021-02-21 11:38:21 +02:00
umount Document that umount -A does not unmount /dev 2020-06-18 23:12:55 +00:00
veriexec veriexec: Fix veriexec -i's confusion between loaded and locked states 2021-09-23 10:53:56 +02:00
zfsbootcfg loader: zfs should support bootonce an nextboot 2020-09-21 09:01:10 +00:00
Makefile Retire obsolete iscsi_initiator(4) 2021-10-26 16:17:35 -04:00
Makefile.amd64 Fix sconfig(8) build. 2021-10-22 13:28:44 -07:00
Makefile.arm
Makefile.i386 NVME support is only for x86 and powerpc64. 2018-06-14 01:15:19 +00:00
Makefile.inc build: provide a default WARNS for all in-tree builds 2020-09-18 17:17:46 +00:00
Makefile.mips
Makefile.powerpc64 NVME support is only for x86 and powerpc64. 2018-06-14 01:15:19 +00:00