typedef.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package diskinfo
  2. // Disk represents a disk device with its attributes.
  3. type Disk struct {
  4. Name string `json:"name"` // Name of the disk, e.g. sda
  5. Identifier string `json:"identifier"` // Disk identifier, e.g. 0x12345678
  6. Model string `json:"model"` // Disk model, e.g. Samsung SSD 860 EVO 1TB
  7. Size int64 `json:"size"` // Size of the disk in bytes
  8. Used int64 `json:"used"` // Used space in bytes, calculated from partitions
  9. Free int64 `json:"free"` // Free space in bytes, calculated as Size - Used
  10. DiskLabel string `json:"disklabel"` // Disk label type, e.g. gpt
  11. BlockType string `json:"blocktype"` // Type of the block device, e.g. disk
  12. Partitions []*Partition `json:"partitions"` // List of partitions on the disk
  13. }
  14. // Partition represents a partition on a disk with its attributes.
  15. type Partition struct {
  16. UUID string `json:"uuid"` // UUID of the file system
  17. PartUUID string `json:"partuuid"` // Partition UUID
  18. PartLabel string `json:"partlabel"` // Partition label
  19. Name string `json:"name"` // Name of the partition, e.g. sda1
  20. Path string `json:"path"` // Path of the partition, e.g. /dev/sda1
  21. Size int64 `json:"size"` // Size of the partition in bytes
  22. Used int64 `json:"used"` // Used space in bytes
  23. Free int64 `json:"free"` // Free space in bytes
  24. BlockSize int `json:"blocksize"` // Block size in bytes, e.g. 4096
  25. BlockType string `json:"blocktype"` // Type of the block device, e.g. part
  26. FsType string `json:"fstype"` // File system type, e.g. ext4
  27. MountPoint string `json:"mountpoint"` // Mount point of the partition, e.g. /mnt/data
  28. }
  29. // Block represents a block device with its attributes.
  30. type Block struct {
  31. UUID string `json:"uuid"`
  32. Name string `json:"name"`
  33. Path string `json:"path"`
  34. Size int64 `json:"size"`
  35. BlockSize int `json:"blocksize"`
  36. BlockType string `json:"blocktype"`
  37. FsType string `json:"fstype"`
  38. MountPoint string `json:"mountpoint"`
  39. }