31int deviceopen(
const char *pathname,
char *type);
60 virtual bool is_open()
const override;
62 virtual bool open()
override;
64 virtual bool close()
override;
92 set_err((errno==ENOENT || errno==ENOTDIR) ? ENODEV : errno);
130 return ::ata_command_interface(
get_fd(), command, select,
data);
150 const char * dev_name,
const char * req_type)
183 unsigned char req_buff[64] = {0, };
192 set_err(EIO,
"INQUIRY failed");
197 int avail_len = req_buff[4] + 5;
198 int len = (avail_len < req_len ? avail_len : req_len);
227 const char * pattern = 0)
override;
242 if (!strcmp(appname,
"smartctl"))
273 for (
int i = 0; i < numdevs; i++) {
281 const char * type,
const char * pattern )
284 set_err(EINVAL,
"DEVICESCAN with pattern not implemented yet");
289 char * * atanames = 0;
int numata = 0;
290 if (!type || !strcmp(type,
"ata")) {
298 char * * scsinames = 0;
int numscsi = 0;
299 if (!type || !strcmp(type,
"scsi")) {
312 for (i = 0; i < numata; i++) {
319 for (i = 0; i < numscsi; i++) {
Adapter class to implement new ATA pass through old interface.
Implement standard ATA support with old functions.
virtual int ata_command_interface(smart_command_set command, int select, char *data)
Old ATA interface called by ata_pass_through()
legacy_ata_device(smart_interface *intf, const char *dev_name, const char *req_type)
Implement standard SCSI support with old functions.
virtual bool scsi_pass_through(scsi_cmnd_io *iop) override
SCSI pass through.
virtual smart_device * autodetect_open() override
SCSI open with autodetection support.
legacy_scsi_device(smart_interface *intf, const char *dev_name, const char *req_type)
Implement shared open/close routines with old functions.
int get_fd() const
Return filedesc for derived classes.
virtual bool is_open() const override
Return true if device is open.
legacy_smart_device(const char *mode)
virtual bool close() override
Close device, return false on error.
const char * m_mode
Mode string for deviceopen().
int m_fd
filedesc, -1 if not open.
virtual ~legacy_smart_device()
virtual bool open() override
Open device, return false on error.
Implement platform interface with old functions.
virtual bool scan_smart_devices(smart_device_list &devlist, const char *type, const char *pattern=0) override
Fill 'devlist' with devices of some 'type' with device names specified by some optional 'pattern'.
virtual ata_device * get_ata_device(const char *name, const char *type) override
Return standard ATA device.
virtual smart_device * autodetect_smart_device(const char *name) override
Autodetect device if no device type specified.
virtual std::string get_app_examples(const char *appname) override
Return example string for program 'appname'.
virtual scsi_device * get_scsi_device(const char *name, const char *type) override
Return standard SCSI device.
List of devices for DEVICESCAN.
void push_back(smart_device *dev)
Base class for all devices.
smart_interface * smi()
Get interface which produced this object.
const char * get_req_type() const
Get type requested by user, empty if none.
bool set_err(int no, const char *msg,...) __attribute_format_printf(3
Set last error number and message.
const char * get_dev_name() const
Get device (path)name.
The platform interface abstraction.
static void set(smart_interface *intf)
Set interface to use, must be called from init().
static void init()
Initialize platform interface and register with smi().
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.
bool set_err(int no, const char *msg,...) __attribute_format_printf(3
Set last error number and message.
#define DEV_INTERFACE_H_CVSID
int make_device_names(char ***devlist, const char *name)
int deviceopen(const char *pathname, char *type)
int do_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io *iop, int report)
const char * dev_legacy_cpp_cvsid
int ata_command_interface(int device, smart_command_set command, int select, char *data)
int guess_device_type(const char *dev_name)
void print_smartctl_examples()
static int make_device_names(char ***devlist, const char *name)
static void free_devnames(char **devnames, int numdevs)
int scsiStdInquiry(scsi_device *device, uint8_t *pBuf, int bufLen)
unsigned char scsi_debugmode