1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ****************************************************************************
11  ****************************************************************************/
12 #ifndef _LINUX_HDSMART_H
13 #define _LINUX_HDSMART_H
14 
15 #define OFFLINE_FULL_SCAN 0
16 #define SHORT_SELF_TEST 1
17 #define EXTEND_SELF_TEST 2
18 #define SHORT_CAPTIVE_SELF_TEST 129
19 #define EXTEND_CAPTIVE_SELF_TEST 130
20 
21 typedef struct ata_smart_attribute_s {
22  unsigned char id;
23  unsigned short status_flag;
24  unsigned char normalized;
25  unsigned char worse_normal;
26  unsigned char raw[6];
27  unsigned char reserv;
28 } __attribute__ ((packed)) ata_smart_attribute_t;
29 
30 typedef struct ata_smart_values_s {
31  unsigned short revnumber;
32  ata_smart_attribute_t vendor_attributes [30];
33  unsigned char offline_data_collection_status;
34  unsigned char self_test_exec_status;
35  unsigned short total_time_to_complete_off_line;
36  unsigned char vendor_specific_366;
37  unsigned char offline_data_collection_capability;
38  unsigned short smart_capability;
39  unsigned char errorlog_capability;
40  unsigned char vendor_specific_371;
41  unsigned char short_test_completion_time;
42  unsigned char extend_test_completion_time;
43  unsigned char reserved_374_385 [12];
44  unsigned char vendor_specific_386_509 [125];
45  unsigned char chksum;
46 } __attribute__ ((packed)) ata_smart_values_t;
47 
48 typedef struct ata_smart_threshold_entry_s {
49  unsigned char id;
50  unsigned char normalized_threshold;
51  unsigned char reserved[10];
52 } __attribute__ ((packed)) ata_smart_threshold_entry_t;
53 
54 typedef struct ata_smart_thresholds_s {
55  unsigned short revnumber;
56  ata_smart_threshold_entry_t thres_entries[30];
57  unsigned char reserved[149];
58  unsigned char chksum;
59 } __attribute__ ((packed)) ata_smart_thresholds_t;
60 
61 typedef struct ata_smart_errorlog_command_struct_s {
62  unsigned char devicecontrolreg;
63  unsigned char featuresreg;
64  unsigned char sector_count;
65  unsigned char sector_number;
66  unsigned char cylinder_low;
67  unsigned char cylinder_high;
68  unsigned char drive_head;
69  unsigned char commandreg;
70  unsigned int timestamp;
71 } __attribute__ ((packed)) ata_smart_errorlog_command_struct_t;
72 
73 typedef struct ata_smart_errorlog_error_struct_s {
74  unsigned char error_condition;
75  unsigned char extended_error[14];
76  unsigned char state;
77  unsigned short timestamp;
78 } __attribute__ ((packed)) ata_smart_errorlog_error_struct_t;
79 
80 typedef struct ata_smart_errorlog_struct_s {
81  ata_smart_errorlog_command_struct_t commands[6];
82  ata_smart_errorlog_error_struct_t error_struct;
83 } __attribute__ ((packed)) ata_smart_errorlog_struct_t;
84 
85 typedef struct ata_smart_errorlog_s {
86  unsigned char revnumber;
87  unsigned char error_log_pointer;
88  ata_smart_errorlog_struct_t errorlog_struct[5];
89  unsigned short ata_error_count;
90  unsigned short non_fatal_count;
91  unsigned short drive_timeout_count;
92  unsigned char reserved[53];
93  unsigned char chksum;
94 } __attribute__ ((packed)) ata_smart_errorlog_t;
95 
96 typedef struct ata_smart_selftestlog_struct_s {
97  unsigned char selftestnumber;
98  unsigned char selfteststatus;
99  unsigned short timestamp;
100  unsigned char selftestfailurecheckpoint;
101  unsigned int lbafirstfailure;
102  unsigned char vendorspecific[15];
103 } __attribute__ ((packed)) ata_smart_selftestlog_struct_t;
104 
105 typedef struct ata_smart_selftestlog_s {
106  unsigned short revnumber;
107  ata_smart_selftestlog_struct_t selftest_struct[21];
108  unsigned char vendorspecific[2];
109  unsigned char mostrecenttest;
110  unsigned char resevered[2];
111  unsigned char chksum;
112 } __attribute__ ((packed)) ata_smart_selftestlog_t;
113 
114 #endif
115