* use separate function to get free space
* allow to use label-specific get_freespace() function
(this is necessary for MBR extended partitions mess)
Signed-off-by: Karel Zak <kzak@redhat.com>
The include/tt.h has to be used only internally by the library (for
example to convert fdisk_table to string).
The fdisk_ask API should not be more used for complex tasks like print
partition table. The application has to use fdisk_get_table() and
fdisk_table_to_string() or something else.
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's use more generic:
fdisk_get_partition()
fdisk_partition_get_parttype()
rather than fdisk_get_partition_type().
The patch also improves fdisk_get_partition() semantic to allocate
a new partition struct if the argument is NULL.
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - move paths to pathnames.h,
- use static path buffer]
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Notes:
* fdisk don't sync hybrid MBR with GPT
* hybrid MBR is ignored and not overwritten by PBMR
* users is informed about expert command 'M' to toggle between MBR
and GPT mode. It's possible to manually modify hybrid MBR.
Signed-off-by: Karel Zak <kzak@redhat.com>
error: run: man --warnings=all fdisks/fdisk.8 >/dev/null
<standard input>:209: cannot use a space as a starting delimiter
Signed-off-by: Karel Zak <kzak@redhat.com>
Unfortunately, fdisk_warn/info/.. function was not marked by
printf __attribute__.
We don't want to break gettext stuff now, so all compiler warnings
have been fixed by casts. This is temporary solution, after release it
will be necessary to fix all the strings.
Signed-off-by: Karel Zak <kzak@redhat.com>
In some cases (for example hybrid GPT) it's useful to force fdisk to
read only specified disk label and ignore everything else.
For example:
# fdisk -l /dev/sda
Disk /dev/sda: 149.1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3549290F-417C-4941-8503-F7835109B821
Device Start End Size Type
/dev/sda1 2048 2050047 1000M EFI System
/dev/sda2 2050048 6146047 2G Microsoft basic data
/dev/sda3 6146048 26462207 9.7G Linux swap
/dev/sda4 26462208 98142207 34.2G Microsoft basic data
/dev/sda5 98142208 230662143 63.2G Microsoft basic data
/dev/sda6 230662144 312580095 39.1G Microsoft basic data
but when GPT is disabled we can access PMBR:
# fdisk -l -t dos /dev/sda
Disk /dev/sda: 149.1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 312581807 156290903+ ee GPT
Reported-by: Craig <util-linux_contact@magister.com.au>
Signed-off-by: Karel Zak <kzak@redhat.com>
__sighandler_t is libc implementation specific and should not be relied
upon. Instead, we fall back upon void (*)(int), as specified by POSIX.
Signed-off-by: Karel Zak <kzak@redhat.com>
The ncurses package has been providing pkg-config files for a while now.
So let's start using them to get the proper linker & compiler flags. It
can make a difference when ncurses is configured in a way that requires
extra link time flags but util-linux doesn't provide them, or when the
headers live in a weird place and util-linux can't find them.
Since the NCURSES_LIBS is always defined for the Makefile, there's no need
to gate on the HAVE_NCURSES conditional. When it's disabled, the var will
simply be empty.
With a minor tweak to how tinfo is handled, we can do the same thing -- we
just always use TINFO_LIBS in the Makefile's.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>