Commit Graph

56 Commits

Author SHA1 Message Date
Karel Zak 98fd13a169 cramfs: add missing includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-19 12:17:19 +02:00
Gustavo Zacarias 7f0d4d56a2 lib/crc32: prefix public functions
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>
2016-10-19 12:11:59 +02:00
Karel Zak 10c66b0b9e fsck.cramfs: don't ignore read() result [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-04 15:53:55 +02:00
Sami Kerola 74ce680a3e
misc: simplify if clauses [oclint]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-21 21:14:33 +01:00
Karel Zak 075d2c0754 include: move sys/sysmacros.h to c.h
The file is no portable (#ifdef HAVE_SYS_SYSMACROS_H is necessary),
but needed on many places. It seems better to keep it in c.h.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-08 14:29:45 +01:00
Ruediger Meier 66daee0765 include: check for sys/sysmacros.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:17 +01:00
Boris Egorov e3ca1312a2 sys-utils/disk-utils/lib: fix printf format types [cppcheck]
Fix 'invalidPrintfArgType' cppcheck warnings

Signed-off-by: Boris Egorov <egorov@linux.com>
2015-06-25 12:08:45 +02:00
Benno Schulenberg fc14ceba5e textual: grammarize and harmonize the stat error message
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>
2015-02-02 11:27:10 +01:00
Sami Kerola 7ee26cbf02 maint: fix shadow declaration
This change fixes all shadow declarations.  The worth while to mention
fix is with libfdisk sun geometry.  It comes from bitops.h cpu_to_be16
macro that further expands from include/bits/byteswap.h that has the
shadowing.

libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow]
libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow]

That could have caused earlier some unexpected results.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 10:08:21 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Benno Schulenberg 09af3db48e textual: fix some typos and inconsistencies in various messages
Fixing plain typos, miswordings, inconsistent periods, some missing
angular brackets, and a proper pluralization (even when it involves
a constant, because for some languages the precise value matters).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-07-23 08:56:00 +02:00
Ruediger Meier 60cb2c3720 build: fix some compiler warnings
Most of them catched on 32bit gcc and icc.

disk-utils/fsck.cramfs.c:     printf format type
lib/boottime.c:               unused variables
misc-utils/cal.c:             set but never used
sys-utils/losetup.c:          set but never used
sys-utils/lscpu-dmi.c:        defined but not used
sys-utils/switch_root.c:      comparison between signed and unsigned
tests/helpers/test_sysinfo.c: printf format type
2014-05-30 01:18:09 +02:00
Karel Zak deedae5f5c fsck.cramfs: cleanup usage() and warning messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-20 10:32:57 +02:00
Ruediger Meier 34731f89c7 fsck.cramfs: remove define INCLUDE_FS_TESTS
There is only one non-trivial issue where we now print a
warning instead of exit error.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-19 23:49:06 +02:00
Ruediger Meier 2d317f117b fsck.cramfs: refactor option -x/--extract
We want to clean it up to compile it later per default (not only
if defined INCLUDE_FS_TESTS).

- Rename option --destination to --extract.
- DIR argument is now optional because we want to keep the use
  case "test uncompression without writing files" ... but we
  don't want it always.
- Remove shortopt -x because shortopts with optional args are
  evil.

Changing the cmd interface is no compatibility issue here because
all affected options errored out per default in past.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-19 15:07:17 +02:00
Ruediger Meier 5cd50ebc96 fsck.cramfs: add option --blocksize
.. similar to mkfs.cramfs

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-19 09:22:48 +02:00
Ruediger Meier 38141baff6 fsck.cramfs: rename variable page_size to blksize
... similar to mkfs.cramfs.c

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-19 09:22:44 +02:00
Ruediger Meier b7a7520692 fsck.cramfs: ifdef unused outbuffer and page_size
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-19 09:22:39 +02:00
Ruediger Meier f991dbd31f fsck.cramfs: allow smaller superblock sizes
We are already fine with checking for different endianess. Now we
also succeed if systems's page size does not match.

Note that page_size is only really used if INCLUDE_FS_TESTS is
defined, see followups.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-19 09:19:29 +02:00
Karel Zak 5d4ece6ea1 fsck.cramfs: add LC_CTYPE
Maybe it would be possible to use LC_ALL, but it requires to review
the code to check if there is no any sensitive code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-18 11:38:02 +02:00
Benno Schulenberg 47481cbd01 textual: standardize some "cannot read" and "seek failed" error messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-09 11:37:38 +02:00
Sami Kerola 83f210e8f9 fsck.cramfs: check writing to a file descriptor was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:26:06 +02:00
Karel Zak b3f30f50ab fsck.cramfs: check returns [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 14:12:23 +01:00
Karel Zak 52848780e3 fsck.cramfs: fix compiler warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-15 15:33:23 +01:00
Karel Zak 6bf463c54c fsck.cramfs: add dummy -a -y for compatibility
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-18 12:18:29 +01:00
Karel Zak aa71999827 fsck.cramfs: fix compiler warning [-Wpointer-arith]
disk-utils/fsck.cramfs.c: In function ‘test_crc’:
disk-utils/fsck.cramfs.c:231:32: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]
disk-utils/fsck.cramfs.c:233:24: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith]

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-04 16:49:28 +02:00
Karel Zak d63eb75eee fsck.cramfs: fix compiler warning [-Wmissing-prototypes]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-16 18:55:01 +02:00
Sami Kerola 289dcc9023 translation: unify file open error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Sami Kerola add1b8afd0 translation: unify stat error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Sami Kerola de173766e0 fsck.cramfs: disallow unknown command line options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Sami Kerola 45ca68ece7 disk-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 20:04:39 +02:00
Sami Kerola 922ec175e5 fsck.cramfs: add long options
And align with howto-usage-function.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-30 16:48:12 +02:00
Karel Zak 70b604b827 include/exitcodes: clean up names, add _EX_ suffix
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20 11:22:08 +01:00
Sami Kerola 6f312c8957 xalloc: use xasprintf in all files
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Karel Zak e4a36b8bf4 fsck.cramfs: mark usage() as noreturn
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 21:20:55 +01:00
Sami Kerola 5d6fb944bf include: move fsck return values to exitcodes.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-22 00:34:12 +02:00
Sami Kerola 6de1396e6a fsck.cramfs: add missed strings to translation
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 23:56:48 +02:00
Sami Kerola 6ffd9b03f2 fsck.cramfs: coding style
Lots of braces got to be removed, which can cause something to
break even everything is double checked.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 23:56:25 +02:00
Sami Kerola fc8dc41054 fsck.cramfs: use xalloc.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 23:50:13 +02:00
Sami Kerola 11b7698c27 fsck.cramfs: retire die function
Replaced with err{,x} from libc.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-21 23:50:13 +02:00
Sami Kerola d51f37a368 cramfs: use stdint.h instead of u{8,16,32}
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-07-20 22:49:48 +02:00
Davidlohr Bueso 06f2558508 cramfs: remove cramfs_common.h
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>
2011-05-17 16:30:08 +02:00
Guillem Jover cef0ccd580 Remove now unused <sys/ioctl.h> includes
Those became unused with the switch to the blkdev functions.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2009-10-09 15:17:54 +02:00
Karel Zak a6f72ab47e fsck.cramfs: segfault with INCLUDE_FS_TESTS and no -x option
The current implementation causes a segmentation fault if
INCLUDE_FS_TESTS is defined, but the -x option is not specified.

The error is caused by the extract_dir variable being null.

Reported-by: Roy Peled <the.roy.peled@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-04 23:36:39 +01:00
Signed-off-by: Roy Peled fbaec83bc0 mkfs.cramfs: add endianness support to cramfs tools
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>
2009-02-04 14:56:54 +01:00
Pedro Ribeiro e56644ca45 fsck.cramfs: add NLS support
[kzak@redhat.com: - add setlocale(), ...]

Signed-off-by: Pedro Ribeiro <p.m42.ribeiro@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-10-03 08:30:33 +02:00
Karel Zak 293889d084 fsck.cramfs: fix compiler warning
fsck.cramfs.c: In function ‘main’:
fsck.cramfs.c:676  warning: ‘length’ may be used uninitialized in this function

Signed-off-by: Karel Zak <kzak@redhat.com>
2008-09-29 12:24:38 +02:00
maximilian attems d144727bc3 use getpagesize()
getpagesize() is said to be more portable than sysconf(_SC_PAGESIZE)
to anything Linux.

this patch helps klibc porting effort as the sysconf
multiplex API is not supported there.

also remove comment of the switch to sysconf in mkswap.c.

Signed-off-by: maximilian attems <max@stro.at>
2008-07-30 13:26:58 +02:00
Samuel Thibault 098fa6b120 disk-utils: clean up code, use blkdev_* functions
[kzak@redhat.com: split the original patch to small patches]

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-07-24 01:15:07 +02:00