[Pacemaker] FYI: Unified error codes and backwards compatibility

Andrew Beekhof andrew at beekhof.net
Thu Jun 28 04:52:35 UTC 2012


One of the things on my todo list for 1.2 is to unify the various sets
of custom error codes in pacemaker into a single set of codes with a
single error-to-text function.
LSB and OCF return codes are the obvious exception here.

Where possible I will be using standard system error codes from errno.h[1]
Any custom errors[2] will be chosen well above the existing range to
avoid conflicts.

This should simplify error reporting, since there is plenty of
redundancy within some APIs and things like "not found" and "not
connected" will become consistent across APIs.
It will also allow us to push most of the error-to-text code into the
standard strerror() function - less custom code means less bugs.

To ease the task of programs using the old enum values, we will begin
providing <crm/compatability.h>
This will contain the new values for the old error names.

In the future, other deprecated macros and functions will also move
here, utilising the __deprecated__ compiler attribute where possible.
It is important to note however, the header must be explicitly pulled
in by anyone that wants to use it.
For non-C programs, it provides value as a conversion guide.

-- Andrew

[1] With the caveat that we'll be negating them. Eg. -EIO instead of EIO.
[2] It looks like there should only be half a dozen or so.




More information about the Pacemaker mailing list