https://github.com/akhilerm/device-hierarchy
Sysfs parser library to get blockdevice topology
https://github.com/akhilerm/device-hierarchy
golang linux sysfs
Last synced: about 1 month ago
JSON representation
Sysfs parser library to get blockdevice topology
- Host: GitHub
- URL: https://github.com/akhilerm/device-hierarchy
- Owner: akhilerm
- License: apache-2.0
- Created: 2019-10-18T09:19:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-29T07:26:07.000Z (over 6 years ago)
- Last Synced: 2024-05-28T21:04:44.265Z (about 2 years ago)
- Topics: golang, linux, sysfs
- Language: Go
- Size: 15.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Device Topology
A simple package that parses the sysfs directory to obtain the blockdevice topology.
The project is still in **Alpha** stage.
Usage:
- To use as a binary, build the code
```
go build -o topo main.go
./topo /dev/sdb
```
- To use as a package. Import the `topology` package and create a `Device` object using the device path.
This will be used to get the dependent devices.
Terms used:
1. `Holders` : Holders are the list of blockdevices that are held by the given blockdevice.
eg: `/dev/sda1` is held by `/dev/sda` since it is a partition. Therefore the holder list of `/dev/sda` will have `/dev/sda1`
2. `Slaves` : Slaves are the list of blockdevices to which the given device acts as a slave.
eg: `/dev/sda1` is a slave for `/dev/sda`. Therefore slave list of `/dev/sda1` will contain `/dev/sda`