Merge pull request #216 from zstyblik/add-documentation

[disk]linux: add documentation for GetDiskSerialNumber()
This commit is contained in:
shirou 2016-06-13 22:54:23 +09:00 committed by GitHub
commit 93e9068485
1 changed files with 2 additions and 0 deletions

View File

@ -336,6 +336,8 @@ func IOCounters() (map[string]IOCountersStat, error) {
return ret, nil return ret, nil
} }
// GetDiskSerialNumber returns Serial Number of given device or empty string
// on error. Name of device is expected, eg. /dev/sda
func GetDiskSerialNumber(name string) string { func GetDiskSerialNumber(name string) string {
n := fmt.Sprintf("--name=%s", name) n := fmt.Sprintf("--name=%s", name)
udevadm, err := exec.LookPath("/sbin/udevadm") udevadm, err := exec.LookPath("/sbin/udevadm")