github.com/jaypipes/ghw@v0.21.1/pkg/snapshot/clonetree_gpu_linux.go (about) 1 // 2 // Use and distribution licensed under the Apache license version 2. 3 // 4 // See the COPYING file in the root project directory for full text. 5 // 6 7 package snapshot 8 9 import ( 10 "strings" 11 ) 12 13 // ExpectedCloneGPUContent returns a slice of strings pertaining to the GPU devices ghw 14 // cares about. We cannot use a static list because we want to grab only the first cardX data 15 // (see comment in pkg/gpu/gpu_linux.go) 16 // Additionally, we want to make sure to clone the backing device data. 17 func ExpectedCloneGPUContent() []string { 18 cardEntries := []string{ 19 "device", 20 } 21 22 filterName := func(cardName string) bool { 23 if !strings.HasPrefix(cardName, "card") { 24 return false 25 } 26 if strings.ContainsRune(cardName, '-') { 27 return false 28 } 29 return true 30 } 31 32 return cloneContentByClass("drm", cardEntries, filterName, filterNone) 33 }