Move buffers.c out of lib/containers to resolve a circularity.

This commit is contained in:
Nick Mathewson 2018-11-06 18:05:14 -05:00
parent c9f9c9bc49
commit f6b8c7da66
47 changed files with 71 additions and 41 deletions

2
.gitignore vendored
View File

@ -155,6 +155,8 @@ uptime-*.json
# /src/lib
/src/lib/libcurve25519_donna.a
/src/lib/libtor-buf.a
/src/lib/libtor-buf-testing.a
/src/lib/libtor-compress.a
/src/lib/libtor-compress-testing.a
/src/lib/libtor-container.a

View File

@ -42,6 +42,7 @@ endif
TOR_UTIL_LIBS = \
src/lib/libtor-geoip.a \
src/lib/libtor-process.a \
src/lib/libtor-buf.a \
src/lib/libtor-time.a \
src/lib/libtor-fs.a \
src/lib/libtor-encoding.a \
@ -72,6 +73,7 @@ if UNITTESTS_ENABLED
TOR_UTIL_TESTING_LIBS = \
src/lib/libtor-geoip-testing.a \
src/lib/libtor-process-testing.a \
src/lib/libtor-buf-testing.a \
src/lib/libtor-time-testing.a \
src/lib/libtor-fs-testing.a \
src/lib/libtor-encoding-testing.a \

View File

@ -67,7 +67,7 @@
#include "feature/stats/predict_ports.h"
#include "feature/stats/rephist.h"
#include "lib/compress/compress.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_s2k.h"
#include "lib/geoip/geoip.h"

View File

@ -57,7 +57,7 @@
#define CONNECTION_PRIVATE
#include "core/or/or.h"
#include "feature/client/bridges.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/tls/buffers_tls.h"
#include "lib/err/backtrace.h"

View File

@ -95,7 +95,7 @@
#include "feature/stats/geoip_stats.h"
#include "feature/stats/predict_ports.h"
#include "feature/stats/rephist.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/err/backtrace.h"
#include "lib/tls/buffers_tls.h"

View File

@ -94,7 +94,7 @@
#include "lib/compress/compress_lzma.h"
#include "lib/compress/compress_zlib.h"
#include "lib/compress/compress_zstd.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "ht.h"

View File

@ -97,7 +97,7 @@
#include "feature/rend/rendservice.h"
#include "feature/stats/predict_ports.h"
#include "feature/stats/rephist.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/crypt_ops/crypto_util.h"
#include "core/or/cell_st.h"

View File

@ -22,7 +22,7 @@
**/
#include "core/or/or.h"
#include "feature/client/bridges.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
/*
* Define this so we get channel internal functions, since we're implementing
* part of a subclass (channel_tls_t).

View File

@ -26,7 +26,7 @@
#include "lib/cc/compat_compiler.h"
#include "lib/cc/torint.h"
#include "lib/container/map.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/container/smartlist.h"
#include "lib/crypt_ops/crypto_cipher.h"
#include "lib/crypt_ops/crypto_rsa.h"

View File

@ -49,7 +49,7 @@
#include "core/or/or.h"
#include "feature/client/addressmap.h"
#include "lib/err/backtrace.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/or/channel.h"
#include "feature/client/circpathbias.h"
#include "core/or/circuitbuild.h"

View File

@ -9,7 +9,7 @@
#define SCHEDULER_KIST_PRIVATE
#include "core/or/scheduler.h"
#include "core/mainloop/mainloop.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#define TOR_CHANNEL_INTERNAL_
#include "core/or/channeltls.h"
#include "lib/evloop/compat_libevent.h"

View File

@ -4,7 +4,7 @@
#define SCHEDULER_KIST_PRIVATE
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "feature/nodelist/networkstatus.h"

View File

@ -5,7 +5,7 @@
/* See LICENSE for licensing information */
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/proto/proto_cell.h"
#include "core/or/connection_or.h"

View File

@ -5,7 +5,7 @@
/* See LICENSE for licensing information */
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/proto/proto_control0.h"
/** Return 1 iff buf looks more like it has an (obsolete) v0 controller

View File

@ -5,7 +5,7 @@
/* See LICENSE for licensing information */
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "feature/relay/ext_orport.h"
#include "core/proto/proto_ext_or.h"

View File

@ -6,7 +6,7 @@
#define PROTO_HTTP_PRIVATE
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/proto/proto_http.h"
/** Return true if <b>cmd</b> looks like a HTTP (proxy) request. */

View File

@ -6,7 +6,7 @@
#include "core/or/or.h"
#include "feature/client/addressmap.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/mainloop/connection.h"
#include "feature/control/control.h"
#include "app/config/config.h"

View File

@ -87,7 +87,7 @@
#include "feature/rend/rendservice.h"
#include "feature/stats/geoip_stats.h"
#include "feature/stats/predict_ports.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/encoding/confline.h"

View File

@ -30,7 +30,7 @@
#include "core/or/or.h"
#include "ht.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "app/config/config.h"
#include "feature/control/control.h"
#include "feature/client/dnsserv.h"

View File

@ -1,5 +1,6 @@
include src/ext/include.am
include src/lib/arch/include.am
include src/lib/buf/include.am
include src/lib/err/include.am
include src/lib/cc/include.am
include src/lib/ctime/include.am

10
src/lib/buf/.may_include Normal file
View File

@ -0,0 +1,10 @@
orconfig.h
lib/buf/*.h
lib/cc/*.h
lib/ctime/*.h
lib/malloc/*.h
lib/testsupport/*.h
lib/log/*.h
lib/string/*.h
lib/time/*.h

View File

@ -25,7 +25,7 @@
#define BUFFERS_PRIVATE
#include "orconfig.h"
#include <stddef.h>
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/cc/torint.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"

17
src/lib/buf/include.am Normal file
View File

@ -0,0 +1,17 @@
noinst_LIBRARIES += src/lib/libtor-buf.a
if UNITTESTS_ENABLED
noinst_LIBRARIES += src/lib/libtor-buf-testing.a
endif
src_lib_libtor_buf_a_SOURCES = \
src/lib/buf/buffers.c
src_lib_libtor_buf_testing_a_SOURCES = \
$(src_lib_libtor_buf_a_SOURCES)
src_lib_libtor_buf_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
src_lib_libtor_buf_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
noinst_HEADERS += \
src/lib/buf/buffers.h

View File

@ -1,5 +1,6 @@
orconfig.h
lib/arch/*.h
lib/buf/*.h
lib/cc/*.h
lib/compress/*.h
lib/container/*.h

View File

@ -11,7 +11,7 @@
#define BUFFERS_PRIVATE
#include "lib/cc/compat_compiler.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/compress/compress.h"
#include "lib/log/util_bug.h"

View File

@ -11,8 +11,5 @@ lib/testsupport/testsupport.h
lib/intmath/*.h
lib/log/*.h
# XXXX I am unsure about this one. It's only here for buffers.c
lib/time/*.h
ht.h
siphash.h

View File

@ -7,7 +7,6 @@ endif
src_lib_libtor_container_a_SOURCES = \
src/lib/container/bloomfilt.c \
src/lib/container/buffers.c \
src/lib/container/map.c \
src/lib/container/order.c \
src/lib/container/smartlist.c
@ -20,7 +19,6 @@ src_lib_libtor_container_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS)
noinst_HEADERS += \
src/lib/container/bitarray.h \
src/lib/container/bloomfilt.h \
src/lib/container/buffers.h \
src/lib/container/handles.h \
src/lib/container/map.h \
src/lib/container/order.h \

View File

@ -3,6 +3,7 @@ siphash.h
ht.h
lib/arch/*.h
lib/buf/*.h
lib/cc/*.h
lib/container/*.h
lib/ctime/*.h

View File

@ -11,7 +11,7 @@
#define BUFFERS_PRIVATE
#include "lib/net/buffers_net.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include "lib/net/nettypes.h"

View File

@ -1,6 +1,7 @@
orconfig.h
lib/arch/*.h
lib/buf/*.h
lib/cc/*.h
lib/container/*.h
lib/crypt_ops/*.h

View File

@ -12,7 +12,7 @@
#define BUFFERS_PRIVATE
#include "orconfig.h"
#include <stddef.h>
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/tls/buffers_tls.h"
#include "lib/cc/torint.h"
#include "lib/log/log.h"

View File

@ -8,7 +8,7 @@
#include "core/or/or.h"
#include "lib/err/backtrace.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "feature/dircache/dircache.h"

View File

@ -8,7 +8,7 @@
#include "core/or/or.h"
#include "lib/err/backtrace.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "core/or/connection_edge.h"

View File

@ -6,7 +6,7 @@
#define BUFFERS_PRIVATE
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/err/backtrace.h"
#include "lib/log/log.h"
#include "core/proto/proto_socks.h"

View File

@ -37,7 +37,7 @@
#include "core/or/or.h"
#include "lib/err/backtrace.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/or/circuitlist.h"
#include "core/or/circuitstats.h"
#include "lib/compress/compress.h"

View File

@ -6,7 +6,7 @@
#define BUFFERS_PRIVATE
#define PROTO_HTTP_PRIVATE
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "lib/tls/buffers_tls.h"
#include "lib/tls/tortls.h"
#include "lib/compress/compress.h"

View File

@ -21,7 +21,7 @@
#include "test/log_test_helpers.h"
#include "lib/tls/tortls.h"
#include "lib/evloop/timers.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/or/cell_st.h"
#include "feature/nodelist/networkstatus_st.h"

View File

@ -8,7 +8,7 @@
#define TOR_CHANNEL_INTERNAL_
#include "core/or/or.h"
#include "lib/net/address.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/or/channel.h"
#include "core/or/channeltls.h"
#include "core/mainloop/connection.h"

View File

@ -5,7 +5,7 @@
#define EXT_ORPORT_PRIVATE
#define MAINLOOP_PRIVATE
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/mainloop/connection.h"
#include "core/or/connection_or.h"
#include "app/config/config.h"

View File

@ -14,7 +14,7 @@
#include "orconfig.h"
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "app/config/config.h"
#include "app/config/confparse.h"
#include "core/mainloop/connection.h"

View File

@ -8,7 +8,7 @@
#define CIRCUITLIST_PRIVATE
#define CONNECTION_PRIVATE
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/or/circuitlist.h"
#include "lib/evloop/compat_libevent.h"
#include "core/mainloop/connection.h"

View File

@ -8,7 +8,7 @@
#include "core/or/or.h"
#include "test/test.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/proto/proto_http.h"
#include "test/log_test_helpers.h"

View File

@ -8,7 +8,7 @@
#include "core/or/or.h"
#include "test/test.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "core/or/connection_or.h"
#include "feature/relay/ext_orport.h"
#include "core/proto/proto_cell.h"

View File

@ -46,7 +46,7 @@
#include "feature/nodelist/routerstatus_st.h"
#include "lib/encoding/confline.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "test/test.h"
#include "test/test_dir_common.h"

View File

@ -4,7 +4,7 @@
/* See LICENSE for licensing information */
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "core/proto/proto_socks.h"

View File

@ -13,7 +13,7 @@
#define SUBPROCESS_PRIVATE
#include "lib/testsupport/testsupport.h"
#include "core/or/or.h"
#include "lib/container/buffers.h"
#include "lib/buf/buffers.h"
#include "app/config/config.h"
#include "feature/control/control.h"
#include "feature/client/transports.h"