smartmontools SVN Rev 5640
Utility to control and monitor storage systems with "S.M.A.R.T."
|
Linux interface. More...
Public Member Functions | |
virtual std::string | get_os_version_str () override |
Return info string about build host and/or OS version. | |
virtual std::string | get_app_examples (const char *appname) override |
Return example string for program 'appname'. | |
virtual bool | scan_smart_devices (smart_device_list &devlist, const smart_devtype_list &types, const char *pattern=0) override |
Fill 'devlist' with devices of all 'types' with device names specified by some optional 'pattern'. | |
Public Member Functions inherited from smart_interface | |
smart_interface () | |
virtual | ~smart_interface () |
virtual std::string | get_os_version_str () |
Return info string about build host and/or OS version. | |
virtual std::string | get_valid_dev_types_str () |
Return valid args for device type option/directive. | |
virtual std::string | get_app_examples (const char *appname) |
Return example string for program 'appname'. | |
virtual bool | disable_system_auto_standby (bool disable) |
Disable/Enable system auto standby/sleep mode. | |
const smart_device::error_info & | get_err () const |
Get last error info struct. | |
int | get_errno () const |
Get last error number. | |
const char * | get_errmsg () const |
Get last error message. | |
bool | set_err (int no, const char *msg,...) __attribute_format_printf(3 |
Set last error number and message. | |
bool decltype(nullptr) | set_err_np (int no, const char *msg,...) __attribute_format_printf(3 |
Set last error number and message. | |
bool decltype(nullptr) bool | set_err (const smart_device::error_info &err) |
Set last error info struct. | |
void | clear_err () |
Clear last error info. | |
bool | set_err (int no) |
Set last error number and default message. | |
bool | set_err_var (smart_device::error_info *err, int no) |
Set last error number and default message to any error_info. | |
virtual const char * | get_msg_for_errno (int no) |
Convert error number into message, used by set_err(no). | |
virtual smart_device * | get_smart_device (const char *name, const char *type) |
Return device object for device 'name' with some 'type'. | |
virtual bool | scan_smart_devices (smart_device_list &devlist, const char *type, const char *pattern=0) |
Fill 'devlist' with devices of some 'type' with device names specified by some optional 'pattern'. | |
virtual bool | scan_smart_devices (smart_device_list &devlist, const smart_devtype_list &types, const char *pattern=0) |
Fill 'devlist' with devices of all 'types' with device names specified by some optional 'pattern'. | |
virtual std::string | get_unique_dev_name (const char *name, const char *type) const |
Return unique device name which is (only) suitable for duplicate detection. | |
virtual bool | is_raid_dev_type (const char *type) const |
Return true if the 'type' string contains a RAID drive number. | |
virtual ata_device * | autodetect_sat_device (scsi_device *scsidev, const unsigned char *inqdata, unsigned inqsize) |
Try to detect a SAT device behind a SCSI interface. | |
virtual const char * | get_usb_dev_type_by_id (int vendor_id, int product_id, int version=-1) |
Get type name for USB device with known VENDOR:PRODUCT ID. | |
Protected Member Functions | |
virtual ata_device * | get_ata_device (const char *name, const char *type) override |
Return standard ATA device. | |
virtual scsi_device * | get_scsi_device (const char *name, const char *type) override |
Return standard SCSI device. | |
virtual nvme_device * | get_nvme_device (const char *name, const char *type, unsigned nsid) override |
Return standard NVMe device. | |
virtual smart_device * | autodetect_smart_device (const char *name) override |
Autodetect device if no device type specified. | |
virtual smart_device * | get_custom_smart_device (const char *name, const char *type) override |
Return device for platform specific 'type'. | |
virtual std::string | get_valid_custom_dev_types_str () override |
Return valid 'type' args accepted by above. | |
Protected Member Functions inherited from smart_interface | |
virtual ata_device * | get_ata_device (const char *name, const char *type)=0 |
Return standard ATA device. | |
virtual scsi_device * | get_scsi_device (const char *name, const char *type)=0 |
Return standard SCSI device. | |
virtual nvme_device * | get_nvme_device (const char *name, const char *type, unsigned nsid) |
Return standard NVMe device. | |
virtual smart_device * | autodetect_smart_device (const char *name)=0 |
Autodetect device if no device type specified. | |
virtual smart_device * | get_custom_smart_device (const char *name, const char *type) |
Return device for platform specific 'type'. | |
virtual std::string | get_valid_custom_dev_types_str () |
Return valid 'type' args accepted by above. | |
virtual smart_device * | get_scsi_passthrough_device (const char *type, scsi_device *scsidev) |
Return ATA->SCSI of NVMe->SCSI filter for a SAT, SNT or USB 'type'. | |
virtual ata_device * | get_sat_device (const char *type, scsi_device *scsidev) |
Return ATA->SCSI filter for a SAT or USB 'type'. | |
virtual nvme_device * | get_snt_device (const char *type, scsi_device *scsidev) |
Return NVMe->SCSI filter for a SNT or USB 'type'. | |
virtual ata_device * | get_intelliprop_device (const char *type, ata_device *atadev) |
Return filter for Intelliprop controllers. | |
virtual ata_device * | get_jmb39x_device (const char *type, smart_device *smartdev) |
Return JMB93x->ATA filter. | |
Private Member Functions | |
void | get_dev_list (smart_device_list &devlist, const char *pattern, bool scan_scsi, bool(*p_dev_sdxy_seen)[devxy_to_n_max+1], bool scan_nvme, const char *req_type, bool autodetect) |
bool | get_dev_megasas (smart_device_list &devlist) |
smart_device * | missing_option (const char *opt) |
int | megasas_dcmd_cmd (int bus_no, uint32_t opcode, void *buf, size_t bufsize, uint8_t *mbox, size_t mboxlen, uint8_t *statusp) |
int | megasas_pd_add_list (int bus_no, smart_device_list &devlist) |
bool | get_dev_sssraid (smart_device_list &devlist) |
int | sssraid_pd_add_list (int bus_no, smart_device_list &devlist) |
int | sssraid_pdlist_cmd (int bus_no, uint16_t start_idx, void *buf, size_t bufsize, uint8_t *statusp) |
Static Private Member Functions | |
static int | devxy_to_n (const char *name, bool debug) |
Static Private Attributes | |
static constexpr int | devxy_to_n_max = 701 |
Additional Inherited Members | |
Static Public Member Functions inherited from smart_interface | |
static void | init () |
Initialize platform interface and register with smi(). | |
Static Protected Member Functions inherited from smart_interface | |
static void | set (smart_interface *intf) |
Set interface to use, must be called from init(). | |
Linux interface.
Definition at line 2825 of file os_linux.cpp.
|
overrideprotectedvirtual |
Autodetect device if no device type specified.
Implements smart_interface.
Definition at line 3434 of file os_linux.cpp.
|
staticprivate |
Definition at line 2887 of file os_linux.cpp.
|
overridevirtual |
Return example string for program 'appname'.
Default implementation returns empty string. For the migration of print_smartctl_examples(), function is allowed to print examples to stdout. TODO: Remove this hack.
Reimplemented from smart_interface.
Definition at line 2877 of file os_linux.cpp.
|
overrideprotectedvirtual |
Return standard ATA device.
Implements smart_interface.
Definition at line 3150 of file os_linux.cpp.
|
overrideprotectedvirtual |
Return device for platform specific 'type'.
Default implementation returns 0.
Reimplemented from smart_interface.
Definition at line 3527 of file os_linux.cpp.
|
private |
Definition at line 2923 of file os_linux.cpp.
|
private |
Definition at line 2991 of file os_linux.cpp.
|
private |
Definition at line 3047 of file os_linux.cpp.
|
overrideprotectedvirtual |
Return standard NVMe device.
Default implementation returns 0.
Reimplemented from smart_interface.
Definition at line 3160 of file os_linux.cpp.
|
overridevirtual |
Return info string about build host and/or OS version.
Default implementation returns SMARTMONTOOLS_BUILD_HOST.
Reimplemented from smart_interface.
Definition at line 2868 of file os_linux.cpp.
|
overrideprotectedvirtual |
Return standard SCSI device.
Implements smart_interface.
Definition at line 3155 of file os_linux.cpp.
|
overrideprotectedvirtual |
Return valid 'type' args accepted by above.
This is called in get_valid_dev_types_str(). Default implementation returns empty string.
Reimplemented from smart_interface.
Definition at line 3619 of file os_linux.cpp.
|
private |
Definition at line 3172 of file os_linux.cpp.
|
private |
Definition at line 3229 of file os_linux.cpp.
|
private |
Definition at line 3166 of file os_linux.cpp.
|
overridevirtual |
Fill 'devlist' with devices of all 'types' with device names specified by some optional 'pattern'.
Use platform specific default if 'types' is empty. Return false on error. Default implementation calls above function for all types and concatenates the results.
Reimplemented from smart_interface.
Definition at line 3082 of file os_linux.cpp.
|
private |
Definition at line 3327 of file os_linux.cpp.
|
private |
Definition at line 3266 of file os_linux.cpp.
|
staticconstexprprivate |
Definition at line 2851 of file os_linux.cpp.