summaryrefslogtreecommitdiffstats
path: root/libfdisk
Commit message (Collapse)AuthorAgeFilesLines
* maint: fix shadow declarationSami Kerola2015-01-072-6/+8
| | | | | | | | | | | | | | | | This change fixes all shadow declarations. The worth while to mention fix is with libfdisk sun geometry. It comes from bitops.h cpu_to_be16 macro that further expands from include/bits/byteswap.h that has the shadowing. libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow] libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow] libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow] libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow] That could have caused earlier some unexpected results. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libfdisk: fix bug in cmp_numbers() and partitions sortingKarel Zak2014-12-042-7/+42
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1170191 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove 'end' from struct fdisk_partitionKarel Zak2014-12-0411-25/+75
| | | | | | This struct member duplicate "start+size". Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: rename sector_t to fdisk_sector_tKarel Zak2014-12-0411-119/+125
| | | | | | .. just to avoid too generic names for public API. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix cfdisk freespace analyzeKarel Zak2014-12-045-3/+23
| | | | | | | | | The problem is how fdisk_partition_cmp_start() compare numbers, the function returns result from "a->start - b->start", unfortunately the numbers are uint64, but function returns "int". Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1170191 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add API docsKarel Zak2014-11-2621-61/+554
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: rename and move functionKarel Zak2014-11-265-30/+33
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add fdisk.pcKarel Zak2014-11-262-0/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add fdiskP.h to sourcesKarel Zak2014-11-261-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: create a regular shared libfdisk.soKarel Zak2014-11-265-25/+295
| | | | | | | | | - symbols versioning - SONAME from configure.ac - library version to header file - modify build-sys to compile and install shared lib Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add comments to header fileKarel Zak2014-11-261-4/+70
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add docs for SGI functionsKarel Zak2014-11-261-0/+26
|
* libfdisk: add docs for SUN functionsKarel Zak2014-11-261-1/+53
|
* libfdisk: cleanup fdisk_partition_to_string() commentKarel Zak2014-11-261-2/+4
|
* libfdisk: fix typoKarel Zak2014-11-261-1/+3
|
* libfdisk: add docs for iteratorKarel Zak2014-11-261-2/+11
|
* libfdisk: add docs for init functionsKarel Zak2014-11-261-0/+11
|
* libfdisk: add docs for GPT functionsKarel Zak2014-11-261-0/+22
|
* libfdisk: add docs for DOS functionsKarel Zak2014-11-263-11/+31
|
* libfdisk: add docs for BSD functionsKarel Zak2014-11-261-2/+29
|
* libfdisk: cleanup ask API, add commentsKarel Zak2014-11-253-101/+260
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove flags from fdisk_ask APIKarel Zak2014-11-218-77/+48Star
| | | | | | 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-219-24/+72
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix typoKarel Zak2014-11-218-6/+59
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ibfdisk: (gpt) allow to maximize partitionKarel Zak2014-11-201-2/+20
| | | | | | | | | | | | | | | | | | | | enlarge second partition: # echo ',+' | ./sfdisk -N2 /dev/sdb ... Disk /dev/sdb: 100 MiB, 104857600 bytes, 204800 sectors Old situation: Device Start End Sectors Size Type /dev/sdb1 2048 22527 20480 10M Linux filesystem /dev/sdb2 22528 43007 20480 10M Linux filesystem New situation: Device Start End Sectors Size Type /dev/sdb1 2048 22527 20480 10M Linux filesystem /dev/sdb2 22528 204766 182239 89M Linux filesystem Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) allow to maximize partitionKarel Zak2014-11-201-25/+96
| | | | | | | | | | | | | | | | | | | | | | | 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>
* libfdisk: fix partition names on GNU Hurd.Gabriele Giacone2014-11-181-0/+4
|
* libfdisk: fix get_partition_unused_primary()Boris Egorov2014-11-141-23/+27
| | | | | | | | | | | | | | | | Was: Mentioned function returns -1 if adding of primary partition is impossible. Caller treats this value as size_t (res variable) and then compares it for negative values, totally ignoring errors. Becomes: Now function takes address to variable and fills it with partition number. Caller treats return value as int and use it appropriately. [kzak@redhat.com: - don't mix return code and partno at all] Signed-off-by: Boris Egorov <egorov@linux.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) be sure that sorted EBR list is terminatedKarel Zak2014-11-131-5/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix table_add_freespace(), add debug messagesKarel Zak2014-11-132-5/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix script parser, add debug messagesKarel Zak2014-11-121-7/+26
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) don't offer first sector before the first partionKarel Zak2014-11-101-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GPT first usable LBA is usually aligned to grain (1MiB), but for small (<=4MiB) devices we strictly follow sector sizes. In this case there is a small space in front of the aligned begin of the first partition. This useless space should not be offered for the next partitions. Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 32768 bytes Disklabel type: gpt Disk identifier: 041E2D54-AD0C-4C7E-A50D-363D23058D47 Device Start End Size Type /dev/sdb1 40 2087 1M Linux filesystem Command (m for help): n Partition number (2-128, default 2): First sector (34-8158, default 2088): ^^ first usable LBA is 34, but first aligned (recommended) LBA is 40, we use it for the first partition. All this is correct, but the space before the first partition should be ignored. Fixed version: Command (m for help): n Partition number (2-128, default 2): First sector (2088-8158, default 2088): ^^^^ Note this problem does not exist for "normal" (large) devices where first usable LBA is aligned to grain. Reported-by: Boaz Harrosh <boaz@plexistor.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) make mode more readableKarel Zak2014-11-101-39/+43
| | | | | | | | * use check_ prefix for checking functions * use plural in function names where we work with more partitions than one * always use "ents" when when we work with gpt entries array Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fdisk_read_firstsector should seek to offset 0Samuel Thibault2014-11-101-0/+7
| | | | | | | The current offset of cxt->dev_fd may not be still 0, notably when blkdev_get_size has to resort to using blkdev_find_size Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org
* libfdisk: clean up debug, add help debug maskKarel Zak2014-11-032-25/+37
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: fix typoKarel Zak2014-10-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add more commentsKarel Zak2014-10-164-54/+126
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup parttype APIKarel Zak2014-10-157-66/+208
| | | | | | | * add reference counting * add functions to set allocated types Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup partno APIKarel Zak2014-10-154-51/+123
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make it possible to use zero for size and startKarel Zak2014-10-1511-176/+272
| | | | | | | | | | | | | | | | 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: (dos) set partition start/size only when requestedKarel Zak2014-10-143-7/+22
|
* libfdisk: cleanup context devname usageKarel Zak2014-10-141-8/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) fix N-1 error for partition sizeKarel Zak2014-10-141-2/+1Star
| | | | | | | The same bug like on dos.c, the limits for the "last sector" dialog are already with "-1". Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) fix N-1 error for partition sizeKarel Zak2014-10-141-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix script unit testKarel Zak2014-10-141-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: grammarize an informative message, and tweak some commentsBenno Schulenberg2014-10-141-4/+6
| | | | | | Also add two clarifying comments for translators. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: fix script next_token()Karel Zak2014-10-101-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make script header parser more pedanticKarel Zak2014-10-101-0/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) reset logical partition stuff after errorKarel Zak2014-10-091-5/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup script dumpKarel Zak2014-10-091-3/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>