From 7f71d529b83c31635b99451a7b431fb455c5a93c Mon Sep 17 00:00:00 2001 From: Bipin B Narayan Date: Thu, 16 Jan 2025 17:09:25 +0530 Subject: [PATCH] Storage: add new field `removable` Denotes if a block device is removable or not. --- storage.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage.go b/storage.go index eaee7a7..7911589 100644 --- a/storage.go +++ b/storage.go @@ -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,omitempty"` } func getSerial(name, fullpath string) (serial string) { @@ -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) } }