On dom, mag 08, 2011 at 10:11:48 +0200, Andrew Lunn wrote:
agree. I thin that using a define like
#define UEV_TYPE_VAR "BATTYPE="
would be more elegant.
In this case I can avoid to use snprintf. Do you agree on this?
Yes, that is safer.
+ if (ret)
+ bat_dbg(DBG_BATMAN, bat_priv, "Impossible to send "
+ "uevent for (%s,%s,%s) event\n",
+ uev_type_str[type], uev_action_str[action],
+ (action == UEV_DEL ? "NULL" : data));
The value of ret could be interesting here, especially if kobject_uevent_env() failed.
Mh, Ok. I can print it into the message. Is there a function in the kernel to
transform it in a proper string?
I don't think so. At least i cannot find a kstrerror(). It is messy,
since each architecture can define its own numbers for the
symbols. Most don't and use asm-generic/errno.h, but Sparc for example
has an errno.h which is compatible to SunOS.
Just print the decimal value. Anybody who is competent enough to debug
the code should be able to map a value back to a symbol.
..each of us alone is worth nothing..
Ernesto "Che" Guevara