summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/bsd.c
Commit message (Collapse)AuthorAgeFilesLines
* libfdisk: (bsd) improve checksum calculation [-Waddress-of-packed-member]Karel Zak2019-05-221-5/+12
| | | | | | | | Let's keep compilers and static analyzers happy. The idea is to use memcpy() to copy from buffer to variable and use all label as unsigned char rather than vectorize by unsigned short. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Accept negative numbers for last sector inputAwal Garg2018-07-311-2/+3
| | | | | | | | [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: fix compiler warning [-Wunused-parameter]Karel Zak2018-05-031-3/+1Star
| | | | | Reported-by: L A Walsh <lkml@tlinx.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix NLS supportKarel Zak2017-04-251-1/+0Star
| | | | | | | | | | | | | | | | | | | The current libfdisk code uses gettext() to translate strings. It means it follows the default text domain (as set by textdomain(3) usually in the main program). This is useless for public shared library. We have call private bindtextdomain() and use dgettext() with private domain name to be independent on the main program. For this purpose include/nls.h supports UL_TEXTDOMAIN_EXPLICIT to use dgettext(). Note that libfdisk will continue to use util-linux.po, rather than keep the texts in the separate file. The nls.h has to be included only from fdiskP.h to be sure that nls.h works as expected for the library. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libfdisk: change the way how apply user device propertiesKarel Zak2017-01-131-0/+3
| | | | | | | | | | | | | | | | The current code calls fdisk_apply_user_device_properties() after label probing, because we want to overwrite label geometry by user settings (e.g. -C -H -S fdisk options). Unfortunately, this way does not work if we need to use a different sector size, because label probing depends on sector size... So, the right way is to apply user setting to the fdisk context before we start to read from device, and overwrite geometry again after label is already read. Fortunately, this shit is necessary only rarely and for SUN and SGI disk labels. Addresses: https://github.com/karelzak/util-linux/issues/396 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-2/+2
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* libfdisk: (bsd) fix spelling in warning messageBenno Schulenberg2016-03-161-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: (bsd) add note about non-written parental MBRKarel Zak2015-08-311-1/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add new API to read label specific dataKarel Zak2015-06-111-37/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | * removes list() label operation from internal API The list() has been based on fdisk_info() it was useless for anything else than print on stdout... * add a new get_item() label operation and fdisk_get_disklabel_item() public API The new API provides abstract and pretty simple way how to get label specific disk label information, for example fdisk_get_disklabel_item(cxt, GPT_LABELITEM_ENTRIESLBA, &iterm); return LBA of the array with GPT entries. Note that this patch does not implement public functions to get data from the @item object. * removes get_id() label operation -- it's subset of the new get_item() * the new internal API is also used to implement backwardly compatible fdisk_list_disklabel() and fdisk_get_disklabel_id() Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove 'end' from struct fdisk_partitionKarel Zak2014-12-041-1/+0Star
| | | | | | This struct member duplicate "start+size". Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: rename sector_t to fdisk_sector_tKarel Zak2014-12-041-6/+6
| | | | | | .. just to avoid too generic names for public API. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add API docsKarel Zak2014-11-261-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add docs for BSD functionsKarel Zak2014-11-261-2/+29
|
* libfdisk: remove flags from fdisk_ask APIKarel Zak2014-11-211-8/+4Star
| | | | | | 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-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make it possible to use zero for size and startKarel Zak2014-10-151-7/+9
| | | | | | | | | | | | | | | | 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>
* libfdisk: (bsd) add set_part() APIKarel Zak2014-10-071-23/+64
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup internal drivers' APIKarel Zak2014-10-071-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: return partno when add new partitionKarel Zak2014-10-071-1/+4
| | | | | | | * improve the way how sfdisk report results * the API change simplify applications Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: final parttype API cleanupKarel Zak2014-08-141-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup fdisk_is_label stuffKarel Zak2014-08-131-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: clean up API (context.c)Karel Zak2014-08-131-10/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: rename fdisk_column to fdisk_fieldKarel Zak2014-08-131-13/+13
| | | | | | .. to make the API and fdisk(s) code more readable. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove dependence on libsmartcolsKarel Zak2014-08-131-9/+8Star
| | | | | | It's application business to convert libfdisk_table to string. Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix some typos and inconsistencies in various messagesBenno Schulenberg2014-07-231-1/+1
| | | | | | | | Fixing plain typos, miswordings, inconsistent periods, some missing angular brackets, and a proper pluralization (even when it involves a constant, because for some languages the precise value matters). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: fix bsd_translate_fstype() for alphaRuediger Meier2014-06-091-0/+2
| | | | | Reported-by: Tobias Klausmann <klausman@schwarzvogel.de> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Use libsmartcols in libfdisk and cfdiskOndrej Oprala2014-04-031-8/+9
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libfdisk: remove fdisk_colon()Karel Zak2014-04-011-18/+18
| | | | | | | It was unnecessary overkill to have colorized "foo:" prefix in fdisk output. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use new debug functionsKarel Zak2014-03-211-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (bsd) fix outputKarel Zak2014-03-111-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: clean up cylinder columnKarel Zak2014-03-111-3/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use fdisk_table to generate outputKarel Zak2014-03-111-2/+2
| | | | | | | | | | | * add generic fdisk_iter iterator * use fdisk_table to convert partition table to human readable output * clean up partition.c API (don't use reference to fdisk_context in fdisk_partition struct) * extern table.c API to use fdisk_iter iterator * remove old fdisk_list_partitions() Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use partition templateKarel Zak2014-03-111-61/+78
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (bsd) remove get_partition_type()Karel Zak2014-03-111-18/+11Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add new list() columns, cleanupKarel Zak2014-03-111-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (bsd) use new get_part() APIKarel Zak2014-03-111-85/+60Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add struct fdisk_partitionKarel Zak2014-03-111-14/+6Star
| | | | 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>
* libfdisk: (bsd) leave context if new disklabel unwantedKarel Zak2013-10-161-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: fix printf stuffKarel Zak2013-10-151-1/+1
| | | | | | | | | | | 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>
* textual: change spelling of "disk label" to the more abundant "disklabel"Benno Schulenberg2013-10-081-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: cleanup warning messagesKarel Zak2013-10-041-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: improve spelling of two commentsBenno Schulenberg2013-10-041-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: (bds) cleanup includesKarel Zak2013-09-261-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use fdisk_colon() and fdisk_sinfo()Karel Zak2013-09-161-23/+28
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add bsd driverKarel Zak2013-09-161-0/+939
Signed-off-by: Karel Zak <kzak@redhat.com>