cleanerd: adjust the OOM killer

cleanerd is a very important process in a system which uses nilfs. So
it should adjust the OOM killer for reducing possibility of the
killing as much as possible.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
mkfs: check sizes of important structs at build time

Current nilfs_check_ondisk_sizes() checks sizes of important structs
at run time. The checking should be done at build time. This patch
adds a new macro, BUILD_BUG_ON(), for this purpose. It is similar to
static_assert() of C++11. If an argument is true, the macro causes a
bulid error.

Below is an example of BUILD_BUG_ON(). When the checked conditions are
true like below:

/* intentional change for testing BUILD_BUG_ON() */

static __attribute__((used)) void nilfs_check_ondisk_sizes(void)
{
	BUILD_BUG_ON(sizeof(struct nilfs_inode) > NILFS_MIN_BLOCKSIZE);
...

build process of mkfs.o causes errors like this:

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../..  -I../../include  -Wall -g -O2 -MT mkfs.o -MD -MP -MF .deps/mkfs.Tpo -c -o mkfs.o mkfs.c
mkfs.c: In function 'nilfs_check_ondisk_sizes':
mkfs.c:429:2: error: negative width in bit-field '<anonymous>'
mkfs.c:430:2: error: negative width in bit-field '<anonymous>'
mkfs.c:431:2: error: negative width in bit-field '<anonymous>'
mkfs.c:432:2: error: negative width in bit-field '<anonymous>'
mkfs.c:433:2: error: negative width in bit-field '<anonymous>'
mkfs.c:434:2: error: negative width in bit-field '<anonymous>'
mkfs.c:435:2: error: negative width in bit-field '<anonymous>'

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
cleanerd: ignore nofork option

The nofork option aims to reduce call of fork(), but it is not
effective. This patch lets cleanerd ignore the option simply even if
it is passed.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
cleanerd: call _exit(2) twice for ensuring not being a session leader

Current daemonize() function of cleanerd call _exit(2) only once
during its process of becoming a daemon process.  But in the linux
environment, a daemon should call _exit(2) twice for ensuring not
being a session leader.  If a process don't do that, unexpected SIGHUP
can be sent to the process (though it happens rarely). The signal
would be confusing event for cleanerd of nilfs.  This patch removes
this potential problem.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
mount: don't pass -n option to cleanerd

This patch lets mount.nilfs2 not pass the -n option to cleanerd,
because it is obsoleted.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
man: remove a description of -n option

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
man/lscp.1: remove "experimental" from the description of FLG field

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: compile legacy {mount,umount}.nilfs2 with libselinux

SELinux context mount options were optional for the legacy version of
{mount,umount}.nilfs2.  This changes the default build configuration
so that they are built with selinux library unless --without-selinux
options is specified.  When we compile them with libmount, libselinux
is not used regardless of this because context mount options are
provided by libmount.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
nilfs-utils: add --with-libmount build option

The libmount build option of the current configure script is confusing
since it is provided as an --enable-<feature> style option.

This fixes the issue by adding --with-libmount configure option.  The
--enable-libmount option is still available for compatibility reason.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
lib/nilfs.c: add missing initializations of ioctl arguments

Some wrapper functions for ioctl APIs in libnilfs do not initialize
unused arguments passed to kernel space.  This is hurting
extensibility of these ioctls.  This fixes the issue.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>