From 2a5fcae954f992cf558eb91c83aa4c5a880a6bdc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:50:40 +0200 Subject: Adding upstream version 1:6.1. Signed-off-by: Daniel Baumann --- netlink/bitset.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 netlink/bitset.h (limited to 'netlink/bitset.h') diff --git a/netlink/bitset.h b/netlink/bitset.h new file mode 100644 index 0000000..4c9cdac --- /dev/null +++ b/netlink/bitset.h @@ -0,0 +1,28 @@ +/* + * bitset.h - netlink bitset helpers + * + * Declarations of helpers for handling ethtool netlink bitsets. + */ + +#ifndef ETHTOOL_NETLINK_BITSET_H__ +#define ETHTOOL_NETLINK_BITSET_H__ + +#include +#include +#include +#include +#include "strset.h" + +typedef void (*bitset_walk_callback)(unsigned int, const char *, bool, void *); + +uint32_t bitset_get_count(const struct nlattr *bitset, int *retptr); +bool bitset_get_bit(const struct nlattr *bitset, bool mask, unsigned int idx, + int *retptr); +bool bitset_is_compact(const struct nlattr *bitset); +bool bitset_is_empty(const struct nlattr *bitset, bool mask, int *retptr); +uint32_t *get_compact_bitset_value(const struct nlattr *bitset); +uint32_t *get_compact_bitset_mask(const struct nlattr *bitset); +int walk_bitset(const struct nlattr *bitset, const struct stringset *labels, + bitset_walk_callback cb, void *data); + +#endif /* ETHTOOL_NETLINK_BITSET_H__ */ -- cgit v1.2.3