[lkml]   [2009]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 3/5] Use vt_get_kmsg_redirect() and vt_set_kmsg_redirect()
> -	kmsg_redirect = SUSPEND_CONSOLE;
> + orig_kmsg = vt_get_kmsg_redirect();
> + vt_set_kmsg_redirect(SUSPEND_CONSOLE);

Probably better to have a single

orig_kmsg = vt_kmsg_redirect(new);

because it makes the locking easy and means a third party can't sneak
between those two and break stuff. This has another advantage - the
variable is now function local and the whole pile of stuff you posted

#if defined(CONFIG_VT_CONSOLE)

extern inline int vt_kmsg_redirect(int new)
static int kmsg_con;

if (new != -1)
xchg(new, &kmsg_con);
new = kmsg_con;
return new;


extern inline int vt_kmsg_redirect(int new)
return 0;


Optionally adding

#define vt_get_kmsg_redirect vt_kmsg_redirect(-1);

One ifdef, clear locking rules, no globals, no file level statics and for
almost all cases it'll compile down to almost nothing.


 \ /
  Last update: 2009-10-11 01:11    [W:0.058 / U:1.956 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site