mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 15:40:10 +01:00
netlink: add signed 8-bit and 32-bit accessors
This commit is contained in:
parent
732b63ffb7
commit
dfa8d35e57
1 changed files with 18 additions and 0 deletions
|
|
@ -176,6 +176,12 @@ nla_get_u8 (const struct nlattr *nla)
|
|||
return *(const uint8_t *) nla_data (nla);
|
||||
}
|
||||
|
||||
static inline uint8_t
|
||||
nla_get_s8 (const struct nlattr *nla)
|
||||
{
|
||||
return *(const int8_t *) nla_data (nla);
|
||||
}
|
||||
|
||||
static inline uint8_t
|
||||
nla_get_u8_cond (/*const*/ struct nlattr *const*tb, int attr, uint8_t default_val)
|
||||
{
|
||||
|
|
@ -197,6 +203,12 @@ nla_get_u32(const struct nlattr *nla)
|
|||
return *(const uint32_t *) nla_data (nla);
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
nla_get_s32(const struct nlattr *nla)
|
||||
{
|
||||
return *(const int32_t *) nla_data (nla);
|
||||
}
|
||||
|
||||
uint64_t nla_get_u64 (const struct nlattr *nla);
|
||||
|
||||
static inline char *
|
||||
|
|
@ -232,12 +244,18 @@ nla_put_string (struct nl_msg *msg, int attrtype, const char *str)
|
|||
#define NLA_PUT_U8(msg, attrtype, value) \
|
||||
NLA_PUT_TYPE(msg, uint8_t, attrtype, value)
|
||||
|
||||
#define NLA_PUT_S8(msg, attrtype, value) \
|
||||
NLA_PUT_TYPE(msg, int8_t, attrtype, value)
|
||||
|
||||
#define NLA_PUT_U16(msg, attrtype, value) \
|
||||
NLA_PUT_TYPE(msg, uint16_t, attrtype, value)
|
||||
|
||||
#define NLA_PUT_U32(msg, attrtype, value) \
|
||||
NLA_PUT_TYPE(msg, uint32_t, attrtype, value)
|
||||
|
||||
#define NLA_PUT_S32(msg, attrtype, value) \
|
||||
NLA_PUT_TYPE(msg, int32_t, attrtype, value)
|
||||
|
||||
#define NLA_PUT_U64(msg, attrtype, value) \
|
||||
NLA_PUT_TYPE(msg, uint64_t, attrtype, value)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue