mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-02 05:54:26 +01:00
Not all hypervisors support filesystem sharing. Add capability flags to track this. Since most hypervisor implementations in Kata *do* support this, the set semantices are reversed (ie, set the flag if you do not support the feature). Fixes: #1022 Signed-off-by: Eric Ernst <eric.ernst@intel.com> Signed-off-by: Julio Montes <julio.montes@intel.com>
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
// Copyright (c) 2017 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package virtcontainers
|
|
|
|
const (
|
|
blockDeviceSupport = 1 << iota
|
|
blockDeviceHotplugSupport
|
|
multiQueueSupport
|
|
fsSharingUnsupported
|
|
)
|
|
|
|
type capabilities struct {
|
|
flags uint
|
|
}
|
|
|
|
func (caps *capabilities) isBlockDeviceSupported() bool {
|
|
if caps.flags&blockDeviceSupport != 0 {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (caps *capabilities) setBlockDeviceSupport() {
|
|
caps.flags = caps.flags | blockDeviceSupport
|
|
}
|
|
|
|
func (caps *capabilities) isBlockDeviceHotplugSupported() bool {
|
|
if caps.flags&blockDeviceHotplugSupport != 0 {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (caps *capabilities) setBlockDeviceHotplugSupport() {
|
|
caps.flags |= blockDeviceHotplugSupport
|
|
}
|
|
|
|
func (caps *capabilities) isMultiQueueSupported() bool {
|
|
if caps.flags&multiQueueSupport != 0 {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (caps *capabilities) setMultiQueueSupport() {
|
|
caps.flags |= multiQueueSupport
|
|
}
|
|
|
|
func (caps *capabilities) isFsSharingSupported() bool {
|
|
return caps.flags&fsSharingUnsupported == 0
|
|
}
|
|
|
|
func (caps *capabilities) setFsSharingUnsupported() {
|
|
caps.flags |= fsSharingUnsupported
|
|
}
|