sysfs: Add (empty) cpu directories for each cpu in /sys/devices/system/cpu.

Numpy needs these.

Also added the "present" directory, since the contents are the same as possible
and online.

PiperOrigin-RevId: 209451777
Change-Id: I2048de3f57bf1c57e9b5421d607ca89c2a173684
This commit is contained in:
Nicolas Lacasse
2018-08-20 11:19:15 -07:00
committed by Shentubot
parent 11800311a5
commit 0050e3e71c
+13 -3
View File
@@ -57,10 +57,20 @@ func newPossible(ctx context.Context, msrc *fs.MountSource) *fs.Inode {
}
func newCPU(ctx context.Context, msrc *fs.MountSource) *fs.Inode {
return newDir(ctx, msrc, map[string]*fs.Inode{
"possible": newPossible(ctx, msrc),
m := map[string]*fs.Inode{
"online": newPossible(ctx, msrc),
})
"possible": newPossible(ctx, msrc),
"present": newPossible(ctx, msrc),
}
// Add directories for each of the cpus.
if k := kernel.KernelFromContext(ctx); k != nil {
for i := 0; uint(i) < k.ApplicationCores(); i++ {
m[fmt.Sprintf("cpu%d", i)] = newDir(ctx, msrc, nil)
}
}
return newDir(ctx, msrc, m)
}
func newSystemDir(ctx context.Context, msrc *fs.MountSource) *fs.Inode {