runtime: add hugepages support

Add hugepages support, port from:
b486387cba

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
Signed-off-by: bin <bin@hyper.sh>
This commit is contained in:
bin
2021-12-23 14:02:11 +08:00
parent 7df677c01e
commit 81a8baa5e5
9 changed files with 168 additions and 11 deletions

View File

@@ -96,11 +96,12 @@ const (
procDeviceIndex = iota
procPathIndex
procTypeIndex
procOptionIndex
)
// GetDevicePathAndFsType gets the device for the mount point and the file system type
// of the mount.
func GetDevicePathAndFsType(mountPoint string) (devicePath, fsType string, err error) {
// GetDevicePathAndFsTypeOptions gets the device for the mount point, the file system type
// and mount options
func GetDevicePathAndFsTypeOptions(mountPoint string) (devicePath, fsType string, fsOptions []string, err error) {
if mountPoint == "" {
err = fmt.Errorf("Mount point cannot be empty")
return
@@ -134,6 +135,7 @@ func GetDevicePathAndFsType(mountPoint string) (devicePath, fsType string, err e
if mountPoint == fields[procPathIndex] {
devicePath = fields[procDeviceIndex]
fsType = fields[procTypeIndex]
fsOptions = strings.Split(fields[procOptionIndex], ",")
return
}
}