Re: [PATCH 00/19 v2] mkfs cleaning

Jan Tulak
2016-06-03T12:09:44Z

[-- Attachment #1.1: Type: text/plain, Size: 1465 bytes --]

[
​snip all, another issue, unrelated to the lsunit one]​

>
​I realised one small glitch with conflicts watching in the code in
combination with flags. It is not regression, I think, because b​efore now,
it was not possible to do something like -l internal=0,logdev=something,
but now it should be possible.

The code checks only whether an option was seen, not its value, so it
does't know that we are in fact disabling something. I see two ways how to
do solve it. One is a custom conflict solving for these cases, putting some
if (flag1 && option2) somewhere once every argument and option is parsed.
But this goes against what the patchset did and moves it again out of the
option table...

The other way is to make a special case for flags in the conflicts-handling
code. Basically, I would extend the structure with something like:

{ .index = L_INTERNAL,
.conflicts = { L_FILE,
L_DEV,
LAST_CONFLICT },
.conflicts_ignore_on_false=true, // new item, shorter name to be found
.minval = 0,
.maxval = 1,
.defaultval = 1,
},

And then, if a conflict is found, it checks the value and if the value is
false/zero, then ignore the conflict. A more generic code would allow for
any given value, but I think that this would be useful only for flags, so
"on_false" and possibly "on_true" would be enough.

​Any comments?

Thanks,
Jan​

--
Jan Tulak
jtulak@redhat.com / jan@tulak.me

[-- Attachment #1.2: Type: text/html, Size: 3775 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]