buld-sys: simplify configure script; drop unused checks.
[platform/upstream/libatasmart.git] / vala / atasmart.vapi
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 /***
4     This file is part of libatasmart.
5
6     Copyright 2008 Lennart Poettering
7
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.
12
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.
17
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/>.
21 ***/
22
23 using GLib;
24
25 [CCode (cheader_filename="atasmart.h")]
26 namespace AtaSmart {
27
28         [CCode (cname="SkSmartSelfTest", cprefix="SK_SMART_SELF_TEST_")]
29         public enum SmartSelfTest {
30                 SHORT, EXTENDED, CONVEYANCE, ABORT;
31
32                 [CCode (cname="sk_smart_self_test_to_string")]
33                 public unowned string? to_string();
34         }
35
36         [Immutable]
37         [CCode (cname="SkIdentifyParsedData")]
38         public struct IdentifyParsedData {
39                 public string serial;
40                 public string firmware;
41                 public string model;
42         }
43
44         [CCode (cname="SkSmartOfflineDataCollectionStatus", cprefix="SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_")]
45         public enum SmartOfflineDataCollectionStatus {
46                 NEVER, SUCCESS, INPROGRESS, SUSPENDED, ABORTED, FATAL, UNKNOWN;
47
48                 [CCode (cname="sk_smart_offline_data_collection_status_to_string")]
49                 public unowned string? to_string();
50         }
51
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;
55
56                 [CCode (cname="sk_smart_self_test_execution_status_to_string")]
57                 public unowned string? to_string();
58         }
59
60         [Immutable]
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;
67
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;
72
73                 public uint short_test_polling_minutes;
74                 public uint extended_test_polling_minutes;
75                 public uint conveyance_test_polling_minutes;
76
77                 [CCode (cname="sk_smart_self_test_available")]
78                 public bool self_test_available(SmartSelfTest test);
79
80                 [CCode (cname="sk_smart_self_test_polling_minutes")]
81                 public uint self_test_polling_minutes(SmartSelfTest test);
82         }
83
84         [CCode (cname="SkSmartAttributeUnit", cprefix="SK_SMART_ATTRIBUTE_UNIT_")]
85         public enum SmartAttributeUnit {
86                 UNKNOWN, NONE, MSECONDS, SECTORS, MKELVIN;
87
88                 [CCode (cname="sk_smart_attribute_unit_to_string")]
89                 public unowned string? to_string();
90         }
91
92         [Immutable]
93         [CCode (cname="SkSmartAttributeParsedData")]
94         public struct SmartAttributeParsedData {
95                 public uint8 id;
96                 public string name;
97                 public SmartAttributeUnit pretty_unit;
98                 public uint16 flags;
99                 public uint8 threshold;
100                 public bool threshold_valid;
101                 public bool online;
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;
109                 public bool warn;
110                 public uint8 current_value;
111                 public uint8 worst_value;
112                 public uint64 pretty_value;
113                 public uint8[] raw;
114         }
115
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;
119
120                 [CCode (cname="sk_smart_overall_to_string")]
121                 public unowned string? to_string();
122         }
123
124         [CCode (cname="SkSmartAttributeParseCallback")]
125         public delegate void SmartAttributeParseCallback(Disk disk, SmartAttributeParsedData a);
126
127         [Compact]
128         [CCode (free_function="sk_disk_free", cname="SkDisk", cprefix="sk_disk_")]
129         public class Disk {
130
131                 public static int open(string name, out Disk? disk);
132
133                 public int get_size(out uint64 bytes);
134
135                 public int check_sleep_mode(out bool awake);
136
137                 public int identify_is_available(out bool available);
138                 public int identify_parse(out unowned IdentifyParsedData* data);
139
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);
153
154                 public int dump();
155         }
156 }