Messages in this thread Patch in this message | | | From | Nigel Cunningham <> | Subject | [Suspend2][ 10/21] [Suspend2] __suspend_message. | Date | Tue, 27 Jun 2006 14:41:46 +1000 |
| |
The guts of the suspend_message routine. This is for highlevel descriptions of what we're doing, which are also printk'd if we're logging everything.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
kernel/power/ui.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/kernel/power/ui.c b/kernel/power/ui.c index b01c89b..3378766 100644 --- a/kernel/power/ui.c +++ b/kernel/power/ui.c @@ -283,3 +283,51 @@ unsigned long suspend_update_status(unsi return next_update; } +/* __suspend_message. + * + * Description: This function is intended to do the same job as printk, but + * without normally logging what is printed. The point is to be + * able to get debugging info on screen without filling the logs + * with "1/534. ^M 2/534^M. 3/534^M" + * + * It may be called from an interrupt context - can't sleep! + * + * Arguments: int mask: The debugging section(s) this message belongs to. + * int level: The level of verbosity of this message. + * int restartline: Whether to output a \r or \n with this line + * (\n if we're logging all output). + * const char *fmt, ...: Message to be displayed a la printk. + */ +void __suspend_message(unsigned long section, unsigned long level, + int normally_logged, + const char *fmt, ...) +{ + struct userui_msg_params msg; + + if ((level) && (level > console_loglevel)) + return; + + memset(&msg, 0, sizeof(msg)); + + msg.a = section; + msg.b = level; + msg.c = normally_logged; + + if (fmt) { + va_list args; + va_start(args, fmt); + vsnprintf(msg.text, sizeof(msg.text), fmt, args); + va_end(args); + msg.text[sizeof(msg.text)-1] = '\0'; + } + + if (test_action_state(SUSPEND_LOGALL)) + printk("%s\n", msg.text); + + if (ui_helper_data.pid == -1) + return; + + suspend_send_netlink_message(&ui_helper_data, USERUI_MSG_MESSAGE, + &msg, sizeof(msg)); +} + -- Nigel Cunningham nigel at suspend2 dot net - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |