New returns a new Paths struct containing filepath fields relative to the supplied Context
(ctx context.Context)
| 79 | // New returns a new Paths struct containing filepath fields relative to the |
| 80 | // supplied Context |
| 81 | func New(ctx context.Context) *Paths { |
| 82 | roots := PathRootsFromContext(ctx) |
| 83 | chroot := config.Chroot(ctx) |
| 84 | return &Paths{ |
| 85 | SysRoot: filepath.Join(chroot, roots.Sys), |
| 86 | VarLog: filepath.Join(chroot, roots.Var, "log"), |
| 87 | ProcMeminfo: filepath.Join(chroot, roots.Proc, "meminfo"), |
| 88 | ProcCpuinfo: filepath.Join(chroot, roots.Proc, "cpuinfo"), |
| 89 | ProcMounts: filepath.Join(chroot, roots.Proc, "self", "mounts"), |
| 90 | SysKernelMMHugepages: filepath.Join(chroot, roots.Sys, "kernel", "mm", "hugepages"), |
| 91 | SysBlock: filepath.Join(chroot, roots.Sys, "block"), |
| 92 | SysDevicesSystemNode: filepath.Join(chroot, roots.Sys, "devices", "system", "node"), |
| 93 | SysDevicesSystemMemory: filepath.Join(chroot, roots.Sys, "devices", "system", "memory"), |
| 94 | SysDevicesSystemCPU: filepath.Join(chroot, roots.Sys, "devices", "system", "cpu"), |
| 95 | SysBusPciDevices: filepath.Join(chroot, roots.Sys, "bus", "pci", "devices"), |
| 96 | SysBusUsbDevices: filepath.Join(chroot, roots.Sys, "bus", "usb", "devices"), |
| 97 | SysClassDRM: filepath.Join(chroot, roots.Sys, "class", "drm"), |
| 98 | SysClassDMI: filepath.Join(chroot, roots.Sys, "class", "dmi"), |
| 99 | SysClassNet: filepath.Join(chroot, roots.Sys, "class", "net"), |
| 100 | RunUdevData: filepath.Join(chroot, roots.Run, "udev", "data"), |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func (p *Paths) NodeCPU(nodeID int, lpID int) string { |
| 105 | return filepath.Join( |