2 * kernel/power/tuxonice_ui.h
4 * Copyright (C) 2004-2010 Nigel Cunningham (nigel at tuxonice net)
13 /* Userspace -> Kernel */
14 USERUI_MSG_ABORT
= 0x11,
15 USERUI_MSG_SET_STATE
= 0x12,
16 USERUI_MSG_GET_STATE
= 0x13,
17 USERUI_MSG_GET_DEBUG_STATE
= 0x14,
18 USERUI_MSG_SET_DEBUG_STATE
= 0x15,
19 USERUI_MSG_SPACE
= 0x18,
20 USERUI_MSG_GET_POWERDOWN_METHOD
= 0x1A,
21 USERUI_MSG_SET_POWERDOWN_METHOD
= 0x1B,
22 USERUI_MSG_GET_LOGLEVEL
= 0x1C,
23 USERUI_MSG_SET_LOGLEVEL
= 0x1D,
24 USERUI_MSG_PRINTK
= 0x1E,
26 /* Kernel -> Userspace */
27 USERUI_MSG_MESSAGE
= 0x21,
28 USERUI_MSG_PROGRESS
= 0x22,
29 USERUI_MSG_POST_ATOMIC_RESTORE
= 0x25,
34 struct userui_msg_params
{
40 char (*wait_for_key
) (int timeout
);
41 u32(*update_status
) (u32 value
, u32 maximum
, const char *fmt
, ...);
42 void (*prepare_status
) (int clearbar
, const char *fmt
, ...);
43 void (*cond_pause
) (int pause
, char *message
);
44 void (*abort
) (int result_code
, const char *fmt
, ...);
45 void (*prepare
) (void);
46 void (*cleanup
) (void);
47 void (*message
) (u32 section
, u32 level
, u32 normally_logged
, const char *fmt
, ...);
50 extern struct ui_ops
*toi_current_ui
;
52 #define toi_update_status(val, max, fmt, args...) \
53 (toi_current_ui ? (toi_current_ui->update_status) (val, max, fmt, ##args) : \
56 #define toi_prepare_console(void) \
57 do { if (toi_current_ui) \
58 (toi_current_ui->prepare)(); \
61 #define toi_cleanup_console(void) \
62 do { if (toi_current_ui) \
63 (toi_current_ui->cleanup)(); \
66 #define abort_hibernate(result, fmt, args...) \
67 do { if (toi_current_ui) \
68 (toi_current_ui->abort)(result, fmt, ##args); \
70 set_abort_result(result); \
74 #define toi_cond_pause(pause, message) \
75 do { if (toi_current_ui) \
76 (toi_current_ui->cond_pause)(pause, message); \
79 #define toi_prepare_status(clear, fmt, args...) \
80 do { if (toi_current_ui) \
81 (toi_current_ui->prepare_status)(clear, fmt, ##args); \
83 printk(KERN_INFO fmt "%s", ##args, "\n"); \
86 #define toi_message(sn, lev, log, fmt, a...) \
88 if (toi_current_ui && (!sn || test_debug_state(sn))) \
89 toi_current_ui->message(sn, lev, log, fmt, ##a); \
92 __exit
void toi_ui_cleanup(void);
93 extern int toi_ui_init(void);
94 extern void toi_ui_exit(void);
95 extern int toi_register_ui_ops(struct ui_ops
*this_ui
);
96 extern void toi_remove_ui_ops(struct ui_ops
*this_ui
);