Class LinuxHWDiskStore
java.lang.Object
oshi.hardware.common.AbstractHWDiskStore
oshi.hardware.common.platform.linux.LinuxHWDiskStore
- All Implemented Interfaces:
HWDiskStore
- Direct Known Subclasses:
LinuxHWDiskStoreNF
Linux hard disk implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumField ordering in udev stat output. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringSysfs block device type.protected static final StringDevice-mapper description string.protected static final StringSysfs disk device type.protected static final StringDevice-mapper logical volume name property.protected static final StringDevice-mapper name property.protected static final StringDevice-mapper UUID property.protected static final StringDevice-mapper volume group name property.protected static final StringEncrypted volume description string.protected static final StringUdev filesystem label property.protected static final StringUdev filesystem type property.protected static final StringUdev filesystem UUID property.protected static final StringUdev model property.protected static final StringUdev serial number property.protected static final StringLogical volume group description string.protected static final StringUdev MAJOR property.protected static final StringUdev MINOR property.protected static final StringSysfs partition device type.protected static final intSector size in bytes.protected static final StringSysfs size file name.protected static final StringSysfs stat file name.protected static final intNumber of fields in udev stat output.protected static final int[]Ordering array for parsing udev stat fields. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLinuxHWDiskStore(String name, String model, String serial, long size) Creates a LinuxHWDiskStore with unknown disk type.protectedLinuxHWDiskStore(String name, String model, String serial, long size, String diskType) Creates a LinuxHWDiskStore. -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddDeviceMapperPartition(LinuxHWDiskStore store, Map<String, String> mountsMap, String dmUuid, String vgName, String lvName, String dmName, String devnode, String sysname, String sysPath, String fsType, String fsUuid, String fsLabel, long size, int major, int minor) Adds a partition entry for a supported device-mapper device.protected static voidcomputeDiskStats(LinuxHWDiskStore store, String devstat) Computes and sets disk statistics from a stat string.protected static voidfinalizePartitions(List<HWDiskStore> result) Sorts and makes partition lists unmodifiable for all disk stores.protected static StringGets dependent device names from the holders directory.protected static StringgetDmDevicePath(String dmName, String devnode) Gets the preferred path for a device-mapper device.protected static StringgetModelForDmDevice(String dmUuid) Gets the model description for a device-mapper device.protected static StringgetMountPointForDmDevice(Map<String, String> mountsMap, String dmName, String devnode, String sysPath) Gets the mount point for a device-mapper device.protected static StringgetMountPointOfDmDevice(String vgName, String lvName) Gets the mount point path for a device-mapper device.protected List<HWPartition> Gets the mutable partition list for building.protected static StringgetPartitionNameForDmDevice(String vgName, String lvName) Gets the partition name for a device-mapper device.protected static booleanisEncryptedVolume(String dmUuid) Checks whether a device-mapper UUID identifies an encrypted volume.protected static booleanisLogicalVolume(String dmUuid) Checks whether a device-mapper UUID identifies an LVM logical volume.Reads /proc/mounts into a map of device to mount point.Methods inherited from class AbstractHWDiskStore
getCurrentQueueLength, getDiskType, getModel, getName, getPartitions, getReadBytes, getReads, getSerial, getSize, getTimeStamp, getTransferTime, getWriteBytes, getWrites, setCurrentQueueLength, setDiskStats, setPartitionList, setReadBytes, setReads, setTimeStamp, setTransferTime, setWriteBytes, setWrites, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface HWDiskStore
updateAttributes
-
Field Details
-
BLOCK
-
DISK
-
PARTITION
-
STAT
-
SIZE
-
MINOR
-
MAJOR
-
ID_FS_TYPE
-
ID_FS_UUID
-
ID_FS_LABEL
-
ID_MODEL
-
ID_SERIAL_SHORT
-
DM_UUID
-
DM_NAME
-
DM_VG_NAME
-
DM_LV_NAME
-
LOGICAL_VOLUME_GROUP
Logical volume group description string.- See Also:
-
ENCRYPTED_VOLUME
-
DEVICE_MAPPER
-
SECTORSIZE
protected static final int SECTORSIZESector size in bytes.- See Also:
-
UDEV_STAT_ORDERS
protected static final int[] UDEV_STAT_ORDERSOrdering array for parsing udev stat fields. -
UDEV_STAT_LENGTH
protected static final int UDEV_STAT_LENGTHNumber of fields in udev stat output.
-
-
Constructor Details
-
LinuxHWDiskStore
-
LinuxHWDiskStore
-
-
Method Details
-
getMutablePartitionList
Gets the mutable partition list for building.- Returns:
- the mutable partition list
-
computeDiskStats
Computes and sets disk statistics from a stat string.- Parameters:
store- the disk store to updatedevstat- the stat string from sysfs or /proc/diskstats
-
readMountsMap
-
getPartitionNameForDmDevice
-
getMountPointOfDmDevice
-
getModelForDmDevice
-
isLogicalVolume
Checks whether a device-mapper UUID identifies an LVM logical volume.- Parameters:
dmUuid- the device-mapper UUID- Returns:
- whether the UUID identifies an LVM logical volume
-
isEncryptedVolume
Checks whether a device-mapper UUID identifies an encrypted volume.- Parameters:
dmUuid- the device-mapper UUID- Returns:
- whether the UUID identifies an encrypted volume
-
getDmDevicePath
-
getMountPointForDmDevice
protected static String getMountPointForDmDevice(Map<String, String> mountsMap, String dmName, String devnode, String sysPath) Gets the mount point for a device-mapper device.- Parameters:
mountsMap- the map of device paths to mount pointsdmName- the device-mapper namedevnode- the device node pathsysPath- the sysfs path for the device- Returns:
- the mount point or dependent device names
-
addDeviceMapperPartition
protected static void addDeviceMapperPartition(LinuxHWDiskStore store, Map<String, String> mountsMap, String dmUuid, String vgName, String lvName, String dmName, String devnode, String sysname, String sysPath, String fsType, String fsUuid, String fsLabel, long size, int major, int minor) Adds a partition entry for a supported device-mapper device.- Parameters:
store- the disk store to updatemountsMap- the map of device paths to mount pointsdmUuid- the device-mapper UUIDvgName- the LVM volume group namelvName- the LVM logical volume namedmName- the device-mapper namedevnode- the device node pathsysname- the sysfs device namesysPath- the sysfs path for the devicefsType- the filesystem typefsUuid- the filesystem UUIDfsLabel- the filesystem labelsize- the partition size in bytesmajor- the major device IDminor- the minor device ID
-
getDependentNamesFromHoldersDirectory
-
finalizePartitions
Sorts and makes partition lists unmodifiable for all disk stores.- Parameters:
result- the list of disk stores to finalize
-