Class LinuxHWDiskStoreJNA
java.lang.Object
oshi.hardware.common.AbstractHWDiskStore
oshi.hardware.common.platform.linux.LinuxHWDiskStore
oshi.hardware.platform.linux.LinuxHWDiskStoreJNA
- All Implemented Interfaces:
HWDiskStore
JNA-based Linux hard disk implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from class LinuxHWDiskStore
LinuxHWDiskStore.UdevStatModifier and TypeClassDescriptionprotected static enumField ordering in udev stat output. -
Field Summary
Fields inherited from class LinuxHWDiskStore
BLOCK, DEVICE_MAPPER, DISK, DM_LV_NAME, DM_NAME, DM_UUID, DM_VG_NAME, ENCRYPTED_VOLUME, ID_FS_LABEL, ID_FS_TYPE, ID_FS_UUID, ID_MODEL, ID_SERIAL_SHORT, LOGICAL_VOLUME_GROUP, MAJOR, MINOR, PARTITION, SECTORSIZE, SIZE, STAT, UDEV_STAT_LENGTH, UDEV_STAT_ORDERSModifier 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. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<HWDiskStore> getDisks()Gets the disks on this machinebooleanMake a best effort to update all the statistics about the drive without needing to recreate the drive list.Methods inherited from class LinuxHWDiskStore
addDeviceMapperPartition, computeDiskStats, finalizePartitions, getDependentNamesFromHoldersDirectory, getDmDevicePath, getModelForDmDevice, getMountPointForDmDevice, getMountPointOfDmDevice, getMutablePartitionList, getPartitionNameForDmDevice, isEncryptedVolume, isLogicalVolume, readMountsMapModifier 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, toStringModifier and TypeMethodDescriptionlongThe length of the disk queue (#I/O's in progress).The type of the disk, such as SSD, HDD, Removable, Virtual, or Unknown.getModel()The disk modelgetName()The disk nameThe partitions on this disk.longThe number of bytes read from the disklonggetReads()The number of reads from the diskThe disk serial number, if available.longgetSize()The size of the disklongThe time this disk's statistics were updated.longThe time spent reading or writing, in milliseconds.longThe number of bytes written to the disklongThe number of writes to the diskprotected voidsetCurrentQueueLength(long currentQueueLength) Sets the current queue length.protected voidsetDiskStats(long reads, long readBytes, long writes, long writeBytes, long currentQueueLength, long transferTime, long timeStamp) Sets the disk statistics.protected voidsetPartitionList(List<HWPartition> partitionList) Sets the partition list.protected voidsetReadBytes(long readBytes) Sets the read bytes.protected voidsetReads(long reads) Sets the reads.protected voidsetTimeStamp(long timeStamp) Sets the timestamp.protected voidsetTransferTime(long transferTime) Sets the transfer time.protected voidsetWriteBytes(long writeBytes) Sets the write bytes.protected voidsetWrites(long writes) Sets the writes.toString()
-
Method Details
-
getDisks
Gets the disks on this machine- Returns:
- a list of
HWDiskStoreobjects representing the disks
-
updateAttributes
public boolean updateAttributes()Description copied from interface:HWDiskStoreMake a best effort to update all the statistics about the drive without needing to recreate the drive list. This method provides for more frequent periodic updates of individual drive statistics but may be less efficient to use if updating all drives. It will not detect if a removable drive has been removed and replaced by a different drive in between method calls.- Returns:
- True if the update was (probably) successful, false if the disk was not found
-