From dffce256370d5f6c4d2890b5f5e55ccec5416ce2 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 4 Jun 2024 10:25:49 +0200 Subject: [PATCH] Rename driver-root option to root This change renames the nvidia-ctk system create-device-nodes flag driver-root to root. This makes it clearer that this is used to load the kernel modules and is not specific to the user-mode driver installation. Signed-off-by: Evan Lezar --- .../create-device-nodes.go | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go b/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go index 6b3cf1f5..37ed45b0 100644 --- a/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go +++ b/cmd/nvidia-ctk/system/create-device-nodes/create-device-nodes.go @@ -31,8 +31,8 @@ type command struct { } type options struct { - driverRoot string - devRoot string + root string + devRoot string dryRun bool @@ -66,11 +66,15 @@ func (m command) build() *cli.Command { c.Flags = []cli.Flag{ &cli.StringFlag{ - Name: "driver-root", - Usage: "the path to the driver root. Device nodes will be created at `DRIVER_ROOT`/dev", + Name: "root", + // TODO: Remove this alias + Aliases: []string{"driver-root"}, + Usage: "the path to to the root to use to load the kernel modules. This root must be a chrootable path. " + + "If device nodes to be created these will be created at `ROOT`/dev unless an alternative path is specified", Value: "/", - Destination: &opts.driverRoot, - EnvVars: []string{"NVIDIA_DRIVER_ROOT", "DRIVER_ROOT"}, + Destination: &opts.root, + // TODO: Remove the NVIDIA_DRIVER_ROOT and DRIVER_ROOT envvars. + EnvVars: []string{"ROOT", "NVIDIA_DRIVER_ROOT", "DRIVER_ROOT"}, }, &cli.StringFlag{ Name: "dev-root", @@ -101,9 +105,9 @@ func (m command) build() *cli.Command { } func (m command) validateFlags(r *cli.Context, opts *options) error { - if opts.devRoot == "" && opts.driverRoot != "" { - m.logger.Infof("Using dev-root %q", opts.driverRoot) - opts.devRoot = opts.driverRoot + if opts.devRoot == "" && opts.root != "" { + m.logger.Infof("Using dev-root %q", opts.root) + opts.devRoot = opts.root } return nil } @@ -113,7 +117,7 @@ func (m command) run(c *cli.Context, opts *options) error { modules := nvmodules.New( nvmodules.WithLogger(m.logger), nvmodules.WithDryRun(opts.dryRun), - nvmodules.WithRoot(opts.driverRoot), + nvmodules.WithRoot(opts.root), ) if err := modules.LoadAll(); err != nil { return fmt.Errorf("failed to load NVIDIA kernel modules: %v", err)