]> sourceware.org Git - lvm2.git/commit
args: add priorities for grouping args
authorPeter Rajnoha <prajnoha@redhat.com>
Fri, 17 Jun 2016 09:03:14 +0000 (11:03 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 20 Jun 2016 09:33:42 +0000 (11:33 +0200)
commitd23c5b93183675199ff78ff288e4bbd12f935515
treec68443a95f832a63f9454e82baf9cbb077c362f7
parent9c37b7ed7c33bb6e66daf369fd563c52f6743282
args: add priorities for grouping args

Groupable args (the ones marked with ARG_GROUPABLE flag) start a new
group of args if:
  - this is the first time we hit such a groupable arg,
  - or if non-countable arg is repeated.

However, there may be cases where we want to give priorities when
forming groups and hence force new group creation if we hit an arg
with higher grouping priority.

For example, let's assume (for now) hypothetical sequence of args used:

  lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name

Without giving any priorites, we end up with:

  lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name
     |                            | |                           | |          |
     \__________GROUP1___________/   \________GROUP2___________/   \_GROUP3_/

This is because we hit "-o" as the first groupable arg. The --configreport,
even though it's groupable too, it falls into the previous "-o" group.

While we may need to give priority to the --configreport arg that should
always start a new group in this scenario instead:

  lvs -o lv_name --configreport log -o log_type --configreport lv -o +vg_name
      |         | |                            | |                           |
      \_GROUP1_/   \_________GROUP2___________/   \_________GROUP3__________/

So here "-o" started a new group but since "--configreport" has higher
priority than "-o", it starts fresh new group now and hence the rest of
the command line's args are grouped by --configreport now.
WHATS_NEW
tools/args.h
tools/lvmcmdline.c
tools/tools.h
This page took 0.039063 seconds and 5 git commands to generate.