util: Move msg_append_attr into util part

This commit is contained in:
Tomasz Bursztyka 2015-02-26 15:30:09 +02:00 committed by Denis Kenzior
parent 428aad8907
commit ab07091f8c
3 changed files with 23 additions and 16 deletions

View File

@ -27,6 +27,9 @@
#include <string.h>
#include <ell/string.h>
#include <ell/genl.h>
#include <ell/util.h>
#include <ell/log.h>
#include "util.h"
@ -74,3 +77,16 @@ no_ssid:
return buf;
}
bool _msg_append_attr(struct l_genl_msg *msg,
uint16_t type, const char *type_str,
uint16_t len, const void *value)
{
bool ret;
ret = l_genl_msg_append_attr(msg, type, len, value);
if (!ret)
l_warn("Cannot append attr %s", type_str);
return ret;
}

View File

@ -39,4 +39,11 @@ static inline bool util_is_bit_set(const uint8_t oct, int bit)
int mask = 1 << bit;
return oct & mask ? true : false;
}
bool _msg_append_attr(struct l_genl_msg *msg,
uint16_t type, const char *type_str,
uint16_t len, const void *value);
#define msg_append_attr(msg, type, len, value) \
_msg_append_attr(msg, type, #type, len, value)
#endif /* __UTIL_H */

View File

@ -86,22 +86,6 @@ struct wiphy {
static struct l_queue *wiphy_list = NULL;
static bool _msg_append_attr(struct l_genl_msg *msg,
uint16_t type, const char *type_str,
uint16_t len, const void *value)
{
bool ret;
ret = l_genl_msg_append_attr(msg, type, len, value);
if (!ret)
l_warn("Cannot append attr %s", type_str);
return ret;
}
#define msg_append_attr(msg, type, len, value) \
_msg_append_attr(msg, type, #type, len, value)
static void do_debug(const char *str, void *user_data)
{
const char *prefix = user_data;