diff options
author | Thomas Haller <thaller@redhat.com> | 2016-12-15 19:31:21 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-12-15 19:41:06 +0100 |
commit | 02cccc69bcca9148fda5c488784a6bd3c23bf1b4 (patch) | |
tree | 782a790c1cdaca48530c2c71343ff7f91b15a9c1 | |
parent | c033ee8cb4de4fa5a0fd1bb6995b7a992858ccf9 (diff) | |
download | libnl-02cccc69bcca9148fda5c488784a6bd3c23bf1b4.tar.gz |
utils/trivial: rename internal _nl_offset_plus_sizeof() macro to _nl_offsetofend()
Kernel calls a very similar macro "offsetofend". So use that name
as it migth be more familiar to the reader.
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | include/netlink-private/utils.h | 2 | ||||
-rw-r--r-- | lib/route/link.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h index 0d5ca9f7..f038a80e 100644 --- a/include/netlink-private/utils.h +++ b/include/netlink-private/utils.h @@ -25,6 +25,6 @@ extern const char * nl_strerror_l(int err); /* internal macro to calculate the size of a struct @type up to (and including) @field. * this will be used for .minlen policy fields, so that we require only a field of up * to the given size. */ -#define _nl_offset_plus_sizeof(type, field) (offsetof (type, field) + sizeof (((type *) NULL)->field)) +#define _nl_offsetofend(type, field) (offsetof (type, field) + sizeof (((type *) NULL)->field)) #endif diff --git a/lib/route/link.c b/lib/route/link.c index b26f8719..4840c238 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -346,8 +346,8 @@ struct nla_policy rtln_link_policy[IFLA_MAX+1] = { [IFLA_LINKINFO] = { .type = NLA_NESTED }, [IFLA_QDISC] = { .type = NLA_STRING, .maxlen = IFQDISCSIZ }, - [IFLA_STATS] = { .minlen = _nl_offset_plus_sizeof (struct rtnl_link_stats, tx_compressed) }, - [IFLA_STATS64] = { .minlen = _nl_offset_plus_sizeof (struct rtnl_link_stats64, tx_compressed) }, + [IFLA_STATS] = { .minlen = _nl_offsetofend (struct rtnl_link_stats, tx_compressed) }, + [IFLA_STATS64] = { .minlen = _nl_offsetofend (struct rtnl_link_stats64, tx_compressed) }, [IFLA_MAP] = { .minlen = sizeof(struct rtnl_link_ifmap) }, [IFLA_IFALIAS] = { .type = NLA_STRING, .maxlen = IFALIASZ }, [IFLA_NUM_VF] = { .type = NLA_U32 }, @@ -413,9 +413,9 @@ int rtnl_link_info_parse(struct rtnl_link *link, struct nlattr **tb) link->l_stats[RTNL_LINK_TX_COMPRESSED] = st->tx_compressed; /* beware: @st might not be the full struct, only fields up to - * tx_compressed are present. See _nl_offset_plus_sizeof() above. */ + * tx_compressed are present. See _nl_offsetofend() above. */ - if (nla_len(tb[IFLA_STATS]) >= _nl_offset_plus_sizeof (struct rtnl_link_stats, rx_nohandler)) + if (nla_len(tb[IFLA_STATS]) >= _nl_offsetofend (struct rtnl_link_stats, rx_nohandler)) link->l_stats[RTNL_LINK_RX_NOHANDLER] = st->rx_nohandler; else link->l_stats[RTNL_LINK_RX_NOHANDLER] = 0; @@ -463,7 +463,7 @@ int rtnl_link_info_parse(struct rtnl_link *link, struct nlattr **tb) link->l_stats[RTNL_LINK_TX_COMPRESSED] = st.tx_compressed; /* beware: @st might not be the full struct, only fields up to - * tx_compressed are present. See _nl_offset_plus_sizeof() above. */ + * tx_compressed are present. See _nl_offsetofend() above. */ link->l_stats[RTNL_LINK_RX_NOHANDLER] = st.rx_nohandler; |