text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer
Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.
Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
We cannot use our crc32 without changes in the code, because our
ul_crc32() assumes that post-conditioning (xor) is done by
application. The zlib implementation does everything.
Signed-off-by: Karel Zak <kzak@redhat.com>
Make the publicly-visible crc32 library functions prefixed by ul_, such
as crc32() -> ul_crc32().
This is because it clashes with the crc32() function from zlib.
For newer versions of glib (2.50+) zlib and libblkid are required
dependencies and otherwise results in build failure when building
statically.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
There two possible ways, print error and exit on too long names or
truncate the filename -- but it's impossible to do both in the same
code :-) It seems that code already assumes warning on long names, so
let's remove errx() and keep the behavior in dependence on -E.
Signed-off-by: Karel Zak <kzak@redhat.com>
The message "stat failed %s" seems to say that stat() failed to
do something, or failed to pass a test, but of course it means
that the statting of something failed. So say so. Also make
two very similar messages equal to this one.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Use error printing facilities that add command name in front of the error
message, and add explanation that is part of existing translations.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
From manual page; 'On error, the value MAP_FAILED is returned, and errno
is set appropriately'.
Reference: http://man7.org/linux/man-pages/man2/mmap.2.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Enhance user input checking and error messaging, while fixing
cppcheck warning.
[disk-utils/mkfs.cramfs.c:729]: (style) Checking if unsigned variable 'blksize' is less than zero.
[kzak@redhat.com: fix coding style]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
mkfs.cramfs on version v2.17.2 has a small bug when dealing with very small
filesystems. look at upstream code on git, and the issue is still here.
ex:
$ cd /tmp
$ mkdir content
$ echo hello > content/a
$ echo hello > content/b
$ mkfs.cramfs content content.cramfs
not enough space allocated for ROM image (4090 allocated, 4096 used)
Here is a patch for fixing (simply rounding to page size AFTER eleminating
doubles).
Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The patch will fix few starange looking errors such as:
$ mkfs.cramfs -N foo
invalid endianness given. Must be 'big', 'little', or 'host': Success
to be more sensible:
mkfs.cramfs: invalid endianness given. Must be 'big', 'little', or 'host'
And there are couple new return value checks to stop command if
out file cannot be opened, or an IO error occurs.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Magic hash lenght number 16 is turned to a definition MD5LENGTH,
and put into use everywhere where md5 checksum is in use.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Before this commit two strdup calls, in line 366 and 374, where
able to fail silently and cause a rare bug.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
We currently have cramfs.h and cramfs_common.h, this makes no sense, so remove
unite them and keep just cramfs.h
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Get rid of this function and use errx(3) instead. This patch also
introduces a mkfs.h header and defines general purpose mkfs related
exit codes.
[kzak@redhat.com: - fix "warning: too many arguments for format" errors]
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
For some reason original author had defined symbolic exit codes,
but had not use them. One could argue the symbolic exit codes for
mkfs should go to local exit header which would be included to
all commands that exit with non zero or one return code.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
mkfs.cramfs.c: In function ‘parse_directory’:
mkfs.cramfs.c:310: warning: passing argument 4 of ‘scandir’ from incompatible pointer type
Signed-off-by: Karel Zak <kzak@redhat.com>
mkfs.cramfs allocates memory based on a calculated upper-bound
of required filesystem size. If there are duplicate files
or hard links, the current implementation unnecessarily increases
the upper-bound per each copy of the file, even though cramfs does
not store copies of contents of identical files.
This patch improves the calculation of fslen_ub, the upper bound
of required filesystem size, by making the upper bound aware of
duplicate files.
This is very helpful for layouts that hold a lot of hard links,
which are seen as duplicate files by mkfs.cramfs. For example,
this drastically reduces the memory requirements for creating
a standard Busybox layout.
Signed-off-by: Roy Peled <the.roy.peled@gmail.com>
cramfs is an endianness dependent file system. So far, the cramfs
utilities did not support cramfs images of different endianness than
the host machine.
A separate utility, cramfsswap, was required in order to change the
endianness of the image before and after using cramfs utilities. The
extra utility introduced extra maintenance and an additional step in
the process.
This patch adds endianness support to mkfs.cramfs and fsck.cramfs.
fsck.cramfs now automatically detects the image endianness, and can
work on images of either endianness. mkfs.cramfs now accepts a new
optional parameter (-N) that allows creating the cramfs image in
either endianness.
Signed-off-by: Roy Peled <the.roy.peled@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>