diff options
author | Thomas Haller <thaller@redhat.com> | 2018-12-22 12:45:01 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-12-27 21:33:59 +0100 |
commit | 4fe18e5bdfff9f9d1c665c53aafa8d78b11ab298 (patch) | |
tree | e3ec8a197a1f4199b8241abca792899b9b26342f /src/platform/nm-netlink.h | |
parent | 943dcba531545ba5cb6e3a0656427381fee136a2 (diff) |
core: move netlink errors to nm-errno.h
No other changes (yet).
Diffstat (limited to 'src/platform/nm-netlink.h')
-rw-r--r-- | src/platform/nm-netlink.h | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/platform/nm-netlink.h b/src/platform/nm-netlink.h index d5df7ab9b1..2fbddff4cf 100644 --- a/src/platform/nm-netlink.h +++ b/src/platform/nm-netlink.h @@ -26,20 +26,6 @@ #include <linux/genetlink.h> /*****************************************************************************/ -#define _NLE_BASE 100000 -#define NLE_UNSPEC (_NLE_BASE + 0) -#define NLE_BUG (_NLE_BASE + 1) -#define NLE_NATIVE_ERRNO (_NLE_BASE + 2) -#define NLE_SEQ_MISMATCH (_NLE_BASE + 3) -#define NLE_MSG_TRUNC (_NLE_BASE + 4) -#define NLE_MSG_TOOSHORT (_NLE_BASE + 5) -#define NLE_DUMP_INTR (_NLE_BASE + 6) -#define NLE_ATTRSIZE (_NLE_BASE + 7) -#define NLE_BAD_SOCK (_NLE_BASE + 8) -#define NLE_NOADDR (_NLE_BASE + 9) -#define NLE_MSG_OVERFLOW (_NLE_BASE + 10) - -#define _NLE_BASE_END (_NLE_BASE + 11) #define NLMSGERR_ATTR_UNUSED 0 #define NLMSGERR_ATTR_MSG 1 @@ -51,50 +37,6 @@ #define NLM_F_ACK_TLVS 0x200 #endif -static inline int -nl_errno (int nlerr) -{ - /* Normalizes an netlink error to be positive. Various API returns negative - * error codes, and this function converts the negative value to its - * positive. - * - * It's very similar to nm_errno(), but not exactly. The difference is that - * nm_errno() is for plain errno, while nl_errno() is for netlink error numbers. - * Yes, netlink error number are ~almost~ the same as errno, except that a particular - * range (_NLE_BASE, _NLE_BASE_END) is reserved. The difference between the two - * functions is only how G_MININT is mapped. - * - * See also nl_syserr2nlerr() below. */ - return nlerr >= 0 - ? nlerr - : ((nlerr == G_MININT) ? NLE_BUG : -nlerr); -} - -static inline int -nl_syserr2nlerr (int errsv) -{ - /* this maps a native errno to a (always non-negative) netlink error number. - * - * Note that netlink error numbers are embedded into the range of regular - * errno. The only difference is, that netlink error numbers reserve a - * range (_NLE_BASE, _NLE_BASE_END) for their own purpose. - * - * That means, converting an errno to netlink error number means in - * most cases just returning itself (negative values are normalized - * to be positive). Only values G_MININT and [_NLE_BASE, _NLE_BASE_END] - * are coerced to the special value NLE_NATIVE_ERRNO, as they cannot - * otherwise be represented in netlink error number domain. */ - if (errsv == G_MININT) - return NLE_NATIVE_ERRNO; - if (errsv < 0) - errsv = -errsv; - return (errsv >= _NLE_BASE && errsv < _NLE_BASE_END) - ? NLE_NATIVE_ERRNO - : errsv; -} - -const char *nl_geterror (int nlerr); - /*****************************************************************************/ /* Basic attribute data types */ |