* usage of WIN_SMART
@ 2004-11-24 9:54 Jagadeesh Bhaskar P
[not found] ` <8783be6604112611137bcbfb61@mail.gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Jagadeesh Bhaskar P @ 2004-11-24 9:54 UTC (permalink / raw)
To: LKML
I have seen SMART system's code containing WIN_SMART directive in ioctl
sprinkled through out the code? What does that mean? What is its proper
usage? Is there a proper documentation for it?
Thanks in advance for all replies
--
With regards,
Jagadeesh Bhaskar P
^ permalink raw reply [flat|nested] 8+ messages in thread
* usage of WIN_SMART
@ 2004-11-24 10:49 Jagadeesh Bhaskar P
2004-11-24 12:10 ` Jan-Benedict Glaw
0 siblings, 1 reply; 8+ messages in thread
From: Jagadeesh Bhaskar P @ 2004-11-24 10:49 UTC (permalink / raw)
To: Linux C Programming
Can someone help me with an explanation for the usage of WIN_SMART
directive declared in hdreg.h in ioctl() function?
--
With regards,
Jagadeesh Bhaskar P
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: usage of WIN_SMART
2004-11-24 10:49 usage of WIN_SMART Jagadeesh Bhaskar P
@ 2004-11-24 12:10 ` Jan-Benedict Glaw
2004-11-25 4:27 ` Jagadeesh Bhaskar P
0 siblings, 1 reply; 8+ messages in thread
From: Jan-Benedict Glaw @ 2004-11-24 12:10 UTC (permalink / raw)
To: Linux C Programming
[-- Attachment #1: Type: text/plain, Size: 998 bytes --]
On Wed, 2004-11-24 16:19:57 +0530, Jagadeesh Bhaskar P <jbhaskar@hclinsys.com>
wrote in message <1101293397.3787.34.camel@myLinux>:
> Can someone help me with an explanation for the usage of WIN_SMART
> directive declared in hdreg.h in ioctl() function?
Just look at some users of WIN_SMART. Found these with Google:
Function ataReadSmartValues() in
http://cvs.sourceforge.net/viewcvs.py/smartmontools/sm5/atacmds.c?rev=1.2
Function smart_read_values() in
http://www.linux-ide.org/smart/ide-smart.c
There are other examples, too. Of course, you can only use code out of
these if your software is going to be available under GNU GPL ...
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: usage of WIN_SMART
2004-11-24 12:10 ` Jan-Benedict Glaw
@ 2004-11-25 4:27 ` Jagadeesh Bhaskar P
2004-11-25 7:08 ` Glynn Clements
0 siblings, 1 reply; 8+ messages in thread
From: Jagadeesh Bhaskar P @ 2004-11-25 4:27 UTC (permalink / raw)
To: Jan-Benedict Glaw; +Cc: Linux C Programming
I meant how to use WIN_SMART in the code? Not its uses or advantages!!
Can someone help me with that??
On Wed, 2004-11-24 at 17:40, Jan-Benedict Glaw wrote:
> On Wed, 2004-11-24 16:19:57 +0530, Jagadeesh Bhaskar P <jbhaskar@hclinsys.com>
> wrote in message <1101293397.3787.34.camel@myLinux>:
> > Can someone help me with an explanation for the usage of WIN_SMART
> > directive declared in hdreg.h in ioctl() function?
>
> Just look at some users of WIN_SMART. Found these with Google:
>
> Function ataReadSmartValues() in
> http://cvs.sourceforge.net/viewcvs.py/smartmontools/sm5/atacmds.c?rev=1.2
>
> Function smart_read_values() in
> http://www.linux-ide.org/smart/ide-smart.c
>
> There are other examples, too. Of course, you can only use code out of
> these if your software is going to be available under GNU GPL ...
>
> MfG, JBG
--
Jagadeesh Bhaskar P <jbhaskar@hclinsys.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: usage of WIN_SMART
2004-11-25 4:27 ` Jagadeesh Bhaskar P
@ 2004-11-25 7:08 ` Glynn Clements
0 siblings, 0 replies; 8+ messages in thread
From: Glynn Clements @ 2004-11-25 7:08 UTC (permalink / raw)
To: Jagadeesh Bhaskar P; +Cc: Jan-Benedict Glaw, Linux C Programming
Jagadeesh Bhaskar P wrote:
> I meant how to use WIN_SMART in the code? Not its uses or advantages!!
>
> Can someone help me with that??
Look at the source code of an existing program which uses it, such as
those to which Jan-Benedict referred.
Also, within a few clicks of the linux-ide.org URL, I found:
http://www.linux-ide.org/smart/smartmontools-5.0/
which says:
== REFERENCES ==
If you need help in understanding the output of smartctl, a good place
to start is to read Section 8.41 of the AT Attachment with Packet
Interface-5 (ATA/ATAPI-5) specification. This documents the
S.M.A.R.T. functionality which the smartmontools utilities provide
access to. You can find Revision 1 of this document at:
http://www.t13.org/project/d1321r1c.pdf
Future versions of the specifications (ATA/ATAPI-6 and ATA/ATAPI-7)
can be obtained from:
http://www.t13.org/#FTP_site
Later revisions (2, 3) of the ATA/ATAPI-5 specification are also
available there.
The functioning of S.M.A.R.T. is also described by the SFF-8035i
revision 2 specification. This is a publication of the Small Form
Factors Committee, and can be obtained from SFF Committee, 14426 Black
Walnut Ct., Saratoga, CA 95070, USA.
SFF FaxAccess: (408) 741-1600
Ph: (408) 867-6630
Fax: (408) 867-2115
E-Mail: 250-1752@mcimail.com.
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: usage of WIN_SMART
[not found] ` <8783be6604112611137bcbfb61@mail.gmail.com>
@ 2004-11-30 0:05 ` Edward Falk
2004-11-30 3:10 ` Jagadeesh Bhaskar P
0 siblings, 1 reply; 8+ messages in thread
From: Edward Falk @ 2004-11-30 0:05 UTC (permalink / raw)
To: LKML, Jagadeesh Bhaskar P
> I have seen SMART system's code containing WIN_SMART directive in ioctl
> sprinkled through out the code? What does that mean? What is its proper
> usage? Is there a proper documentation for it?
>
> Thanks in advance for all replies
Hi Jagadeesh; I'm not entirely sure what your question is, so I'll see
if I can provide a vague enough answer to cover it :)
Executive summary: The SMART data is used to obtain information about
the state of the drive hardware, for the purpose of predicting or
diagnosing failures. What little documentation there is exists in the
ATA/ATAPI specification, but most of the data is vendor-specific and
undocumented. The easiest way to access SMART data is by cat'ing the
appropriate file in /proc/ide/hdX
Long answer:
Many (all?) modern disk drives provide what is known as "SMART"
(Self-Monitoring, Analysis, and Reporting Technology) data. This
includes information about the performance of the drive, including how
many errors the drive has corrected, what the drive temperature has
been, and so on. The WIN_SMART command has a number of sub-commands
(specified through the features register), which are described in the
ATA spec under "Command descriptions".
AFAIK, there are no ioctls directly corresponding to the SMART commands,
but the SMART commands can be accessed via the HDIO_DRIVE_TASKFILE
ioctl. (NOTE: do not attempt this without a copy of the ATA spec in
front of you.)
An even easier way to obtain the SMART data is to cat
/proc/ide/hdX/smart_values or /proc/ide/hdX/smart_thresholds.
(At Google, we've added "smart_logs" and "smart_status" entries to
/proc. We'll be submitting those patches Real Soon Now.)
The interesting SMART subcommands are:
SMART READ DATA
Read and return the 512-byte SMART data structure.
The ATA spec describes this structure, but most of the
interesting fields are vendor-specific. Several of the
vendors have adopted a number of common data fields,
such as spinup time, reallocation count, seek error
rate, and so on. In general though, the information is
really private to the vendor, intended for the vendor
to diagnose the drive.
SMART READ LOG
Returns one of a number of available logs, including log
directory, summary error log, comprehensive error log,
and so on, including a few vendor-specific logs.
SMART WRITE LOG
Write data to a log.
SMART RETURN STATUS
Returns a simple yes/no status indicating whether or
not any of the device's thresholds have been exceeded.
I hope this helps answer your questions.
-ed falk
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: usage of WIN_SMART
2004-11-30 0:05 ` Edward Falk
@ 2004-11-30 3:10 ` Jagadeesh Bhaskar P
2004-11-30 14:31 ` Ross Biro
0 siblings, 1 reply; 8+ messages in thread
From: Jagadeesh Bhaskar P @ 2004-11-30 3:10 UTC (permalink / raw)
To: Edward Falk; +Cc: LKML
Dear Edward,
I am grateful for such a descriptive reply. I was exploring through the
ide-disk driver interface, which provides the SMART readings through the
ioctl, using WIN_SMART. At the end its calling an inb and an outb to the
regs, like u said, feature regs and all. Is it possible to do it
directly with an inb and outb from a C program, avoiding the
complexities involved in the WIN_SMART command.
And, can u help me out with the syntax of WIN_SMART class of ioctl?
I know that a buffer like
buffer = {WIN_SMART, 0, SMART_READ_VALUES, 1};
and it is passed to the ioctl.
I have seen the significance of 1st element(WIN_SMART) and 3rd element
(SMART_READ_VALUES) in the ide-disk module's code.
What does the second argument and the fourth argument signify?
Can u help me with this also, coz I've been digging for this a long
time, and haven't been that successfull!!
--
Thanks & Regards,
Jagadeesh Bhaskar P
R&D Engineer
HCL Infosystems Ltd
Pondicherry
INDIA
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: usage of WIN_SMART
2004-11-30 3:10 ` Jagadeesh Bhaskar P
@ 2004-11-30 14:31 ` Ross Biro
0 siblings, 0 replies; 8+ messages in thread
From: Ross Biro @ 2004-11-30 14:31 UTC (permalink / raw)
To: Jagadeesh Bhaskar P; +Cc: Edward Falk, LKML
As Ed said, you need the ATA spec to make sense of all that.
Fortunately, a draft copy is available online at t13.org. In
particular at http://www.t13.org/#Project_drafts The docs will
explain the register settings, but not the meanings of the output.
You can avoid the driver is you wish, but it's a really bad idea to do
so since you will change the state of the drive when the driver is not
expecting it. To safely access the drive from user space, you would
have to make sure the driver is disabled, disable interrupts, and then
poll the controller directly. The exact method would of course be
controller specific. You need to look at the ioperm man page and
/dev/port.
Finally, if all you want to do is access the SMART data, you should
look at smartsuite http://sourceforge.net/projects/smartsuite/ or
something similiar. It already includes much of the vendor specific
information and knows how to get along with the kernel.
Ross
On Tue, 30 Nov 2004 08:40:40 +0530, Jagadeesh Bhaskar P
<jbhaskar@hclinsys.com> wrote:
> Dear Edward,
> I am grateful for such a descriptive reply. I was exploring through the
> ide-disk driver interface, which provides the SMART readings through the
> ioctl, using WIN_SMART. At the end its calling an inb and an outb to the
> regs, like u said, feature regs and all. Is it possible to do it
> directly with an inb and outb from a C program, avoiding the
> complexities involved in the WIN_SMART command.
>
> And, can u help me out with the syntax of WIN_SMART class of ioctl?
> I know that a buffer like
>
> buffer = {WIN_SMART, 0, SMART_READ_VALUES, 1};
> and it is passed to the ioctl.
>
> I have seen the significance of 1st element(WIN_SMART) and 3rd element
> (SMART_READ_VALUES) in the ide-disk module's code.
>
> What does the second argument and the fourth argument signify?
>
> Can u help me with this also, coz I've been digging for this a long
> time, and haven't been that successfull!!
>
> --
> Thanks & Regards,
>
> Jagadeesh Bhaskar P
> R&D Engineer
> HCL Infosystems Ltd
> Pondicherry
> INDIA
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-11-30 14:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-24 10:49 usage of WIN_SMART Jagadeesh Bhaskar P
2004-11-24 12:10 ` Jan-Benedict Glaw
2004-11-25 4:27 ` Jagadeesh Bhaskar P
2004-11-25 7:08 ` Glynn Clements
-- strict thread matches above, loose matches on Subject: below --
2004-11-24 9:54 Jagadeesh Bhaskar P
[not found] ` <8783be6604112611137bcbfb61@mail.gmail.com>
2004-11-30 0:05 ` Edward Falk
2004-11-30 3:10 ` Jagadeesh Bhaskar P
2004-11-30 14:31 ` Ross Biro
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.