I've been trying trying to implement the SELinux provider for a while
now. It is written in C and it uses the new job manager. So far, I've
only had to implement jobs in storage, which is python, and that was
relatively easy compared to all the detail that has to be taken care of
in C.
This complexity, and the fact that debugging it is pretty hard, led me
to an idea...
I suggest that all the providers (I'm now mainly concerned about
openlmi-providers) have a common, unified tracing facility. We should be
able to turn it on as the lowest logging level and it should trace
entrance/exit of all functions. This would make debugging and
pinpointing failures much easier.
#define lmi_trace_in lmi_debug("==> %s", __PRETTY_FUNCTION__);
#define lmi_trace_out lmi_debug("<== %s", __PRETTY_FUNCTION__);
#define lmi_trace_out_rc(rc) lmi_debug("<== %s (rc=%d)", __PRETTY_FUNCTION__,
rc);
Every function would look like:
void function()
{
lmi_trace_in
stuff();
lmi_trace_out /* or lmi_trace_out_rc(rc) where relevant */
}
Note that "lmi_debug" could be replaced with something like
"lmi_trace",
which would be defined via CMPI bindings to be even lower level than
"lmi_debug".
Suggestions and constructive criticism welcome.
--
Jan Synacek
Software Engineer, Red Hat