diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-06-23 11:03:10 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-06-24 13:45:47 +0200 |
commit | 817d1cd824bedba8feeef24c9724ec8bd160a7b2 (patch) | |
tree | 80730ddac6f615441e43708f243d7a44de7bcf03 /src/libsystemd/sd-netlink/netlink-types.c | |
parent | c658008f50fdbc617e6f7ad321c058f3a6f175f5 (diff) |
sd-netlink: make NLType internal
If we extend NLType to support arrays and further extended types, we
really want to avoid hard-coding the type-layout outside of
netlink-types.c. We already avoid accessing nl_type->type_system outside
of netlink-types.c, extend this to also avoid accessing any other fields.
Provide accessor functions for nl_type->type and nl_type->size and then
move NLType away from the type-system header.
With this in place, follow-up patches can safely turn "type_system" and
"type_system_union" into a real "union { }", and then add another type for
arrays.
Diffstat (limited to 'src/libsystemd/sd-netlink/netlink-types.c')
-rw-r--r-- | src/libsystemd/sd-netlink/netlink-types.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c index fe9e5f9826..7715ff8a44 100644 --- a/src/libsystemd/sd-netlink/netlink-types.c +++ b/src/libsystemd/sd-netlink/netlink-types.c @@ -39,6 +39,13 @@ #include "netlink-types.h" #include "missing.h" +struct NLType { + uint16_t type; + size_t size; + const NLTypeSystem *type_system; + const NLTypeSystemUnion *type_system_union; +}; + static const NLTypeSystem rtnl_link_type_system; static const NLType rtnl_link_info_data_veth_types[VETH_INFO_MAX + 1] = { @@ -460,6 +467,16 @@ const NLTypeSystem rtnl_type_system = { .types = rtnl_types, }; +uint16_t type_get_type(const NLType *type) { + assert(type); + return type->type; +} + +size_t type_get_size(const NLType *type) { + assert(type); + return type->size; +} + void type_get_type_system(const NLType *nl_type, const NLTypeSystem **ret) { assert(nl_type); assert(ret); |