mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
tunedasd: Implement zsh and bash autocompletion
Add generation of shell autocompletion scripts. Acked-by: Steffen Eiden <seiden@linux.ibm.com> Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Szabina Korbai <szkorbai@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
3b55ca085e
commit
af99efaab2
2
.gitignore
vendored
2
.gitignore
vendored
@@ -112,6 +112,8 @@ systemd/cpacfstatsd.service
|
||||
systemd/iucvtty-login@.service
|
||||
systemd/ttyrun-getty@.service
|
||||
tunedasd/src/tunedasd
|
||||
tunedasd/src/_tunedasd
|
||||
tunedasd/src/tunedasd.bash
|
||||
vmcp/vmcp
|
||||
vmur/vmur
|
||||
zconf/chp/chchp
|
||||
|
||||
104
tunedasd/include/tunedasd_cli.h
Normal file
104
tunedasd/include/tunedasd_cli.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright IBM Corp.
|
||||
*/
|
||||
|
||||
#ifndef TUNEDASD_CLI_H
|
||||
#define TUNEDASD_CLI_H
|
||||
|
||||
#include "lib/util_opt.h"
|
||||
|
||||
/* Defines for options with no short command */
|
||||
#define OPT_PATH_RESET_ALL 128
|
||||
#define OPT_ENABLE_STATS 129
|
||||
#define OPT_DISABLE_STATS 130
|
||||
|
||||
static struct util_opt opt_vec[] = {
|
||||
UTIL_OPT_SECTION("CACHING MODES (ECKD ONLY)"),
|
||||
{
|
||||
.option = { "cache", required_argument, NULL, 'c' },
|
||||
.argument = "BEHAVIOUR",
|
||||
.desc = "Specify caching behaviour on storage server: "
|
||||
"normal, bypass, inhibit, sequential, prestage, or record",
|
||||
},
|
||||
{
|
||||
.option = { "no_cyl", required_argument, NULL, 'n' },
|
||||
.argument = "NUM",
|
||||
.desc = "NUM cylinders to be cached (only valid with -c/--cache)",
|
||||
},
|
||||
{
|
||||
.option = { "get_cache", no_argument, NULL, 'g' },
|
||||
.desc = "Get current storage server caching behaviour",
|
||||
},
|
||||
UTIL_OPT_SECTION("RESERVE / RELEASE"),
|
||||
{
|
||||
.option = { "release", no_argument, NULL, 'L' },
|
||||
.desc = "Release device",
|
||||
},
|
||||
{
|
||||
.option = { "slock", no_argument, NULL, 'O' },
|
||||
.desc = "Unconditional reservce device\n"
|
||||
"NOTE: Use with care, this breaks an existing lock",
|
||||
},
|
||||
{
|
||||
.option = { "query_reserve", no_argument, NULL, 'Q' },
|
||||
.desc = "Print reserve status of device",
|
||||
},
|
||||
{
|
||||
.option = { "reserve", no_argument, NULL, 'S' },
|
||||
.desc = "Reserve device",
|
||||
},
|
||||
UTIL_OPT_SECTION("PERFORMANCE STATISTICS"),
|
||||
{
|
||||
.option = {
|
||||
"enable-stats", no_argument, NULL, OPT_ENABLE_STATS
|
||||
},
|
||||
.desc = "Enable performance statistics globally",
|
||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||
},
|
||||
{
|
||||
.option = {
|
||||
"disable-stats", no_argument, NULL, OPT_DISABLE_STATS
|
||||
},
|
||||
.desc = "Disable performance statistics globally",
|
||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||
},
|
||||
{
|
||||
.option = { "prof_item", required_argument, NULL, 'I' },
|
||||
.argument = "ROW",
|
||||
.desc = "Print single profile item: reqs, sects, sizes, total, "
|
||||
"totsect, start, irq, irqsect, end, or queue",
|
||||
},
|
||||
{
|
||||
.option = { "profile", no_argument, NULL, 'P' },
|
||||
.desc = "Print profile info of device",
|
||||
},
|
||||
{
|
||||
.option = { "reset_prof", no_argument, NULL, 'R' },
|
||||
.desc = "Reset profile info of device",
|
||||
},
|
||||
UTIL_OPT_SECTION("MISC"),
|
||||
{
|
||||
.option = { "path_reset", required_argument, NULL, 'p' },
|
||||
.argument = "CHPID",
|
||||
.desc = "Reset channel path CHPID of a device",
|
||||
},
|
||||
{
|
||||
.option = {
|
||||
"path_reset_all", no_argument, NULL, OPT_PATH_RESET_ALL
|
||||
},
|
||||
.desc = "Reset all channel paths of a device",
|
||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||
},
|
||||
{
|
||||
.option = { "copy-pair-swap", required_argument, NULL, 's' },
|
||||
.argument = "COPY_PAIR",
|
||||
.desc = "Swap a specified, comma separated copy pair.",
|
||||
},
|
||||
UTIL_OPT_HELP,
|
||||
UTIL_OPT_VERSION,
|
||||
UTIL_OPT_END
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,10 @@
|
||||
include ../../common.mak
|
||||
|
||||
zsh-completions = _tunedasd
|
||||
bash-completions = tunedasd.bash
|
||||
|
||||
include ../../common_autocomp.mak
|
||||
|
||||
ALL_CPPFLAGS += -I../include
|
||||
|
||||
libs = $(rootdir)/libdasd/libdasd.a \
|
||||
|
||||
16
tunedasd/src/autocompletion_generator_host.c
Normal file
16
tunedasd/src/autocompletion_generator_host.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright IBM Corp.
|
||||
*/
|
||||
|
||||
#include "lib/util_autocomp.h"
|
||||
|
||||
#include "../include/tunedasd_cli.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
generate_autocomp(opt_vec, "tunedasd");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "disk.h"
|
||||
#include "tunedasd.h"
|
||||
#include "tunedasd_cli.h"
|
||||
|
||||
static const struct util_prg prg = {
|
||||
.desc = "Adjust tunable DASD parameters. More than one DEVICE node can "
|
||||
@@ -36,98 +37,6 @@ static const struct util_prg prg = {
|
||||
}
|
||||
};
|
||||
|
||||
/* Defines for options with no short command */
|
||||
#define OPT_PATH_RESET_ALL 128
|
||||
#define OPT_ENABLE_STATS 129
|
||||
#define OPT_DISABLE_STATS 130
|
||||
|
||||
static struct util_opt opt_vec[] = {
|
||||
UTIL_OPT_SECTION("CACHING MODES (ECKD ONLY)"),
|
||||
{
|
||||
.option = { "cache", required_argument, NULL, 'c' },
|
||||
.argument = "BEHAVIOUR",
|
||||
.desc = "Specify caching behaviour on storage server: "
|
||||
"normal, bypass, inhibit, sequential, prestage, or record",
|
||||
},
|
||||
{
|
||||
.option = { "no_cyl", required_argument, NULL, 'n' },
|
||||
.argument = "NUM",
|
||||
.desc = "NUM cylinders to be cached (only valid with -c/--cache)",
|
||||
},
|
||||
{
|
||||
.option = { "get_cache", no_argument, NULL, 'g' },
|
||||
.desc = "Get current storage server caching behaviour",
|
||||
},
|
||||
UTIL_OPT_SECTION("RESERVE / RELEASE"),
|
||||
{
|
||||
.option = { "release", no_argument, NULL, 'L' },
|
||||
.desc = "Release device",
|
||||
},
|
||||
{
|
||||
.option = { "slock", no_argument, NULL, 'O' },
|
||||
.desc = "Unconditional reservce device\n"
|
||||
"NOTE: Use with care, this breaks an existing lock",
|
||||
},
|
||||
{
|
||||
.option = { "query_reserve", no_argument, NULL, 'Q' },
|
||||
.desc = "Print reserve status of device",
|
||||
},
|
||||
{
|
||||
.option = { "reserve", no_argument, NULL, 'S' },
|
||||
.desc = "Reserve device",
|
||||
},
|
||||
UTIL_OPT_SECTION("PERFORMANCE STATISTICS"),
|
||||
{
|
||||
.option = {
|
||||
"enable-stats", no_argument, NULL, OPT_ENABLE_STATS
|
||||
},
|
||||
.desc = "Enable performance statistics globally",
|
||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||
},
|
||||
{
|
||||
.option = {
|
||||
"disable-stats", no_argument, NULL, OPT_DISABLE_STATS
|
||||
},
|
||||
.desc = "Disable performance statistics globally",
|
||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||
},
|
||||
{
|
||||
.option = { "prof_item", required_argument, NULL, 'I' },
|
||||
.argument = "ROW",
|
||||
.desc = "Print single profile item: reqs, sects, sizes, total, "
|
||||
"totsect, start, irq, irqsect, end, or queue",
|
||||
},
|
||||
{
|
||||
.option = { "profile", no_argument, NULL, 'P' },
|
||||
.desc = "Print profile info of device",
|
||||
},
|
||||
{
|
||||
.option = { "reset_prof", no_argument, NULL, 'R' },
|
||||
.desc = "Reset profile info of device",
|
||||
},
|
||||
UTIL_OPT_SECTION("MISC"),
|
||||
{
|
||||
.option = { "path_reset", required_argument, NULL, 'p' },
|
||||
.argument = "CHPID",
|
||||
.desc = "Reset channel path CHPID of a device",
|
||||
},
|
||||
{
|
||||
.option = {
|
||||
"path_reset_all", no_argument, NULL, OPT_PATH_RESET_ALL
|
||||
},
|
||||
.desc = "Reset all channel paths of a device",
|
||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||
},
|
||||
{
|
||||
.option = { "copy-pair-swap", required_argument, NULL, 's' },
|
||||
.argument = "COPY_PAIR",
|
||||
.desc = "Swap a specified, comma separated copy pair.",
|
||||
},
|
||||
UTIL_OPT_HELP,
|
||||
UTIL_OPT_VERSION,
|
||||
UTIL_OPT_END
|
||||
};
|
||||
|
||||
#define CMD_KEYWORD_NUM 17
|
||||
#define DEVICES_NUM 256
|
||||
|
||||
|
||||
Reference in New Issue
Block a user