Commit Graph

43 Commits

Author SHA1 Message Date
Karel Zak 8275b7326e partx: cleanup usage() and man page, add undocumented --verbose
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-08 14:14:28 +01:00
Phillip Susi ab025087f9 partx: don't print error when partition already doesn't exist
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>
2011-12-08 13:41:39 +01:00
Davidlohr Bueso 4ded382332 partx: use USAGE_ macros
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-11-02 16:22:44 +01:00
Davidlohr Bueso 10ebfeeaf4 partx: remove __NCOLUMNS
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>
2011-11-02 16:17:19 +01:00
Davidlohr Bueso af7df9ee67 lib,strutils: add default value to parse_range()
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>
2011-10-17 11:06:48 +02:00
Davidlohr Bueso a883c6349c lib,strutils: share parse_range()
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>
2011-10-12 10:01:26 +02:00
Davidlohr Bueso 0e9381133e partx: support loop devices
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>
2011-08-31 16:51:48 +02:00
Karel Zak b37155e284 partx: use lowercase in usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:44:31 +02:00
Karel Zak e96fd1766d partx: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:37:05 +02:00
Davidlohr Bueso 2e2b6bb1c7 partx: do not print null
Replace the annoying null output when displaying no partitions in verbose mode.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-08-15 14:28:21 +02:00
Benno Schulenberg 5c87aa1a27 partx: switch on localization
Reported-by: Petr Písař <petr.pisar@atlas.cz>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-02 14:13:39 +02:00
Karel Zak c87638ad30 include: [strutils.c] add list parsers
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27 16:41:21 +02:00
Karel Zak bdc3ed6678 include; [tt.c] check for array size in columns parser
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27 16:21:11 +02:00
Davidlohr Bueso 4190aaf619 partx: use sysfs_deinit
Commit a88268b8cc (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>
2011-07-26 11:58:38 +02:00
Davidlohr Bueso a88268b8cc partx: get partition number with sysfs lib
Now that we have this feature, there's no need to manually parse sysfs in partx.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-07-21 17:49:02 +02:00
Davidlohr Bueso 5a49c0cedc partx: remove unused headers
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-06-02 13:27:26 +02:00
Francesco Cosoleto 5d2a98490e This adds a second parameter to size_to_human_string() to return a
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>
2011-05-26 15:32:33 +02:00
Karel Zak 8ed48785e1 partx: add --pairs to output in key="value" format
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-10 11:39:51 +02:00
Davidlohr Bueso 1d6a5daa58 partx: trivial comment fix
Replace atgv for argv

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-04-06 10:37:16 +02:00
Karel Zak 741a5b1085 partx: add fallback for openat() to be usable on old systems
Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-29 10:45:57 +02:00
Benno Schulenberg 144df9a2a8 partx: improve clarity of some messages, gettextize two missed ones
[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>
2011-02-16 15:53:30 +01:00
Benno Schulenberg e8ab5ce3d0 textual: improve the wording of some error and usage messages
[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>
2011-02-16 15:46:38 +01:00
Benno Schulenberg e22d8b9519 textual: fix three typos in message strings and improve consistency
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-02-16 15:30:13 +01:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
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>
2011-02-14 17:45:24 +01:00
Karel Zak d015794e09 partx, lsblk: fix gettext calls
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-11 09:06:27 +01:00
Sami Kerola a94853966e remaining util-linux-ng to util-linux
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-01-23 22:22:30 +01:00
Karel Zak abafd68667 fix __noreturn__ usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 16:47:18 +01:00
Karel Zak 0742ce4ae5 partx: tiny change in usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-09 23:00:33 +01:00
Karel Zak 5de966b34b partx: cleanup and add columns
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-09 22:58:12 +01:00
Davidlohr Bueso c4ecaf21d5 partx: complete rewrite
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-09 21:54:17 +01:00
Davidlohr Bueso 4f1509b969 partx: integrate support for mac and sun partitions, based on kpartx.
[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>
2010-10-08 10:56:28 +02:00
Karel Zak c86dda7b36 partx: fix infinite loop
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>
2010-03-31 16:38:51 +02:00
Phillip Susi d6d9cc6ea1 partx: do not add nonexistent partitions
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>
2010-03-31 15:52:08 +02:00
Karel Zak 1aff9b620e partx: use c.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-16 01:35:55 +02:00
Daniel Mierswa c0f19ccff7 replace bcopy,bzero,index and rindex
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>
2009-08-17 11:15:59 +02:00
Karel Zak 0d518f3420 partx: don't duplicate lib/blkdev.c code
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-26 15:58:28 +01:00
Karel Zak 97a88ccb35 partx: fix compiler warnings
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>
2008-03-20 15:23:16 +01:00
Karel Zak cf6d7faebb Imported from util-linux-2.13-pre6 tarball. 2006-12-07 00:27:13 +01:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak c129767e06 Imported from util-linux-2.12b tarball. 2006-12-07 00:26:16 +01:00
Karel Zak 95f1bdeee4 Imported from util-linux-2.11x tarball. 2006-12-07 00:26:05 +01:00
Karel Zak 1d4ad1decc Imported from util-linux-2.11q tarball. 2006-12-07 00:25:54 +01:00
Karel Zak 22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +01:00