On Mon, 2011-06-20 at 18:16 -0400, Simo Sorce wrote:
On Mon, 2011-06-20 at 15:42 -0400, Stephen Gallagher wrote:
>
> For backwards compatibility, we would map the existing debug_level
> values as below:
>
> SSS_DEBUG0: SSSDBG_FATAL_FAILURE
> SSS_DEBUG1: SSS_DEBUG0 & SSSDBG_CRIT_FAILURE
> SSS_DEBUG2: SSS_DEBUG1 & SSSDBG_OP_FAILURE
> SSS_DEBUG3: SSS_DEBUG2 & SSSDBG_MINOR_FAILURE
> SSS_DEBUG4: SSS_DEBUG3 & SSSDBG_CONF_SETTINGS
> SSS_DEBUG5: SSS_DEBUG4 & SSSDBG_FUNC_DATA
> SSS_DEBUG6: SSS_DEBUG5 & SSSDBG_TRACE_FUNC
> SSS_DEBUG7: SSS_DEBUG6 & SSSDBG_TRACE_LIBS
> SSS_DEBUG8: SSS_DEBUG7 & SSSDBG_TRACE_INTERNAL
> SSS_DEBUG9: SSS_DEBUG8 & SSSDBG_TRACE_ALL
I guess you meant to use | on each line above here, not & ?
Yes, I meant |
> If we agree on these definitions, I will write it up on the wiki and
> we'll put the following policy in place:
>
> All new code MUST use the new DEBUG definitions. Existing code being
> modified SHOULD convert related DEBUG messages to the new macros. It is
> NOT required to mass-convert existing messages at this time, but patches
> are welcome :)
By "new DEBUG definitions" I hope you mean the SSSDBG_* ones while the
SSS_DEBUGN are considered legacy ?
Well, I was thinking we'd probably just choose a new macro name (like
SSS_DEBUG) and slowly migrate to using that. But I like your suggestion
below.
Also the problem with this scheme is that you'll have to change every
single debug statement in the code at once.
If we move all 4 bits upper we can treat any number < 0x0F as a legacy
code. So we would not need to define SSS_DEBUGN macros, plus we can
avoid changing DEBUG macros all at once, but change them only when we
change code around them.
This would mean:
#define SSSDBG_MASK_LEGACY 0x000F
#define SSSDBG_MASK_FATAL 0x00F0
#define SSSDBG_MASK_INFO 0x0F00
#define SSSDBG_MASK_DEBUG 0xF000
(Adjust list appropriately)
Ok, and we should use the presence of the classic number as an
indication when updating code that we should convert it to a proper
alias (like SSSDBG_CRIT_FAILURE).