]> git.saurik.com Git - apple/system_cmds.git/blame - update.tproj/disk_power.h
system_cmds-336.20.tar.gz
[apple/system_cmds.git] / update.tproj / disk_power.h
CommitLineData
83f6dbe8
A
1#ifndef __SPINDOWN_H__
2
3#define __SPINDOWN_H__
4
2fc1e207
A
5#include <libkern/OSTypes.h>
6#include <IOKit/storage/ata/IOATAStorageDefines.h>
83f6dbe8
A
7#include <stdio.h>
8#include <time.h>
9
83f6dbe8
A
10/* IOATAPowerStates */
11
12struct IOATAPowerStates
13{
14 IOATAPowerState driverDesire;
15 IOATAPowerState deviceDesire;
16 IOATAPowerState userDesire;
17};
18
19typedef struct IOATAPowerStates IOATAPowerStates;
20
21/* DiskDevice: see GetATADeviceInfo(), GetATADeviceInfoWithRetry() */
22
23struct DiskDevice
24{
25 time_t timestamp;
26 char * name;
27 char * location;
28 char * interconnect;
29 IOATAPowerStates powerStates;
30};
31
32typedef struct DiskDevice DiskDevice;
33
34/* Devices */
35
36
37/* PowerStatesMax()
38-- Returns the max-of-three power state "desires" from the given IOATAPowerStates.
39*/
40IOATAPowerState 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*/
46char * PowerStateString( IOATAPowerState x, int opt_summary );
47
48/* Routines for printing fs_usage-compatible timestamps: HH:MM:SS.000
49*/
50int sprintf_timestamp( char * str, time_t t );
51int sprintf_timestamp_now( char * str );
52char * 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*/
57int sprintf_interval( char * str, time_t interval );
58char * 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*/
65int GetATADeviceInfoWithRetry( DiskDevice * diskDevice );
66
67/*
68--
69*/
70
71#endif /* __SPINDOWN_H__ */