IsBlockdevPath checks if the provided path is a block device.
(pathName string)
| 266 | |
| 267 | // IsBlockdevPath checks if the provided path is a block device. |
| 268 | func IsBlockdevPath(pathName string) bool { |
| 269 | sb, err := os.Stat(pathName) |
| 270 | if err != nil { |
| 271 | return false |
| 272 | } |
| 273 | |
| 274 | fm := sb.Mode() |
| 275 | return ((fm&os.ModeDevice != 0) && (fm&os.ModeCharDevice == 0)) |
| 276 | } |
| 277 | |
| 278 | // GetMountinfo tracks down the mount entry for the path and returns all MountInfo fields. |
| 279 | func GetMountinfo(path string) ([]string, error) { |
no test coverage detected
searching dependent graphs…