CVSROOT:        /cvs
Module name:    src
Changes by:     k...@cvs.openbsd.org    2020/01/03 12:45:51

Modified files:
        usr.sbin/ldomctl: ldomctl.c 

Log message:
Move code into new hv_config(), defer to commands needing it

This moves setup code from main() into its own function so instead of
upfront it can be used only when and where needed.

With the exception of `create-vdisk' all currently open /dev/hvctl;  for
that command I added a rather quirky goto to avoid this unneeded step,
but `list-io' for example does not need /dev/hvctl at all either.

So instead of adding more quirks, split as per above and clearly call
hv_config() from the commands that *do* require it.

This also effectively defers such privileged operations after all argv[]
parsing is done, that is the code fails earlier on invalid input without
file I/O for nothing.

With that in, I can easily add more commands not requiring hvctl access,
e.g. a dry-run configuration check.

OK kettenis

Reply via email to