summaryrefslogtreecommitdiffstats
path: root/partx/partx.c
Commit message (Collapse)AuthorAgeFilesLines
* partx: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* partx: add --version optionSami Kerola2012-03-301-1/+5
| | | | | | | Th commit 8275b7326e535c6d745414baca680f03e9eccdf3 added --version to usage() but not as working option. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* xalloc: use xasprintf in all filesSami Kerola2012-03-181-7/+7
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* partx: fix small leakKarel Zak2012-02-011-3/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: check sysfs_init() return value [coverity scan]Karel Zak2012-01-311-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: support LO_FLAGS_PARTSCAN flag (kernel 3.2)Karel Zak2012-01-091-21/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: don't treat empty partition table as errorKarel Zak2011-12-081-7/+5Star
| | | | | | | | | | Phillip wrote: If a partition table was detected, but it had no partitions in it, a poorly worded error message was printed and further action halted. For partx -a, this gave an unnecessary error. Reported-by: Phillip Susi <psusi@cfl.rr.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: cleanup usage() and man page, add undocumented --verboseKarel Zak2011-12-081-4/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: don't print error when partition already doesn't existPhillip Susi2011-12-081-1/+6
| | | | | | | | | | If you run partx -d to delete partitions, and there are gaps in the sequence ( partition 2 exists, but 1 doesn't ), then it would complain that it had errors trying to remove the partitions that already don't exist. Changed to ignore the error when errno == ENXIO. Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
* partx: use USAGE_ macrosDavidlohr Bueso2011-11-021-2/+2
| | | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: remove __NCOLUMNSDavidlohr Bueso2011-11-021-9/+11
| | | | | | | | | We use ARRAY_SIZE() instead to define the amount of available columns. [kzak@redhat.com: - fix compiler warnings [-Wsign-compare]] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib,strutils: add default value to parse_range()Davidlohr Bueso2011-10-171-1/+1
| | | | | | | | This function currently sets the low or high values to 0 when the string doesn't contain a value, like '123:' or ':123'. In order to make it more flexible, we allow it to be passed an arbitrary value. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* lib,strutils: share parse_range()Davidlohr Bueso2011-10-121-35/+0Star
| | | | | | | This function is currently only being used by partx(8), but it's handy and generic enough that we can use it elsewhere as well. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* partx: support loop devicesDavidlohr Bueso2011-08-311-2/+77
| | | | | | | | | | | | | | | | | | Add support for loop devices to add partitions. For now we make use of the max_part parameter from the loop kernel module, otherwise the feature is disabled. Below an example output: root@offbook:~/projects/util-linux/partx# ./partx -a -n 1:5 images-pt/dos+bsd.img root@offbook:~/projects/util-linux/partx# ls /dev/loop0* -ltr brw-rw---- 1 root disk 7, 0 2011-08-15 00:07 /dev/loop0 brw-rw---- 1 root disk 7, 5 2011-08-15 00:07 /dev/loop0p5 brw-rw---- 1 root disk 7, 2 2011-08-15 00:07 /dev/loop0p2 brw-rw---- 1 root disk 7, 1 2011-08-15 00:07 /dev/loop0p1 Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: use lowercase in usage()Karel Zak2011-08-161-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: cleanup usage()Karel Zak2011-08-161-8/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: do not print nullDavidlohr Bueso2011-08-151-1/+1
| | | | | | Replace the annoying null output when displaying no partitions in verbose mode. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* partx: switch on localizationBenno Schulenberg2011-08-021-0/+4
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* include: [strutils.c] add list parsersKarel Zak2011-07-271-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include; [tt.c] check for array size in columns parserKarel Zak2011-07-271-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: use sysfs_deinitDavidlohr Bueso2011-07-261-1/+3
| | | | | | | | Commit a88268b8cc124b6f721ba17ab01a3f6d5800c749 (get partition number with sysfs lib) recently added the sysfs library to partx without freeing resources once finished. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* partx: get partition number with sysfs libDavidlohr Bueso2011-07-211-17/+5Star
| | | | | | Now that we have this feature, there's no need to manually parse sysfs in partx. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* partx: remove unused headersDavidlohr Bueso2011-06-021-6/+0Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* This adds a second parameter to size_to_human_string() to return aFrancesco Cosoleto2011-05-261-1/+1
| | | | | | | | | | | | | | | string with a different format based on the following flags: SIZE_SUFFIX_1LETTER = "1K" SIZE_SUFFIX_3LETTER = "1KiB", SIZE_SUFFIX_SPACE = "1 KiB" or "1 K" [kzak@redhat.com: - rename flags to SIZE_SUFFIX_* format, - fix suffix[] buffer size - add 3 letter version to the test] Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: add --pairs to output in key="value" formatKarel Zak2011-05-101-14/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: trivial comment fixDavidlohr Bueso2011-04-061-1/+1
| | | | | | Replace atgv for argv Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* partx: add fallback for openat() to be usable on old systemsKarel Zak2011-03-291-3/+7
| | | | | Reported-by: "Gabor Z. Papp" <gzp@papp.hu> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: improve clarity of some messages, gettextize two missed onesBenno Schulenberg2011-02-161-14/+13Star
| | | | | | | | [kzak@redhat.com: - use <disk> rather than <device> in error/verbose messages] Signed-off-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: improve the wording of some error and usage messagesBenno Schulenberg2011-02-161-3/+3
| | | | | | | | | [kzak@redhat.com: - cleanup lscpu(1) usage text - use <disk> rather than <device> in partx(8) usage text] Signed-off-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix three typos in message strings and improve consistencyBenno Schulenberg2011-02-161-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+0Star
| | | | | | | | Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* partx, lsblk: fix gettext callsKarel Zak2011-02-111-1/+1
| | | | | Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* remaining util-linux-ng to util-linuxSami Kerola2011-01-231-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fix __noreturn__ usageKarel Zak2010-12-101-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: tiny change in usage()Karel Zak2010-12-091-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: cleanup and add columnsKarel Zak2010-12-091-13/+31
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: complete rewriteDavidlohr Bueso2010-12-091-326/+756
| | | | | | Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: integrate support for mac and sun partitions, based on kpartx.Davidlohr Bueso2010-10-081-0/+2
| | | | | | | | [kzak@redhat.com: - remove unnecessary members from struct slice, - fix gcc warnings] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: fix infinite loopKarel Zak2010-03-311-0/+2
| | | | | | | | | On Wed, Mar 24, 2010 at 04:39:35PM -0400, Phillip Susi wrote: > I noticed that running partx -d /dev/sda hangs so I looked into it > and it seems that it keeps trying to delete partitions forever. Reported-By: Phillip Susi <psusi@cfl.rr.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: do not add nonexistent partitionsPhillip Susi2010-03-311-0/+3
| | | | | | | | | This simple patch fixes partx -a to not add nonexistent zero length partitions for unused primary partition slots to to the kernel. This makes partx conform to the usual kernel behavior. Signed-off-by: Phillip Susi <psusi@cfl.rr.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: use c.hKarel Zak2009-10-161-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* replace bcopy,bzero,index and rindexDaniel Mierswa2009-08-171-1/+1
| | | | | | | | | Those 4 functions are marked as LEGACY in POSIX.1-2001 and removed in POSIX.1-2008. Replaced with memmove,memset,strchr and strrchr. Signed-off-by: Daniel Mierswa <impulze@impulze.org>
* partx: don't duplicate lib/blkdev.c codeKarel Zak2009-02-261-5/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: fix compiler warningsKarel Zak2008-03-201-3/+3
| | | | | | | dos.c:44: warning: pointer targets in assignment differ in signedness dos.c:93: warning: pointer targets in assignment differ in signedness Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.13-pre6 tarball.Karel Zak2006-12-071-20/+1Star
|
* Imported from util-linux-2.13-pre1 tarball.Karel Zak2006-12-071-1/+4
|
* Imported from util-linux-2.12b tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.11x tarball.Karel Zak2006-12-071-2/+6
|
* Imported from util-linux-2.11q tarball.Karel Zak2006-12-071-6/+20
|
* Imported from util-linux-2.10m tarball.Karel Zak2006-12-071-0/+395