summaryrefslogtreecommitdiffstats
path: root/disk-utils/fsck.cramfs.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-2/+2
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-9/+9
| | | | | | | | | | 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>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* cramfs: revert crc32 changesKarel Zak2016-10-191-7/+12
| | | | | | | | 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>
* cramfs: add missing includesKarel Zak2016-10-191-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/crc32: prefix public functionsGustavo Zacarias2016-10-191-6/+6
| | | | | | | | | | | 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>
* fsck.cramfs: don't ignore read() result [coverity scan]Karel Zak2016-10-041-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: simplify if clauses [oclint]Sami Kerola2016-07-211-7/+4Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: move sys/sysmacros.h to c.hKarel Zak2016-03-081-4/+1Star
| | | | | | | 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>
* include: check for sys/sysmacros.hRuediger Meier2016-02-181-0/+2
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* sys-utils/disk-utils/lib: fix printf format types [cppcheck]Boris Egorov2015-06-251-3/+3
| | | | | | Fix 'invalidPrintfArgType' cppcheck warnings Signed-off-by: Boris Egorov <egorov@linux.com>
* textual: grammarize and harmonize the stat error messageBenno Schulenberg2015-02-021-1/+1
| | | | | | | | | 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>
* maint: fix shadow declarationSami Kerola2015-01-071-23/+24
| | | | | | | | | | | | | | | | 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>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | 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>
* textual: fix some typos and inconsistencies in various messagesBenno Schulenberg2014-07-231-1/+1
| | | | | | | | 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>
* build: fix some compiler warningsRuediger Meier2014-05-301-2/+2
| | | | | | | | | | | | 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
* fsck.cramfs: cleanup usage() and warning messagesKarel Zak2014-05-201-7/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck.cramfs: remove define INCLUDE_FS_TESTSRuediger Meier2014-05-191-24/+5Star
| | | | | | | 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>
* fsck.cramfs: refactor option -x/--extractRuediger Meier2014-05-191-14/+17
| | | | | | | | | | | | | | | | | 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>
* fsck.cramfs: add option --blocksizeRuediger Meier2014-05-191-3/+12
| | | | | | .. similar to mkfs.cramfs Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* fsck.cramfs: rename variable page_size to blksizeRuediger Meier2014-05-191-11/+11
| | | | | | ... similar to mkfs.cramfs.c Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* fsck.cramfs: ifdef unused outbuffer and page_sizeRuediger Meier2014-05-191-5/+4Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* fsck.cramfs: allow smaller superblock sizesRuediger Meier2014-05-191-1/+2
| | | | | | | | | | 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>
* fsck.cramfs: add LC_CTYPEKarel Zak2013-10-181-0/+1
| | | | | | | 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>
* textual: standardize some "cannot read" and "seek failed" error messagesBenno Schulenberg2013-10-091-7/+7
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* fsck.cramfs: check writing to a file descriptor was successfulSami Kerola2013-04-261-1/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.cramfs: check returns [coverity scan]Karel Zak2013-03-271-4/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck.cramfs: fix compiler warningsKarel Zak2013-03-151-4/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck.cramfs: add dummy -a -y for compatibilityKarel Zak2013-02-181-2/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck.cramfs: fix compiler warning [-Wpointer-arith]Karel Zak2012-09-041-2/+2
| | | | | | | | 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>
* fsck.cramfs: fix compiler warning [-Wmissing-prototypes]Karel Zak2012-07-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify file open error messagesSami Kerola2012-07-161-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify stat error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.cramfs: disallow unknown command line optionsSami Kerola2012-06-171-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* disk-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.cramfs: add long optionsSami Kerola2012-03-301-12/+20
| | | | | | And align with howto-usage-function.txt Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/exitcodes: clean up names, add _EX_ suffixKarel Zak2012-03-201-52/+52
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* xalloc: use xasprintf in all filesSami Kerola2012-03-181-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: corrections to FSF license files, and postal addressSami Kerola2012-02-241-3/+3
| | | | | | | | | | | | | | 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>
* fsck.cramfs: mark usage() as noreturnKarel Zak2012-01-311-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include: move fsck return values to exitcodes.hSami Kerola2011-07-221-9/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.cramfs: add missed strings to translationSami Kerola2011-07-211-4/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.cramfs: coding styleSami Kerola2011-07-211-219/+180Star
| | | | | | | 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>
* fsck.cramfs: use xalloc.hSami Kerola2011-07-211-24/+16Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.cramfs: retire die functionSami Kerola2011-07-211-69/+53Star
| | | | | | Replaced with err{,x} from libc. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cramfs: use stdint.h instead of u{8,16,32}Sami Kerola2011-07-201-4/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cramfs: remove cramfs_common.hDavidlohr Bueso2011-05-171-1/+0Star
| | | | | | | 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>
* Remove now unused <sys/ioctl.h> includesGuillem Jover2009-10-091-1/+0Star
| | | | | | Those became unused with the switch to the blkdev functions. Signed-off-by: Guillem Jover <guillem@hadrons.org>
* fsck.cramfs: segfault with INCLUDE_FS_TESTS and no -x optionKarel Zak2009-02-041-2/+3
| | | | | | | | | | 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>
* mkfs.cramfs: add endianness support to cramfs toolsSigned-off-by: Roy Peled2009-02-041-12/+37
| | | | | | | | | | | | | | | | | | | | 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>