summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkfs.minix.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* various: fix 'uninitialized when used' warnings [clang]Sami Kerola2019-02-181-1/+1
| | | | | | | This change fixes "warning: variable 'var' may be uninitialized when used here [-Wconditional-uninitialized]" warnings reported in various files. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-4/+6
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix xalloc.h related exit codesRuediger Meier2017-06-221-0/+2
| | | | | | | | | Found by: grep -L "XALLOC_EXIT_CODE" $(grep -l "xalloc\.h" \ $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c")) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix more strutils related exit codesRuediger Meier2017-06-221-0/+2
| | | | | | | | | | | | Found by grep: grep -l "\bEXIT_\|exit *( *[0-9][0-9] *)\|strutils\.h" $(grep -L \ strutils_set_exitcode $(git grep -l "_EX_\|FINDFS_\|BLKID_EXIT\|EX_USAGE" -- "*.c")) The Command shows also some false positives (fstrim.c, context_mount.c, ...) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* disk-utils/mkfs.minix: Set ninodes after checking maxNate Clark2017-01-041-1/+1
| | | | | | | | | | | ninodes in the superblock needs to be set after inodes is checked against MINIX_MAX_INODES otherwise a value larger than MINIX_MAX_INODES can be attempted to be stored in the superblock. Without this change the command "mkfs.minix -2 -i 65530 <dev>" would write a minix superblock with ninodes set to 0. Signed-off-by: Nate Clark <nate@neworld.us>
* 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>
* misc: simplify if clauses [oclint]Sami Kerola2016-07-211-6/+2Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: Fix various typosSebastian Rasmussen2016-05-311-3/+3
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* misc: again fixing many printf format stringsRuediger Meier2016-03-071-2/+3
| | | | | | | | | | | | | | | | | | | This is again a huge patch regarding printf format strings to fix compiler warnings seen on clang/OSX. I'm trying to follow these rules strictly: #type #format #cast uintmax_t %ju - intmax_t %jd - uint64_t PRIu64 - int64_t PRId64 - size_t %zu - ssize_t %zd - ino_t %ju (uintmax_t) off_t %jd (intmax_t) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* mkfs.minix: fix v2/v3 .badblocks inode number for big endianRuediger Meier2016-03-031-3/+2Star
| | | | | | | | | | | | | | For minix v2/v3 on big endian systems the inode number of the unwanted ".badblocks" file was not set to zero. This was introduced when v3 was added in a2657ae3. Actually it did not seem to cause any problems but since we zero it out at all we should do it correctly. Now we zero out the whole directory entry (inclusive ".badblocks" file name, also for v1). Unfortunately we have to update the test data checksums. CC: Davidlohr Bueso <davidlohr@hp.com> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* include: remove unused mntent.hRuediger Meier2016-02-181-1/+0Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* mkfs.minix: fix block device open raceSami Kerola2015-11-221-6/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: add hint for scanners [coverity scan]Karel Zak2015-08-041-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkfs.minix: use xallocKarel Zak2015-08-041-13/+8Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add way to control mkfs.minix time stampsSami Kerola2015-08-031-4/+18
| | | | | | | Needed in order to create reproducable file systems image files, so that out come of mkfs.minix can be checksum'ed. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: re-fix block count mathsSami Kerola2015-08-031-2/+2
| | | | | | | | | | Error, that Joshua Hudson already pointed out, creapped back to commit da41ff5 when changes were applied from mailbox rather than git remote, as the corrected change had included some accidental rubbish. Reference: http://www.spinics.net/lists/util-linux-ng/msg11764.html Reference: http://www.spinics.net/lists/util-linux-ng/msg11848.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: refactor root block content creationSami Kerola2015-07-301-21/+21
| | | | | | This does not belong to main() function. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: check requested blocks will not exceed available on deviceSami Kerola2015-07-301-30/+34
| | | | | | | | | | | | | | | | | | | | Earlier user could define more blocks than device, or backing file for loopback file system, had available. That lead to a system crash with following commands; fallocate --length 64KiB test-file mkfs.minix -3 -i 842160 test-file 104882174 mkdir test-file.d mount test-file test-file.d cp /etc/service test-file.d Killed sudo umount test-file.d The minix driver should probably not hang the whole kernel, but the least that mkfs.minix ought to do is not to let users to get that condition quite as easily. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: check user input carefullySami Kerola2015-07-301-26/+53
| | | | | | | File name lenght and version input needs to be checked against each other, which will determine what version of file system is in question. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: add fs_control structure, and remove most global variablesSami Kerola2015-07-301-190/+190
| | | | | | This allows better code structure in future. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: remove unuseful codeSami Kerola2015-07-301-8/+1Star
| | | | | | | | | | | | | Checks about inodes vs block sizes does not add much robustness. Both values are derived at compilation time from struct minix_inode size, and they form full definition circle. Bad block check for none-block devices should not be supressed, user requested it so let him have it. Check for st_rdev == 0x0300 || st_rdev == 0x0340 was unreachable. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: use is_mounted() from libcommonSami Kerola2015-07-301-23/+4Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: introduce long options to the commandSami Kerola2015-07-301-52/+55
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: increase maximum minix v2 and v3 file system sizesJoshua Hudson2015-07-301-4/+21
| | | | | | | | | | | | | | | | | | | | | | | mkfs.minix misbehaves when attempting to create a large v2 or v3 filesystem. I finally traced it down to attempting to create too many inodes so that the first zone is past 65535 blocks in. This obviously doesn't work as the on-disk superblock says this is a 16 bit integer. I wrote a patch that catches this, clamps to the absolute v2/v3 limit (like it already does for v1), and sets the blocks per inode to a more reasonable ratio when exceeding half a gigabyte. Having a half-gig filesystem with most files being smaller than 3k isn't really reasonable. I suppose if you don't want to adjust inode sizes automatically you could take that part out, and it will just crab sooner. Given the non-attention in the code, I suspect nobody ever had cause to try such a big minix filesystem. Well I have my reasons involving some deeply embedded work where ext2 would place too much strain on the hardware. Reviewed-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Joshua Hudson <joshudson@gmail.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>
* textual: use version printing macro everywhereSami Kerola2014-10-011-1/+1
| | | | | | | Only mount, umount, and blkid remains not using the macro because they are print also library references. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: fix couple compiler warningsSami Kerola2014-09-191-6/+10
| | | | | | | disk-utils/mkfs.minix.c:366:3: warning: ISO C forbids 'return' with expression, in function returning void [-Wpedantic] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: fix fscanf() format string [coverity scan]Karel Zak2013-11-181-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkfs.minix: properly pluralize four messagesBenno Schulenberg2013-10-081-10/+6Star
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: improve clarity of some error messagesBenno Schulenberg2013-06-071-1/+1
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* mkfs.minix: check writing to a file descriptor was successfulSami Kerola2013-04-261-1/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: fix compiler warning [-Wformat]Karel Zak2013-01-091-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkfs.minix: fsck:minix: fix compiler warningsKarel Zak2012-12-201-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* minix: replace magic constants with macro namesSami Kerola2012-12-191-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* minix: use off_t, size_t, etc appropriate typesSami Kerola2012-12-191-4/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkfs.minix: check numeric user inputsSami Kerola2012-10-151-11/+6Star
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify file open error messagesSami Kerola2012-07-161-1/+1
| | | | 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>
* include: rename writeall.h to all-io.hPetr Uzel2012-05-151-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* disk-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/exitcodes: clean up names, add _EX_ suffixKarel Zak2012-03-201-31/+31
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkfs.minix: The total number of zones is limited to 65536 only on V1 filesystemsMaurizio Lombardi2011-11-211-3/+2Star
|
* mkfs.minix: Some bug fixes:Maurizio Lombardi2011-11-211-5/+6
| | | | | - Fix root inode initialization - In V3 filesystems the maximum number of inodes is not 65536 but 2^32.
* mkfs.minix: The s_blocksize field of the MinixV3 superblock must beMaurizio Lombardi2011-11-211-1/+1
| | | | | initialized with a valid block size, not the total number of blocks of the device!
* mkfs.minix: inode numbers are 32-bit wide in V3 filesystemsMaurizio Lombardi2011-11-211-8/+19
|
* mkfs.minix: In Minix V3 filesystems the maximum filename lenght is 60Maurizio Lombardi2011-11-211-0/+2
| | | | chars and the dirsize is 64 bytes.
* mkfs.minix: Fix super_set_nzones()Maurizio Lombardi2011-11-211-0/+4
| | | | | Write the total number of zones in Super3.n_zones when dealing with v3 filesystems.