1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

net/netif : Move 'NETIF_NAMELENMAX' to 'CONFIG_'

This commit is contained in:
Akshai M 2020-07-28 23:02:12 +05:30
parent 6adf07caf0
commit b52e3e1587
4 changed files with 10 additions and 10 deletions

View File

@ -45,8 +45,8 @@ extern "C" {
/**
* @brief Maximum length for an interface name
*/
#ifndef NETIF_NAMELENMAX
#define NETIF_NAMELENMAX (8U)
#ifndef CONFIG_NETIF_NAMELENMAX
#define CONFIG_NETIF_NAMELENMAX (8U)
#endif
/**
@ -75,14 +75,14 @@ netif_t *netif_iter(netif_t *last);
* @brief Gets name of an interface
*
* @pre `name != NULL`
* @pre name holds at least @ref NETIF_NAMELENMAX characters
* @pre name holds at least @ref CONFIG_NETIF_NAMELENMAX characters
*
* @note Supposed to be implemented by the networking module. `name` must be
* zero-terminated in the result!
*
* @param[in] netif A network interface.
* @param[out] name The name of the interface. Must not be `NULL`. Must at least
* hold @ref NETIF_NAMELENMAX bytes.
* hold @ref CONFIG_NETIF_NAMELENMAX bytes.
*
* @return length of @p name on success
*/

View File

@ -56,11 +56,11 @@ netif_t *netif_get_by_name(const char *name)
assert(name);
list_node_t *node = netif_list.next;
char tmp[NETIF_NAMELENMAX];
char tmp[CONFIG_NETIF_NAMELENMAX];
while(node) {
netif_get_name((netif_t *)node, tmp);
if(strncmp(name, tmp, NETIF_NAMELENMAX) == 0) {
if(strncmp(name, tmp, CONFIG_NETIF_NAMELENMAX) == 0) {
return (netif_t *)node;
}
node = node->next;

View File

@ -82,7 +82,7 @@ static const struct {
/* utility functions */
static void _print_iface_name(netif_t *iface)
{
char name[NETIF_NAMELENMAX];
char name[CONFIG_NETIF_NAMELENMAX];
netif_get_name(iface, name);
printf("%s", name);
}

View File

@ -1117,8 +1117,8 @@ static void test_netif_iter(void)
static void test_netif_get_name(void)
{
char exp_name[NETIF_NAMELENMAX + 1];
char name[NETIF_NAMELENMAX];
char exp_name[CONFIG_NETIF_NAMELENMAX + 1];
char name[CONFIG_NETIF_NAMELENMAX];
int res;
netif_t *netif = netif_iter(NULL);
/* there must be at least one interface */
@ -1132,7 +1132,7 @@ static void test_netif_get_name(void)
static void test_netif_get_by_name(void)
{
char name[NETIF_NAMELENMAX] = "6nPRK28";
char name[CONFIG_NETIF_NAMELENMAX] = "6nPRK28";
netif_t *netif = netif_iter(NULL);
TEST_ASSERT(netif_get_by_name(name) == NULL);