diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:50:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:50:40 +0000 |
commit | 2a5fcae954f992cf558eb91c83aa4c5a880a6bdc (patch) | |
tree | 843baab7b4189d366d3d5479fe272950bf407034 /netlink/bitset.h | |
parent | Initial commit. (diff) | |
download | ethtool-2a5fcae954f992cf558eb91c83aa4c5a880a6bdc.tar.xz ethtool-2a5fcae954f992cf558eb91c83aa4c5a880a6bdc.zip |
Adding upstream version 1:6.1.upstream/1%6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | netlink/bitset.h | 28 |
1 files changed, 28 insertions, 0 deletions
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 <libmnl/libmnl.h> +#include <linux/netlink.h> +#include <linux/genetlink.h> +#include <linux/ethtool_netlink.h> +#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__ */ |