[PATCH v1 1/2] nvme/rc: Parse optional arguments in _nvme_connect_subsys()
Chaitanya Kulkarni
chaitanyak at nvidia.com
Mon Mar 20 22:16:25 PDT 2023
On 3/20/2023 10:38 AM, Daniel Wagner wrote:
> Extend the nvme_connect_subsys() function to parse optional arguments.
> This avoids that all test have to pass in always all arguments.
>
> Signed-off-by: Daniel Wagner <dwagner at suse.de>
> ---
> tests/nvme/rc | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 210a82aea384..8f4b4601c44e 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -316,6 +316,42 @@ _nvme_disconnect_subsys() {
> }
>
> _nvme_connect_subsys() {
> + local positional_args=()
> +
> + local nr_io_queues=""
> + local nr_write_queues=""
> + local nr_poll_queues=""
> +
> + while [[ $# -gt 0 ]]; do
> + case $1 in
> + -i|--nr-io-queues)
> + nr_io_queues="$2"
> + shift
> + shift
> + ;;
> + -W|--nr-write-queues)
> + nr_write_queues="$2"
> + shift
> + shift
> + ;;
> + -P|--nr-poll-queues)
> + nr_poll_queues="$2"
> + shift
> + shift
> + ;;
> + -*|--*)
> + echo "Unknown option $1"
> + exit 1
> + ;;
> + *)
> + positional_args+=("$1")
> + shift
> + ;;
> + esac
> + done
> +
> + set -- "${positional_args[@]}"
> +
> local trtype="$1"
> local subsysnqn="$2"
> local traddr="${3:-$def_traddr}"
can we please have all variable declarations at the start of the
function then add the actual code instead of adding in between
different variable declarations ??
-ck
More information about the Linux-nvme
mailing list