diff options
Diffstat (limited to 'core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/kernel-cmdln.inc')
-rw-r--r-- | core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/kernel-cmdln.inc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/kernel-cmdln.inc b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/kernel-cmdln.inc new file mode 100644 index 00000000..aab49afe --- /dev/null +++ b/core/modules/qemu/data/opt/openslx/vmchooser/plugins/qemukvm/includes/kernel-cmdln.inc @@ -0,0 +1,29 @@ +# ----------------------------------------------------------------------------- +# +# Copyright (c) 2009..2021 bwLehrpool-Projektteam +# +# This program/file is free software distributed under the GPL version 2. +# See https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html +# +# If you have any feedback please consult https://bwlehrpool.de and +# send your feedback to support@bwlehrpool.de. +# +# General information about bwLehrpool can be found at https://bwlehrpool.de +# +# ----------------------------------------------------------------------------- +# Utils and functions to parse Linux kernel command line options +# ----------------------------------------------------------------------------- + +# Function to parse an option's value from the kernel command line +# Parameter 1: name of the kernel command line option +# Return : value of the kernel command line option +function kernel_cmdln_parse_option() { + grep -o "\b${1}=[^ ]*" /proc/cmdline | cut -d '=' -f 2 +} + +# Function to parse VFIO PCI-IDs from the kernel command line +# Return : PCI-IDs of the kernel command line as space separated string +function kernel_cmdln_parse_pci_ids() { + local passthrough_pci_ids="$(kernel_cmdln_parse_option "vfio-pci.ids")" + echo "${passthrough_pci_ids}" | tr ',' ' ' +} |