1 /* 2 * bitset.h - netlink bitset helpers 3 * 4 * Declarations of helpers for handling ethtool netlink bitsets. 5 */ 6 7 #ifndef ETHTOOL_NETLINK_BITSET_H__ 8 #define ETHTOOL_NETLINK_BITSET_H__ 9 10 #include <libmnl/libmnl.h> 11 #include <linux/netlink.h> 12 #include <linux/genetlink.h> 13 #include <linux/ethtool_netlink.h> 14 #include "strset.h" 15 16 typedef void (*bitset_walk_callback)(unsigned int, const char *, bool, void *); 17 18 uint32_t bitset_get_count(const struct nlattr *bitset, int *retptr); 19 bool bitset_get_bit(const struct nlattr *bitset, bool mask, unsigned int idx, 20 int *retptr); 21 bool bitset_is_compact(const struct nlattr *bitset); 22 bool bitset_is_empty(const struct nlattr *bitset, bool mask, int *retptr); 23 uint32_t *get_compact_bitset_value(const struct nlattr *bitset); 24 uint32_t *get_compact_bitset_mask(const struct nlattr *bitset); 25 int walk_bitset(const struct nlattr *bitset, const struct stringset *labels, 26 bitset_walk_callback cb, void *data); 27 28 #endif /* ETHTOOL_NETLINK_BITSET_H__ */ 29