@@ -45,6 +45,29 @@ func (h *Hook) Hooks() ([]Hook, error) {
4545 return []Hook {* h }, nil
4646}
4747
48+ type HookName string
49+
50+ // DisabledHooks allows individual hooks to be disabled.
51+ type DisabledHooks map [HookName ]bool
52+
53+ const (
54+ // HookEnableCudaCompat refers to the hook used to enable CUDA Forward Compatibility.
55+ // This was added with v1.17.5 of the NVIDIA Container Toolkit.
56+ HookEnableCudaCompat = HookName ("enable-cuda-compat" )
57+ // directory path to be mounted into a container.
58+ HookCreateSymlinks = HookName ("create-symlinks" )
59+ // HookUpdateLDCache refers to the hook used to Update the dynamic linker
60+ // cache inside the directory path to be mounted into a container.
61+ HookUpdateLDCache = HookName ("update-ldcache" )
62+ )
63+
64+ // AllHooks maintains a future-proof list of all defined hooks.
65+ var AllHooks = []HookName {
66+ HookEnableCudaCompat ,
67+ HookCreateSymlinks ,
68+ HookUpdateLDCache ,
69+ }
70+
4871// Option is a function that configures the nvcdilib
4972type Option func (* CDIHook )
5073
@@ -54,7 +77,7 @@ type CDIHook struct {
5477}
5578
5679type HookCreator interface {
57- Create (string , ... string ) * Hook
80+ Create (HookName , ... string ) * Hook
5881}
5982
6083func NewHookCreator (nvidiaCDIHookPath string , debugLogging bool ) HookCreator {
@@ -66,7 +89,7 @@ func NewHookCreator(nvidiaCDIHookPath string, debugLogging bool) HookCreator {
6689 return CDIHook
6790}
6891
69- func (c CDIHook ) Create (name string , args ... string ) * Hook {
92+ func (c CDIHook ) Create (name HookName , args ... string ) * Hook {
7093 if name == "create-symlinks" {
7194 if len (args ) == 0 {
7295 return nil
0 commit comments