Skip to content
Snippets Groups Projects
Commit 40c3cc0e authored by samm2's avatar samm2
Browse files

FreeBSD: corrected open flags for 3ware devices, replaced all perror() with set_err()

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2947 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 4a07acda
No related branches found
No related tags found
No related merge requests found
...@@ -217,7 +217,7 @@ bool freebsd_smart_device::open() ...@@ -217,7 +217,7 @@ bool freebsd_smart_device::open()
{ {
const char *dev = get_dev_name(); const char *dev = get_dev_name();
if ((m_fd = ::open(dev,O_RDONLY))<0) { if ((m_fd = ::open(dev,O_RDONLY))<0) {
perror("open failed"); set_err(errno);
return false; return false;
} }
return true; return true;
...@@ -289,7 +289,7 @@ bool freebsd_atacam_device::open(){ ...@@ -289,7 +289,7 @@ bool freebsd_atacam_device::open(){
const char *dev = get_dev_name(); const char *dev = get_dev_name();
if ((m_camdev = cam_open_device(dev, O_RDWR)) == NULL) { if ((m_camdev = cam_open_device(dev, O_RDWR)) == NULL) {
perror("cam_open_device"); set_err(errno);
return false; return false;
} }
set_fd(m_camdev->fd); set_fd(m_camdev->fd);
...@@ -534,6 +534,7 @@ public: ...@@ -534,6 +534,7 @@ public:
protected: protected:
virtual int ata_command_interface(smart_command_set command, int select, char * data); virtual int ata_command_interface(smart_command_set command, int select, char * data);
virtual bool open();
private: private:
int m_escalade_type; ///< Type string for escalade_command_interface(). int m_escalade_type; ///< Type string for escalade_command_interface().
...@@ -552,6 +553,19 @@ freebsd_escalade_device::freebsd_escalade_device(smart_interface * intf, const c ...@@ -552,6 +553,19 @@ freebsd_escalade_device::freebsd_escalade_device(smart_interface * intf, const c
set_info().info_name = strprintf("%s [3ware_disk_%02d]", dev_name, disknum); set_info().info_name = strprintf("%s [3ware_disk_%02d]", dev_name, disknum);
} }
bool freebsd_escalade_device::open()
{
const char *dev = get_dev_name();
int fd;
if ((fd = ::open(dev,O_RDWR))<0) {
set_err(errno);
return false;
}
set_fd(fd);
return true;
}
int freebsd_escalade_device::ata_command_interface(smart_command_set command, int select, char * data) int freebsd_escalade_device::ata_command_interface(smart_command_set command, int select, char * data)
{ {
// to hold true file descriptor // to hold true file descriptor
...@@ -828,7 +842,7 @@ bool freebsd_highpoint_device::open() ...@@ -828,7 +842,7 @@ bool freebsd_highpoint_device::open()
int fd; int fd;
if ((fd = ::open(dev,O_RDWR))<0) { if ((fd = ::open(dev,O_RDWR))<0) {
perror("open failed"); set_err(errno);
return false; return false;
} }
set_fd(fd); set_fd(fd);
...@@ -1016,7 +1030,7 @@ bool freebsd_scsi_device::open(){ ...@@ -1016,7 +1030,7 @@ bool freebsd_scsi_device::open(){
const char *dev = get_dev_name(); const char *dev = get_dev_name();
if ((m_camdev = cam_open_device(dev, O_RDWR)) == NULL) { if ((m_camdev = cam_open_device(dev, O_RDWR)) == NULL) {
perror("cam_open_device"); set_err(errno);
return false; return false;
} }
set_fd(m_camdev->fd); set_fd(m_camdev->fd);
...@@ -1157,7 +1171,7 @@ bool freebsd_cciss_device::open() ...@@ -1157,7 +1171,7 @@ bool freebsd_cciss_device::open()
return false; return false;
#endif #endif
if ((fd = ::open(dev,O_RDWR))<0) { if ((fd = ::open(dev,O_RDWR))<0) {
perror("open failed"); set_err(errno);
return false; return false;
} }
set_fd(fd); set_fd(fd);
...@@ -1789,7 +1803,7 @@ smart_device * freebsd_smart_interface::autodetect_smart_device(const char * nam ...@@ -1789,7 +1803,7 @@ smart_device * freebsd_smart_interface::autodetect_smart_device(const char * nam
{ // our disk device is CAM { // our disk device is CAM
if ((cam_dev = cam_open_device(name, O_RDWR)) == NULL) { if ((cam_dev = cam_open_device(name, O_RDWR)) == NULL) {
// open failure // open failure
perror("cam_open_device"); set_err(errno);
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment