summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/ask.c
Commit message (Collapse)AuthorAgeFilesLines
* libfdisk: Accept negative numbers for last sector inputAwal Garg2018-07-311-0/+25
| | | | | | | | [kzak@redhat.com: - add note to the man page - add '-' to the dialog query - cleanup functions names and libfdisk.sym] Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_disable_dialogs()Karel Zak2017-07-191-0/+8
| | | | | | | | | | | | | | | The default (for historical reasons) is to use dialog driven partitioning. It's possible to avoid dialogs by fdisk_partition template for fdisk_add_partition(). Unfortunately in some case (mostly DOS driver) it's not enough, because we need to distinguish between logical and primary partitions. If we know that dialogs are unwanted then we can default to primary partition, etc. This function simplify semantic of the library for non-interactive programs. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-7/+7
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* libmount: remove duplicate codeKarel Zak2016-04-221-1/+1
| | | | | | | | For petty long time we have strdup_to_struct_member() macro to avoid duplicate code when strdup() strings in setter functions. Let's use it for libmount. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: again fixing many printf format stringsRuediger Meier2016-03-071-2/+2
| | | | | | | | | | | | | | | | | | | 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>
* misc: safer (and uniform) handling of return valueYuriy M. Kaminskiy2016-03-071-6/+2Star
| | | | | | When `rc` is `INT_MAX`, `rc + 1` result in signed integer overflow. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: fix compiler warnungs (unsigned/signed)Ruediger Meier2016-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These ones should be fixed: libblkid/src/probe.c:393:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/probe.c:907:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/probe.c:1221:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:540:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1043:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1056:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1057:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1061:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1199:27: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/partitions/partitions.c:1410:26: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/partitions/partitions.c:1431:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/superblocks/linux_raid.c:151:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] libblkid/src/superblocks/linux_raid.c:155:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] libblkid/src/superblocks/superblocks.c:375:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/superblocks/xfs.c:141:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libsmartcols/src/table.c:333:24: warning: signed and unsigned type in conditional expression [-Wsign-compare] libsmartcols/src/table.c:344:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libsmartcols/src/table_print.c:753:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/ask.c:364:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/utils.c:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/context.c:435:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/context.c:730:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/script.c:557:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/dos.c:1791:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/gpt.c:813:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:140:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:551:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:640:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* tests: fix compiler warnings [-Wmissing-prototypes]Ruediger Meier2016-02-231-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: make context->label usage more robust [smatch scan]Karel Zak2015-08-051-2/+2
|
* libfdisk: rename sector_t to fdisk_sector_tKarel Zak2014-12-041-1/+1
| | | | | | .. just to avoid too generic names for public API. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add API docsKarel Zak2014-11-261-6/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: rename and move functionKarel Zak2014-11-261-0/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup ask API, add commentsKarel Zak2014-11-251-35/+207
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove flags from fdisk_ask APIKarel Zak2014-11-211-34/+31Star
| | | | | | We don't use it for anything usable, lets kill this over-engineering. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add ref.counting to ask APIKarel Zak2014-11-211-11/+56
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make yes/no dialogs more robustKarel Zak2014-10-071-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: move fdisk_ask_partnum() to APIKarel Zak2014-08-151-1/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove fdisk_colon()Karel Zak2014-04-011-13/+0Star
| | | | | | | It was unnecessary overkill to have colorized "foo:" prefix in fdisk output. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: clean up debug outputKarel Zak2014-03-211-11/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use new debug functionsKarel Zak2014-03-211-11/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add ASKTYPE_MENU and context last_lbaKarel Zak2014-03-111-0/+130
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove tt stuff from APIKarel Zak2014-03-111-28/+0Star
| | | | | | | | | | | 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>
* libfdisk: add struct fdisk_partitionKarel Zak2014-03-111-6/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix printf stuffKarel Zak2013-10-231-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: fix printf stuffKarel Zak2013-10-151-9/+9
| | | | | | | | | | | 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>
* libfdisk: update test_ranges() codeKarel Zak2013-09-171-7/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use fdisk_warnx() in fdisk_ask_partnum()Karel Zak2013-09-171-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add debug message, use colors for -lKarel Zak2013-09-171-1/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) use generic 'created partition' messageKarel Zak2013-09-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: extend fdisk_info() functionalityKarel Zak2013-09-161-5/+48
| | | | | | | | - add per message flags - add fdisk_colon() for "foo bar: bla bla..." messages - add fdisk_sinfo() as smart version of fdisk_info() Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: allow to address partition by charsKarel Zak2013-09-161-11/+32
| | | | | | | For example BSD uses letters rather tahn numbers to address partition, the fist partition is 'a', last partition is 'p'. Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: remove Mac codeKarel Zak2013-09-161-2/+0Star
| | | | | | The code has been used only to detect magic strings, nothing else. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove unnecessary code from test_fdisk_askKarel Zak2013-09-161-1/+0Star
| | | | | | .. 'sun' stuff is already in the library. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add asktype "string" and support UUID partition changeKarel Zak2013-09-161-0/+46
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (sun) move driver from fdisk to libraryKarel Zak2013-09-161-0/+15
| | | | | | ... and also add fdisk_info_new_partition() Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add new 'ask' type TABLEKarel Zak2013-09-161-0/+27
| | | | | | | The new type could be used to print table-like output (for example list of the partitions). Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: don't re-allocate range string in Ask APIKarel Zak2013-05-091-10/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: do not use va_list in the Ask APIKarel Zak2013-05-091-26/+9Star
| | | | | | | | | | | | | | | | # fdisk /dev/sda Welcome to fdisk (util-linux 2.23). [...] Command (m for help): a Segmentation fault (core dumped) It's too fragile, the va_list implementation is architecture specific and it seems we need such thing in libfdisk at all. Reported-by: "Gabor Z. Papp" <gzp@papp.hu> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: no more AIX "support"Karel Zak2013-03-121-1/+0Star
| | | | | | | | The whole AIX support in fdisk has been limited to pretty poor AIX magic string detection and warning that the AIX is unsupported. It's too expensive to maintain such fdisk driver. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: improve fdisk_ask_partnum()Karel Zak2013-03-111-9/+32
| | | | | | .. to don't ask is there is only one choice. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add Yes/No to Ask APIKarel Zak2013-03-111-0/+41
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add wrapper to ask for numbersKarel Zak2013-03-111-0/+36
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add info, warn and wanx Ask APIKarel Zak2013-03-111-1/+131
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: extend "ask" API, add support for offsetsKarel Zak2013-03-111-40/+166
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add "ask" interfaceKarel Zak2013-03-111-0/+223
Signed-off-by: Karel Zak <kzak@redhat.com>