summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-19 13:14:21 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-20 07:27:37 +0100
commita527f70a41d96a754ab02915a69b4e4bdea18cc7 (patch)
tree04e9838b51b8524b0f3b978e53a29b142cd1b789 /docs
parent4de8d971f0ccad872c3576636e1ae5a972334d3f (diff)
downloadsystemd-a527f70a41d96a754ab02915a69b4e4bdea18cc7.tar.gz
CODING_STYLE: clarify the rules for the src/basic & src/shared split
The rule is changed from "put in basic unless there's a reason not to" to "put in shared unless there's a reason not to", to match the change done in previous commit. This minimizes libbasic. See previous commit for the reasons why this is useful. Previously, the guideline was based on whether the files in question use "publicly exported APIs". This distinction is not particularly relevant. Let's consider all other programs we compile: most of them use "publicly exported APIs", usually linking to libsystemd-shared.so for the actual code. But those programs are not forced to be in src/basic, and the distinction whether they happen to use 'sd-*.h' or not is of no importance. The same is true for files in src/shared/. If we didn't have publicly exported shared objects, we'd put everything in libsystemd-shared.so. So let's only move things out of it that we need to. Previous guideline was not "wrong", in the sense that it created *a* split that was functional (no code in src/shared was required in the publicly exported shared objects), but it put more files in basic/ then necessary. Not much changes in practice, because (as previous commit shows), moving files between libbasic.a and libsystemd-shared.so mostly just changes compilation order. The list of components which cannot use libsystemd-shared.so is adjusted.
Diffstat (limited to 'docs')
-rw-r--r--docs/CODING_STYLE.md17
1 files changed, 10 insertions, 7 deletions
diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md
index b8337fd097..abcdaab4ac 100644
--- a/docs/CODING_STYLE.md
+++ b/docs/CODING_STYLE.md
@@ -431,12 +431,13 @@
want to call it "big endian" right-away.
- You might wonder what kind of common code belongs in `src/shared/` and what
- belongs in `src/basic/`. The split is like this: anything that uses public APIs
- we expose (i.e. any of the sd-bus, sd-login, sd-id128, ... APIs) must be
- located in `src/shared/`. All stuff that only uses external libraries from
- other projects (such as glibc's APIs), or APIs from `src/basic/` itself should
- be placed in `src/basic/`. Conversely, `src/libsystemd/` may only use symbols
- from `src/basic`, but not from `src/shared/`.
+ belongs in `src/basic/`. The split is like this: anything that is used to
+ implement the public shared object we provide (sd-bus, sd-login, sd-id128,
+ nss-systemd, nss-mymachines, nss-resolve, nss-myhostname, pam_systemd), must
+ be located in `src/basic` (those objects are not allowed to link to
+ libsystemd-shared.so). Conversly, anything which is shared between multiple
+ components and does not need to be in `src/basic/`, should be in
+ `src/shared/`.
To summarize:
@@ -449,7 +450,9 @@
- may not use any code outside of `src/basic/`, `src/libsystemd/`
`src/shared/`
- - may be used by all code in the tree, except for code in `src/basic/`, `src/libsystemd/`
+ - may be used by all code in the tree, except for code in `src/basic/`,
+ `src/libsystemd/`, `src/nss-*`, `src/login/pam_systemd.*`, and files under
+ `src/journal/` that end up in `libjournal-client.a` convenience library.
- may not use any code outside of `src/basic/`, `src/libsystemd/`, `src/shared/`
- Our focus is on the GNU libc (glibc), not any other libcs. If other libcs are