[SLOF] [PATCH 1/3] net: Get rid of netlib and netapps prefixes in include statements

Alexey Kardashevskiy aik at ozlabs.ru
Fri Jun 10 14:56:34 AEST 2016


On 09/06/16 17:06, Thomas Huth wrote:
> These prefixes prevent that the files can easily be moved to another
> folder, so let's use proper "-I" statements in the Makefiles instead.
> 
> Signed-off-by: Thomas Huth <thuth at redhat.com>
> ---
>  clients/net-snk/app/netapps/Makefile  |  2 +-
>  clients/net-snk/app/netapps/netapps.h |  2 +-
>  clients/net-snk/app/netapps/netboot.c | 16 ++++++++--------
>  clients/net-snk/app/netapps/ping.c    |  8 ++++----
>  clients/net-snk/app/netlib/Makefile   |  2 +-
>  clients/net-snk/app/netlib/dhcp.c     |  2 +-
>  clients/net-snk/app/netlib/dhcp.h     |  7 +------
>  clients/net-snk/app/netlib/dhcpv6.c   | 12 ++++++------
>  clients/net-snk/app/netlib/dhcpv6.h   |  2 +-
>  clients/net-snk/app/netlib/icmpv6.c   | 10 +++++-----
>  clients/net-snk/app/netlib/icmpv6.h   |  4 ++--
>  clients/net-snk/app/netlib/ipv6.c     | 10 +++++-----
>  clients/net-snk/app/netlib/ipv6.h     |  2 +-
>  clients/net-snk/app/netlib/ndp.c      |  6 +++---
>  clients/net-snk/app/netlib/ndp.h      |  2 +-
>  clients/net-snk/app/netlib/tftp.h     |  2 +-
>  16 files changed, 42 insertions(+), 47 deletions(-)
> 
> diff --git a/clients/net-snk/app/netapps/Makefile b/clients/net-snk/app/netapps/Makefile
> index 70b990a..1e50226 100644
> --- a/clients/net-snk/app/netapps/Makefile
> +++ b/clients/net-snk/app/netapps/Makefile
> @@ -16,7 +16,7 @@ ifndef TOP
>  endif
>  include $(TOP)/make.rules
>  
> -CFLAGS += -I../ -I../../../../lib/ -Wall -W
> +CFLAGS += -I.. -I../netlib -I../../../../lib/ -Wall -W
>  
>  OBJS    = netboot.o ping.o args.o
>  
> diff --git a/clients/net-snk/app/netapps/netapps.h b/clients/net-snk/app/netapps/netapps.h
> index 20879c5..d3f7eb2 100644
> --- a/clients/net-snk/app/netapps/netapps.h
> +++ b/clients/net-snk/app/netapps/netapps.h
> @@ -13,7 +13,7 @@
>  #ifndef _NETAPPS_H_
>  #define _NETAPPS_H_
>  
> -#include <netlib/tftp.h>
> +#include <tftp.h>
>  
>  #define F_IPV4	4
>  #define F_IPV6	6
> diff --git a/clients/net-snk/app/netapps/netboot.c b/clients/net-snk/app/netapps/netboot.c
> index bb1db03..d99aa29 100644
> --- a/clients/net-snk/app/netapps/netboot.c
> +++ b/clients/net-snk/app/netapps/netboot.c
> @@ -10,21 +10,21 @@
>   *     IBM Corporation - initial implementation
>   *****************************************************************************/
>  
> -#include <netlib/tftp.h>
> -#include <netlib/ethernet.h>
> -#include <netlib/dhcp.h>
> -#include <netlib/dhcpv6.h>
> -#include <netlib/ipv4.h>
> -#include <netlib/ipv6.h>
> -#include <netlib/dns.h>
> +#include <tftp.h>
> +#include <ethernet.h>
> +#include <dhcp.h>
> +#include <dhcpv6.h>
> +#include <ipv4.h>
> +#include <ipv6.h>
> +#include <dns.h>
>  #include <string.h>
>  #include <stdio.h>
>  #include <time.h>
>  #include <stdlib.h>
>  #include <sys/socket.h>
> -#include <netapps/args.h>
>  #include <libbootmsg/libbootmsg.h>
>  #include <of.h>
> +#include "args.h"
>  #include "netapps.h"
>  
>  #define IP_INIT_DEFAULT 5
> diff --git a/clients/net-snk/app/netapps/ping.c b/clients/net-snk/app/netapps/ping.c
> index f55e0db..def3179 100644
> --- a/clients/net-snk/app/netapps/ping.c
> +++ b/clients/net-snk/app/netapps/ping.c
> @@ -10,15 +10,15 @@
>   *     IBM Corporation - initial implementation
>   *****************************************************************************/
>  
> -#include <netlib/ipv4.h>
> -#include <netlib/dhcp.h>
> -#include <netlib/ethernet.h>
> +#include <ipv4.h>
> +#include <dhcp.h>
> +#include <ethernet.h>
>  #include <sys/socket.h>
>  #include <string.h>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <time.h>
> -#include <netapps/args.h>
> +#include "args.h"
>  #include "netapps.h"
>  
>  struct ping_args {
> diff --git a/clients/net-snk/app/netlib/Makefile b/clients/net-snk/app/netlib/Makefile
> index df09bf8..610e189 100644
> --- a/clients/net-snk/app/netlib/Makefile
> +++ b/clients/net-snk/app/netlib/Makefile
> @@ -16,7 +16,7 @@ ifndef TOP
>  endif
>  include $(TOP)/make.rules
>  
> -CFLAGS += -I../
> +CFLAGS += -I../netapps
>  
>  ifeq ($(SNK_USE_MTFTP), 1)
>  CFLAGS += -DUSE_MTFTP
> diff --git a/clients/net-snk/app/netlib/dhcp.c b/clients/net-snk/app/netlib/dhcp.c
> index 7e2e88c..0cb4fa4 100644
> --- a/clients/net-snk/app/netlib/dhcp.c
> +++ b/clients/net-snk/app/netlib/dhcp.c
> @@ -48,7 +48,7 @@
>  #include <ipv4.h>
>  #include <udp.h>
>  #include <dns.h>
> -#include <netapps/args.h>
> +#include <args.h>
>  
>  #include <stdio.h>
>  #include <string.h>
> diff --git a/clients/net-snk/app/netlib/dhcp.h b/clients/net-snk/app/netlib/dhcp.h
> index 54fb1ee..4432c9b 100644
> --- a/clients/net-snk/app/netlib/dhcp.h
> +++ b/clients/net-snk/app/netlib/dhcp.h
> @@ -14,12 +14,7 @@
>  #define _DHCP_H_
>  
>  #include <stdint.h>
> -
> -#ifdef USE_MTFTP
> -#include <netlib/mtftp.h>
> -#else
> -#include <netlib/tftp.h>
> -#endif
> +#include "tftp.h"


You are getting rid of MTFTP references by tiny bits? :)

Another thing - it does not compile without 2/3 applied:

> make distclean
        [CLEAN] time/
        [CLEAN] netlib/
        [CLEAN] netapps/
        [CLEAN] netapps/
        [CLEAN] netapps/

> make qemu
******** Building qemu system ********
 ====== Building clients ======
        [CC]    depend
        [CC]    init.o
        [CC]    crt0.o
        [CC]    systemcall.o
        [CC]    timer.o
        [CC]    entry.o
In file included from main.c:16:0:
./netapps/netapps.h:16:18: fatal error: tftp.h: No such file or directory
compilation terminated.
/home/aik/p/slof/clients/net-snk/make.depend:16: recipe for target 'depend'
failed
make[4]: *** [depend] Error 1
Makefile:62: recipe for target '.depend' failed
make[3]: *** [.depend] Error 2
make[3]: *** Waiting for unfinished jobs....


Also, while we are on this topic, could you write a small text explaining
the romfs layout? Thanks!



-- 
Alexey


More information about the SLOF mailing list