summaryrefslogtreecommitdiffstats
path: root/fdisk
Commit message (Collapse)AuthorAgeFilesLines
* cfdisk: fix compilation with slangKarel Zak2011-07-281-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: use a single variable for the current disklabelFrancesco Cosoleto2011-07-116-92/+85Star
| | | | | | | | | | | | Using a variable for each supported partition table type doesn't seem necessary. This fixes also a minor bug in switching from SGI label to SUN label: the expert menu isn't available as sgi_label variable remains set to true. Code a bit more clear as *_label names have similarity with names such as "sgilabel", "struct sun_label". Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* sfdisk: fix coding style.Karel Zak2011-06-291-918/+998
| | | | | | | | | | | | The style in the file is really horrible and unreadable. This patch uses: indent -linux -i4 -psl -brf sfdisk.c to fix the style. The ideal solution is to call the indent with only -linux option, but it's too invasive... Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'master', remote-tracking branch 'upstream/master' into sfdiskSami Kerola2011-06-162-18/+18
|\
| * fdisk, display, hexdump.h: Use standard C types instead of u_int, u_char, ↵Josiah Worcester2011-06-141-17/+17
| | | | | | | | | | | | u_long, etc. Signed-off-by: Josiah Worcester <josiahw@gmail.com>
| * cfdisk: fix gcc warning (unused variable)Karel Zak2011-06-081-1/+1
| | | | | | | | | | | | | | cfdisk.c: In function ‘fp_printf’: cfdisk.c:1760:12: warning: variable ‘x’ set but not used [-Wunused-but-set-variable] Signed-off-by: Karel Zak <kzak@redhat.com>
* | sfdisk: fix for data type mismatchesSami Kerola2011-06-141-6/+7
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | sfdisk: fix implicit overflowSami Kerola2011-05-301-1/+1
| | | | | | | | | | | | sfdisk.c:1650:6: warning: overflow in implicit constant conversion [-Woverflow] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | docs: sfdisk manual updateSami Kerola2011-05-301-11/+42
| | | | | | | | | | | | | | Add to manual page previously unmentioned options and few missing long options. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | sfdisk: previously undocumented options to usageSami Kerola2011-05-301-21/+50
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | sfdisk: help screen formatSami Kerola2011-05-301-45/+48
| | | | | | | | | | | | | | Readability improvement by making the help screen to look like majority of command line utilities. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | sfdisk: declare unused function attributesSami Kerola2011-05-301-4/+16
|/ | | | | | Add `__attribute__ ((__unused__))' where needed. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdisk: accept digits-space-suffix formatFrancesco Cosoleto2011-05-101-0/+3
| | | | | | This is for users who are used to separate with a space numbers from units. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* fdisk: print logical partition number while adding itFrancesco Cosoleto2011-05-101-2/+4
| | | | | | | [kzak@redhat.com: - merged two Francesco's patches] Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* fdisk: quit from partition type dialog after invalid responseFrancesco Cosoleto2011-05-101-25/+20Star
| | | | | | This gets rid of the while() loop and fixes indentation. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* fdisk: add a default response for the partition type dialogFrancesco Cosoleto2011-05-101-5/+13
| | | | | | | | | The default response is 'p' until three primary partitions are created, then 'e'. The original idea is from Karel Zak. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* fdisk: change primary or extended partition type dialogFrancesco Cosoleto2011-05-101-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mainly this appends a colon for the prompt, reverses order of the list, reports the number of primary partitions used and unused. Old version: Command action e extended p primary partition (1-4) p New version: Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select: p Old version: Command action l logical (5 or over) p primary partition (1-4) l New version: Partition type: p primary (0 primary, 1 extended, 3 free) l logical (numbered from 5) Select: l Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* sfdisk: returns non-zero on failed BLKRRPART ioctlAndrea Galbusera2011-05-061-8/+17
| | | | | | | | | | | Make sfdisk(8) return non-zero value on failed BLKRRPART ioctl(). This will happen for either partition table re-reads after partition changes or on explicit use of -R switch. The function reread_disk_partition() was changed from 'void' to 'int' and now returns a result to let the calling functions decide to exit(1). Signed-off-by: Andrea Galbusera <gizero@gmail.com>
* fdisk: improve error message for missing extended partitionFrancesco Cosoleto2011-05-031-2/+2
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* fdisk: fix "invalid partition number for type" error messageFrancesco Cosoleto2011-05-031-2/+1Star
| | | | | | You can't input a partition number here. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* fdisk: check index before access to array [coverity scan]Karel Zak2011-03-171-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: don't use HAVE_LIBBLKID_INTERNAL macroKarel Zak2011-03-162-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: don't support external (e2fsprogs) libblkidKarel Zak2011-03-161-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add home and end keys movements in partition listFrancesco Cosoleto2011-03-111-0/+6
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* cfdisk: move keys related to the cursor of the partition list outside ↵Francesco Cosoleto2011-03-111-15/+7Star
| | | | | | menuselect() Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* cfdisk: move "No more partition" warning to draw_cursor()Francesco Cosoleto2011-03-111-14/+8Star
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* cfdisk: use keypad() in menu selection functionFrancesco Cosoleto2011-03-111-71/+41Star
| | | | | | | This makes the source code looks cleaner, and works a bit better than the previous way with hardcoded escape sequences. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* cfdisk: fix compiler warningKarel Zak2011-02-211-1/+1
| | | | | | | cfdisk.c: In function ‘menuUpdate’: cfdisk.c:1034:25: warning: unused variable ‘ymargin’ Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: remove unused vertical menu direction codeFrancesco Cosoleto2011-02-211-51/+5Star
| | | | | | | It isn't used and doesn't seem very important, as well as requires more work to run properly. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* sfdisk: rename warn to my_warnFabian Groffen2011-02-141-51/+51
| | | | | | | To avoid a conflict with the warn function from err.h, renamed warn to my_warn, as the functionality of both is not the same. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* cfdisk: data type mismatch, and other, compiler warning fixesSami Kerola2011-01-251-5/+10
| | | | | | | | | | | | | | | | | | Following warnings will longer appear when one will compile with gcc flags -Wall -Wextra -pedantic cfdisk.c:475:3: warning: comparison of unsigned expression < 0 is always false cfdisk.c:487:16: warning: comparison between signed and unsigned integer expressions cfdisk.c:492:14: warning: comparison between signed and unsigned integer expressions cfdisk.c:565:19: warning: comparison between signed and unsigned integer expressions cfdisk.c:569:19: warning: comparison between signed and unsigned integer expressions cfdisk.c:1070:14: warning: comparison between signed and unsigned integer expressions cfdisk.c:1568:5: warning: missing initializer cfdisk.c:1568:5: warning: (near initialization for 'tmp_ext.volume_label') mbsalign.c:131:2: warning: comparison of unsigned expression >= 0 is always true Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdisk: more meaningful error messages (use err.h)Francesco Cosoleto2011-01-231-24/+11Star
| | | | | | | [kzak@redhat.com: - minor changes in error messages] Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: use xalloc libFrancesco Cosoleto2011-01-233-17/+9Star
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* fdisk: replace fatal(usage) with a separate usage() functionFrancesco Cosoleto2011-01-232-26/+27
| | | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add exFAT to MBR partition type 0x7Jon Grant2011-01-231-1/+1
| | | | Signed-off-by: Jon Grant<jg@jguk.org>
* fdisk: add description for partition type 0x27Karel Zak2011-01-171-0/+1
| | | | | Reported-by: Jon Grant <jg@jguk.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: re-print prompt after maybe_exit()Karel Zak2011-01-053-10/+22
| | | | | | | | | | | | | | | after Do you really want to quit? n the read_chars() has to re-print the original prompt and ask again for new input. For example: Partition number (1-4, default 3): <-- CTRL-D Do you really want to quit? n Partition number (1-4, default 3): 3 <-- ask again First sector (411648-1023999, default 411648): Signed-off-by: Karel Zak <kzak@redhat.com>
* include: add fallback for rpmatch()Francesco Cosoleto2011-01-052-7/+4Star
| | | | | | | | Simple replacement code with hardcoded y/n responses to allow compilation on systems without rpmatch() such as Cygwin. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: quit with a single CTRL-D, confirm if necessaryFrancesco Cosoleto2011-01-051-9/+26
| | | | Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* cfdisk: close the program when terminal isn't presentFrancesco Cosoleto2010-12-301-6/+17
| | | | | | | | | | | cfdisk was getting characters without checking ERR return code, causing an endless while loop in do_curses_fdisk() or in other functions when the terminal is lost. [kzak@redhat.com: - fix coding style, remove CR macro] Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: use canonicalized names for -l (and sfdisk -d)Karel Zak2010-12-174-23/+32
| | | | | | | .. no more /dev/dm-X in "fdisk -l" and "sfdisk -d" output, always use /dev/mapper/<name>. Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add option to use maximum partition sizeKarel Zak2010-12-092-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Based on patch from Alex Bligh <alex@alex.org.uk>, Alex wrote: By default, omitting a size parameter means that the maximum sized partition is used. However, this option is not available in conjunction with the -N flag, as under such circumstances the default is the current size of the partition. This patch allows a size to be specified as "+" in which case the maximum sized partition is used, irrespective of the setting of the -N flag. This allows partitions to be programatically resized to their maximum size, by (for instance): echo ",+," | sfdisk -N1 /dev/sda This is non-trivial to do without the patch, as -N makes the default size the existing size. As there is (without this patch) no way of reading the maximum size, the only option is to delete the partition and recreate it. This is undesirable for a number of reasons (e.g. errors between delete and recreate). Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/686124 Signed-off-by: Karel Zak <kzak@redhat.com>
* rename util-linux-ng back to util-linuxKarel Zak2010-11-303-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: fix freespace boundaries calculation on SGI disklabelKarel Zak2010-11-291-0/+3
| | | | | | | Thanks to Aurelien Jarno <aurelien@aurel32.net> Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510130 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-231-1/+1
| | | | | | | | | | | | | This patch replaces a few functions used throughout the source: * Renames getnum (from schedutils) to strtol_or_err * Moves strtosize (from lib/strtosize.c) * Moves xstrncpy (from include/xstrncpy.h) * Adds strnlen, strnchr and strndup if not available (remove it from libmount utils) A few Makefile.am files were modified to compile accordingly along with trivial renaming in schedutils source code. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* sfdisk: save errno before calling perrorForest Bond2010-10-071-1/+4
| | | | | | | | | | | | errno is saved into a local variable to avoid it getting trampled by perror before it is checked to determine the return value. This issue seems quite rare, but I have seen it when running sfdisk via gksudo and using the --quiet command-line option. From what I can tell, this combination triggers loading of translations in perror, which (at least on my machine) ends up changing the value of errno. Signed-off-by: Forest Bond <forest@alittletooquiet.net>
* fdisk: eliminate redundant call to open()Markus Rinne2010-09-301-8/+8
| | | | | | | Don't use open() in get_boot() if it's called with an argument try_only, because the file has already been opened by the caller. Signed-off-by: Markus Rinne <markus.ka.rinne@gmail.com>
* cfdisk: don't use size of device based on cylindersKarel Zak2010-09-061-12/+5Star
| | | | | | | | | This patch is enough to make cfdisk usable on non-DOS disks where partitioning is not based on CHS. cfdisk should not print error messages for such disks. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=630340 Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: fix alignment check for non-512-byte logical sectorsKarel Zak2010-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # modprobe scsi_debug dev_size_mb=1024 sector_size=4096 # fdisk /dev/sdb Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4, default 1): Using default value 1 First sector (256-262143, default 256): 257 Last sector, +sectors or +size{K,M,G} (257-262143, default 262143): +100M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes 32 heads, 32 sectors/track, 256 cylinders, total 262144 sectors Units = sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 262144 bytes Disk identifier: 0x16db2bb0 Device Boot Start End Blocks Id System /dev/sdb1 257 25855 102396 83 Linux Partition 1 does not start on physical sector boundary. ^^^^^^^^ The warning is nonsense. The logical and physical sector size is the same. It means that every LBA is always aligned to physical sector boundary. Note that this bug does not mean that fdisk produces unaligned partitions. The problem is that fdisk forces to use bigger gaps between aligned LBAs, for example: correctly aligned LBA are: 256, 257, 258, ... [N+1] fdisk assumes: 256, 264, 272, ... [N+(sector_size/512)] Reported-by: JOB NELSON <job_nelson@hotmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: don't keep internally device size in 512-byte sectorsKarel Zak2010-08-231-15/+14Star
| | | | | | | All fdisk code uses sector_size variable, so there should not be an exception where we use 512-byte sectors. Signed-off-by: Karel Zak <kzak@redhat.com>