Public Member Functions | |
DriveInfo (const char *dev_name) | |
Read data from proc. | |
String | GetFullDeviceName (void) const |
Get full path to the device. | |
DiskDrive * | GetDiskDrive (void) const |
Convert data to DiskDrive structure. | |
Data Fields | |
char | device_name [DEVICE_NAME_LENGTH] |
Name of the device. | |
unsigned long long | size |
Total size of the drive. | |
String | media |
Media name. | |
String | model |
Model name. | |
Static Public Attributes | |
static const unsigned long long | SECTOR_SIZE = 512 |
Size of the one sector on drive. | |
static const size_t | DEVICE_NAME_LENGTH = 16 |
Length of the device name string. | |
Private Member Functions | |
void | ReadSize (void) |
Read info about size of the drive. | |
void | ReadMedia (void) |
Read media type info. | |
void | ReadModel (void) |
Read model info. | |
Private Attributes | |
std::string | base_path |
Path to the directory with drive info in proc. |
This class is able to read info about device from the files in /proc/ide/<devicename>/ directory.
hwdet::LinuxDetector::DriveInfo::DriveInfo | ( | const char * | dev_name | ) |
Read data from proc.
This will read files that store information about given drive from the proc filesystem. Note that this works for IDE devices only.
dev_name | Name of the drive's device. |
DiskDrive * hwdet::LinuxDetector::DriveInfo::GetDiskDrive | ( | void | ) | const |
String hwdet::LinuxDetector::DriveInfo::GetFullDeviceName | ( | void | ) | const |
Get full path to the device.
void hwdet::LinuxDetector::DriveInfo::ReadMedia | ( | void | ) | [private] |
Read media type info.
Read data from the /proc/ide/<devicename>/media file. This file contains only one line which contains type of the media in the drive.
void hwdet::LinuxDetector::DriveInfo::ReadModel | ( | void | ) | [private] |
Read model info.
Reads data from the /proc/ide/<devicename>/model file. This file contains only one line with the model name of the device.
void hwdet::LinuxDetector::DriveInfo::ReadSize | ( | void | ) | [private] |
Read info about size of the drive.
Reads data from /proc/ide/<devicename>/capacity file which contains only one number which represents size of the drive in sectors.
std::string hwdet::LinuxDetector::DriveInfo::base_path [private] |
Path to the directory with drive info in proc.
Name of the device.
const size_t hwdet::LinuxDetector::DriveInfo::DEVICE_NAME_LENGTH = 16 [static] |
Length of the device name string.
Media name.
Model name.
const unsigned long long hwdet::LinuxDetector::DriveInfo::SECTOR_SIZE = 512 [static] |
Size of the one sector on drive.
unsigned long long hwdet::LinuxDetector::DriveInfo::size |
Total size of the drive.