Merge pull request #10831 from keszybz/less-libbasic
Move various files that don't need to be in basic/ to shared/
This commit is contained in:
+19
-12
@@ -373,12 +373,16 @@
|
||||
something some time", or so is a lazy excuse. Always wait for the
|
||||
proper event, instead of doing time-based poll loops.
|
||||
|
||||
- To determine the length of a constant string `"foo"`, don't bother
|
||||
with `sizeof("foo")-1`, please use `STRLEN()` instead.
|
||||
- To determine the length of a constant string `"foo"`, don't bother with
|
||||
`sizeof("foo")-1`, please use `strlen()` instead (both gcc and clang optimize
|
||||
the call away for fixed strings). The only exception is when declaring an
|
||||
array. In that case use STRLEN, which evalutates to a static constant and
|
||||
doesn't force the compiler to create a VLA.
|
||||
|
||||
- If you want to concatenate two or more strings, consider using
|
||||
`strjoin()` rather than `asprintf()`, as the latter is a lot
|
||||
slower. This matters particularly in inner loops.
|
||||
- If you want to concatenate two or more strings, consider using `strjoina()`
|
||||
or `strjoin()` rather than `asprintf()`, as the latter is a lot slower. This
|
||||
matters particularly in inner loops (but note that `strjoina()` cannot be
|
||||
used there).
|
||||
|
||||
- Please avoid using global variables as much as you can. And if you
|
||||
do use them make sure they are static at least, instead of
|
||||
@@ -431,12 +435,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 +454,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
|
||||
|
||||
+1
-1
@@ -1666,7 +1666,7 @@ endif
|
||||
if conf.get('HAVE_BLKID') == 1
|
||||
executable('systemd-gpt-auto-generator',
|
||||
'src/gpt-auto-generator/gpt-auto-generator.c',
|
||||
'src/basic/blkid-util.h',
|
||||
'src/shared/blkid-util.h',
|
||||
include_directories : includes,
|
||||
link_with : [libshared],
|
||||
dependencies : libblkid,
|
||||
|
||||
@@ -15,23 +15,14 @@ basic_sources = files('''
|
||||
async.h
|
||||
audit-util.c
|
||||
audit-util.h
|
||||
barrier.c
|
||||
barrier.h
|
||||
bitmap.c
|
||||
bitmap.h
|
||||
blkid-util.h
|
||||
blockdev-util.c
|
||||
blockdev-util.h
|
||||
bpf-program.c
|
||||
bpf-program.h
|
||||
btrfs-ctree.h
|
||||
btrfs-util.c
|
||||
btrfs-util.h
|
||||
build.h
|
||||
bus-label.c
|
||||
bus-label.h
|
||||
calendarspec.c
|
||||
calendarspec.h
|
||||
cap-list.c
|
||||
cap-list.h
|
||||
capability-util.c
|
||||
@@ -40,16 +31,10 @@ basic_sources = files('''
|
||||
cgroup-util.h
|
||||
chattr-util.c
|
||||
chattr-util.h
|
||||
clock-util.c
|
||||
clock-util.h
|
||||
conf-files.c
|
||||
conf-files.h
|
||||
copy.c
|
||||
copy.h
|
||||
cpu-set-util.c
|
||||
cpu-set-util.h
|
||||
crypt-util.c
|
||||
crypt-util.h
|
||||
def.h
|
||||
device-nodes.c
|
||||
device-nodes.h
|
||||
@@ -63,20 +48,12 @@ basic_sources = files('''
|
||||
escape.h
|
||||
ether-addr-util.c
|
||||
ether-addr-util.h
|
||||
exec-util.c
|
||||
exec-util.h
|
||||
exit-status.c
|
||||
exit-status.h
|
||||
extract-word.c
|
||||
extract-word.h
|
||||
fd-util.c
|
||||
fd-util.h
|
||||
fileio-label.c
|
||||
fileio-label.h
|
||||
fileio.c
|
||||
fileio.h
|
||||
format-table.c
|
||||
format-table.h
|
||||
format-util.h
|
||||
fs-util.c
|
||||
fs-util.h
|
||||
@@ -97,11 +74,6 @@ basic_sources = files('''
|
||||
io-util.c
|
||||
io-util.h
|
||||
ioprio.h
|
||||
journal-importer.c
|
||||
journal-importer.h
|
||||
json-internal.h
|
||||
json.c
|
||||
json.h
|
||||
khash.c
|
||||
khash.h
|
||||
label.c
|
||||
@@ -109,8 +81,6 @@ basic_sources = files('''
|
||||
list.h
|
||||
locale-util.c
|
||||
locale-util.h
|
||||
lockfile-util.c
|
||||
lockfile-util.h
|
||||
log.c
|
||||
log.h
|
||||
login-util.c
|
||||
@@ -129,8 +99,6 @@ basic_sources = files('''
|
||||
nss-util.h
|
||||
ordered-set.c
|
||||
ordered-set.h
|
||||
os-util.c
|
||||
os-util.h
|
||||
pager.c
|
||||
pager.h
|
||||
parse-util.c
|
||||
@@ -151,17 +119,11 @@ basic_sources = files('''
|
||||
ratelimit.h
|
||||
raw-clone.h
|
||||
raw-reboot.h
|
||||
reboot-util.c
|
||||
reboot-util.h
|
||||
refcnt.h
|
||||
replace-var.c
|
||||
replace-var.h
|
||||
rlimit-util.c
|
||||
rlimit-util.h
|
||||
rm-rf.c
|
||||
rm-rf.h
|
||||
securebits-util.c
|
||||
securebits-util.h
|
||||
securebits.h
|
||||
selinux-util.c
|
||||
selinux-util.h
|
||||
@@ -175,8 +137,6 @@ basic_sources = files('''
|
||||
smack-util.c
|
||||
smack-util.h
|
||||
socket-label.c
|
||||
socket-protocol-list.c
|
||||
socket-protocol-list.h
|
||||
socket-util.c
|
||||
socket-util.h
|
||||
sparse-endian.h
|
||||
@@ -213,16 +173,10 @@ basic_sources = files('''
|
||||
utf8.h
|
||||
util.c
|
||||
util.h
|
||||
verbs.c
|
||||
verbs.h
|
||||
virt.c
|
||||
virt.h
|
||||
web-util.c
|
||||
web-util.h
|
||||
xattr-util.c
|
||||
xattr-util.h
|
||||
xml.c
|
||||
xml.h
|
||||
'''.split())
|
||||
|
||||
missing_h = files('missing.h')
|
||||
@@ -315,7 +269,6 @@ libbasic = static_library(
|
||||
include_directories : includes,
|
||||
dependencies : [threads,
|
||||
libcap,
|
||||
libblkid,
|
||||
libmount,
|
||||
libselinux,
|
||||
libm],
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sd-event.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "btrfs-util.h"
|
||||
#include "chattr-util.h"
|
||||
@@ -23,7 +25,6 @@
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "random-util.h"
|
||||
#include "sd-event.h"
|
||||
#include "set.h"
|
||||
#include "stat-util.h"
|
||||
#include "string-util.h"
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_GCRYPT
|
||||
#include <gcrypt.h>
|
||||
# include <gcrypt.h>
|
||||
#endif
|
||||
|
||||
#include "sd-event.h"
|
||||
#include "sd-id128.h"
|
||||
|
||||
#include "hashmap.h"
|
||||
#include "journal-def.h"
|
||||
#include "macro.h"
|
||||
#include "mmap-cache.h"
|
||||
#include "sd-event.h"
|
||||
#include "sparse-endian.h"
|
||||
|
||||
typedef struct JournalMetrics {
|
||||
|
||||
@@ -8,24 +8,39 @@ shared_sources = files('''
|
||||
apparmor-util.h
|
||||
ask-password-api.c
|
||||
ask-password-api.h
|
||||
barrier.c
|
||||
barrier.h
|
||||
base-filesystem.c
|
||||
base-filesystem.h
|
||||
bitmap.c
|
||||
bitmap.h
|
||||
blkid-util.h
|
||||
boot-timestamps.c
|
||||
boot-timestamps.h
|
||||
bootspec.c
|
||||
bootspec.h
|
||||
bpf-program.c
|
||||
bpf-program.h
|
||||
bus-unit-util.c
|
||||
bus-unit-util.h
|
||||
bus-util.c
|
||||
bus-util.h
|
||||
calendarspec.c
|
||||
calendarspec.h
|
||||
cgroup-show.c
|
||||
cgroup-show.h
|
||||
clean-ipc.c
|
||||
clean-ipc.h
|
||||
clock-util.c
|
||||
clock-util.h
|
||||
condition.c
|
||||
condition.h
|
||||
conf-parser.c
|
||||
conf-parser.h
|
||||
cpu-set-util.c
|
||||
cpu-set-util.h
|
||||
crypt-util.c
|
||||
crypt-util.h
|
||||
dev-setup.c
|
||||
dev-setup.h
|
||||
dissect-image.c
|
||||
@@ -37,9 +52,17 @@ shared_sources = files('''
|
||||
efivars.c
|
||||
efivars.h
|
||||
enable-mempool.c
|
||||
exec-util.c
|
||||
exec-util.h
|
||||
exit-status.c
|
||||
exit-status.h
|
||||
fdset.c
|
||||
fdset.h
|
||||
fileio-label.c
|
||||
fileio-label.h
|
||||
firewall-util.h
|
||||
format-table.c
|
||||
format-table.h
|
||||
fstab-util.c
|
||||
fstab-util.h
|
||||
generator.c
|
||||
@@ -56,8 +79,15 @@ shared_sources = files('''
|
||||
install-printf.h
|
||||
install.c
|
||||
install.h
|
||||
journal-importer.c
|
||||
journal-importer.h
|
||||
journal-util.c
|
||||
journal-util.h
|
||||
json-internal.h
|
||||
json.c
|
||||
json.h
|
||||
lockfile-util.c
|
||||
lockfile-util.h
|
||||
logs-show.c
|
||||
logs-show.h
|
||||
loop-util.c
|
||||
@@ -69,19 +99,29 @@ shared_sources = files('''
|
||||
module-util.h
|
||||
nsflags.c
|
||||
nsflags.h
|
||||
os-util.c
|
||||
os-util.h
|
||||
output-mode.c
|
||||
output-mode.h
|
||||
path-lookup.c
|
||||
path-lookup.h
|
||||
ptyfwd.c
|
||||
ptyfwd.h
|
||||
reboot-util.c
|
||||
reboot-util.h
|
||||
resolve-util.c
|
||||
resolve-util.h
|
||||
rlimit-util.c
|
||||
rlimit-util.h
|
||||
seccomp-util.h
|
||||
securebits-util.c
|
||||
securebits-util.h
|
||||
serialize.c
|
||||
serialize.h
|
||||
sleep-config.c
|
||||
sleep-config.h
|
||||
socket-protocol-list.c
|
||||
socket-protocol-list.h
|
||||
spawn-ask-password-agent.c
|
||||
spawn-ask-password-agent.h
|
||||
spawn-polkit-agent.c
|
||||
@@ -99,13 +139,19 @@ shared_sources = files('''
|
||||
uid-range.c
|
||||
uid-range.h
|
||||
utmp-wtmp.h
|
||||
verbs.c
|
||||
verbs.h
|
||||
vlan-util.c
|
||||
vlan-util.h
|
||||
volatile-util.c
|
||||
volatile-util.h
|
||||
watchdog.c
|
||||
watchdog.h
|
||||
web-util.c
|
||||
web-util.h
|
||||
wireguard-netlink.h
|
||||
xml.c
|
||||
xml.h
|
||||
'''.split())
|
||||
|
||||
if get_option('tests') != 'false'
|
||||
|
||||
Reference in New Issue
Block a user