]> git.saurik.com Git - apple/system_cmds.git/blob - update.tproj/disk_power.h
system_cmds-336.tar.gz
[apple/system_cmds.git] / update.tproj / disk_power.h
1 #ifndef __SPINDOWN_H__
2
3 #define __SPINDOWN_H__
4
5 #include <libkern/OSTypes.h>
6 #include <IOKit/storage/ata/IOATAStorageDefines.h>
7 #include <stdio.h>
8 #include <time.h>
9
10 /* IOATAPowerStates */
11
12 struct IOATAPowerStates
13 {
14 IOATAPowerState driverDesire;
15 IOATAPowerState deviceDesire;
16 IOATAPowerState userDesire;
17 };
18
19 typedef struct IOATAPowerStates IOATAPowerStates;
20
21 /* DiskDevice: see GetATADeviceInfo(), GetATADeviceInfoWithRetry() */
22
23 struct DiskDevice
24 {
25 time_t timestamp;
26 char * name;
27 char * location;
28 char * interconnect;
29 IOATAPowerStates powerStates;
30 };
31
32 typedef struct DiskDevice DiskDevice;
33
34 /* Devices */
35
36
37 /* PowerStatesMax()
38 -- Returns the max-of-three power state "desires" from the given IOATAPowerStates.
39 */
40 IOATAPowerState PowerStatesMax( IOATAPowerStates * powerStates );
41
42 /* PowerStateString()
43 -- Returns human-readable string name for the given IOATAPowerState.
44 -- Returns pointer to a static, const string.
45 */
46 char * PowerStateString( IOATAPowerState x, int opt_summary );
47
48 /* Routines for printing fs_usage-compatible timestamps: HH:MM:SS.000
49 */
50 int sprintf_timestamp( char * str, time_t t );
51 int sprintf_timestamp_now( char * str );
52 char * timestampStr_static( time_t t ); /* Returns pointer to a static, const string. */
53
54 #if 0
55 /* Routines for printing time intervals: HH:MM:SS
56 */
57 int sprintf_interval( char * str, time_t interval );
58 char * intervalStr_static( time_t interval ); /* Returns pointer to a static, const string. */
59 #endif
60
61 /* GetATADeviceInfoWithRetry()
62 -- This invokes GetATADeviceInfo() repeatedly at one second intervals until it returns without error.
63 -- Gives up after 10 tries, so it is possible that this could return an error.
64 */
65 int GetATADeviceInfoWithRetry( DiskDevice * diskDevice );
66
67 /*
68 --
69 */
70
71 #endif /* __SPINDOWN_H__ */