From c77f77ee3f9460893fc3f6cdb5fe6acb994d9637 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 31 Aug 2014 21:25:27 +0300 Subject: [PATCH] build: organize files into a directory structure --- httpd.cc => apps/httpd/httpd.cc | 4 ++-- main.cc => apps/seastar/main.cc | 2 +- build.mk | 18 +++++++++--------- apply.hh => core/apply.hh | 0 posix.hh => core/posix.hh | 0 print.hh => core/print.hh | 0 reactor.cc => core/reactor.cc | 0 reactor.hh => core/reactor.hh | 0 sstring.hh => core/sstring.hh | 0 vla.hh => core/vla.hh | 0 arp.cc => net/arp.cc | 0 arp.hh => net/arp.hh | 4 ++-- byteorder.hh => net/byteorder.hh | 0 ethernet.cc => net/ethernet.cc | 0 ethernet.hh => net/ethernet.hh | 2 +- ip.cc => net/ip.cc | 2 +- ip.hh => net/ip.hh | 0 net.cc => net/net.cc | 0 net.hh => net/net.hh | 2 +- virtio-interface.hh => net/virtio-interface.hh | 0 virtio.cc => net/virtio.cc | 6 +++--- virtio.hh => net/virtio.hh | 2 +- fileiotest.cc => tests/fileiotest.cc | 2 +- ip_test.cc => tests/ip_test.cc | 10 +++++----- l3_test.cc => tests/l3_test.cc | 6 +++--- test-reactor.cc => tests/test-reactor.cc | 2 +- virtiotest.cc => tests/virtiotest.cc | 6 +++--- 27 files changed, 34 insertions(+), 34 deletions(-) rename httpd.cc => apps/httpd/httpd.cc (99%) rename main.cc => apps/seastar/main.cc (84%) rename apply.hh => core/apply.hh (100%) rename posix.hh => core/posix.hh (100%) rename print.hh => core/print.hh (100%) rename reactor.cc => core/reactor.cc (100%) rename reactor.hh => core/reactor.hh (100%) rename sstring.hh => core/sstring.hh (100%) rename vla.hh => core/vla.hh (100%) rename arp.cc => net/arp.cc (100%) rename arp.hh => net/arp.hh (98%) rename byteorder.hh => net/byteorder.hh (100%) rename ethernet.cc => net/ethernet.cc (100%) rename ethernet.hh => net/ethernet.hh (97%) rename ip.cc => net/ip.cc (98%) rename ip.hh => net/ip.hh (100%) rename net.cc => net/net.cc (100%) rename net.hh => net/net.hh (99%) rename virtio-interface.hh => net/virtio-interface.hh (100%) rename virtio.cc => net/virtio.cc (99%) rename virtio.hh => net/virtio.hh (89%) rename fileiotest.cc => tests/fileiotest.cc (98%) rename ip_test.cc => tests/ip_test.cc (73%) rename l3_test.cc => tests/l3_test.cc (87%) rename test-reactor.cc => tests/test-reactor.cc (98%) rename virtiotest.cc => tests/virtiotest.cc (96%) diff --git a/httpd.cc b/apps/httpd/httpd.cc similarity index 99% rename from httpd.cc rename to apps/httpd/httpd.cc index 9dd96232a6..38a70c725d 100644 --- a/httpd.cc +++ b/apps/httpd/httpd.cc @@ -2,8 +2,8 @@ * Copyright 2014 Cloudius Systems */ -#include "reactor.hh" -#include "sstring.hh" +#include "core/reactor.hh" +#include "core/sstring.hh" #include #include #include diff --git a/main.cc b/apps/seastar/main.cc similarity index 84% rename from main.cc rename to apps/seastar/main.cc index e79623840d..ebbdbc23f4 100644 --- a/main.cc +++ b/apps/seastar/main.cc @@ -6,7 +6,7 @@ */ -#include "reactor.hh" +#include "core/reactor.hh" int main(int ac, char** av) { diff --git a/build.mk b/build.mk index 641e6e10ed..3e7ebd2083 100644 --- a/build.mk +++ b/build.mk @@ -20,7 +20,7 @@ CXXFLAGS += -I $(src) # Ubuntu fails without this, see https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201 CXXFLAGS += -Wl,--no-as-needed -tests = test-reactor fileiotest virtiotest l3_test ip_test +tests = tests/test-reactor tests/fileiotest tests/virtiotest tests/l3_test tests/ip_test link = mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -o $@ $^ compile = mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c -o $@ $< @@ -31,24 +31,24 @@ compile = mkdir -p $(@D) && $(CXX) $(CXXFLAGS) -c -o $@ $< %.o: %.cc $(compile) -all: seastar $(tests) httpd +all: apps/seastar/seastar $(tests) apps/httpd/httpd clean: rm seastar $(tests) *.o -seastar: main.o reactor.o +apps/seastar/seastar: apps/seastar/main.o core/reactor.o $(link) -test-reactor: test-reactor.o reactor.o +tests/test-reactor: tests/test-reactor.o core/reactor.o -httpd: httpd.o reactor.o +apps/httpd/httpd: apps/httpd/httpd.o core/reactor.o -fileiotest: fileiotest.o reactor.o +tests/fileiotest: tests/fileiotest.o core/reactor.o -virtiotest: virtiotest.o virtio.o reactor.o net.o ip.o ethernet.o arp.o +tests/virtiotest: tests/virtiotest.o net/virtio.o core/reactor.o net/net.o net/ip.o net/ethernet.o net/arp.o -l3_test: l3_test.o virtio.o reactor.o net.o ip.o ethernet.o arp.o +tests/l3_test: tests/l3_test.o net/virtio.o core/reactor.o net/net.o net/ip.o net/ethernet.o net/arp.o -ip_test: ip_test.o virtio.o reactor.o net.o ip.o arp.o ethernet.o +tests/ip_test: tests/ip_test.o net/virtio.o core/reactor.o net/net.o net/ip.o net/arp.o net/ethernet.o -include $(shell find -name '*.d') diff --git a/apply.hh b/core/apply.hh similarity index 100% rename from apply.hh rename to core/apply.hh diff --git a/posix.hh b/core/posix.hh similarity index 100% rename from posix.hh rename to core/posix.hh diff --git a/print.hh b/core/print.hh similarity index 100% rename from print.hh rename to core/print.hh diff --git a/reactor.cc b/core/reactor.cc similarity index 100% rename from reactor.cc rename to core/reactor.cc diff --git a/reactor.hh b/core/reactor.hh similarity index 100% rename from reactor.hh rename to core/reactor.hh diff --git a/sstring.hh b/core/sstring.hh similarity index 100% rename from sstring.hh rename to core/sstring.hh diff --git a/vla.hh b/core/vla.hh similarity index 100% rename from vla.hh rename to core/vla.hh diff --git a/arp.cc b/net/arp.cc similarity index 100% rename from arp.cc rename to net/arp.cc diff --git a/arp.hh b/net/arp.hh similarity index 98% rename from arp.hh rename to net/arp.hh index fe467e50c7..d22e08aa78 100644 --- a/arp.hh +++ b/net/arp.hh @@ -7,10 +7,10 @@ #define ARP_HH_ #include "net.hh" -#include "reactor.hh" +#include "core/reactor.hh" #include "byteorder.hh" #include "ethernet.hh" -#include "print.hh" +#include "core/print.hh" #include namespace net { diff --git a/byteorder.hh b/net/byteorder.hh similarity index 100% rename from byteorder.hh rename to net/byteorder.hh diff --git a/ethernet.cc b/net/ethernet.cc similarity index 100% rename from ethernet.cc rename to net/ethernet.cc diff --git a/ethernet.hh b/net/ethernet.hh similarity index 97% rename from ethernet.hh rename to net/ethernet.hh index 639e832c1c..256775f6e2 100644 --- a/ethernet.hh +++ b/net/ethernet.hh @@ -7,7 +7,7 @@ #include #include "byteorder.hh" -#include "print.hh" +#include "core/print.hh" namespace net { diff --git a/ip.cc b/net/ip.cc similarity index 98% rename from ip.cc rename to net/ip.cc index f6a8dc4633..8fffdd22d4 100644 --- a/ip.cc +++ b/net/ip.cc @@ -4,7 +4,7 @@ */ #include "ip.hh" -#include "print.hh" +#include "core/print.hh" namespace net { diff --git a/ip.hh b/net/ip.hh similarity index 100% rename from ip.hh rename to net/ip.hh diff --git a/net.cc b/net/net.cc similarity index 100% rename from net.cc rename to net/net.cc diff --git a/net.hh b/net/net.hh similarity index 99% rename from net.hh rename to net/net.hh index 519a0a695a..254f413e73 100644 --- a/net.hh +++ b/net/net.hh @@ -5,7 +5,7 @@ #ifndef NET_HH_ #define NET_HH_ -#include "reactor.hh" +#include "core/reactor.hh" #include "ethernet.hh" #include diff --git a/virtio-interface.hh b/net/virtio-interface.hh similarity index 100% rename from virtio-interface.hh rename to net/virtio-interface.hh diff --git a/virtio.cc b/net/virtio.cc similarity index 99% rename from virtio.cc rename to net/virtio.cc index 18e1500e98..a7d68ae642 100644 --- a/virtio.cc +++ b/net/virtio.cc @@ -3,10 +3,10 @@ */ #include "virtio.hh" -#include "posix.hh" -#include "vla.hh" +#include "core/posix.hh" +#include "core/vla.hh" #include "virtio-interface.hh" -#include "reactor.hh" +#include "core/reactor.hh" #include #include #include diff --git a/virtio.hh b/net/virtio.hh similarity index 89% rename from virtio.hh rename to net/virtio.hh index 07d185794d..4c52e10042 100644 --- a/virtio.hh +++ b/net/virtio.hh @@ -7,7 +7,7 @@ #include #include "net.hh" -#include "sstring.hh" +#include "core/sstring.hh" std::unique_ptr create_virtio_net_device(sstring tap_device); diff --git a/fileiotest.cc b/tests/fileiotest.cc similarity index 98% rename from fileiotest.cc rename to tests/fileiotest.cc index fce22a4d3b..35a8138c25 100644 --- a/fileiotest.cc +++ b/tests/fileiotest.cc @@ -3,7 +3,7 @@ */ #include -#include "reactor.hh" +#include "core/reactor.hh" struct file_test { file_test(file&& f) : f(std::move(f)) {} diff --git a/ip_test.cc b/tests/ip_test.cc similarity index 73% rename from ip_test.cc rename to tests/ip_test.cc index 5bad48b6e8..9bfa715059 100644 --- a/ip_test.cc +++ b/tests/ip_test.cc @@ -2,11 +2,11 @@ * Copyright (C) 2014 Cloudius Systems, Ltd. */ -#include "arp.hh" -#include "ip.hh" -#include "net.hh" -#include "reactor.hh" -#include "virtio.hh" +#include "net/arp.hh" +#include "net/ip.hh" +#include "net/net.hh" +#include "core/reactor.hh" +#include "net/virtio.hh" using namespace net; diff --git a/l3_test.cc b/tests/l3_test.cc similarity index 87% rename from l3_test.cc rename to tests/l3_test.cc index 205bea55b7..c88d282942 100644 --- a/l3_test.cc +++ b/tests/l3_test.cc @@ -2,9 +2,9 @@ * Copyright (C) 2014 Cloudius Systems, Ltd. */ -#include "net.hh" -#include "reactor.hh" -#include "virtio.hh" +#include "net/net.hh" +#include "core/reactor.hh" +#include "net/virtio.hh" using namespace net; diff --git a/test-reactor.cc b/tests/test-reactor.cc similarity index 98% rename from test-reactor.cc rename to tests/test-reactor.cc index fe1fbe20af..b149fa77fa 100644 --- a/test-reactor.cc +++ b/tests/test-reactor.cc @@ -5,7 +5,7 @@ * Author: avi */ -#include "reactor.hh" +#include "core/reactor.hh" #include struct test { diff --git a/virtiotest.cc b/tests/virtiotest.cc similarity index 96% rename from virtiotest.cc rename to tests/virtiotest.cc index 88691c297c..e92a505cd3 100644 --- a/virtiotest.cc +++ b/tests/virtiotest.cc @@ -3,9 +3,9 @@ * */ -#include "virtio.hh" -#include "reactor.hh" -#include "ip.hh" +#include "net/virtio.hh" +#include "core/reactor.hh" +#include "net/ip.hh" #include #include #include