[PATCH v2 13/35] qemu: attach/detach device: Move 'virCheckFlags' to top level functions