diff --git a/.gitignore b/.gitignore index 2cccc4531bd48ddfddc6b9b903237d49f3122c10..061c08d017f0604b154b091af03c37d88ab70e23 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ TAGS *.o libccan.a config.h -ccan/*-Makefile *~ tools/ccan_depends tools/doc_extract diff --git a/Makefile b/Makefile index b35531567d5751320f52e017466c7c301656353d..1e08982704956b7ba0465c4dd6062f7071534048 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,10 @@ summary-check-%: tools/ccanlint/ccanlint $(OBJFILES) summary-fastcheck-%: tools/ccanlint/ccanlint $(OBJFILES) tools/ccanlint/ccanlint -x tests_pass_valgrind -x tests_compile_coverage -s ccan/$* +# FIXME: Horrible hacks because % doesn't match / +summary-fastcheck-antithread/%: tools/ccanlint/ccanlint $(OBJFILES) + tools/ccanlint/ccanlint -x tests_pass_valgrind -x tests_compile_coverage -s ccan/antithread/$* + ccan/%/info: ccan/%/_info $(CC) $(CCAN_CFLAGS) -o $@ -x c $< diff --git a/Makefile-ccan b/Makefile-ccan index 39e5c69579a767e4fcf1b99a21e166d30df44456..6641e53e6bf6c8228840a5a81a2014ca6cefb795 100644 --- a/Makefile-ccan +++ b/Makefile-ccan @@ -25,8 +25,8 @@ MODS_NORMAL_NO_SRC := alignof \ typesafe_cb # No external dependencies, with C code: -MODS_NORMAL_WITH_SRC := alloc \ - antithread \ +MODS_NORMAL_WITH_SRC := antithread \ + antithread/alloc \ asort \ asprintf \ autodata \ diff --git a/ccan/.gitignore b/ccan/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..714e66ab8d7f3b3c4f65722f8368f145096a3e20 --- /dev/null +++ b/ccan/.gitignore @@ -0,0 +1 @@ +*-Makefile diff --git a/ccan/alloc/LICENSE b/ccan/alloc/LICENSE deleted file mode 120000 index dc314ecac02a0fb3117e54b1271ca135aaada572..0000000000000000000000000000000000000000 --- a/ccan/alloc/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../licenses/LGPL-2.1 \ No newline at end of file diff --git a/ccan/antithread/_info b/ccan/antithread/_info index ca8cd16c597b785733cac127d8316ab07d663f24..b4cf67fc8bfa559492fdc34f9147ad5aa744d686 100644 --- a/ccan/antithread/_info +++ b/ccan/antithread/_info @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { - printf("ccan/alloc\n"); + printf("ccan/antithread/alloc\n"); printf("ccan/err\n"); printf("ccan/list\n"); printf("ccan/noerr\n"); diff --git a/ccan/antithread/alloc/LICENSE b/ccan/antithread/alloc/LICENSE new file mode 120000 index 0000000000000000000000000000000000000000..4d0b239e79a99c803074188907950bc69cde158c --- /dev/null +++ b/ccan/antithread/alloc/LICENSE @@ -0,0 +1 @@ +../../../licenses/LGPL-2.1 \ No newline at end of file diff --git a/ccan/alloc/_info b/ccan/antithread/alloc/_info similarity index 96% rename from ccan/alloc/_info rename to ccan/antithread/alloc/_info index e4a47bac1733f01ab46c567219535d1e7ba30970..5ad18002e9563c2e5091445402e15335aabd6422 100644 --- a/ccan/alloc/_info +++ b/ccan/antithread/alloc/_info @@ -3,7 +3,7 @@ #include "config.h" /** - * alloc - memory allocator routines + * antithread/alloc - memory allocator routines * * The alloc module implements a simple allocator which you can use to * dynamically allocate space within a region of memory. This can be useful @@ -24,7 +24,7 @@ * #include <fcntl.h> * #include <string.h> * #include <stdlib.h> - * #include <ccan/alloc/alloc.h> + * #include <ccan/antithread/alloc/alloc.h> * * static void usage(const char *name) * { diff --git a/ccan/alloc/alloc.c b/ccan/antithread/alloc/alloc.c similarity index 99% rename from ccan/alloc/alloc.c rename to ccan/antithread/alloc/alloc.c index 47a597091d5a1df8f056a234298a48d143522c4c..1b36aa47e21c39c4d6b869b3aaaf791f27a55244 100644 --- a/ccan/alloc/alloc.c +++ b/ccan/antithread/alloc/alloc.c @@ -20,7 +20,7 @@ http://samba.org/~tridge/junkcode/alloc_mmap/ Copyright (C) Andrew Tridgell 2007 - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -362,7 +362,7 @@ void alloc_init(void *pool, unsigned long poolsize) /* We rely on page numbers fitting in 16 bit. */ BUILD_ASSERT(MAX_SMALL_PAGES < 65536); - + sp_bits = small_page_bits(poolsize); lp_bits = sp_bits + BITS_FROM_SMALL_TO_LARGE_PAGE; @@ -776,7 +776,7 @@ void alloc_free(void *pool, unsigned long poolsize, void *free) tiny_alloc_free(pool, poolsize, free); return; } - + /* Get page header. */ sp_bits = small_page_bits(poolsize); pgnum = offset >> sp_bits; @@ -1097,7 +1097,7 @@ bool alloc_check(void *pool, unsigned long poolsize) prev = i; } - + /* Make sure every page accounted for. */ for (i = 0; i < poolsize >> sp_bits; i++) { if (!test_bit(pages, i)) @@ -1200,7 +1200,7 @@ void alloc_visualize(FILE *out, void *pool, unsigned long poolsize) tiny_alloc_visualize(out, pool, poolsize); return; } - + sp_bits = small_page_bits(poolsize); lp_bits = sp_bits + BITS_FROM_SMALL_TO_LARGE_PAGE; diff --git a/ccan/alloc/alloc.h b/ccan/antithread/alloc/alloc.h similarity index 100% rename from ccan/alloc/alloc.h rename to ccan/antithread/alloc/alloc.h diff --git a/ccan/alloc/bitops.c b/ccan/antithread/alloc/bitops.c similarity index 100% rename from ccan/alloc/bitops.c rename to ccan/antithread/alloc/bitops.c diff --git a/ccan/alloc/bitops.h b/ccan/antithread/alloc/bitops.h similarity index 100% rename from ccan/alloc/bitops.h rename to ccan/antithread/alloc/bitops.h diff --git a/ccan/alloc/test/run-corrupt.c b/ccan/antithread/alloc/test/run-corrupt.c similarity index 80% rename from ccan/alloc/test/run-corrupt.c rename to ccan/antithread/alloc/test/run-corrupt.c index 3e7be17322a47f3fc3f9e846ac5ccf08952ae0b6..2c332d56a3761f3c4956a672aee2b3bc7b8c8500 100644 --- a/ccan/alloc/test/run-corrupt.c +++ b/ccan/antithread/alloc/test/run-corrupt.c @@ -1,7 +1,7 @@ /* Example allocation which caused corruption. */ -#include <ccan/alloc/alloc.c> -#include <ccan/alloc/bitops.c> -#include <ccan/alloc/tiny.c> +#include <ccan/antithread/alloc/alloc.c> +#include <ccan/antithread/alloc/bitops.c> +#include <ccan/antithread/alloc/tiny.c> #include <ccan/tap/tap.h> #include <stdlib.h> diff --git a/ccan/alloc/test/run-testsize.c b/ccan/antithread/alloc/test/run-testsize.c similarity index 90% rename from ccan/alloc/test/run-testsize.c rename to ccan/antithread/alloc/test/run-testsize.c index c70770cfc7f22e746f41e47d98ef1f329bf786d2..c702a3d29b39b9d2ac11592bdfea460729b10600 100644 --- a/ccan/alloc/test/run-testsize.c +++ b/ccan/antithread/alloc/test/run-testsize.c @@ -1,8 +1,8 @@ -#include <ccan/alloc/alloc.h> +#include <ccan/antithread/alloc/alloc.h> #include <ccan/tap/tap.h> -#include <ccan/alloc/alloc.c> -#include <ccan/alloc/bitops.c> -#include <ccan/alloc/tiny.c> +#include <ccan/antithread/alloc/alloc.c> +#include <ccan/antithread/alloc/bitops.c> +#include <ccan/antithread/alloc/tiny.c> #include <stdlib.h> #include <stdbool.h> #include <err.h> diff --git a/ccan/alloc/test/run-tiny-encode.c b/ccan/antithread/alloc/test/run-tiny-encode.c similarity index 94% rename from ccan/alloc/test/run-tiny-encode.c rename to ccan/antithread/alloc/test/run-tiny-encode.c index 8f548622fdc5bae8c7ab8b2d3b329b8d2c68c6f0..a76e746b9e26a0587785a42f75872900e26afb85 100644 --- a/ccan/alloc/test/run-tiny-encode.c +++ b/ccan/antithread/alloc/test/run-tiny-encode.c @@ -1,7 +1,7 @@ #include <ccan/tap/tap.h> #include "config.h" -#include <ccan/alloc/tiny.c> -#include <ccan/alloc/bitops.c> +#include <ccan/antithread/alloc/tiny.c> +#include <ccan/antithread/alloc/bitops.c> #include <stdlib.h> #include <err.h> diff --git a/ccan/alloc/test/run.c b/ccan/antithread/alloc/test/run.c similarity index 94% rename from ccan/alloc/test/run.c rename to ccan/antithread/alloc/test/run.c index f9981e7038fb736166b74381ba26db6f3ab20881..4b2b900bcbcbfbbbe7465841b4f4b8d9101691ad 100644 --- a/ccan/alloc/test/run.c +++ b/ccan/antithread/alloc/test/run.c @@ -1,8 +1,8 @@ -#include <ccan/alloc/alloc.h> +#include <ccan/antithread/alloc/alloc.h> #include <ccan/tap/tap.h> -#include <ccan/alloc/alloc.c> -#include <ccan/alloc/bitops.c> -#include <ccan/alloc/tiny.c> +#include <ccan/antithread/alloc/alloc.c> +#include <ccan/antithread/alloc/bitops.c> +#include <ccan/antithread/alloc/tiny.c> #include <stdlib.h> #include <err.h> @@ -22,9 +22,9 @@ static bool unique(void *p[], unsigned int num) if (p[i] == p[i-1]) return false; return true; -} +} -static bool free_every_second_one(void *mem, unsigned int num, +static bool free_every_second_one(void *mem, unsigned int num, unsigned long pool_size, void *p[]) { unsigned int i; diff --git a/ccan/alloc/tiny.c b/ccan/antithread/alloc/tiny.c similarity index 100% rename from ccan/alloc/tiny.c rename to ccan/antithread/alloc/tiny.c diff --git a/ccan/alloc/tiny.h b/ccan/antithread/alloc/tiny.h similarity index 100% rename from ccan/alloc/tiny.h rename to ccan/antithread/alloc/tiny.h diff --git a/ccan/antithread/antithread.c b/ccan/antithread/antithread.c index 080f890cd859fc6390c19e4e1daa18025283fb30..72e172b1a244d82bd6e503510943eaf155091691 100644 --- a/ccan/antithread/antithread.c +++ b/ccan/antithread/antithread.c @@ -15,7 +15,7 @@ #include <ccan/noerr/noerr.h> #include <ccan/talloc/talloc.h> #include <ccan/read_write_all/read_write_all.h> -#include <ccan/alloc/alloc.h> +#include <ccan/antithread/alloc/alloc.h> #include <ccan/list/list.h> /* FIXME: Valgrind support should be possible for some cases. Tricky