Try to reduce number of shell callouts to the bare minimum.
It's slightly more ugly but use setvar to set return values where possible.
Over the top 1000-round testing showed almost a second for $(), and near instant
for setvar. The following functions now take a variable name and set that rather than
echo'ing the response, so can be called inline rather than via $().
__switch_get_ident
__config_get
__vm_running_check
__vm_find_console
__vm_get_disk_path
Also use ${var%%} & ${var##} to parse slot/func numbers from passthru devices rather
than callout to echo/cut.
Replace spaces with tabs
Change __nat_init function name to match other functions in the switch library
Completely rewrite guest support, making vm-core logic much cleaner
Guests are now supported via the lib/vm-guest library
Each guest has a function which unifies the install/run logic in once place rather than two.
Loaders now run in the background; Not 100% ideal in some cases but better for most.
This also fixes the small tap0 issue which will now only present itself if you start a guest
with no networking
All guests need more testing with these changes but should be functional.
Switches now only created if they don't exist so init no longer requires
vmm.ko to be unloaded. Multiple init runs will just do nothing.
Switches have been updated to add a dash to the end of the interface
description. This stops the possibility of the wrong switch being used
if one switch has a name that is a substring of another - eg "int" &
"internet".