Skip to content

Commit

Permalink
Merge pull request #3 from RealImage/removable-blk
Browse files Browse the repository at this point in the history
Storage: Add flag for removable block devices
  • Loading branch information
PeaceRebel authored Jan 23, 2025
2 parents 6412909 + 7aa39ac commit e75baa0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type StorageDevice struct {
Model string `json:"model,omitempty"`
Serial string `json:"serial,omitempty"`
Size uint `json:"size,omitempty"` // device size in GB
Removable bool `json:"removable"`
}

func getSerial(name, fullpath string) (serial string) {
Expand Down Expand Up @@ -99,6 +100,9 @@ func (si *SysInfo) getStorageInfo() {
size, _ := strconv.ParseUint(slurpFile(path.Join(fullpath, "size")), 10, 64)
device.Size = uint(size) / 1953125 // GiB

removable, _ := strconv.ParseBool(slurpFile(path.Join(fullpath, "removable")))
device.Removable = removable

si.Storage = append(si.Storage, device)
}
}

0 comments on commit e75baa0

Please sign in to comment.