[disk]darwin,freebsd: implements 'all' argument.

pull/185/head
Shirou WAKAYAMA 9 years ago
parent ca99d7dc3f
commit f2ebb91cf0

@ -3,6 +3,7 @@
package disk package disk
import ( import (
"path"
"syscall" "syscall"
"unsafe" "unsafe"
@ -74,6 +75,12 @@ func Partitions(all bool) ([]PartitionStat, error) {
Fstype: common.IntToString(stat.Fstypename[:]), Fstype: common.IntToString(stat.Fstypename[:]),
Opts: opts, Opts: opts,
} }
if all == false {
if !path.IsAbs(d.Device) || !common.PathExists(d.Device) {
continue
}
}
ret = append(ret, d) ret = append(ret, d)
} }

@ -5,6 +5,7 @@ package disk
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"path"
"strconv" "strconv"
"syscall" "syscall"
"unsafe" "unsafe"
@ -81,6 +82,12 @@ func Partitions(all bool) ([]PartitionStat, error) {
Fstype: common.IntToString(stat.Fstypename[:]), Fstype: common.IntToString(stat.Fstypename[:]),
Opts: opts, Opts: opts,
} }
if all == false {
if !path.IsAbs(d.Device) || !common.PathExists(d.Device) {
continue
}
}
ret = append(ret, d) ret = append(ret, d)
} }

Loading…
Cancel
Save