summaryrefslogtreecommitdiffstats
path: root/disk-utils
Commit message (Collapse)AuthorAgeFilesLines
* fsck: retire stat(3) when access(3) does better jobSami Kerola2015-11-091-2/+1Star
| | | | | | | | The stat(3) and access(3) are in this case almost interchangeable, so choose the lightweight function with additional advantage checking the file is executable. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mount, umount, swapon, fsck, lsblk, findmnt: ignore malformed linesKarel Zak2015-10-151-1/+1
| | | | | | | | | | | | | | | | | The libmount provides way how to deal with parsing errors in fstab -- on error callback function is executed and according to the return libmount manipulate with the malformed line, possible are three states: 1/ fatal error; all file ignored (callback rc < 0) 2/ recoverable error; malformed line ignored (callback rc > 0) 3/ ignore the error (callback rc == 0) The 2/ is the default if no callback specified. Unfortunately our utils uses 3/. The correct way is to use 2/. Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: prevent code duplicationKarel Zak2015-10-091-36/+23Star
| | | | | Reported-by: Alexander Kuleshov <kuleshovmail@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --deleteKarel Zak2015-09-172-0/+53
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: fix -N return code detection, add debug messagesKarel Zak2015-09-171-5/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: cleanup and optimize --move-dataKarel Zak2015-09-091-20/+32
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --move-dataKarel Zak2015-09-082-11/+227
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --reorderKarel Zak2015-09-072-1/+42
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1232707 Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix trivial typosYuri Chornoivan2015-08-251-1/+1
|
* misc: fix shadow declarationsSami Kerola2015-08-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | sys-utils/zramctl.c: In function 'get_mm_stat': sys-utils/zramctl.c:276:58: warning: declaration of 'inbytes' shadows a global declaration [-Wshadow] static char *get_mm_stat(struct zram *z, size_t idx, int inbytes) sys-utils/zramctl.c:119:39: note: shadowed declaration is here static unsigned int raw, no_headings, inbytes; libmount/src/tab.c: In function 'mnt_table_get_fs_root': libmount/src/tab.c:1221:22: warning: declaration of 'fs' shadows a parameter [-Wshadow] struct libmnt_fs *fs = mnt_table_find_mountpoint(tb, libmount/src/tab.c:1197:24: note: shadowed declaration is here struct libmnt_fs *fs, disk-utils/fsck.minix.c: In function 'main': disk-utils/fsck.minix.c:1364:17: warning: declaration of 'i' shadows a previous local [-Wshadow] unsigned long i, free; disk-utils/fsck.minix.c:1250:6: note: shadowed declaration is here int i; Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cfdisk, sfdisk: remove unused variablesKarel Zak2015-08-052-11/+9Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: clarification for sfdisk man pageIan Wienand2015-08-051-14/+24
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1249893 Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>
* mkfs.cramfs: remove dead code [coverity scan]Karel Zak2015-08-041-16/+7Star
| | | | | | | | | 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>
* fsck.minix: be more paranoid with block buffers [coverity scan]Karel Zak2015-08-041-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: check return value [coverity scan]Karel Zak2015-08-041-3/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add way to control mkfs.minix time stampsSami Kerola2015-08-032-4/+23
| | | | | | | 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>
* textual: adjust grammar and punctuation of some messagesBenno Schulenberg2015-08-035-20/+20
| | | | | | | Also equalize three messages to one other one, and fix a typo in USE_COLORS_BY_DEFAULT. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* sfdisk: don't print extra linebreaks on --quietKarel Zak2015-07-301-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: make fsck.minix(8) more prettySami Kerola2015-07-301-50/+80
| | | | | | | | | Use real table to device list, add missing new paragraph markers, remove braces that cause reader to wonder if test is meant or not, squeeze error code list, move references to bottom of the manual, and use mail or web address macro when possible. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.minix: introduce long options to the commandSami Kerola2015-07-302-89/+90
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.minix: add minix v3 supportSami Kerola2015-07-301-13/+20
| | | | | Relates-to: a2657ae3ffb56616ac9c921886bcca8ef242499f Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fsck.minix: rename device file descriptor variableSami Kerola2015-07-301-20/+20
| | | | 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-302-31/+57
| | | | | | | 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-302-64/+71
| | | | 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>
* fdisk: value is never read [clang analyze]Karel Zak2015-07-291-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: value is never read [clang analyze]Karel Zak2015-07-291-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: value is never read [clang analyze]Karel Zak2015-07-291-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --list-freeKarel Zak2015-07-282-1/+36
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add 'F' command to list free unpartitioned spaceKarel Zak2015-07-283-0/+130
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: don't print obsolete CHS addressesKarel Zak2015-07-271-10/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: make sure that output fits to terminal widthKarel Zak2015-07-271-2/+13
| | | | | Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: init libsmartcols debugKarel Zak2015-07-272-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: remove extra line between menu and info lineKarel Zak2015-07-271-1/+1
| | | | | Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: spell "label" in lower caseBenno Schulenberg2015-07-271-1/+1
| | | | | | To be less shouty. It is not an abbreviation like "UUID". Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cfdisk: allow an uppercase X to toggle the extra infoBenno Schulenberg2015-07-271-0/+1
| | | | | | | To make true the help text line that says that all commands can be entered with either upper or lower case. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cfdisk: make sure that extra info is refreshed/removedKarel Zak2015-07-221-1/+3
| | | | | | | For example when you move from a Partition to the FreeSapce then we need to remove old extra info and draw nothing. Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: properly toggle extra info window, make it more robustKarel Zak2015-07-221-9/+31
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix fdisk_label_parse_parttype() for unknown typesKarel Zak2015-07-152-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: unify mkswap(8) with swapon(8) about holes warningSami Kerola2015-06-291-2/+12
| | | | | Reviewed-by: Dave Rutherford <dave@evilpettingzoo.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cfdisk: fix condition logic [cppcheck]Boris Egorov2015-06-251-1/+1
| | | | | | | | [disk-utils/cfdisk.c:1181] -> [disk-utils/cfdisk.c:1181]: (warning) Possible null pointer dereference: data - otherwise it is redundant to check it against null. Signed-off-by: Boris Egorov <egorov@linux.com>
* sys-utils/disk-utils/lib: fix printf format types [cppcheck]Boris Egorov2015-06-252-6/+6
| | | | | | Fix 'invalidPrintfArgType' cppcheck warnings Signed-off-by: Boris Egorov <egorov@linux.com>