From 798427280bfafd0561bcce8cbfe1a00d991ff037 Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Mon, 10 Apr 2023 14:36:57 +0200 Subject: [PATCH] Add documentation --- internal/configs/config_dracut.go | 1 + internal/configs/config_mkinitcpio.go | 1 + internal/configs/config_modprobe.go | 1 + internal/configs/config_vbios_dumper.go | 2 ++ internal/configs/config_vfio_video.go | 2 ++ internal/configs/configs.go | 4 ++++ 6 files changed, 11 insertions(+) diff --git a/internal/configs/config_dracut.go b/internal/configs/config_dracut.go index 1e7c137..0a87da5 100644 --- a/internal/configs/config_dracut.go +++ b/internal/configs/config_dracut.go @@ -9,6 +9,7 @@ import ( "github.com/HikariKnight/quickpassthrough/pkg/fileio" ) +// This function writes a dracut configuration file for /etc/dracut.conf.d/ func Set_Dracut() { config := GetConfig() diff --git a/internal/configs/config_mkinitcpio.go b/internal/configs/config_mkinitcpio.go index 7173356..369d1ab 100644 --- a/internal/configs/config_mkinitcpio.go +++ b/internal/configs/config_mkinitcpio.go @@ -10,6 +10,7 @@ import ( "github.com/HikariKnight/quickpassthrough/pkg/fileio" ) +// This function copies the content of /etc/mkinitcpio.conf to the config folder and does an inline replace/insert on the MODULES=() line func Set_Mkinitcpio() { // Get the config struct config := GetConfig() diff --git a/internal/configs/config_modprobe.go b/internal/configs/config_modprobe.go index 308e465..ba8cc3e 100644 --- a/internal/configs/config_modprobe.go +++ b/internal/configs/config_modprobe.go @@ -9,6 +9,7 @@ import ( "github.com/HikariKnight/quickpassthrough/pkg/fileio" ) +// This function generates a modprobe file for /etc/modprobe.d/ func Set_Modprobe(gpu_IDs []string) { // Get the config config := GetConfig() diff --git a/internal/configs/config_vbios_dumper.go b/internal/configs/config_vbios_dumper.go index 6328af6..afc4260 100644 --- a/internal/configs/config_vbios_dumper.go +++ b/internal/configs/config_vbios_dumper.go @@ -10,6 +10,8 @@ import ( "github.com/HikariKnight/quickpassthrough/internal/logger" ) +// Generates a script file named dump_vbios.sh and places it inside the utils folder. +// This script has to be run without a display manager or display server running func GenerateVBIOSDumper(vbios_path string) { // Get the config directories config := GetConfig() diff --git a/internal/configs/config_vfio_video.go b/internal/configs/config_vfio_video.go index d654d81..a439237 100644 --- a/internal/configs/config_vfio_video.go +++ b/internal/configs/config_vfio_video.go @@ -7,6 +7,8 @@ import ( "github.com/HikariKnight/quickpassthrough/pkg/fileio" ) +// This function adds the disable vfio video output on host option to the config +// The function will use the given int as the value for the option func DisableVFIOVideo(i int) { // Get the config config := GetConfig() diff --git a/internal/configs/configs.go b/internal/configs/configs.go index d720708..1602ede 100644 --- a/internal/configs/configs.go +++ b/internal/configs/configs.go @@ -29,6 +29,7 @@ type Config struct { Path *Path } +// Gets the path to all the config files func GetConfigPaths() *Path { Paths := &Path{ CMDLINE: "config/kernel_args", @@ -44,6 +45,7 @@ func GetConfigPaths() *Path { return Paths } +// Gets all the configs and returns the struct func GetConfig() *Config { config := &Config{ Bootloader: "unknown", @@ -57,6 +59,7 @@ func GetConfig() *Config { return config } +// Constructs the empty config files and folders based on what exists on the system func InitConfigs() { config := GetConfig() @@ -152,6 +155,7 @@ func InitConfigs() { } } +// Returns a list of modules used for vfio based on the systems kernel version func vfio_modules() []string { // Make the list of modules modules := []string{