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
34
[CCode (cname="SkIdentifyParsedData")]
35
public struct IdentifyParsedData {
37
public string firmware;
41
[CCode (cname="SkSmartOfflineDataCollectionStatus", cprefix="SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_")]
42
public enum SmartOfflineDataCollectionStatus {
43
NEVER, SUCCESS, INPROGRESS, SUSPENDED, ABORTED, FATAL, UNKNOWN
46
[CCode (cname="sk_smart_offline_data_collection_status_to_string")]
47
public weak string smart_offline_data_collection_status_to_string(SmartOfflineDataCollectionStatus status);
50
[CCode (cname="SkSmartSelfTestExecutionStatus", cprefix="SK_SMART_SELF_TEST_EXECUTION_STATUS_")]
51
public enum SmartSelfTestExecutionStatus {
52
SUCCESS_OR_NEVER, ABORTED, INTERRUPTED, FATAL, ERROR_UNKNOWN, ERROR_ELECTRICAL, ERROR_SERVO, ERROR_READ, ERROR_HANDLING, INPROGRESS
55
[CCode (cname="sk_smart_self_test_execution_status_to_string")]
56
public weak string smart_self_test_execution_status_to_string(SmartSelfTestExecutionStatus status);
59
[CCode (cname="SkSmartParsedData")]
60
public struct SmartParsedData {
61
public SmartOfflineDataCollectionStatus offline_data_collection_status;
62
public uint total_offline_data_collection_seconds;
63
public SmartSelfTestExecutionStatus self_test_execution_status;
64
public uint self_test_execution_percent_remaining;
66
public bool conveyance_test_available;
67
public bool short_and_extended_test_available;
68
public bool start_test_available;
69
public bool abort_test_available;
71
public uint short_test_polling_minutes;
72
public uint extended_test_polling_minutes;
73
public uint conveyance_test_polling_minutes;
75
[CCode (cname="sk_smart_self_test_available")]
76
public bool self_test_available(SmartSelfTest test);
78
[CCode (cname="sk_smart_self_test_polling_minutes")]
79
public uint self_test_polling_minutes(SmartSelfTest test);
82
[CCode (cname="SkSmartAttributeUnit", cprefix="SK_SMART_ATTRIBUTE_UNIT_")]
83
public enum SmartAttributeUnit {
84
UNKNOWN, NONE, MSECONDS, SECTORS, MKELVIN
87
[CCode (cname="sk_smart_attribute_unit_to_string")]
88
public weak string smart_attribute_unit_to_string(SmartAttributeUnit unit);
91
[CCode (cname="SkSmartAttributeParsedData")]
92
public struct SmartAttributeParsedData {
95
public SmartAttributeUnit pretty_unit;
97
public uint8 threshold;
98
public bool threshold_valid;
100
public bool prefailure;
102
public uint8 current_value;
103
public uint8 worst_value;
104
public uint64 pretty_value;
108
[CCode (cname="SkSmartAttributeParseCallback")]
109
public delegate void SmartAttributeParseCallback(void* disk, SmartAttributeParsedData a);
112
[CCode (free_function="sk_disk_free", cname="SkDisk", cprefix="sk_disk_")]
115
public static int open(string name, out Disk disk);
117
public int get_size(out uint64 bytes);
119
public int check_sleep_mode(out bool awake);
121
public int identify_is_available(out bool available);
122
public int identify_parse(out weak IdentifyParsedData* data);
124
public int smart_is_available(out bool available);
125
public int smart_status(out bool good);
126
public int smart_read_data();
127
public int smart_parse_attributes(SmartAttributeParseCallback cb);
128
public int smart_parse(out weak SmartParsedData* data);
129
public int smart_self_test(SmartSelfTest test);
134
/* These two should move to an official vala package */
135
[CCode (cname="errno", cheader_filename="errno.h")]
138
[CCode (cname="g_strerror", cheader_filename="glib.h")]
139
public weak string strerror(int err);