hwdet::LinuxDetector::DriveInfo Class Reference

Helper class which stores details about one drive device. More...


Public Member Functions

 DriveInfo (const char *dev_name)
 Read data from proc.
String GetFullDeviceName (void) const
 Get full path to the device.
DiskDriveGetDiskDrive (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.


Detailed Description

Helper class which stores details about one drive device.

This class is able to read info about device from the files in /proc/ide/<devicename>/ directory.


Constructor & Destructor Documentation

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.

Parameters:
dev_name Name of the drive's device.


Member Function Documentation

DiskDrive * hwdet::LinuxDetector::DriveInfo::GetDiskDrive ( void   )  const

Convert data to DiskDrive structure.

Create new instance of the DiskDrive class on the heap.

Returns:
Pointer to the DiskDrive class which contains same data as this class.

String hwdet::LinuxDetector::DriveInfo::GetFullDeviceName ( void   )  const

Get full path to the device.

Returns:
Full path to the device for the drive.

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.


Field Documentation

std::string hwdet::LinuxDetector::DriveInfo::base_path [private]

Path to the directory with drive info in proc.

char hwdet::LinuxDetector::DriveInfo::device_name[DEVICE_NAME_LENGTH]

Name of the device.

const size_t hwdet::LinuxDetector::DriveInfo::DEVICE_NAME_LENGTH = 16 [static]

Length of the device name string.

String hwdet::LinuxDetector::DriveInfo::media

Media name.

String hwdet::LinuxDetector::DriveInfo::model

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.


The documentation for this class was generated from the following files:
Generated on Tue Dec 19 17:43:51 2006 for Detector for Linux by  doxygen 1.4.7