diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-11-27 16:06:39 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-11-27 16:06:39 +0100 |
commit | 79cdaaa0cf72fec7a43f1747a0c0ee3e6db8bc00 (patch) | |
tree | ced7dca9cff37d6087bf300cc58ed14db2706c43 /src | |
parent | 11bedc5cabb1c7c75b16bdb8276db8b764352b0a (diff) |
fileio: document why fileio-label.c and fileio.c are two different modules
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/fileio-label.h | 4 | ||||
-rw-r--r-- | src/basic/fileio.h | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/basic/fileio-label.h b/src/basic/fileio-label.h index d811ca9b8..42676a352 100644 --- a/src/basic/fileio-label.h +++ b/src/basic/fileio-label.h @@ -24,6 +24,10 @@ #include "fileio.h" +/* These functions are split out of fileio.h (and not for examplement just as flags to the functions they wrap) in + * order to optimize linking: This way, -lselinux is needed only for the callers of these functions that need selinux, + * but not for all */ + int write_string_file_atomic_label_ts(const char *fn, const char *line, struct timespec *ts); static inline int write_string_file_atomic_label(const char *fn, const char *line) { return write_string_file_atomic_label_ts(fn, line, NULL); diff --git a/src/basic/fileio.h b/src/basic/fileio.h index 5b3d045e0..d90fa4836 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -29,11 +29,16 @@ #include "time-util.h" typedef enum { - WRITE_STRING_FILE_CREATE = 1<<0, - WRITE_STRING_FILE_ATOMIC = 1<<1, - WRITE_STRING_FILE_AVOID_NEWLINE = 1<<2, + WRITE_STRING_FILE_CREATE = 1<<0, + WRITE_STRING_FILE_ATOMIC = 1<<1, + WRITE_STRING_FILE_AVOID_NEWLINE = 1<<2, WRITE_STRING_FILE_VERIFY_ON_FAILURE = 1<<3, - WRITE_STRING_FILE_SYNC = 1<<4, + WRITE_STRING_FILE_SYNC = 1<<4, + + /* And before you wonder, why write_string_file_atomic_label_ts() is a separate function instead of just one + more flag here: it's about linking: we don't want to pull -lselinux into all users of write_string_file() + and friends. */ + } WriteStringFileFlags; int write_string_stream_ts(FILE *f, const char *line, WriteStringFileFlags flags, struct timespec *ts); |