Skip to content
Snippets Groups Projects
Commit 3cb638c5 authored by ballen4705's avatar ballen4705
Browse files

Changed access to Read only from Read/Write.

In identify command, if WIN_IDENTITY fails, try WIN_PIDENTITY to get some
info about packet devices.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@71 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent f9d2b4fe
No related branches found
No related tags found
No related merge requests found
CHANGELOG for smartmontools CHANGELOG for smartmontools
$Id: CHANGELOG,v 1.9 2002/10/20 19:40:23 ballen4705 Exp $ $Id: CHANGELOG,v 1.10 2002/10/21 08:49:23 ballen4705 Exp $
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
...@@ -29,6 +29,8 @@ NOTES FOR NEXT RELEASE: ...@@ -29,6 +29,8 @@ NOTES FOR NEXT RELEASE:
smartmontools-5.0-11 smartmontools-5.0-11
device opened only in read-only not read-write mode. Don't need R/W
access to get smart data.
smartctl now handles all possible choices of "multiple options" smartctl now handles all possible choices of "multiple options"
gracefully. It goes through the following phases of operation, gracefully. It goes through the following phases of operation,
...@@ -37,6 +39,10 @@ smartmontools-5.0-11 ...@@ -37,6 +39,10 @@ smartmontools-5.0-11
operation. Control flow through ataPrintMain() operation. Control flow through ataPrintMain()
simplified. simplified.
If reading device identity information fails, try seeing if the info
can be accessed using a "DEVICE PACKET" command. This way we can
at least get device info.
Modified Makefile to automatically tag CVS archive on issuance of Modified Makefile to automatically tag CVS archive on issuance of
a release a release
......
// $Id: atacmds.c,v 1.10 2002/10/20 19:40:23 ballen4705 Exp $ // $Id: atacmds.c,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $
/* /*
* atacmds.c * atacmds.c
* *
...@@ -140,11 +140,13 @@ int ataReadHDIdentity (int device, struct hd_driveid *buf){ ...@@ -140,11 +140,13 @@ int ataReadHDIdentity (int device, struct hd_driveid *buf){
unsigned char parms[HDIO_DRIVE_CMD_HDR_SIZE+sizeof(*buf)]= unsigned char parms[HDIO_DRIVE_CMD_HDR_SIZE+sizeof(*buf)]=
{WIN_IDENTIFY, 0, 0, 1,}; {WIN_IDENTIFY, 0, 0, 1,};
if (ioctl(device ,HDIO_DRIVE_CMD,parms)){
parms[0]=WIN_PIDENTIFY;
if (ioctl(device ,HDIO_DRIVE_CMD,parms)){ if (ioctl(device ,HDIO_DRIVE_CMD,parms)){
perror ("ATA GET HD Identity Failed"); perror ("ATA GET HD Identity Failed");
return -1; return -1;
} }
}
// copy data into driveid structure // copy data into driveid structure
memcpy(buf,parms+HDIO_DRIVE_CMD_HDR_SIZE,sizeof(*buf)); memcpy(buf,parms+HDIO_DRIVE_CMD_HDR_SIZE,sizeof(*buf));
......
// $Id: atacmds.cpp,v 1.10 2002/10/20 19:40:23 ballen4705 Exp $ // $Id: atacmds.cpp,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $
/* /*
* atacmds.c * atacmds.c
* *
...@@ -140,11 +140,13 @@ int ataReadHDIdentity (int device, struct hd_driveid *buf){ ...@@ -140,11 +140,13 @@ int ataReadHDIdentity (int device, struct hd_driveid *buf){
unsigned char parms[HDIO_DRIVE_CMD_HDR_SIZE+sizeof(*buf)]= unsigned char parms[HDIO_DRIVE_CMD_HDR_SIZE+sizeof(*buf)]=
{WIN_IDENTIFY, 0, 0, 1,}; {WIN_IDENTIFY, 0, 0, 1,};
if (ioctl(device ,HDIO_DRIVE_CMD,parms)){
parms[0]=WIN_PIDENTIFY;
if (ioctl(device ,HDIO_DRIVE_CMD,parms)){ if (ioctl(device ,HDIO_DRIVE_CMD,parms)){
perror ("ATA GET HD Identity Failed"); perror ("ATA GET HD Identity Failed");
return -1; return -1;
} }
}
// copy data into driveid structure // copy data into driveid structure
memcpy(buf,parms+HDIO_DRIVE_CMD_HDR_SIZE,sizeof(*buf)); memcpy(buf,parms+HDIO_DRIVE_CMD_HDR_SIZE,sizeof(*buf));
......
// $Id: smartctl.c,v 1.10 2002/10/20 19:22:02 ballen4705 Exp $ // $Id: smartctl.c,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $
/* /*
* smartctl.c * smartctl.c
* *
...@@ -229,7 +229,7 @@ int main (int argc, char **argv){ ...@@ -229,7 +229,7 @@ int main (int argc, char **argv){
printf("is free software, and you are welcome to redistribute it\n"); printf("is free software, and you are welcome to redistribute it\n");
printf("under the terms of the GNU General Public License Version 2.\n"); printf("under the terms of the GNU General Public License Version 2.\n");
printf("See http://www.gnu.org for further details.\n\n"); printf("See http://www.gnu.org for further details.\n\n");
printf("CVS version ID %s\n","$Id: smartctl.c,v 1.10 2002/10/20 19:22:02 ballen4705 Exp $"); printf("CVS version ID %s\n","$Id: smartctl.c,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $");
if (argc==2) if (argc==2)
exit(0); exit(0);
} }
...@@ -240,8 +240,8 @@ int main (int argc, char **argv){ ...@@ -240,8 +240,8 @@ int main (int argc, char **argv){
exit (-1); exit (-1);
} }
/* open device */ // open device - read-only mode is enough to issue needed commands
fd = open ( device=argv[2], O_RDWR ); fd = open ( device=argv[2], O_RDONLY );
if ( fd < 0) { if ( fd < 0) {
perror ( "Device open failed"); perror ( "Device open failed");
......
// $Id: smartctl.cpp,v 1.10 2002/10/20 19:22:02 ballen4705 Exp $ // $Id: smartctl.cpp,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $
/* /*
* smartctl.c * smartctl.c
* *
...@@ -229,7 +229,7 @@ int main (int argc, char **argv){ ...@@ -229,7 +229,7 @@ int main (int argc, char **argv){
printf("is free software, and you are welcome to redistribute it\n"); printf("is free software, and you are welcome to redistribute it\n");
printf("under the terms of the GNU General Public License Version 2.\n"); printf("under the terms of the GNU General Public License Version 2.\n");
printf("See http://www.gnu.org for further details.\n\n"); printf("See http://www.gnu.org for further details.\n\n");
printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.10 2002/10/20 19:22:02 ballen4705 Exp $"); printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.11 2002/10/21 08:49:23 ballen4705 Exp $");
if (argc==2) if (argc==2)
exit(0); exit(0);
} }
...@@ -240,8 +240,8 @@ int main (int argc, char **argv){ ...@@ -240,8 +240,8 @@ int main (int argc, char **argv){
exit (-1); exit (-1);
} }
/* open device */ // open device - read-only mode is enough to issue needed commands
fd = open ( device=argv[2], O_RDWR ); fd = open ( device=argv[2], O_RDONLY );
if ( fd < 0) { if ( fd < 0) {
perror ( "Device open failed"); perror ( "Device open failed");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment