HomeClusterLabs Projects

Refactor: libcrmcommon: introduce new set of return codes

Description

Refactor: libcrmcommon: introduce new set of return codes

Since we plan to introduce a high-level public API, it's a good time to
introduce some best practices.

Most Pacemaker API functions currently return an integer return code, such that
its absolute value is either a system error number or a custom pcmk_err_*
number. This is less than ideal because system error numbers are constrained
only to the positive int range, so there's the possibility (though not noticed
in the wild) that system errors and custom errors could collide.

The new method being introduced here still uses an integer return code,
but negative values are from a new enumeration, and positive values are
system error numbers. 0 still represents success.

It is expected that the new method will be used with new functions, and
existing internal functions will be gradually refactored to use it as well.
Existing public API functions can be addressed at the next backward
compatibility break (2.1.0).

Details

Provenance
kgaillotAuthored on Dec 13 2019, 5:05 PM
Parents
rP1e3b41f65fde: Merge pull request #1965 from kgaillot/rhbz1712584
Branches
Unknown
Tags
Unknown

Event Timeline