3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 14:22:36 +01:00

util: Add container_of macro

This commit is contained in:
Denis Kenzior 2017-08-31 17:56:05 -05:00
parent af22a75fbb
commit 4a9d8278b4

View File

@ -28,6 +28,10 @@
#define align_len(len, boundary) (((len)+(boundary)-1) & ~((boundary)-1)) #define align_len(len, boundary) (((len)+(boundary)-1) & ~((boundary)-1))
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid); const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid);
bool util_ssid_is_utf8(size_t len, const uint8_t *ssid); bool util_ssid_is_utf8(size_t len, const uint8_t *ssid);
const char *util_address_to_string(const uint8_t *addr); const char *util_address_to_string(const uint8_t *addr);