1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

Merge pull request #8643 from poettering/coding-style-fixlets

Trivial CODING_STYLE additions
This commit is contained in:
Evgeny Vereshchagin 2018-04-04 02:13:05 +03:00 committed by GitHub
commit 68b04721dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 5 deletions

22
TODO
View File

@ -24,6 +24,28 @@ Janitorial Clean-ups:
Features:
* list the exit codes from the BSD/glibc <sysexits.h> in our own
exit-codes.[ch] tables.
* introduce Ephemeral= unit file switch, that creates an ephemeral copy of all
files and directories that are left writable for a unit, and which are
removed after the unit goes down again. A bit like --ephemeral for
systemd-nspawn but for system services. If used together with RootImage= this
should reflink the image file itself.
Related: add Ephemeral=<path1> <path2> … which would allow marking
specific paths only like this.
* when RootImage= is used, mark the loopback device read-only if the other
settings permit it (i.e. if ProtectSystem=strict is set, and no directory if
the image is writable)
* add CopyFile= or so as unit file setting that may be used to copy files or
directory trees from the host to te services RootImage= and RootDirectory=
environment. Which we can use for /etc/machine-id and in particular
/etc/resolv.conf. Should be smart and do something useful on read-only
images, for example fallback to read-only bind mounting the file instead.
* nspawn's console TTY should be allocated from within the container, not
mounted in from the outside

View File

@ -7,9 +7,11 @@
comments easily discernable from explanatory, documenting code comments
(i.e. committable stuff).
- Don't break code lines too eagerly. We do *not* force line breaks at
80ch, all of today's screens should be much larger than that. But
then again, don't overdo it, ~119ch should be enough really.
- Don't break code lines too eagerly. We do *not* force line breaks at 80ch,
all of today's screens should be much larger than that. But then again, don't
overdo it, ~119ch should be enough really. The .editorconfig, .vimrc and
.dir-locals.el files contained in the repository will set this limit up for
you automatically, if you let them (as well as a few other things).
- Variables and functions *must* be static, unless they have a
prototype, and are supposed to be exported.
@ -67,7 +69,7 @@
values. Do not mix usec and msec, and usec and whatnot.
- Make use of _cleanup_free_ and friends. It makes your code much
nicer to read!
nicer to read (and shorter)!
- Be exceptionally careful when formatting and parsing floating point
numbers. Their syntax is locale dependent (i.e. "5.000" in en_US is
@ -99,7 +101,9 @@
- Do not write "foo ()", write "foo()".
- Please use streq() and strneq() instead of strcmp(), strncmp() where applicable.
- Please use streq() and strneq() instead of strcmp(), strncmp() where
applicable (i.e. wherever you just care about equality/inequality, not about
the sorting order).
- Please do not allocate variables on the stack in the middle of code,
even if C99 allows it. Wrong:
@ -450,3 +454,15 @@
O_NONBLOCK has a benefit: it bypasses any mandatory lock that might be in
effect on the regular file. If in doubt consider turning off O_NONBLOCK again
after opening.
- When referring to a configuration file option in the documentation and such,
please always suffix it with "=", to indicate that it is a configuration file
setting.
- When referring to a command line option in the documentation and such, please
allways prefix with "--" or "-" (as appropriate), to indicate that it is a
command line option.
- When referring to a file system path that is a directory, please always
suffix it with "/", to indicate that it is a directory, not a regular file
(or other file system object).