torproject / tor Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log dependencies #174
Log dependencies #174
Conversation
Minimizing includes revealed other places includes were necessary.
Containers were using crypto_digest.h, just to see the value of DIGEST_LEN. Moved those constants into a new defs module.
The other time stuff is higher-level
Now that I know that "strings" nests below "container", I know this is safe.
The locking code gets its own module, since it's more fundamental than the higher-level locking code. Extracting the logging code was the whole point here. :)
This change makes a whole bunch of things in torlog.c break, since apparently I did not find all the fd dependencies.
This patch:
- introduces an fdio module for low-level fd functions that don't
need to log.
- moves the responsibility for opening files outside of torlog.c,
so it won't need to call tor_open_cloexec.
|
What's the trac ticket here? |
src/common/util.h
Outdated
| @@ -23,6 +23,7 @@ | |||
| #include <sys/stat.h> | |||
| #endif | |||
| #include "lib/err/torerr.h" | |||
| #include "lib/malloc/util_malloc.h" | |||
I'll bikeshed here but I think util.h or even malloc.h (I might personally prefer util.h) could be better here because we are already in the "malloc module" so util_malloc.h when we enforce the lib/malloc/ include statement is redundant.
I think malloc.h is fine, but not util.h -- that would mean we had a bunch of files named util.h, and I don't want to have two headers or c files with the same name.
| * with helper functions to use smartlists. Also includes | ||
| * hash table implementations of a string-to-void* map, and of | ||
| * a digest-to-void* map. | ||
| **/ |
| int mask; /**< One less than the number of bits in <b>ba</b>; always one less | ||
| * than a power of two. */ | ||
| bitarray_t *ba; /**< A bit array to implement the Bloom filter. */ | ||
| } digestset_t; |
I think, this can be done after, we should namespace these with the bloomfilt name even thought "digest set" is technically valid.
| * with helper functions to use smartlists. Also includes | ||
| * hash table implementations of a string-to-void* map, and of | ||
| * a digest-to-void* map. | ||
| **/ |
Bad comments, I guess copy pasting :). Seems many files in lib/container/ suffer from this.
src/include.am
Outdated
| @@ -5,6 +5,7 @@ include src/lib/ctime/include.am | |||
| include src/lib/compress/include.am | |||
| include src/lib/container/include.am | |||
| include src/lib/crypt_ops/include.am | |||
| include src/lib/defs/include.am | |||
What does defs/ stands for here? "Definitions" I presume? Would we put all global constant in there or ?...
yes, definitions. But I think only top-level definitions that need to be really global.
src/lib/string/include.am
Outdated
|
|
||
| src_lib_libtor_string_a_SOURCES = \ | ||
| src/lib/string/compat_ctype.c \ | ||
| src/lib/string/util_string.c \ |
I might have the same comment as malloc module here with this util_string.c.
.gitignore
Outdated
| @@ -173,6 +173,8 @@ uptime-*.json | |||
| /src/lib/libtor-ctime-testing.a | |||
| /src/lib/libtor-err.a | |||
| /src/lib/libtor-err-testing.a | |||
| /src/lib/libtor-intmath.a | |||
What about a math module instead and we put everything related to "math" in there (not only int stuff). I mean with this name, does the floating math functions apply to go in?
no, higher-level stuff should go in another module.
This one is for low-level integer math.
src/lib/wallclock/include.am
Outdated
| @@ -7,6 +7,7 @@ endif | |||
|
|
|||
| src_lib_libtor_wallclock_a_SOURCES = \ | |||
| src/lib/wallclock/approx_time.c \ | |||
| src/lib/wallclock/tm_cvt.c \ | |||
I'm not familiar with this naming, what does tm_cvt means here?
Makefile.am
Outdated
| @@ -42,6 +42,7 @@ TOR_UTIL_LIBS = \ | |||
| src/common/libor.a \ | |||
| src/lib/libtor-log.a \ | |||
| src/lib/libtor-lock.a \ | |||
| src/lib/libtor-fdio.a \ | |||
Quick question: Is the goal of this library to also get the tor_open_* family of functions (currently mostly in compat.c)?
If yes, I'm wondering if libtor-io.a wouldn't be better and we could also bring in all the network low level functions? Or for that you had in mind a libtor-network. kind of separation?
No, tor_open_* needs to be at a higher level, or else it will cause a circular dependency. Those functions have a lot of complexity, and have the potential to log, and require the sandbox code.
No description provided.
The text was updated successfully, but these errors were encountered: