Make better use of the shutdown flags. In particular this now handles
standard reboot where RB_POWERCYCLE is not set. For RB_HALT, perform a
shutdown. Typically this flag would halt/busy-loop the machine, but for
Xen guests I think a poweroff is more sensible.
Give the function a prefix while here.