Support_vsock: only need to check whether device 'vhost_vsock' exists

QEMU opens /dev/vhost-vsock and this causes vhost_vsock.ko to be
automatically loaded.
So, checking the existence of /dev/vhost-vsock is enough.

Fixes: #1512

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
This commit is contained in:
Penny Zheng 2019-05-10 14:51:28 +08:00
parent 9ab09f9c2d
commit f21d5a37fe

View File

@ -29,9 +29,6 @@ const MibToBytesShift = 20
// See unix(7). // See unix(7).
const MaxSocketPathLen = 107 const MaxSocketPathLen = 107
// VSockDevicePath path to vsock device
var VSockDevicePath = "/dev/vsock"
// VHostVSockDevicePath path to vhost-vsock device // VHostVSockDevicePath path to vhost-vsock device
var VHostVSockDevicePath = "/dev/vhost-vsock" var VHostVSockDevicePath = "/dev/vhost-vsock"
@ -234,10 +231,6 @@ func BuildSocketPath(elements ...string) (string, error) {
// SupportsVsocks returns true if vsocks are supported, otherwise false // SupportsVsocks returns true if vsocks are supported, otherwise false
func SupportsVsocks() bool { func SupportsVsocks() bool {
if _, err := os.Stat(VSockDevicePath); err != nil {
return false
}
if _, err := os.Stat(VHostVSockDevicePath); err != nil { if _, err := os.Stat(VHostVSockDevicePath); err != nil {
return false return false
} }