summaryrefslogtreecommitdiffstats
path: root/disk-utils/sfdisk.c
Commit message (Collapse)AuthorAgeFilesLines
...
* sfdisk: add --wipeKarel Zak2016-02-181-1/+31
| | | | | | | | | | | | | | This patch changes sfdisk behavior and it wipes foreign signatures from the device to avoid collisions. The wipe functionality is automatically enabled in the interactive mode only (user is always warned about it), otherwise it's possible to control all by --wipe <auto|never|always>. The program does not change behavior when executed in scripts (echo <something> | sfdisk), the option "--wipe=always" is required to enable in this case. Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: make --quiet really quietKarel Zak2016-02-011-3/+5
| | | | | References: https://github.com/karelzak/util-linux/issues/268 Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --deleteKarel Zak2015-09-171-0/+50
| | | | 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-081-10/+199
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --reorderKarel Zak2015-09-071-1/+39
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1232707 Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk, sfdisk: remove unused variablesKarel Zak2015-08-051-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: adjust grammar and punctuation of some messagesBenno Schulenberg2015-08-031-14/+14
| | | | | | | 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: add --list-freeKarel Zak2015-07-281-1/+33
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: init libsmartcols debugKarel Zak2015-07-271-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: show that the command --verify optionally takes device namesBenno Schulenberg2015-06-171-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* sfdisk: add --jsonKarel Zak2015-06-151-1/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) add extra check for First/Last LBAKarel Zak2015-04-231-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: don't use BLKRRPART to check loopdev usageKarel Zak2015-04-171-1/+3
| | | | | | | It seesm that kernel always returns EINVAL for BLKRRPART on loop devices, we call the ioctl to check if nobody else uses the device. Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: accept empty partitions from dumpKarel Zak2015-04-161-3/+19
| | | | | | | | | | Old sfdisk uses: dev/sdc2 : start= 0, size= 0, Id= 0 for undefined MBR partitions. Let's follow this behaviour. Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: enable bootbits protectionKarel Zak2015-04-131-0/+1
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1210428 Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: improve -N warningsKarel Zak2015-04-131-2/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: cleanup prompt usageKarel Zak2015-03-271-6/+13
| | | | | | | | Let's use fgets-like callback only when compiled with readline, otherwise (and also for non-tty) print prompt by printf(). Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: fix -a vs. -A bugKarel Zak2015-03-261-6/+6
| | | | | | | | | | | | | The -A has been originally used for --activate, since v2.26 it's used for --append. This is stupid mistake. This patch reverts the change to: -A, --activate -a, --append Note that --append is a new command line option in v2.26. Addresses: https://bugs.archlinux.org/task/44349 Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add readline supportKarel Zak2015-03-251-8/+65
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add missing --colorKarel Zak2015-02-251-3/+15
| | | | | | | The util already support lib/colors.c stuff, but without command line option. Signed-off-by: Karel Zak <kzak@redhat.com>
* rpmatch: use symbolic value when evaluation return codesSami Kerola2015-02-241-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* sfdisk: include rpmatch.hSami Kerola2015-02-161-0/+1
| | | | | | | Some libc's do not have rpmatch(), and they need the workaround in the header file. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: sort the options in the usage text of sfdisk alphabeticallyBenno Schulenberg2015-02-101-7/+7
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* sfdisk: fix --id fallthrough [coverity scan]Karel Zak2015-01-281-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: support unknown partition types in sfdisk scriptsKarel Zak2015-01-281-2/+2
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1183234 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: don't use off_t in public APIKarel Zak2015-01-261-3/+3
| | | | | | | | | | | | It's better to use exact and explicitly defined types (e.g. uint64_t) rather than something like off_t to make code more portable. [reported with gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3)] The patch also fixes one debug message. Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix various minor typosYuri Chornoivan2015-01-261-10/+10
|
* textual: fix spellos and inconsistencies in several program messagesBenno Schulenberg2015-01-261-14/+14
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: accept Start offset in {B,M,G..}iB in sfdisk scriptsKarel Zak2015-01-201-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: fix --bytesKarel Zak2015-01-191-4/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdiskL add API to print SIZE field in bytesKarel Zak2015-01-191-2/+8
| | | | | | The patch also add --bytes to fdisk and fdisk. Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+3
| | | | | | | | | 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>
* sfdisk: in the usage text show -v for --version instead of -VBenno Schulenberg2014-12-191-1/+1
| | | | | | | In sfdisk -V is taken by --verify. Use for the description of --version the same indentation as for --help, not that of the other options. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: rename and move functionKarel Zak2014-11-261-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) allow to maximize partitionKarel Zak2014-11-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | The struct fdisk_partition has special flag "end_follow_default" to make the partition large as much as possible. This patch makes this flag usable for fdisk_set_partition() function. Command line example (enlarge the first partition): # echo ',+' | ./sfdisk -N1 /dev/sdb ... Disk /dev/sdb: 100 MiB, 104857600 bytes, 204800 sectors ... Old situation: Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 22527 20480 10M 83 Linux ^^^^^ New situation: Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 204799 202752 99M 83 Linux ^^^^^^ Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: return deterministic value from sfdisk_deinit()Sami Kerola2014-10-311-2/+1Star
| | | | | | | | | | | disk-utils/sfdisk.c:222:9: warning: variable 'rc' is uninitialized when used here [-Wuninitialized] return rc; disk-utils/sfdisk.c:208:8: note: initialize the variable 'rc' to silence this warning int rc; Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/debug: fix typoKarel Zak2014-10-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: fix compiler warnings about uninitialized variablesSami Kerola2014-10-201-3/+3
| | | | | | warning: 'str' may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libfdisk: cleanup parttype APIKarel Zak2014-10-151-1/+1
| | | | | | | * add reference counting * add functions to set allocated types Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make it possible to use zero for size and startKarel Zak2014-10-151-1/+1
| | | | | | | | | | | | | | | | The zero may be valid size and start of the partition. This patch introduces: fdisk_partition_has_start() fdisk_partition_has_size() fdisk_partition_unset_size() fdisk_partition_unset_start() to make it possible to work with zero. The feature is internally implemented by magic constant ((type) -1) for undefined sizes and offsets. Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add PMBR sfdisk testKarel Zak2014-10-131-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: leave on errorKarel Zak2014-10-101-7/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: ask on EOFKarel Zak2014-10-091-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: cleanup isatty() usageKarel Zak2014-10-081-9/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --label-nested for hybrid GPTKarel Zak2014-10-071-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regular disk label: # sfdisk --list /dev/sdb .. Disklabel type: gpt Disk identifier: 9DF9A9F1-0654-4E7A-9A5E-36E66D60FD79 Device Start End Sectors Size Type /dev/sdb1 2048 22527 20480 10M Linux filesystem /dev/sdb2 22528 43007 20480 10M Linux swap /dev/sdb3 43008 204766 161759 79M Linux filesystem nested (PMBR): # sfdisk --list --label-nested dos /dev/sdb ... Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/sdb1 1 204799 204799 100M ee GPT and for example: # sfdisk --label-nested dos /dev/sdb <<EOF 1, 2047, ee , 10M, L , 10M, S ,, creates hybrid GPT (PMBR partitions point to the same location as GPT) Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix sun and sgi to be usable from sfdiskKarel Zak2014-10-071-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --output <list> for print command(s)Karel Zak2014-10-071-1/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --part-attrsKarel Zak2014-10-071-0/+65
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>