Add a mechanism to embed the git revision into the compiled binaries.
This allows users and developers to identify the exact source commit
used for the build, which aids in debugging and tracking versions.
The git revision is obtained using 'git describe' and stored in the
.comment ELF section using the new NILFS_UTILS_GITID() macro defined
in util.h. This section is not loaded into memory at runtime. The
embedded revision can be checked using 'readelf -p .comment <binary>'.
This feature is opt-in to ensure deterministic builds for package
maintainers. It is enabled only if the environment variable
NILFS_UTILS_USE_GITID is set to 1, true, on, or yes when generating
the configure script (e.g. by running autoconf or autogen.sh).
Also, bump the minimum Autoconf version to 2.64 to utilize m4_esyscmd_s.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Bump the version to 2.4.0-dev. This switches the target of the master
branch to the next development version.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
In 'nilfs_cleanerd_reduce_nsegs_per_step()', the logic to halve the
number of segments to clean was swapped between the manual mode and
the daemon mode. When 'running' is 2 (manual mode), it incorrectly
reduced 'nsegs_per_step' instead of 'mm_nsegs_per_step', and vice
versa for the daemon mode.
Correct this so that the variable corresponding to the current mode is
properly updated when retrying.
This patch applies a fix originally proposed for v2.2.7 but missed.
Here is the original proposal:
Bugfix for nilfs-utils-2.2.7 reduce_ncleansegs_for_retry()
I think I've found a bug in nilfs-utils 2.2.7 when the number of
segments to clean per pass is halfed in respons to a memory
shortage. if cleanerd->running == 2 it is a manual run, and thus
it should be mm_ncleansegs that is reduced.
/Tommy
[ ryusuke: reflected changes to variable names ]
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
If the file system is low on free segments, the number of segments
requested for cleaning ('nsegs_per_step') may exceed the number of
actual free segments ('ncleansegs').
Cap 'nsegs_per_step' to 'ncleansegs' in nilfs_cleanerd_select_segments().
This serves as an entry-level guard to prevent invalid requests and
helps prevent filesystem operations from getting stuck when free space
is running out.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
In nilfs_xreclaim_segment(), the total number of reclaimable blocks is
calculated as:
(blocks_per_segment * nsegs) - ...
On 32-bit systems, where 'size_t' is 32-bit, this multiplication can
theoretically overflow if the total number of blocks exceeds
'SIZE_MAX'.
To prevent this, calculate a safe maximum number of segments per
cleaning step ('max_nsegs_per_step') at initialization based on the
volume's layout information (blocks per segment). Apply this cap
whenever the cleaning speed is configured, ensuring the total block
count always fits within 'size_t'.
Also, add a sanity check for zero 'blocks_per_segment' during
initialization.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Update 'mm_nrestsegs' in struct nilfs_cleanerd to 'uint64_t'.
Although the NILFS2 on-disk format defines the segment count as a
64-bit unsigned integer, this variable was declared as 'long'. This
change aligns the in-memory type with the on-disk format, ensuring it
is explicitly treated as an unsigned 64-bit integer regardless of the
architecture.
Along with this type update, refactor the segment counting function and
related logic:
1. Rename nilfs_cleanerd_count_inuse_segments() to
nilfs_cleanerd_count_reclaimable_segments(). The original name was
misleading because the function counts segments that are candidates
for reclamation (excluding active segments, error segments, etc.),
not just "in-use" segments.
2. Change the function signature to return the status code (0 or -1)
and store the count in a pointer argument to allow handling 64-bit
counts properly. Accordingly, update related local variables and
types to strictly match the 64-bit width.
3. Update the decrement logic in nilfs_cleanerd_progress(). With the
switch to 'uint64_t' (unsigned), the previous subtraction used in
max_t() is no longer appropriate as it causes wraparound on underflow.
This is replaced with a conditional subtraction to handle the
unsigned type correctly.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
The variable name 'ncleansegs' in struct nilfs_cleanerd is confusing
because it conflicts with standard NILFS terminology, where 'ncleansegs'
typically refers to the total number of clean (free) segments in the
filesystem (e.g., in struct nilfs_sustat).
To clarify that this variable represents the number of segments to
process in a single cleaning iteration (step), rename it to
'nsegs_per_step'. Similarly, rename the manual mode counterpart
'mm_ncleansegs' to 'mm_nsegs_per_step' and update the related accessor
and helper functions.
Additionally, change the type of these variables and the corresponding
configuration parameters in struct nilfs_cldconfig from 'unsigned long'
(or 'long') to 'unsigned int'. These values represent a small batch
size for a single GC pass (typically < 32), so 'unsigned int' is
sufficient and semantically appropriate.
Note that the configuration member names in cldconfig are kept as
'cf_nsegments_per_clean' to match the configuration file parameters.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Switch the type of 'reclaimable_blocks' related variables from
'unsigned long' to 'uint32_t' in struct nilfs_cleanerd and struct
nilfs_cldconfig.
Since these variables represent block counts within a single segment,
and the number of blocks per segment is defined as 32-bit in the
on-disk format, using 'uint32_t' is sufficient and appropriate.
This change eliminates the type mismatch with the physical format and
improves consistency.
In addition, modify nilfs_convert_size_to_blocks_per_segment() to
return 'uint32_t' and to clamp the result to the number of blocks per
segment if the calculated value exceeds it. This prevents invalid
parameter values from being set.
Also, update the syslog format specifiers to use PRIu32.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
In nilfs_xreclaim_segment(), the local variable 'reclaimable_blocks'
holds the sum of reclaimable blocks across multiple segments. Using a
32-bit type for this variable imposes a local limit on the total count,
which is theoretically inappropriate even though handling requests
exceeding the 32-bit limit is practically rare.
Change the variable type to 'size_t' to avoid enforcing such a local
restriction and to use a type that is more natural for the
architecture. Also, rename the variable to 'total_reclaimable_blocks'
to clarify that it represents a total count across segments.
Note that checks for overflow, especially on 32-bit architectures,
should be handled separately.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Switch to using the 'bool' type from <stdbool.h> for boolean flags in
struct nilfs_cleanerd and struct nilfs_cldconfig. Currently, these
are defined as 'int', which is ambiguous regarding their possible values.
Convert these members to 'bool' bitfields to explicitly indicate they
hold truth values. Update all assignments and constants to use 'true'
and 'false' instead of '1' and '0'. Also, update configure.ac to
check for the existence of stdbool.h.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Recent distributions, such as Fedora Rawhide, have fully merged /sbin
and /usr/sbin into /usr/bin. In this configuration, /usr/sbin is a
symbolic link to bin.
In this environment, if nilfs-utils is configured to install binaries
into /usr/bin, the current logic to create compatibility symlinks in
/usr/sbin causes a critical issue: it overwrites the actual installed
binaries with symbolic links to themselves (e.g., /usr/sbin/nilfs-clean
points to ../bin/nilfs-clean, which are the same file).
Fix this by detecting if /usr/sbin and /usr/bin identify the same
directory. If they are the same, disable the creation of compatibility
symlinks to avoid this overwrite.
Also, update the README file to clarify that compatibility symbolic
links are created only if /usr/sbin is distinct from /usr/bin.
Fixes: 160ab60d4959 ("build: support UsrMerge and Bin-Sbin merge with automatic detection")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Commit ae0fc7c09b90 ("nilfs-clean: allow specifying filesystem node
instead of device") introduced a regression where running nilfs-clean
without a device argument (e.g., 'nilfs-clean -l') fails with an
"Error: Bad address" message.
This issue occurs because nilfs_cleaner_open() unconditionally calls
nilfs_lookup_device() with the 'device' argument, which is NULL when
no device is specified. This results in an invalid pointer access
within the lookup function.
Fix this by checking if the 'device' argument is valid before attempting
to resolve the backing device.
Fixes: ae0fc7c09b90 ("nilfs-clean: allow specifying filesystem node instead of device")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Fix the kernel-doc comment for nilfs_cldconfig_read() to match the
kernel-doc style and complete the missing descriptions.
This eliminates the following warning and improves code documentation:
Warning: sbin/cldconfig.c:778 function parameter 'path' not described
in 'nilfs_cldconfig_read'
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Move the definitions of NILFS_CLEANERD_NSUINFO and NILFS_CLEANERD_NULLTIME
from the middle of the file to the header section.
This resolves the following kernel-doc warning:
Warning: sbin/cleanerd.c:638 expecting prototype for nilfs_cleanerd_select_segments(). Prototype was for NILFS_CLEANERD_NSUINFO() instead
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Fix the kernel-doc comments for nilfs_cleanerd_config() and
nilfs_cleanerd_reconfig() to match the kernel-doc style and complete
the missing descriptions.
This eliminates the following warnings and improves code documentation:
Warning: sbin/cleanerd.c:284 function parameter 'conffile' not described
in 'nilfs_cleanerd_config'
Warning: sbin/cleanerd.c:322 function parameter 'conffile' not described
in 'nilfs_cleanerd_reconfig'
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Add the missing description for the '@shutdown' member in the kernel-doc
comment of struct nilfs_cleanerd.
This fixes the following warning:
Warning: sbin/cleanerd.c:180 struct member 'shutdown' not described in
'nilfs_cleanerd'
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Fix the kernel-doc comment for nilfs_cleanerd_create() to match the
kernel-doc style and complete the missing descriptions.
This eliminates the following warning and improves code documentation:
Warning: sbin/cleanerd.c:430 function parameter 'dir' not described in
'nilfs_cleanerd_create'
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
The kernel-doc comment for nilfs_edit_feature() incorrectly referred to
nilfs_string2feature() and described a simple conversion, likely due to
a copy-paste error. This causes a warning in scripts/kernel-doc.
Fix the function name and update the short description to accurately
reflect that the function updates feature flags based on the input string.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
The kernel-doc comment for nilfs_vdesc_is_live() incorrectly started
with "/*" instead of "/**".
Fix the comment marker so it is correctly recognized as kernel-doc.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Add kernel-doc style comments to the functions in lib/segment.c.
This file provides iterators for parsing NILFS2 segment summaries
(partial segments, file information, and block information), but it
lacked proper documentation. Add descriptions to facilitate
maintenance.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Update the version number to 2.3 and the date to Jan 2026 in the manual
pages for mkfs.nilfs2, mount.nilfs2, nilfs, nilfs_cleanerd,
nilfs_cleanerd.conf, nilfs-resize, nilfs-tune, and umount.nilfs2.
This synchronizes the version information across all manual pages in
preparation for the upcoming release.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Update the synopsis and description sections of the manual pages for
chcp, dumpseg, lscp, lssu, mkcp, nilfs-clean, and rmcp.
This reflects the recent changes allowing these tools to accept a
filesystem node (file or directory) argument in place of a block device,
automatically resolving the backing device via the library.
Also update the version date and number to "Jan 2026" and "2.3"
respectively.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Update nilfs-clean to accept a regular file or directory path on the
target filesystem in addition to a block device node.
This change is implemented within the private library libcleaner.
The functions nilfs_cleaner_launch() and nilfs_cleaner_open() in
lib/cleaner_ctl.c are modified to automatically resolve the backing
block device using the internal helper nilfs_lookup_device() if a
filesystem node is passed.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Update chcp, dumpseg, lscp, lssu, mkcp, and rmcp to use the new
NILFS_OPEN_SRCHDEV open flag.
This enables these tools to accept a regular file or directory path on
the target filesystem in addition to a block device node. When a
filesystem node is specified, the library automatically resolves the
underlying block device.
The usage messages for these commands are updated to reflect that a
"node" can be specified.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Introduce a new open flag NILFS_OPEN_SRCHDEV.
If this flag is set and the 'dev' argument is a file or directory on a
NILFS filesystem, nilfs_open() automatically locates the backing block
device.
The logic calls the internal helper function nilfs_lookup_device() to
retrieve the device ID from the given path and resolve the canonical
device path (e.g. "/dev/sda1") via sysfs.
To support this, the source file "lookup_device.c" is added to the build
list in lib/Makefile.am.
This feature eliminates the need for users or tools to explicitly specify
the block device path when operating on a mounted NILFS filesystem.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Add a new helper function, nilfs_lookup_device(), to resolve the kernel
device name (e.g. "sda1") associated with a filesystem node (file or
directory).
This function internally uses a static helper,
nilfs_get_devname_by_devid(), which reads the symlink at
/sys/dev/block/<major>:<minor> to identify the canonical device name
from a device ID.
These helpers are separated into a standalone module to allow sharing
the logic between the nilfs library and other utilities (e.g.
nilfs-clean) without exposing internal symbols in the public API.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Since commit 7aae659498b8 ("chcp: fix segfault"), the logic to
distinguish between the optional device argument and the checkpoint
number list has been inverted.
The code intended to check if the current argument is *not* a valid
checkpoint number (indicating it is a device string). However, due to
a logic error in that commit, if the argument is not a number (e.g.
"/dev/sda1"), it sets the device to NULL (implying no device argument).
Conversely, if it is a number, it incorrectly consumes it as a device
name.
This causes chcp to fail with "invalid checkpoint number" when a device
is explicitly specified, because the parser fails to advance past the
device string, subsequently attempting to parse the device name as a
checkpoint number in the main loop.
Fix this regression by correcting the if-else branch assignments.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Fixes: 7aae659498b8 ("chcp: fix segfault")
Update the usage examples in the nilfs(8) manual page to reflect current
behavior.
The previous examples were outdated, showing timestamps from 2014 and
mount command output that differs from modern kernel behavior
(specifically regarding the "gcpid" and "relatime" mount options).
This change aligns the examples with the "What is NILFS?" section of the
official website.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Currently, most NILFS2 utilities print the usage message to stderr,
even when the user explicitly requests help using the -h or --help
options.
Update the utilities to print the usage message to stdout and exit
with status 0 when help is requested. For invalid options or missing
arguments, continue to print the usage message to stderr and exit with
status 1.
This aligns the behavior with standard command-line conventions.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Currently, nilfs-tune exits with success (0) even if no device
argument is provided.
Fix this to return failure (1) when mandatory arguments are missing,
aligning the behavior with standard command-line conventions.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Remove a debug printf() call that prints optind and argc when no
device argument is specified.
This is a leftover from development and pollutes the output when the
usage message is displayed due to missing arguments.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Replace manual parsing of 'argv[0]' and global/local 'progname'
variables with the newly introduced getprogname() macro.
This simplifies main functions across utilities and ensures consistent
program name retrieval.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Add a compatibility layer for getprogname() to allow utilities to
retrieve the short program name uniformly, removing the need for
manual argv[0] parsing.
The logic prioritizes the GNU extension variable
'program_invocation_short_name', falling back to getprogname.
If neither is available, the build fails with an #error.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Replace the custom myprintf() function and ad-hoc exit logic with
standard <err.h> functions (warn, warnx, err, errx).
This modernizes the error handling, simplifies the code, and ensures
consistent output formatting. The error messages now automatically
include the program name prefix, aligning with standard utility
conventions.
In addition, switch the version output from stderr to stdout to comply
with GNU coding standards.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
strtoull() converts negative strings to large unsigned integers, causing
inputs like "-1" to result in confusing "value too large" errors (ERANGE).
Fix this by explicitly checking for a minus sign and setting errno to
EINVAL, ensuring negative inputs are treated as invalid format errors.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Simplify the logging callback functions nilfs_mount_logger() and
nilfs_umount_logger() by using vwarnx().
This replaces the manual fprintf() sequence with the standard <err.h>
function, ensuring consistent message formatting (including the program
name prefix) across the utilities.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Replace the legacy error() and die() functions derived from 'sundries.c'
with the standard <err.h> functions warnx() and errx() in the
libmount-based mount and umount helpers.
This change removes the dependency on 'sundries.h' and 'xmalloc.h',
completing the decoupling from the legacy implementation. Consequently,
'mount_quiet' and explicit program name handling in error messages are
removed, as err.h functions handle the program name automatically.
Accordingly, update 'Makefile.am' to exclude 'sundries.c' and
'xmalloc.c' from the common source list, moving them to legacy sources.
In addition, explicitly include <limits.h> in 'mount_attrs.c' and
'mount_libmount.c' to define ULONG_MAX, which was previously indirectly
included via 'sundries.h'.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Replace the EX_* exit code macros with their MNT_EX_* equivalents in
mount_libmount.c and umount_libmount.c.
This aligns the code with libmount conventions and serves as a
preparatory step to remove the dependency on sundries.h.
A new header libmount_compat.h is added as a transitional measure to
define these macros, because they are missing in libmount.h on some
older distributions.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
The header file "mount.nilfs2.h" includes "sundries.h", but it only
defines a few constants and does not require any symbols from
"sundries.h".
This dependency is unnecessary and hinders the separation of the new
libmount-based implementation from the legacy support code in
"sundries.c".
Removing this include is safe because all source files that rely on
"sundries.h", including both the legacy programs and the libmount-based
helpers, already include it directly.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
The check for empty arguments 'if (!*argv)' was incorrect as it
checked for a NULL pointer, which never occurs within the argument
loop. Consequently, passing an empty string "" resulted in a
confusing error message "umount.nilfs2: : not found" generated by
complain() function, instead of the intended error message.
Fix this by correctly checking for the null terminator '\0'.
In addition, replace the fatal die() call with error() (an internal
function derived from sundries.c) and a 'continue' statement. This
ensures that an empty argument counts as a failure but allows the
command to proceed with unmounting other valid targets, consistent
with the tool's multiple-target behavior.
Refactor the loop structure to support this logic.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Currently, umount.nilfs2 aggregates exit codes using addition. If
multiple targets fail, the exit code EX_FAIL accumulates, resulting in
unintended values (e.g., 64 for two failures, which creates ambiguity
with EX_SOMEOK).
Fix this by refactoring the logic to use flags for tracking success
and failure states. This eliminates the theoretical possibility of
integer overflow potentially flagged by static analysis tools, and
reorganizes the status codes to clearly distinguish between total
failure (EX_FAIL) and partial success (EX_SOMEOK).
Accordingly, stop forcing the return value to EX_FAIL in
nilfs_umount_one() to delegate the exit code decision to the main
function.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
When running umount.nilfs2 with multiple mount points (e.g., "umount
dir1 dir2"), the command crashes with a libmount assertion failure:
mnt_context_do_umount: Assertion `cxt->syscall_status == 1' failed.
This happens because the libmount context 'cxt' is reused in the loop
without resetting its internal status. mnt_context_do_umount()
expects a clean status (syscall_status == 1) for each call.
Fix this by calling mnt_context_reset_status() before processing each
target in the loop.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
In nilfs_prepare_mount(), when a rw->rw remount is attempted on a
different mount point, an error message is printed, but the function
fails to abort the process.
This occurs because the return variable 'res' remains 0 (success) when
jumping to the failure label.
While a regular mount would eventually fail in the system call, a fake
mount (-f) skips the system call and would incorrectly succeed with exit
code 0 despite the error.
Fix this by setting 'res' to -EINVAL.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
The check for overlapping rw-mounts in nilfs_prepare_mount() detects
the condition and prints an error message, but fails to stop the mount
process.
This occurs because the return variable 'res' remains 0 (success) when
jumping to the failure label.
Consequently, the mount succeeds illegally, leading to a state where
umount fails with -EBUSY (due to unhandled garbage collector shutdown),
forcing manual process termination.
Fix this by setting 'res' to -EBUSY. While any negative value would
abort the mount, -EBUSY is chosen to accurately reflect the cause and
align with libmount's error reporting granularity.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
In nilfs_mnt_context_complete_root(), the return value of
mnt_fs_set_root() is ignored.
Since mnt_fs_set_root() involves memory allocation, it can fail and
return a negative error code (e.g., -ENOMEM).
Fix this by checking the return value and reporting an error if it fails.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
The calls to mnt_context_set_source(), mnt_context_set_target(), and
mnt_context_set_fstype() in the main routines ignore the return
values.
Although -EINVAL is not expected here since the context is verified to
be valid, these functions can still return -ENOMEM upon memory
allocation failure.
Fix this by checking the return values and exiting with an error if
they fail.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
In nilfs_prepare_mount(), the return value of nilfs_mount_attrs_parse()
is checked but not stored in 'res'. When it fails, error() prints
strerror(-res) using a stale value (= 0), resulting in an incorrect
message like "Success".
Additionally, nilfs_mount_attrs_parse() returns -1 for memory
allocation failures or invalid options. When negated and passed to
strerror(), this translates to "Operation not permitted" (EPERM),
which is confusing.
Fix this by returning specific error codes (-ENOMEM, -EINVAL) in
nilfs_mount_attrs_parse() and properly assigning the return value in
nilfs_prepare_mount().
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
nilfs_do_mount_one() relies on the global variable 'errno' when
mnt_context_do_mount() fails.
However, mnt_context_do_mount() returns a positive errno for syscall
errors and a negative error code for library errors. In the latter
case, 'errno' is not guaranteed to be set correctly, potentially
leading to incorrect error messages.
Fix this by using the return value of mnt_context_do_mount() instead
of 'errno'.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>