1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
4 This file is part of libatasmart.
6 Copyright 2008 Lennart Poettering
8 libatasmart is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 2.1 of the
11 License, or (at your option) any later version.
13 libatasmart is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with libatasmart. If not, If not, see
20 <http://www.gnu.org/licenses/>.
25 [CCode (cheader_filename="atasmart.h")]
28 [CCode (cname="SkSmartSelfTest", cprefix="SK_SMART_SELF_TEST_")]
29 public enum SmartSelfTest {
30 SHORT, EXTENDED, CONVEYANCE, ABORT;
32 [CCode (cname="sk_smart_self_test_to_string")]
33 public unowned string? to_string();
37 [CCode (cname="SkIdentifyParsedData")]
38 public struct IdentifyParsedData {
40 public string firmware;
44 [CCode (cname="SkSmartOfflineDataCollectionStatus", cprefix="SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_")]
45 public enum SmartOfflineDataCollectionStatus {
46 NEVER, SUCCESS, INPROGRESS, SUSPENDED, ABORTED, FATAL, UNKNOWN;
48 [CCode (cname="sk_smart_offline_data_collection_status_to_string")]
49 public unowned string? to_string();
52 [CCode (cname="SkSmartSelfTestExecutionStatus", cprefix="SK_SMART_SELF_TEST_EXECUTION_STATUS_")]
53 public enum SmartSelfTestExecutionStatus {
54 SUCCESS_OR_NEVER, ABORTED, INTERRUPTED, FATAL, ERROR_UNKNOWN, ERROR_ELECTRICAL, ERROR_SERVO, ERROR_READ, ERROR_HANDLING, INPROGRESS;
56 [CCode (cname="sk_smart_self_test_execution_status_to_string")]
57 public unowned string? to_string();
61 [CCode (cname="SkSmartParsedData")]
62 public struct SmartParsedData {
63 public SmartOfflineDataCollectionStatus offline_data_collection_status;
64 public uint total_offline_data_collection_seconds;
65 public SmartSelfTestExecutionStatus self_test_execution_status;
66 public uint self_test_execution_percent_remaining;
68 public bool conveyance_test_available;
69 public bool short_and_extended_test_available;
70 public bool start_test_available;
71 public bool abort_test_available;
73 public uint short_test_polling_minutes;
74 public uint extended_test_polling_minutes;
75 public uint conveyance_test_polling_minutes;
77 [CCode (cname="sk_smart_self_test_available")]
78 public bool self_test_available(SmartSelfTest test);
80 [CCode (cname="sk_smart_self_test_polling_minutes")]
81 public uint self_test_polling_minutes(SmartSelfTest test);
84 [CCode (cname="SkSmartAttributeUnit", cprefix="SK_SMART_ATTRIBUTE_UNIT_")]
85 public enum SmartAttributeUnit {
86 UNKNOWN, NONE, MSECONDS, SECTORS, MKELVIN;
88 [CCode (cname="sk_smart_attribute_unit_to_string")]
89 public unowned string? to_string();
93 [CCode (cname="SkSmartAttributeParsedData")]
94 public struct SmartAttributeParsedData {
97 public SmartAttributeUnit pretty_unit;
99 public uint8 threshold;
100 public bool threshold_valid;
102 public bool prefailure;
103 public bool good_now;
104 public bool good_now_valid;
105 public bool good_in_the_past;
106 public bool good_in_the_past_valid;
107 public bool current_value_valid;
108 public bool worst_value_valid;
110 public uint8 current_value;
111 public uint8 worst_value;
112 public uint64 pretty_value;
116 [CCode (cname="SkSmartOverall", cprefix="SK_SMART_OVERALL_")]
117 public enum SmartOverall {
118 GOOD, BAD_ATTRIBUTE_IN_THE_PAST, BAD_SECTOR, BAD_ATTRIBUTE_NOW, BAD_SECTOR_MANY, BAD_STATUS;
120 [CCode (cname="sk_smart_overall_to_string")]
121 public unowned string? to_string();
124 [CCode (cname="SkSmartAttributeParseCallback")]
125 public delegate void SmartAttributeParseCallback(Disk disk, SmartAttributeParsedData a);
128 [CCode (free_function="sk_disk_free", cname="SkDisk", cprefix="sk_disk_")]
131 public static int open(string name, out Disk? disk);
133 public int get_size(out uint64 bytes);
135 public int check_sleep_mode(out bool awake);
137 public int identify_is_available(out bool available);
138 public int identify_parse(out unowned IdentifyParsedData* data);
140 public int smart_is_available(out bool available);
141 public int smart_status(out bool good);
142 public int smart_read_data();
143 public int smart_get_blob(out unowned void* blob, out size_t size);
144 public int smart_set_blob(void* blob, size_t size);
145 public int smart_parse_attributes(SmartAttributeParseCallback cb);
146 public int smart_parse(out unowned SmartParsedData* data);
147 public int smart_self_test(SmartSelfTest test);
148 public int smart_get_power_on(out uint64 mseconds);
149 public int smart_get_power_cycle(out uint64 count);
150 public int smart_get_bad(out uint64 sectors);
151 public int smart_get_temperature(out uint64 mkelvin);
152 public int smart_get_overall(out SmartOverall overall);