mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-02 03:28:28 -04:00
90291bd627
ppd, and some things. Add a simple wpa_supplicant backend
30 lines
648 B
Go
30 lines
648 B
Go
package trash
|
|
|
|
import "golang.org/x/sys/unix"
|
|
|
|
// readMountPoints returns user-visible mount points via getfsstat(2),
|
|
// skipping pseudo and system filesystems.
|
|
func readMountPoints() []string {
|
|
n, err := unix.Getfsstat(nil, unix.MNT_NOWAIT)
|
|
if err != nil || n == 0 {
|
|
return nil
|
|
}
|
|
stats := make([]unix.Statfs_t, n)
|
|
n, err = unix.Getfsstat(stats, unix.MNT_NOWAIT)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
|
|
var out []string
|
|
seen := map[string]bool{}
|
|
for _, st := range stats[:n] {
|
|
mp := unix.ByteSliceToString(st.Mntonname[:])
|
|
if mp == "" || skipMountPoint(mp, seen) {
|
|
continue
|
|
}
|
|
seen[mp] = true
|
|
out = append(out, mp)
|
|
}
|
|
return out
|
|
}
|