|
1 | 1 | /* |
2 | | - * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD |
| 2 | + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: Apache-2.0 |
5 | 5 | */ |
|
27 | 27 | #include "esp_check.h" |
28 | 28 |
|
29 | 29 | #ifndef CONFIG_LWIP_NETIF_API |
30 | | - |
31 | | -#include "lwip/priv/tcpip_priv.h" |
32 | 30 | // If POSIX NETIF_API not enabled, we need to supply the implementation of if_indextoname() |
33 | | -// using tcpip_callback() |
| 31 | +// using tcpip_api_call() |
| 32 | +#include "lwip/priv/tcpip_priv.h" |
34 | 33 |
|
35 | 34 | struct tcpip_netif_name { |
36 | 35 | struct tcpip_api_call_data call; |
37 | 36 | u8_t ifindex; |
38 | 37 | char *ifname; |
39 | | - err_t err; |
40 | 38 | }; |
41 | 39 |
|
42 | | -static void do_netif_index_to_name(void *ctx) |
| 40 | +static err_t do_netif_index_to_name(struct tcpip_api_call_data *msg) |
43 | 41 | { |
44 | | - struct tcpip_netif_name *params = ctx; |
45 | | - params->err = netif_index_to_name(params->ifindex, params->ifname) ? ERR_OK : ERR_IF; |
| 42 | + struct tcpip_netif_name *params = __containerof(msg, struct tcpip_netif_name, call); |
| 43 | + return netif_index_to_name(params->ifindex, params->ifname) ? ERR_OK : ERR_IF; |
46 | 44 | } |
47 | 45 |
|
48 | 46 | char *if_indextoname(unsigned int ifindex, char *ifname) |
49 | 47 | { |
50 | 48 | struct tcpip_netif_name params = { .ifindex = ifindex, .ifname = ifname }; |
51 | | - if (tcpip_callback(do_netif_index_to_name, ¶ms) != ERR_OK || params.err != ERR_OK) { |
| 49 | + if (tcpip_api_call(do_netif_index_to_name, ¶ms.call) != ERR_OK) { |
52 | 50 | return NULL; |
53 | 51 | } |
54 | 52 | return ifname; |
|
0 commit comments