|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/LWIP PATCH] net/if.h: Add include guard
Hi Simon, looks good, thanks.
Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
On Mon, Feb 17, 2020 at 1:23 PM Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
>
> Expose `struct ifconf` also when _GNU_SOURCE is defined but add an
> include guard for the header. This way, double definitons of the
> struct are avoided.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> ---
> include/net/if.h | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/if.h b/include/net/if.h
> index 4eadc6d..ea04cb9 100644
> --- a/include/net/if.h
> +++ b/include/net/if.h
> @@ -1,5 +1,12 @@
> +#ifndef __NET_IF_H__
> +#define __NET_IF_H__
> +
> #include <compat/posix/net/if.h>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> char *if_indextoname (unsigned int, char *);
>
> #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> @@ -26,7 +33,6 @@ char *if_indextoname (unsigned int, char *);
> #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
> IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
>
> -#if defined(_BSD_SOURCE)
> struct ifconf {
> int ifc_len;
> union {
> @@ -34,8 +40,13 @@ struct ifconf {
> struct ifreq *ifcu_req;
> } ifc_ifcu;
> };
> -#endif /* _BSD_SOURCE */
> #define ifc_buf ifc_ifcu.ifcu_buf
> #define ifc_req ifc_ifcu.ifcu_req
>
> #endif /* defined(_GNU_SOURCE) || defined(_BSD_SOURCE) */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* __NET_IF_H__ */
> --
> 2.20.1
>
>
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/minios-devel
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |