Util-Linux package development
 help / color / mirror / Atom feed
* Re: [PATCH] grammar fixes
From: Karel Zak @ 2011-08-15 12:36 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: util-linux
In-Reply-To: <1313172465.3305.4.camel@offbook>

On Fri, Aug 12, 2011 at 02:07:45PM -0400, Davidlohr Bueso wrote:
>  libmount/src/context_umount.c  |    4 ++--
>  tests/ts/hwclock/systohc       |    2 +-
>  tests/ts/libmount/context      |   10 +++++-----
>  tests/ts/libmount/context-utab |    8 ++++----
>  tests/ts/mount/devname         |    6 +++---
>  5 files changed, 15 insertions(+), 15 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* Re: [PATCH] hexdump: fix segfault due to uninitialized memory
From: Karel Zak @ 2011-08-15 12:36 UTC (permalink / raw)
  To: util-linux
In-Reply-To: <20110810133227.GA14002@foxbat.suse.cz>

On Wed, Aug 10, 2011 at 03:32:28PM +0200, Petr Uzel wrote:
>  text-utils/display.c |    4 ++--
>  text-utils/parse.c   |    6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* Re: [PATCH] dmesg: avoid mess at the end of dmesg output
From: Karel Zak @ 2011-08-15 12:35 UTC (permalink / raw)
  To: util-linux
In-Reply-To: <20110810121639.GA19672@foxbat.suse.cz>

On Wed, Aug 10, 2011 at 02:16:40PM +0200, Petr Uzel wrote:
>  sys-utils/dmesg.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* Re: [PATCH] logger.1: use simple apostrophe instead of multibyte char
From: Karel Zak @ 2011-08-15 12:35 UTC (permalink / raw)
  To: util-linux
In-Reply-To: <20110810114604.GA31717@foxbat.suse.cz>

On Wed, Aug 10, 2011 at 01:46:06PM +0200, Petr Uzel wrote:
>  misc-utils/logger.1 |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* Re: [PATCH] befs.c: validate di_br_size !=0 and br_per_di_br != 0
From: Karel Zak @ 2011-08-15 12:34 UTC (permalink / raw)
  To: Timo Warns; +Cc: util-linux
In-Reply-To: <20110809074046.GA4237@vermeer.pre-sense.de>

On Tue, Aug 09, 2011 at 09:40:47AM +0200, Timo Warns wrote:
> diff -u util-linux-2.20-rc1-a/libblkid/src/superblocks/befs.c util-linux-2.20-rc1-b/libblkid/src/superblocks/befs.c
> --- util-linux-2.20-rc1-a/libblkid/src/superblocks/befs.c	2011-07-20 21:55:23.000000000 +0200
> +++ util-linux-2.20-rc1-b/libblkid/src/superblocks/befs.c	2011-08-09 09:32:56.000000000 +0200

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* Re: [PATCH] partx: support loop devices
From: Karel Zak @ 2011-08-15 11:58 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: util-linux
In-Reply-To: <1313381477.2509.1.camel@offbook>

On Mon, Aug 15, 2011 at 12:11:17AM -0400, Davidlohr Bueso wrote:
> @@ -800,14 +857,23 @@ int main(int argc, char **argv)
>  	if (what == ACT_ADD || what == ACT_DELETE) {
>  		struct stat x;
>  
> -		if (stat(wholedisk, &x) || !S_ISBLK(x.st_mode))
> -			errx(EXIT_FAILURE, _("%s: not a block device"), wholedisk);
> +		if (stat(wholedisk, &x) || !S_ISBLK(x.st_mode)) {

  && S_ISREG() :-)

> +			/* not a blkdev, try to associate it to a loop device */

            if (what == ACT_DELETE)
                errx(EXIT_FAILURE, _("%s: cannot delete partitions"), wholedisk);

> +			if (!loopmod_supports_parts())
> +				errx(EXIT_FAILURE, _("%s: does not support loop device partitions"), 
> +				     wholedisk);
> +			assoc_loopdev(wholedisk);
> +			wholedisk = xstrdup(lc.device);
> +		}
>  	}
>  	if ((fd = open(wholedisk, O_RDONLY)) == -1)
>  		err(EXIT_FAILURE, _("%s: open failed"), wholedisk);
>  
> -	if (what == ACT_DELETE)
> +	if (what == ACT_DELETE) {
> +		if (loopdev)
> +			errx(EXIT_FAILURE, _("%s: cannot delete partitions"), wholedisk);
>  		rc = del_parts(fd, wholedisk, disk_devno, lower, upper);
> +	}

 Does it make sense to initialize loop device if ACT_DELETE is requested?

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* Re: [patch 0/8] various lscpu patches
From: Karel Zak @ 2011-08-15  9:24 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: util-linux
In-Reply-To: <20110815084530.GA2400@osiris.boeblingen.de.ibm.com>

On Mon, Aug 15, 2011 at 10:45:30AM +0200, Heiko Carstens wrote:
> On Wed, Aug 10, 2011 at 10:36:45AM +0200, Heiko Carstens wrote:
> > Hi Karel,
> > 
> > here are a couple of fixes and improvemts for lscpu on s390.
> > Hopefully I didn't screw up anything ;)
> > At least on my Thinkpad everything still works as before and the output
> > on s390 machines is much improved.
> 
> FWIW, I set up a git branch with the lscpu changes:
> 
>  git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux.git lscpu

 Looks good. Thanks. 
 
 I'm going to merge the changes after 2.20 release (~25th Aug).


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* Re: [patch 0/8] various lscpu patches
From: Heiko Carstens @ 2011-08-15  8:45 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux
In-Reply-To: <20110810083645.135814950@de.ibm.com>

On Wed, Aug 10, 2011 at 10:36:45AM +0200, Heiko Carstens wrote:
> Hi Karel,
> 
> here are a couple of fixes and improvemts for lscpu on s390.
> Hopefully I didn't screw up anything ;)
> At least on my Thinkpad everything still works as before and the output
> on s390 machines is much improved.

FWIW, I set up a git branch with the lscpu changes:

 git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux.git lscpu

Thanks,
Heiko

^ permalink raw reply

* [PATCH] partx: support loop devices
From: Davidlohr Bueso @ 2011-08-15  4:11 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>

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 images-pt/dos+bsd.img 
# 1:        32-     7679 (     7648 sectors,      3 MB)
# 2:      7680-    16383 (     8704 sectors,      4 MB)
# 5:      7936-    12799 (     4864 sectors,      2 MB)
# 6:     12544-    16127 (     3584 sectors,      1 MB)
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>
---
 partx/Makefile.am |    2 +
 partx/partx.c     |   77 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/partx/Makefile.am b/partx/Makefile.am
index 6a72942..080bc47 100644
--- a/partx/Makefile.am
+++ b/partx/Makefile.am
@@ -11,6 +11,8 @@ partx_SOURCES = partx.c partx.h \
 		$(top_srcdir)/lib/at.c \
 		$(top_srcdir)/lib/mbsalign.c \
 		$(top_srcdir)/lib/strutils.c \
+		$(top_srcdir)/lib/canonicalize.c \
+		$(top_srcdir)/lib/loopdev.c \
 		$(top_srcdir)/lib/linux_version.c
 
 partx_CFLAGS = -I$(ul_libblkid_incdir)
diff --git a/partx/partx.c b/partx/partx.c
index 0b35f9f..d0e40c7 100644
--- a/partx/partx.c
+++ b/partx/partx.c
@@ -31,6 +31,7 @@
 #include "xalloc.h"
 #include "partx.h"
 #include "sysfs.h"
+#include "loopdev.h"
 #include "at.h"
 
 /* this is the default upper limit, could be modified by --nr */
@@ -88,7 +89,49 @@ static int columns[__NCOLUMNS], ncolumns;
 
 static int verbose;
 static int partx_flags;
+static struct loopdev_cxt lc;
+static int loopdev = 0;
 
+/*
+ * Check if the kernel supports partitioned loop devices.
+ * In a near future (around linux 3.2, hopefully) this will come
+ * always out of the box, until then we need to check.
+ */
+static int loopmod_supports_parts(void)
+{
+	int rc, ret = 0;
+	FILE *f = fopen("/sys/module/loop/parameters/max_part", "r");
+	
+	if (!f)
+		return 0;
+	rc = fscanf(f, "%d", &ret);
+	fclose(f);
+	return ret;
+}
+
+static void assoc_loopdev(const char *fname)
+{
+	int rc;
+
+	loopcxt_init(&lc, 0);
+	
+	rc = loopcxt_find_unused(&lc);
+	if (rc)
+		err(EXIT_FAILURE, "failed to find unused device");
+
+	if (verbose)
+		printf("Trying to use '%s' for the loop device\n", loopcxt_get_device(&lc));
+	
+	if (loopcxt_set_backing_file(&lc, fname))
+		err(EXIT_FAILURE, "failed to set backing file");
+
+	rc = loopcxt_setup_device(&lc);
+
+	if (rc == -EBUSY)
+		err(EXIT_FAILURE, "failed to setup device for %s", fname);
+
+	loopdev = 1;
+}
 
 static inline int get_column_id(int num)
 {
@@ -278,6 +321,7 @@ static int del_parts(int fd, const char *device, dev_t devno,
 	return rc;
 }
 
+
 static void add_parts_warnx(const char *device, int first, int last)
 {
 	if (first == last)
@@ -288,7 +332,7 @@ static void add_parts_warnx(const char *device, int first, int last)
 }
 
 static int add_parts(int fd, const char *device,
-			blkid_partlist ls, int lower, int upper)
+		     blkid_partlist ls, int lower, int upper)
 {
 	int i, nparts, rc = 0, errfirst = 0, errlast = 0;
 
@@ -338,6 +382,19 @@ static int add_parts(int fd, const char *device,
 
 	if (errfirst)
 		add_parts_warnx(device, errfirst, errlast);
+
+	/* the kernel adds *all* loopdev partitions, so we should delete
+	   any extra, unwanted ones, when the -n option is passed */
+	if (loopdev && (lower || upper)) {
+		for (i = 0; i < nparts; i++) {
+			blkid_partition par = blkid_partlist_get_partition(ls, i);
+			int n = blkid_partition_get_partno(par);
+			
+			if (n < lower || n > upper)
+				partx_del_partition(fd, n);
+		}
+	}
+
 	return rc;
 }
 
@@ -800,14 +857,23 @@ int main(int argc, char **argv)
 	if (what == ACT_ADD || what == ACT_DELETE) {
 		struct stat x;
 
-		if (stat(wholedisk, &x) || !S_ISBLK(x.st_mode))
-			errx(EXIT_FAILURE, _("%s: not a block device"), wholedisk);
+		if (stat(wholedisk, &x) || !S_ISBLK(x.st_mode)) {
+			/* not a blkdev, try to associate it to a loop device */
+			if (!loopmod_supports_parts())
+				errx(EXIT_FAILURE, _("%s: does not support loop device partitions"), 
+				     wholedisk);
+			assoc_loopdev(wholedisk);
+			wholedisk = xstrdup(lc.device);
+		}
 	}
 	if ((fd = open(wholedisk, O_RDONLY)) == -1)
 		err(EXIT_FAILURE, _("%s: open failed"), wholedisk);
 
-	if (what == ACT_DELETE)
+	if (what == ACT_DELETE) {
+		if (loopdev)
+			errx(EXIT_FAILURE, _("%s: cannot delete partitions"), wholedisk);
 		rc = del_parts(fd, wholedisk, disk_devno, lower, upper);
+	}
 	else {
 		blkid_probe pr = blkid_new_probe();
 		blkid_partlist ls = NULL;
@@ -846,6 +912,9 @@ int main(int argc, char **argv)
 		blkid_free_probe(pr);
 	}
 
+	if (loopdev)
+		loopcxt_deinit(&lc);
+
 	close(fd);
 	return rc ? EXIT_FAILURE : EXIT_SUCCESS;
 }
-- 
1.7.4.1

^ permalink raw reply related

* Re: [git pull] documentation directory
From: Sami Kerola @ 2011-08-12 20:58 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux
In-Reply-To: <20110808114617.GL2204@nb.net.home>

On Mon, Aug 8, 2011 at 13:46, Karel Zak <kzak@redhat.com> wrote:
> On Sat, Aug 06, 2011 at 07:57:53PM +0200, Sami Kerola wrote:
>> are available in the git repository at:
>> =A0 https://github.com/kerolasa/lelux-utiliteetit docs-dir
>>
>> discussion, and few rejects, before the Documentation/ is done to
>> upstream. For instance you might disagree with contents of
>> 00-about-docs.txt, and perhaps example.files/ should be deleted.
>
> =A0The 'Warning about content' in 00-about-docs.txt is too crazy :-)
> =A0Let's:

I thought you might say something like that.

> =A0- cleanup the files
>  - remove obsolete information

Done in new patch `docs: clean up old readme files'. The clean up
could be more aggressive. For instance the fdisk.txt sounds very 90's
and has only a limited amount of usable information. Perhaps the file
be simply removed, or should someone be asked to volunteer to clean up
all {c,s,}fdisk documentation & manual pages? By glance that looks
quite large task.

> =A0- move valid information to the man pages

Perhaps I lacked imagination what could be moved coz I found so
little. See hwclock change for details.

> =A0- add info about authors to the AUTHORS file

I went through everything in Documentation/* and notice there's more
in NEWS file. Should that be migrated as well?

> =A0I have updated the example.files/ in the master branch.

Noted.

>> =A0README.devel =3D> Documentation/README.devel =A0 =A0 =A0 =A0 | =A0 =
=A00
>
> =A0see below
>
>> =A0.../ReleaseNotes}/v2.13-ReleaseNotes =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =
=A0 =A00
>
> =A0What about to rename the directory to releases/ ? The NEWS file should
> =A0be updated too.

Done.

>> =A0README.licensing =3D> Documentation/licensing.txt =A0 =A0| =A0 =A00
>
> =A0It would be nice to keep this file in the top-level directory.

Put back to root.

>> =A0tests/README =3D> Documentation/tests.txt =A0 =A0 =A0 =A0 =A0 =A0| =
=A0 =A00
>
> =A0howto-tests.txt

Renamed.

>> =A0Documentation/usage-howto.txt =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0| =A0 73 ++++++++++++++++++++
>
> =A0howto-usage-function.txt
>
> =A0 and s/output/display/ in the file

Renamed & the wording is checked.

> =A0we also need howto-man-page.txt :-)

Something done, comments are welcome.

> =A0I think we can split the README file:
>
> =A0 =A0README =A0(basic info about project)
>
> =A0 =A0Documentation/howto-compilation.txt
>
> =A0In the howto-compilation.txt file should be also a note about
> =A0autogen.sh, static linking, klib and uClib and maybe some preferred
> =A0compiler options, I use:
>
> =A0 -Wmissing-parameter-type -Wsign-compare -Wtype-limits -Wuninitialized=
 \
> =A0 -Wunused-parameter -Wunused-but-set-parameter -fno-common
>
> =A0We can also split README.devel to:
>
> =A0 =A0Documentation/howto-compilation.txt (add extra section for
> =A0 =A0developers (or SCM users) about about autotools).
>
> =A0 =A0Documentation/howto-contribute.txt with info about "ideal
> =A0 =A0patches", coding style.
>
> =A0 =A0Documentation/source-code-management.txt

This README.devel split was done as well.


The following changes since commit 344f73442d3a45db5927c049eef1ed8cf5d13934=
:

  ipcs: use unsigned type for uid/gid (2011-08-09 15:30:19 +0200)

are available in the git repository at:
  https://github.com/kerolasa/lelux-utiliteetit docs-dir

Sami Kerola (11):
      docs: remove README.clear
      docs: Documentation directory added
      docs: add usage() howto for contributors
      docs: tell what the Documentation/ is about
      docs: new file Documentation/howto-compilation.txt
      docs: new file Documentation/howto-contribute.txt
      docs: new file Documentation/source-code-management.txt
      docs: new file Documentation/howto-man-page.txt
      docs: copy contributors from legacy files to AUTHORS
      docs: clean up old readme files
      docs: move setuid information from reame to hwclock.8

--=20
=A0=A0 Sami Kerola
=A0=A0 http://www.iki.fi/kerolasa/

^ permalink raw reply

* [PATCH] partx: do not print null
From: Davidlohr Bueso @ 2011-08-12 19:38 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>
Date: Fri, 12 Aug 2011 15:36:50 -0400

Replace the annoying null output when displaying no partitions in verbose mode.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 partx/partx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/partx/partx.c b/partx/partx.c
index b2a72ed..0b35f9f 100644
--- a/partx/partx.c
+++ b/partx/partx.c
@@ -795,7 +795,7 @@ int main(int argc, char **argv)
 
 	if (verbose)
 		printf(_("partition: %s, disk: %s, lower: %d, upper: %d\n"),
-				device, wholedisk, lower, upper);
+		       device ? device : "none", wholedisk, lower, upper);
 
 	if (what == ACT_ADD || what == ACT_DELETE) {
 		struct stat x;
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH] grammar fixes
From: Davidlohr Bueso @ 2011-08-12 18:07 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>
Date: Fri, 12 Aug 2011 14:06:13 -0400

Correct grammar from "cannot found" to "cannot find".

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 libmount/src/context_umount.c  |    4 ++--
 tests/ts/hwclock/systohc       |    2 +-
 tests/ts/libmount/context      |   10 +++++-----
 tests/ts/libmount/context-utab |    8 ++++----
 tests/ts/mount/devname         |    6 +++---
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 7c048d9..bc08aff 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -86,7 +86,7 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
 	}
 
 	if (!fs) {
-		DBG(CXT, mnt_debug_h(cxt, "umount: cannot found %s in mtab", tgt));
+		DBG(CXT, mnt_debug_h(cxt, "umount: cannot find %s in mtab", tgt));
 		return 0;
 	}
 
@@ -197,7 +197,7 @@ static int evaluate_permissions(struct libmnt_context *cxt)
 
 	if (!(cxt->flags & MNT_FL_TAB_APPLIED)) {
 		DBG(CXT, mnt_debug_h(cxt,
-				"cannot found %s in mtab and you are not root",
+				"cannot find %s in mtab and you are not root",
 				mnt_fs_get_target(cxt->fs)));
 		goto eperm;
 	}
diff --git a/tests/ts/hwclock/systohc b/tests/ts/hwclock/systohc
index 9dedc62..f58d07e 100755
--- a/tests/ts/hwclock/systohc
+++ b/tests/ts/hwclock/systohc
@@ -24,7 +24,7 @@ NTP_SERVER="0.fedora.pool.ntp.org"
 ts_init "$*"
 ts_skip_nonroot
 
-[ -x "/usr/sbin/ntpdate" ] || ts_skip "cannot found ntpdate command"
+[ -x "/usr/sbin/ntpdate" ] || ts_skip "cannot find ntpdate command"
 
 set -o pipefail
 
diff --git a/tests/ts/libmount/context b/tests/ts/libmount/context
index 8119cee..0b10098 100755
--- a/tests/ts/libmount/context
+++ b/tests/ts/libmount/context
@@ -30,7 +30,7 @@ modprobe scsi_debug dev_size_mb=100
 sleep 3
 
 DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
-[ "x${DEVNAME}" == "x" ] && ts_die "Cannot found device"
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
 
 DEVICE="/dev/${DEVNAME}"
 
@@ -63,7 +63,7 @@ mkdir -p $MOUNTPOINT &>  /dev/null
 $TESTPROG --mount $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1
 
 grep -q $DEVICE $LIBMOUNT_MTAB || \
-	echo "(by device) cannot found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+	echo "(by device) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
 ts_finalize_subtest
 
 ts_init_subtest "umount-by-devname"
@@ -78,7 +78,7 @@ ts_init_subtest "mount-by-label"
 mkdir -p $MOUNTPOINT &>  /dev/null
 $TESTPROG --mount LABEL="$LABEL" $MOUNTPOINT >> $TS_OUTPUT 2>&1
 grep -q $DEVICE $LIBMOUNT_MTAB || \
-	echo "(by label) cannot found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+	echo "(by label) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
 ts_finalize_subtest
 
 
@@ -93,7 +93,7 @@ ts_init_subtest "mount-by-uuid"
 mkdir -p $MOUNTPOINT &> /dev/null
 $TESTPROG --mount UUID="$UUID" $MOUNTPOINT >> $TS_OUTPUT 2>&1
 grep -q $DEVICE $LIBMOUNT_MTAB || \
-	echo "(by uuid) cannot found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+	echo "(by uuid) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
 $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1
 grep -q $DEVICE $LIBMOUNT_MTAB &&
 	echo "umount failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
@@ -105,7 +105,7 @@ mkdir -p $MOUNTPOINT &> /dev/null
 $TESTPROG --mount -o ro,noexec,nosuid,strictatime $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1
 $TS_CMD_FINDMNT --kernel $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPUT 2>&1
 grep -q $DEVICE $LIBMOUNT_MTAB || \
-	echo "cannot found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
+	echo "cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1
 
 $TESTPROG --mount -o remount,rw $MOUNTPOINT >> $TS_OUTPUT 2>&1
 $TS_CMD_FINDMNT --kernel $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPUT 2>&1
diff --git a/tests/ts/libmount/context-utab b/tests/ts/libmount/context-utab
index 5f36d28..94d4460 100755
--- a/tests/ts/libmount/context-utab
+++ b/tests/ts/libmount/context-utab
@@ -27,7 +27,7 @@ modprobe scsi_debug dev_size_mb=260
 sleep 3
 
 DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
-[ "x${DEVNAME}" == "x" ] && ts_die "Cannot found device"
+[ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
 
 DEVICE="/dev/${DEVNAME}"
 
@@ -64,7 +64,7 @@ ts_init_subtest "mount-by-devname"
 mkdir -p $MOUNTPOINT &>  /dev/null
 $TESTPROG --mount $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1
 grep -q $DEVICE /proc/mounts || \
-	echo "(by device) cannot found $DEVICE in /proc/mounts" >> $TS_OUTPUT 2>&1
+	echo "(by device) cannot find $DEVICE in /proc/mounts" >> $TS_OUTPUT 2>&1
 ts_finalize_subtest
 
 ts_init_subtest "umount-by-devname"
@@ -78,7 +78,7 @@ ts_init_subtest "mount-uhelper"
 mkdir -p $MOUNTPOINT &>  /dev/null
 $TESTPROG --mount -o uhelper=foo,rw LABEL="$LABEL" $MOUNTPOINT >> $TS_OUTPUT 2>&1
 grep -q $DEVICE $LIBMOUNT_UTAB || \
-	echo "(by label) cannot found $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1
+	echo "(by label) cannot find $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1
 ts_finalize_subtest
 
 ts_init_subtest "umount"
@@ -98,7 +98,7 @@ if [ -x "/sbin/mkfs.btrfs" ]; then
 	mkdir -p $MOUNTPOINT &>  /dev/null
 	$TESTPROG --mount -o uhelper=foo,rw,subvol=sub $DEVICE  $MOUNTPOINT >> $TS_OUTPUT 2>&1
 	grep -q $DEVICE $LIBMOUNT_UTAB || \
-		echo "cannot found $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1
+		echo "cannot find $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1
 	ts_finalize_subtest
 
 	ts_log "All mount options (btrfs subvolume + utab) ---"
diff --git a/tests/ts/mount/devname b/tests/ts/mount/devname
index 4cbd087..8f32ef1 100755
--- a/tests/ts/mount/devname
+++ b/tests/ts/mount/devname
@@ -30,16 +30,16 @@ DEVICE=$(ts_device_init)
 
 mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
 
-ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot found ext3 on $DEVICE" $DEVICE
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
 
 [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
 
 $TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
 
-ts_is_mounted $DEVICE || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
 
 grep -q $DEVICE /etc/mtab ||
-	echo "mount failed: cannot found $DEVICE in mtab" >> $TS_OUTPUT 2>&1
+	echo "mount failed: cannot find $DEVICE in mtab" >> $TS_OUTPUT 2>&1
 
 $TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
 
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH v2] whereis: search in path
From: Davidlohr Bueso @ 2011-08-12 17:55 UTC (permalink / raw)
  To: Karel Zak, util-linux

Sorry for the delay, lots of things on my plate these days. Below is the patch with the mentioned fixes.

From: Davidlohr Bueso <dave@gnu.org>
Date: Fri, 12 Aug 2011 13:49:59 -0400

Currently this tool only uses the hardcoded paths for looking up strings for binaries, man pages and source code.
Adding directories found in $PATH makes a nice little enhancement to support a wider range of lookups.

This feature was also discussed previously here (http://www.spinics.net/lists/util-linux-ng/msg03429.html)

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 misc-utils/whereis.c |   69 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 68 insertions(+), 1 deletions(-)

diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index 08b62e6..6393a70 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -37,6 +37,10 @@
  * - added Native Language Support
  */
 
+/* 2011-08-12 Davidlohr Bueso <dave@gnu.org>
+ * - added $PATH lookup
+ */
+
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -45,6 +49,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+
+#include "xalloc.h"
 #include "nls.h"
 #include "c.h"
 
@@ -124,7 +130,7 @@ static char *srcdirs[] = {
 };
 
 static char sflag = 1, bflag = 1, mflag = 1, uflag;
-static char **Sflag, **Bflag, **Mflag;
+static char **Sflag, **Bflag, **Mflag, **dirp, **pathdir;
 static int Scnt, Bcnt, Mcnt, count, print;
 
 static void __attribute__ ((__noreturn__)) usage(FILE * out)
@@ -231,11 +237,68 @@ findin(char *dir, char *cp)
 
 }
 
+static int inpath(const char *str)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(bindirs) - 1 ; i++)
+		if (!strcmp(bindirs[i], str))
+			return 1;
+	
+	for (i = 0; i < ARRAY_SIZE(mandirs) - 1; i++)
+		if (!strcmp(mandirs[i], str))
+			return 1;
+		
+	for (i = 0; i < ARRAY_SIZE(srcdirs) - 1; i++)
+		if (!strcmp(srcdirs[i], str))
+			return 1;
+	
+	return 0;
+}
+
+static void fillpath(void)
+{
+	char *key=NULL, *tmp=NULL, *tok=NULL, *pathcp, *path = getenv("PATH");
+	int i = 0;
+
+
+	if (!path)
+		return;
+	pathcp = xstrdup(path);
+
+	for (tmp = pathcp; ;tmp = NULL, tok) {
+		tok = strtok_r(tmp, ":", &key);
+		if (!tok)
+			break;
+		
+		/* make sure we don't repeat the search path */
+		if (inpath(tok))
+			continue;
+
+		pathdir = xrealloc(pathdir, (i + 1) * sizeof(char *));
+		pathdir[i++] = xstrdup(tok);
+	}
+
+	pathdir = xrealloc(pathdir, (i + 1) * sizeof(char *));
+	pathdir[i] = NULL;
+
+	dirp = pathdir;
+	free(pathcp);
+}
+
+static void freepath(void)
+{
+	free(pathdir);
+}
+
 static void
 findv(char **dirv, int dirc, char *cp)
 {
+
 	while (dirc > 0)
 		findin(*dirv++, cp), dirc--;
+	while (*dirp)
+		findin(*dirp++, cp);
 }
 
 static void
@@ -359,6 +422,8 @@ main(int argc, char **argv)
 	if (argc == 0)
 		usage(stderr);
 
+	fillpath();
+
 	do
 		if (argv[0][0] == '-') {
 			register char *cp = argv[0] + 1;
@@ -411,5 +476,7 @@ main(int argc, char **argv)
 		} else
 			lookup(*argv++);
 	while (--argc > 0);
+
+	freepath();
 	return EXIT_SUCCESS;
 }
-- 
1.7.4.1

^ permalink raw reply related

* PAM-only login(1)
From: Karel Zak @ 2011-08-12 11:57 UTC (permalink / raw)
  To: util-linux


  I'd like to clean up login(1) code for v2.21. The current code is
  mess with many #ifdef and support for some unused (and badly tested) 
  features (e.g. non-PAM support for /etc/securetty and /etc/usertty).

  What about to finally create nice and readable PAM-only login(1) for
  Linux?

  The alternatives for systems without PAM are busybox and shadow-utils.

  Comments?

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* Re: mkswap fails to use more than 2GiB and doesn't recognize LVM
From: Karel Zak @ 2011-08-11 21:46 UTC (permalink / raw)
  To: Florian Pritz; +Cc: util-linux
In-Reply-To: <20110811181454.GD32051@nb.net.home>

On Thu, Aug 11, 2011 at 08:14:54PM +0200, Karel Zak wrote:
> On Thu, Aug 11, 2011 at 05:32:57PM +0200, Florian Pritz wrote:
> > mkswap displays the following output when trying to create swap on a
> > 8GiB logical volume.
> > > # mkswap /dev/mapper/vg_brynhild-swap
> > > mkswap: warning: truncating swap area to 2097144 KiB
> 
>  It seems correct.

 Ah... sorry, I didn't read your e-mail too carefully.

>  The swap header does not allow to address more than
>  UINT_MAX pages. You have to create more swap areas or use system with
>  bigger pages.

 Right, so if you have 4096 page size, then 4096 * 4294967295 is the
 max size...

 I think the problem is kernel version string -- "3.0". The mkswap
 code uses the version string to set the limit.

 The problem should be fixed in 2.20-rc1, commit
 fa7e0d6d442de9f5940f99fd93f4522602439131.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* [patches] small fixes to some messages and man pages, and some questions
From: Benno Schulenberg @ 2011-08-11 20:22 UTC (permalink / raw)
  To: Util-Linux

[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]


Hi,

Attached bunch of patches improve or correct several error messages
or usage synopses.

About the fourth patch I'm unsure.  The current description of the option
'--no-reread' is "skip partition re-read at boot".  With "boot" is meant
"program startup", so that needs to be corrected.  But the real effect of
--no-reread seems to be to just check that the relevant partition is not
in use.  Is that correct?

By the way, I don't understand why the options -g (--show-geometry) and
-G (show-pt-geometry) are listed under "Dangerous options".  How can
they be dangerous when they just show things?

Also I do not understand the descriptions of the new options --nested,
--chained, and --onesector.  How is "disjoint" different from "mutually
disjoint"?  Would the following attempts at description be correct?

--nested     each logical and extended partition falls within an extended one
--chained     each logical partition falls within an extended one
--onesector   not any partition falls within another

The two new options --inside-outer and --not-inside-outer have been
misdocumented as --inside-order and --not-inside-order.  The last and
seventeenth patch fixes that.


The fourteenth patch adds the missing "[options]" to the usage synopsis
of scriptreplay, and also indicates the timingfile argument as optional.
However, I find this a bit misleading: the timingfile is only optional when
it is specified via the -t option.  Wouldn't it be better to describe the
command with two alternative synopses, as follows?

  Usage: scriptreplay timingfile [typescript [divisor]]
     or: scriptreplay [options] [timingfile] [typescript] [divisor]

Regards,

Benno

-- 
http://www.fastmail.fm - Accessible with your email software
                          or over the web


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mkfs.cramfs-clearer-error-message-cannot-close-inste.patch --]
[-- Type: text/x-patch; name="0001-mkfs.cramfs-clearer-error-message-cannot-close-inste.patch", Size: 990 bytes --]

From 8675f4f28e656a3d754a569afd0a732f786fa572 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 20:55:48 +0200
Subject: [PATCH 01/17] mkfs.cramfs: clearer error message, "cannot close" instead of "closing"

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 disk-utils/mkfs.cramfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c
index 9bb9153..5193634 100644
--- a/disk-utils/mkfs.cramfs.c
+++ b/disk-utils/mkfs.cramfs.c
@@ -665,7 +665,7 @@ static unsigned int write_file(char *file, char *base, unsigned int offset)
 	memcpy(base + offset, buf, image_length);
 	munmap(buf, image_length);
 	if (close (fd) < 0)
-		err(MKFS_ERROR, _("closing file %s"), file);
+		err(MKFS_ERROR, _("cannot close file %s"), file);
 	/* Pad up the image_length to a 4-byte boundary */
 	while (image_length & 3) {
 		*(base + offset + image_length) = '\0';
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-fdisksgilabel-correct-the-grammar-of-an-error-messag.patch --]
[-- Type: text/x-patch; name="0002-fdisksgilabel-correct-the-grammar-of-an-error-messag.patch", Size: 894 bytes --]

From fb2664acf48c1c4c278caabade80f75ddd3ea467 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 20:57:07 +0200
Subject: [PATCH 02/17] fdisksgilabel: correct the grammar of an error message

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 fdisk/fdisksgilabel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c
index cc95598..8179bc1 100644
--- a/fdisk/fdisksgilabel.c
+++ b/fdisk/fdisksgilabel.c
@@ -533,7 +533,7 @@ int
 sgi_change_sysid(int i, int sys)
 {
 	if (sgi_get_num_sectors(i) == 0) /* caught already before, ... */ {
-		printf(_("Sorry You may change the Tag of non-empty partitions.\n"));
+		printf(_("Sorry, only for non-empty partitions you can change the tag.\n"));
 		return 0;
 	}
 	if (((sys != ENTIRE_DISK) && (sys != SGI_VOLHDR))
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-sfdisk-gettextize-each-warning-as-a-whole.patch --]
[-- Type: text/x-patch; name="0003-sfdisk-gettextize-each-warning-as-a-whole.patch", Size: 1332 bytes --]

From aec94f1a8a9c2ae333f2659d283ad8f355869d01 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 20:58:49 +0200
Subject: [PATCH 03/17] sfdisk: gettextize each warning as a whole

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 fdisk/sfdisk.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 6cd85a2..6ae0be4 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1243,8 +1243,8 @@ partitions_ok(struct disk_desc *z) {
 		q = p->ep;
 		if (p->start < q->start
 		    || p->start + p->size > q->start + q->size) {
-		    my_warn(_("Warning: partition %s "), PNO(p));
-		    my_warn(_("is not contained in partition %s\n"), PNO(q));
+		    my_warn(_("Warning: partition %s is not contained in "
+			      "partition %s\n"), PNO(p), PNO(q));
 		    return 0;
 		}
 	    }
@@ -1255,8 +1255,8 @@ partitions_ok(struct disk_desc *z) {
 	    for (q = p + 1; q < partitions + partno; q++)
 		if (q->size && !is_extended(q->p.sys_type))
 		    if (!((p->start > q->start) ? disj(q, p) : disj(p, q))) {
-			my_warn(_("Warning: partitions %s "), PNO(p));
-			my_warn(_("and %s overlap\n"), PNO(q));
+			my_warn(_("Warning: partitions %s and %s overlap\n"),
+				PNO(p), PNO(q));
 			return 0;
 		    }
 
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-sfdisk-improve-descriptions-of-options-no-reread-and.patch --]
[-- Type: text/x-patch; name="0004-sfdisk-improve-descriptions-of-options-no-reread-and.patch", Size: 1747 bytes --]

From 2f124ce033ced627e121522b07795e610b0c5b9d Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 20:59:49 +0200
Subject: [PATCH 04/17] sfdisk: improve descriptions of options --no-reread and --show-extended

Also keep the two geometry options (-g and -G) together by moving -A.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 fdisk/sfdisk.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 6ae0be4..b01723d 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -2378,13 +2378,13 @@ usage(FILE * out) {
 
     fprintf(out, _("\nDangerous options:\n"
 		   "  -f, --force             disable all consistency checking\n"
+		   "      --no-reread         do not check whether the partition is in use\n"
 		   "  -g, --show-geometry     print the kernel's idea of the geometry\n"
-		   "  -A, --activate[=device] activate bootable flag\n"
 		   "  -G, --show-pt-geometry  print geometry guessed from the partition table\n"
+		   "  -A, --activate[=device] activate bootable flag\n"
 		   "  -U, --unhide[=device]   set partition unhidden\n"
-		   "      --no-reread         skip partition re-read at boot\n"
-		   "  -x, --show-extended     also list extended partitions on output\n"
-		   "                          or expect descriptors for them on input\n"
+		   "  -x, --show-extended     also list extended partitions in the output,\n"
+		   "                            or expect descriptors for them in the input\n"
 		   "      --leave-last        do not allocate the last cylinder\n"
 		   "      --IBM               same as --leave-last\n"
 		   "      --in-order          partitions are in order\n"
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-sfdisk-remove-inconsistent-and-wasteful-newlines-in-.patch --]
[-- Type: text/x-patch; name="0005-sfdisk-remove-inconsistent-and-wasteful-newlines-in-.patch", Size: 11969 bytes --]

From e2bac4d95b0d6da74215337a6211e1312ad771e7 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:02:10 +0200
Subject: [PATCH 05/17] sfdisk: remove inconsistent and wasteful newlines in the _() calls

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 fdisk/sfdisk.c |  113 +++++++++++++++++++++----------------------------------
 1 files changed, 43 insertions(+), 70 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index b01723d..cd494d0 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -489,10 +489,9 @@ get_cylindersize(char *dev, int fd, int silent) {
 	B.cylinders = B.total_size / B.cylindersize;
 
     if (R.start && !force) {
-	my_warn(_
-		("Warning: start=%lu - this looks like a partition rather than\n"
-		 "the entire disk. Using fdisk on it is probably meaningless.\n"
-		 "[Use the --force option if you really want this]\n"),
+	my_warn(_("Warning: start=%lu - this looks like a partition rather than\n"
+		  "the entire disk. Using fdisk on it is probably meaningless.\n"
+		  "[Use the --force option if you really want this]\n"),
 		R.start);
 	exit(1);
     }
@@ -505,15 +504,13 @@ get_cylindersize(char *dev, int fd, int silent) {
 		R.sectors);
     if (R.cylinders && B.cylinders != R.cylinders
 	&& B.cylinders < 65536 && R.cylinders < 65536)
-	my_warn(_
-		("Warning: BLKGETSIZE/HDIO_GETGEO says that there are %lu cylinders\n"),
+	my_warn(_("Warning: BLKGETSIZE/HDIO_GETGEO says that there are %lu cylinders\n"),
 		R.cylinders);
 #endif
 
     if (B.sectors > 63)
-	my_warn(_
-		("Warning: unlikely number of sectors (%lu) - usually at most 63\n"
-		 "This will give problems with all software that uses C/H/S addressing.\n"),
+	my_warn(_("Warning: unlikely number of sectors (%lu) - usually at most 63\n"
+		  "This will give problems with all software that uses C/H/S addressing.\n"),
 		B.sectors);
     if (!silent)
 	printf(_("\nDisk %s: %lu cylinders, %lu heads, %lu sectors/track\n"),
@@ -960,8 +957,7 @@ out_partition_header(char *dev, int format, struct geometry G) {
 	if (G.cylindersize) {
 	    printf(_("Units = cylinders of %lu bytes, blocks of 1024 bytes"
 		     ", counting from %d\n\n"), G.cylindersize << 9, increment);
-	    printf(_
-		   ("   Device Boot Start     End   #cyls    #blocks   Id  System\n"));
+	    printf(_("   Device Boot Start     End   #cyls    #blocks   Id  System\n"));
 	    break;
 	}
 	/* fall through */
@@ -978,8 +974,7 @@ out_partition_header(char *dev, int format, struct geometry G) {
     case F_MEGABYTE:
 	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
 		 ", counting from %d\n\n"), increment);
-	printf(_
-	       ("   Device Boot Start   End    MiB    #blocks   Id  System\n"));
+	printf(_("   Device Boot Start   End    MiB    #blocks   Id  System\n"));
 	break;
     }
 }
@@ -1138,20 +1133,17 @@ out_partition(char *dev, int format, struct part_desc *p,
 	aa = chs_to_longchs(a);
 	bb = chs_to_longchs(b);
 	if (a.s && !is_equal_chs(a, b))
-	    do_warn(_
-		    ("\t\tstart: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n"),
+	    do_warn(_("\t\tstart: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n"),
 		    aa.c, aa.h, aa.s, bb.c, bb.h, bb.s);
 	a = (size ? ulong_to_chs(end, G) : zero_chs);
 	b = p->p.end_chs;
 	aa = chs_to_longchs(a);
 	bb = chs_to_longchs(b);
 	if (a.s && !is_equal_chs(a, b))
-	    do_warn(_
-		    ("\t\tend: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n"),
+	    do_warn(_("\t\tend: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n"),
 		    aa.c, aa.h, aa.s, bb.c, bb.h, bb.s);
 	if (G.cylinders && G.cylinders < 1024 && bb.c > G.cylinders)
-	    do_warn(_
-		    ("partition ends on cylinder %ld, beyond the end of the disk\n"),
+	    do_warn(_("partition ends on cylinder %ld, beyond the end of the disk\n"),
 		    bb.c);
     }
 }
@@ -1223,15 +1215,13 @@ partitions_ok(struct disk_desc *z) {
     for (p = partitions; p - partitions < partno; p++)
 	if (p->size == 0) {
 	    if (p->p.sys_type != EMPTY_PARTITION)
-		my_warn(_
-			("Warning: partition %s has size 0 but is not marked Empty\n"),
+		my_warn(_("Warning: partition %s has size 0 but is not marked Empty\n"),
 			PNO(p));
 	    else if (p->p.bootable != 0)
 		my_warn(_("Warning: partition %s has size 0 and is bootable\n"),
 			PNO(p));
 	    else if (p->p.start_sect != 0)
-		my_warn(_
-			("Warning: partition %s has size 0 and nonzero start\n"),
+		my_warn(_("Warning: partition %s has size 0 and nonzero start\n"),
 			PNO(p));
 	    /* all this is probably harmless, no error return */
 	}
@@ -1285,8 +1275,7 @@ partitions_ok(struct disk_desc *z) {
 		    return 0;
 		}
 		if (p->size && p->start + p->size > ds) {
-		    my_warn(_
-			    ("Warning: partition %s extends past end of disk\n"),
+		    my_warn(_("Warning: partition %s extends past end of disk\n"),
 			    PNO(p));
 		    return 0;
 		}
@@ -1302,9 +1291,8 @@ partitions_ok(struct disk_desc *z) {
 	    if (p->p.sys_type == EXTENDED_PARTITION)
 		ect++;
 	if (ect > 1 && !Linux) {
-	    my_warn(_
-		    ("Among the primary partitions, at most one can be extended\n"
-		     " (although this is not a problem under Linux)\n"));
+	    my_warn(_("Among the primary partitions, at most one can be extended\n"
+		      " (although this is not a problem under Linux)\n"));
 	    return 0;
 	}
     }
@@ -1348,25 +1336,22 @@ partitions_ok(struct disk_desc *z) {
 		if (pno == -1)
 		    pno = p - partitions;
 		else if (p - partitions < 4) {
-		    my_warn(_
-			    ("Warning: more than one primary partition is marked "
-			     "bootable (active)\n"
-			     "This does not matter for LILO, but the DOS MBR will "
-			     "not boot this disk.\n"));
+		    my_warn(_("Warning: more than one primary partition is marked "
+			      "bootable (active)\n"
+			      "This does not matter for LILO, but the DOS MBR will "
+			      "not boot this disk.\n"));
 		    break;
 		}
 		if (p - partitions >= 4) {
-		    my_warn(_
-			    ("Warning: usually one can boot from primary partitions "
-			     "only\nLILO disregards the `bootable' flag.\n"));
+		    my_warn(_("Warning: usually one can boot from primary partitions "
+			      "only\nLILO disregards the `bootable' flag.\n"));
 		    break;
 		}
 	    }
 	if (pno == -1 || pno >= 4)
-	    my_warn(_
-		    ("Warning: no primary partition is marked bootable (active)\n"
-		     "This does not matter for LILO, but the DOS MBR will "
-		     "not boot this disk.\n"));
+	    my_warn(_("Warning: no primary partition is marked bootable (active)\n"
+		      "This does not matter for LILO, but the DOS MBR will "
+		      "not boot this disk.\n"));
     }
 
     /* Is chs as we expect? */
@@ -1381,8 +1366,7 @@ partitions_ok(struct disk_desc *z) {
 	    if (!chs_ok(b, PNO(p), _("start")))
 		return 0;
 	    if (a.s && !is_equal_chs(a, b))
-		my_warn(_
-			("partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n"),
+		my_warn(_("partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n"),
 			PNO(p), aa.c, aa.h, aa.s, bb.c, bb.h, bb.s);
 	    a = p->size ? ulong_to_chs(p->start + p->size - 1, B) : zero_chs;
 	    b = p->p.end_chs;
@@ -1391,12 +1375,10 @@ partitions_ok(struct disk_desc *z) {
 	    if (!chs_ok(b, PNO(p), _("end")))
 		return 0;
 	    if (a.s && !is_equal_chs(a, b))
-		my_warn(_
-			("partition %s: end: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n"),
+		my_warn(_("partition %s: end: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n"),
 			PNO(p), aa.c, aa.h, aa.s, bb.c, bb.h, bb.s);
 	    if (B.cylinders && B.cylinders < 1024 && bb.c > B.cylinders)
-		my_warn(_
-			("partition %s ends on cylinder %ld, beyond the end of the disk\n"),
+		my_warn(_("partition %s ends on cylinder %ld, beyond the end of the disk\n"),
 			PNO(p), bb.c);
 	}
 
@@ -1816,8 +1798,7 @@ read_stdin(char **fields, char *line, int fieldssize, int linesize) {
 		if (*ip == 0)
 		    return fno;
 		if (*ip != ',' && *ip != ';')
-		    fatal(_
-			  ("input error: unexpected character %c after %s field\n"),
+		    fatal(_("input error: unexpected character %c after %s field\n"),
 			  *ip, d->fldname);
 		*ip = 0;
 		goto nxtfld;
@@ -2163,8 +2144,7 @@ read_line(int pno, struct part_desc *ep, char *dev, int interactive,
 	p.size -= (p.size % unitsize(format));
     }
     if (p.size > ml1) {
-	my_warn(_
-		("Warning: given size (%lu) exceeds max allowable size (%lu)\n"),
+	my_warn(_("Warning: given size (%lu) exceeds max allowable size (%lu)\n"),
 		(p.size + unitsize(0) - 1) / unitsize(0), ml1 / unitsize(0));
 	if (!force)
 	    return 0;
@@ -2327,10 +2307,9 @@ read_input(char *dev, int interactive, struct disk_desc *z) {
     z->partno = 0;
 
     if (interactive)
-	my_warn(_
-		("Input in the following format; absent fields get a default value.\n"
-		 "<start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>\n"
-		 "Usually you only need to specify <start> and <size> (and perhaps <type>).\n"));
+	my_warn(_("Input in the following format; absent fields get a default value.\n"
+		  "<start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>\n"
+		  "Usually you only need to specify <start> and <size> (and perhaps <type>).\n"));
     eof = 0;
 
     for (i = 0; i < 4; i++)
@@ -2408,11 +2387,9 @@ static void
 activate_usage(char *progn) {
     puts(_("Usage:"));
     printf(_("%s device		 list active partitions on device\n"), progn);
-    printf(_
-	   ("%s device n1 n2 ... activate partitions n1 ..., inactivate the rest\n"),
+    printf(_("%s device n1 n2 ... activate partitions n1 ..., inactivate the rest\n"),
 	   progn);
-    printf(_
-	   ("%s -An device	 activate partition n, inactivate the other ones\n"),
+    printf(_("%s -An device	 activate partition n, inactivate the other ones\n"),
 	   PROGNAME);
     exit(1);
 }
@@ -3040,8 +3017,7 @@ do_activate(char **av, int ac, char *arg) {
 	if (z->partitions[pno].p.bootable)
 	    i++;
     if (i != 1)
-	my_warn(_
-		("You have %d active primary partitions. This does not matter for LILO,\n"
+	my_warn(_("You have %d active primary partitions. This does not matter for LILO,\n"
 		 "but the DOS MBR will only boot a disk with 1 active partition.\n"),
 		i);
 
@@ -3167,10 +3143,9 @@ do_fdisk(char *dev) {
     if (!no_write && !no_reread) {
 	my_warn(_("Checking that no-one is using this disk right now ...\n"));
 	if (reread_ioctl(fd)) {
-	    do_warn(_
-		    ("\nThis disk is currently in use - repartitioning is probably a bad idea.\n"
-		     "Umount all file systems, and swapoff all swap partitions on this disk.\n"
-		     "Use the --no-reread flag to suppress this check.\n"));
+	    do_warn(_("\nThis disk is currently in use - repartitioning is probably a bad idea.\n"
+		      "Umount all file systems, and swapoff all swap partitions on this disk.\n"
+		      "Use the --no-reread flag to suppress this check.\n"));
 	    if (!force) {
 		do_warn(_("Use the --force flag to overrule all checks.\n"));
 		exit(1);
@@ -3205,8 +3180,7 @@ do_fdisk(char *dev) {
 		fatal(_("I don't like these partitions - nothing changed.\n"
 			"(If you really want this, use the --force option.)\n"));
 	    else
-		do_warn(_
-			("I don't like this - probably you should answer No\n"));
+		do_warn(_("I don't like this - probably you should answer No\n"));
 	}
  ask:
 	if (interactive) {
@@ -3241,10 +3215,9 @@ do_fdisk(char *dev) {
     if (!reread_disk_partition(dev, fd))
 	exit_status = 1;
 
-    my_warn(_
-	    ("If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)\n"
-	     "to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1\n"
-	     "(See fdisk(8).)\n"));
+    my_warn(_("If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)\n"
+	      "to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1\n"
+	      "(See fdisk(8).)\n"));
 
     sync();			/* superstition */
     exit(exit_status);
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-ul-in-usage-not-overwriting-but-overriding-is-meant.patch --]
[-- Type: text/x-patch; name="0006-ul-in-usage-not-overwriting-but-overriding-is-meant.patch", Size: 1060 bytes --]

From 5776dd6bcb05f4e2a666608ac2608cf123c3c15f Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:04:42 +0200
Subject: [PATCH 06/17] ul: in usage() not overwriting but overriding is meant

Also always use lowercase.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 text-utils/ul.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/text-utils/ul.c b/text-utils/ul.c
index 1cbacfc..9e08bc1 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -137,8 +137,8 @@ usage(FILE *out)
 
 	fprintf(out, _(
 		"\nOptions:\n"
-		" -t, --terminal TERMINAL    overwrite TERM environment variable\n"
-		" -i, --indicated            Underlining is indicated by a separate line\n"
+		" -t, --terminal TERMINAL    override the TERM environment variable\n"
+		" -i, --indicated            underlining is indicated via a separate line\n"
 		" -V, --version              output version information and exit\n"
 		" -h, --help                 display this help and exit\n\n"));
 
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-ul-make-usage-say-that-more-than-one-input-file-is-a.patch --]
[-- Type: text/x-patch; name="0007-ul-make-usage-say-that-more-than-one-input-file-is-a.patch", Size: 757 bytes --]

From 88f0d378e8ed1474bce2a16f0b7269576dc6a66e Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:06:07 +0200
Subject: [PATCH 07/17] ul: make usage() say that more than one input file is allowed

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 text-utils/ul.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/text-utils/ul.c b/text-utils/ul.c
index 9e08bc1..a52000b 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -133,7 +133,7 @@ usage(FILE *out)
 {
 	fprintf(out, _(
 		"\nUsage:\n"
-		" %s [options] [file]\n"), program_invocation_short_name);
+		" %s [options] [file...]\n"), program_invocation_short_name);
 
 	fprintf(out, _(
 		"\nOptions:\n"
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0008-ul-add-h-and-V-to-the-man-page-use-file-and-lowercas.patch --]
[-- Type: text/x-patch; name="0008-ul-add-h-and-V-to-the-man-page-use-file-and-lowercas.patch", Size: 1486 bytes --]

From fd4c3ccf8b3b9ca9b6f134fb297e5fe90e3a78c0 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:07:13 +0200
Subject: [PATCH 08/17] ul: add -h and -V to the man page; use "file" and lowercase

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 text-utils/ul.1 |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/text-utils/ul.1 b/text-utils/ul.1
index 7d4e57a..7992d72 100644
--- a/text-utils/ul.1
+++ b/text-utils/ul.1
@@ -39,11 +39,11 @@
 .Nd do underlining
 .Sh SYNOPSIS
 .Nm ul
-.Op Fl i
+.Op Fl hiV
 .Op Fl t Ar terminal
-.Op Ar name Ar ...
+.Op Ar file Ar ...
 .Sh DESCRIPTION
-.Nm Ul
+.Nm ul
 reads the named files (or standard input if none are given)
 and translates occurrences of underscores to the sequence
 which indicates underlining for the terminal in use, as specified
@@ -63,6 +63,8 @@ If the terminal cannot underline, underlining is ignored.
 .Pp
 The following options are available:
 .Bl -tag -width Ds
+.It Fl h
+Display a help text and exit.
 .It Fl i
 Underlining is indicated by a separate line containing appropriate
 dashes `\-'; this is useful when you want to look at the underlining
@@ -72,6 +74,8 @@ output stream on a crt-terminal.
 .It Fl t Ar terminal
 Overrides the terminal type specified in the environment with
 .Ar terminal .
+.It Fl V
+Display version information and exit.
 .El
 .Sh ENVIRONMENT
 The following environment variable is used:
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: 0009-ul-remove-superfluous-return-as-usage-does-not-retur.patch --]
[-- Type: text/x-patch; name="0009-ul-remove-superfluous-return-as-usage-does-not-retur.patch", Size: 873 bytes --]

From db67b9c1332a703b7071c2ff02db41b0e91819ef Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:10:29 +0200
Subject: [PATCH 09/17] ul: remove superfluous return as usage() does not return

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 text-utils/ul.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/text-utils/ul.c b/text-utils/ul.c
index a52000b..6132166 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -192,12 +192,11 @@ int main(int argc, char **argv)
 		case 'V':
 			printf(_("%s from %s\n"), program_invocation_short_name,
 						  PACKAGE_STRING);
-			return(EXIT_SUCCESS);
+			return EXIT_SUCCESS;
 		case 'h':
 			usage(stdout);
 		default:
 			usage(stderr);
-			return EXIT_FAILURE;
 		}
 	setupterm(termtype, STDOUT_FILENO, &ret);
 	switch (ret) {
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #11: 0010-tailf-harmonize-option-argument-and-explanation-in-u.patch --]
[-- Type: text/x-patch; name="0010-tailf-harmonize-option-argument-and-explanation-in-u.patch", Size: 986 bytes --]

From 372194ba12cb789f5e03e59b70dcc60461d9d386 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:11:45 +0200
Subject: [PATCH 10/17] tailf: harmonize option argument and explanation in usage message

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 text-utils/tailf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index fbe81c8..c8f3e91 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -200,8 +200,8 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
 
 	fprintf(out, _(
 		"\nOptions:\n"
-		" -n, --lines NUMBER  output the last N lines\n"
-		" -NUMBER             same as -n NUMBER\n"
+		" -n, --lines NUMBER  output the last NUMBER lines\n"
+		" -NUMBER             same as `-n NUMBER'\n"
 		" -V, --version       output version information and exit\n"
 		" -h, --help          display this help and exit\n\n"));
 
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #12: 0011-hexdump-fix-beginnin-typo-in-usage-message.patch --]
[-- Type: text/x-patch; name="0011-hexdump-fix-beginnin-typo-in-usage-message.patch", Size: 1098 bytes --]

From 68cbfe5ad7c2aadbabee083d156ebd5ed893b691 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:12:56 +0200
Subject: [PATCH 11/17] hexdump: fix "beginnin" typo in usage message

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 text-utils/hexsyntax.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/text-utils/hexsyntax.c b/text-utils/hexsyntax.c
index 211e5d5..5cdd1de 100644
--- a/text-utils/hexsyntax.c
+++ b/text-utils/hexsyntax.c
@@ -145,7 +145,7 @@ void __attribute__((__noreturn__)) usage(FILE *out)
 		       " -e format       format string to be used for displaying data\n"
 		       " -f format_file  file that contains format strings\n"
 		       " -n length       interpret only length bytes of input\n"
-		       " -s offset       skip offset bytes from the beginnin\n"
+		       " -s offset       skip offset bytes from the beginning\n"
 		       " -v              display without squeezing similar lines\n"
 		       " -V              output version information and exit\n\n"));
 
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #13: 0012-write-remove-inconsistent-periods-from-two-error-mes.patch --]
[-- Type: text/x-patch; name="0012-write-remove-inconsistent-periods-from-two-error-mes.patch", Size: 1097 bytes --]

From a592a8c71f020e3b44ca0f952de459cc94c39fdb Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:13:44 +0200
Subject: [PATCH 12/17] write: remove inconsistent periods from two error messages

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 term-utils/write.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/term-utils/write.c b/term-utils/write.c
index 8843362..b44f0e0 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -143,7 +143,7 @@ int main(int argc, char **argv)
 			exit(EXIT_FAILURE);
 		if (!msgsok)
 			errx(EXIT_FAILURE,
-			     _("you have write permission turned off."));
+			     _("you have write permission turned off"));
 
 	} else
 		mytty = "<no tty>";
@@ -161,7 +161,7 @@ int main(int argc, char **argv)
 			argv[2] += 5;
 		if (utmp_chk(argv[1], argv[2]))
 			errx(EXIT_FAILURE,
-			     _("%s is not logged in on %s."),
+			     _("%s is not logged in on %s"),
 			     argv[1], argv[2]);
 		if (term_chk(argv[2], &msgsok, &atime, 1))
 			exit(EXIT_FAILURE);
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #14: 0013-script-indicate-that-the-file-argument-to-timing-is-.patch --]
[-- Type: text/x-patch; name="0013-script-indicate-that-the-file-argument-to-timing-is-.patch", Size: 1521 bytes --]

From 215d39ef6686e02db8a5842e5051242763ba2bd6 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:21:17 +0200
Subject: [PATCH 13/17] script: indicate that the file argument to --timing is optional

Also improve some other descriptions in the usage message.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 term-utils/script.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/term-utils/script.c b/term-utils/script.c
index 1f88253..deba155 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -133,13 +133,13 @@ usage(FILE *out)
 
 	fprintf(out, _(
 		"\nOptions:\n"
-		" -a, --append            append output\n"
-		" -c, --command COMMAND   run command rather than interactive shell\n"
+		" -a, --append            append the output\n"
+		" -c, --command COMMAND   run COMMAND rather than interactive shell\n"
 		" -r, --return            return exit code of the child process\n"
 		" -f, --flush             run flush after each write\n"
-		"     --force             use output file even it would be a link\n"
+		"     --force             use output file even when it is a link\n"
 		" -q, --quiet             be quiet\n"
-		" -t, --timing=FILE       output timing data to stderr, or to file\n"
+		" -t, --timing[=FILE]     output timing data to stderr (or to FILE)\n"
 		" -V, --version           output version information and exit\n"
 		" -h, --help              display this help and exit\n\n"));
 
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #15: 0014-scriptreplay-add-options-to-usage-and-timingfile-is-.patch --]
[-- Type: text/x-patch; name="0014-scriptreplay-add-options-to-usage-and-timingfile-is-.patch", Size: 870 bytes --]

From 498625334309e88b21acc859a24b986721b3d184 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:31:55 +0200
Subject: [PATCH 14/17] scriptreplay: add [options] to usage(), and timingfile is optional too

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 term-utils/scriptreplay.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/term-utils/scriptreplay.c b/term-utils/scriptreplay.c
index 86c82fd..d7fb031 100644
--- a/term-utils/scriptreplay.c
+++ b/term-utils/scriptreplay.c
@@ -36,7 +36,7 @@
 void __attribute__((__noreturn__))
 usage(FILE *out)
 {
-	fprintf(out, _("Usage: %s timingfile [typescript] [divisor]\n"),
+	fprintf(out, _("Usage: %s [options] [timingfile] [typescript] [divisor]\n"),
 			program_invocation_short_name);
 	fprintf(out, _(
 		"\nOptions:\n"
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #16: 0015-scriptreplay-improve-synopsis-and-formatting-in-man-.patch --]
[-- Type: text/x-patch; name="0015-scriptreplay-improve-synopsis-and-formatting-in-man-.patch", Size: 2215 bytes --]

From 8cf2b7aa035653cfc26226c275c412569447e492 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 21:46:13 +0200
Subject: [PATCH 15/17] scriptreplay: improve synopsis and formatting in man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 term-utils/scriptreplay.1 |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/term-utils/scriptreplay.1 b/term-utils/scriptreplay.1
index 5610eb1..785d60e 100644
--- a/term-utils/scriptreplay.1
+++ b/term-utils/scriptreplay.1
@@ -145,9 +145,10 @@ scriptreplay \- play back typescripts, using timing information
 .SH "SYNOPSIS"
 .IX Header "SYNOPSIS"
 .B scriptreplay
-.I timingfile
-.RI [ typescript
-.RI [ divisor ]]
+.RI [ option ...]
+.RI [ timingfile ]
+.RI [ typescript ]
+.RI [ divisor ]
 .SH "DESCRIPTION"
 .IX Header "DESCRIPTION"
 This program replays a typescript, using timing information to ensure that
@@ -175,29 +176,29 @@ parameter.
 By default, the typescript to display is assumed to be named \*(L"typescript\*(R",
 but other filenames may be specified, as the second parameter.
 .PP
-If the third parameter is specified, it is used as a speed-up multiplier. For
-example, a speed-up of 2 makes
+If the third parameter is specified, it is used as a speed-up multiplier.
+For example, a speed-up of 2 makes
 .B scriptreplay
 go twice as fast and a speed-up of 0.1 makes it go ten times slower
 than the original session.
 .SH OPTIONS
 The options will overide old style arguments.
 .TP
-.BR \-t , " \-\-timing FILE"
+.BR \-t , " \-\-timing " \fIfile\fR
 File containing script timing output.
 .TP
-.BR \-s , " \-\-typescript FILE"
-Script terminal output file.
+.BR \-s , " \-\-typescript " \fIfile\fR
+File containing the script terminal output.
 .TP
-.BR \-d , " \-\-divisor NUM"
+.BR \-d , " \-\-divisor " \fInumber\fR
 Speed up or slow down replay displaying by divisor. The argument
 is floating point number.
 .TP
 .BR \-V , " \-\-version"
-Print version information.
+Display version information and exit.
 .TP
 .BR \-h , " \-\-help"
-Print a help message.
+Display a help message exit.
 .SH "EXAMPLE"
 .IX Header "EXAMPLE"
 .Vb 7
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #17: 0016-script-normalize-formatting-of-the-man-page.patch --]
[-- Type: text/x-patch; name="0016-script-normalize-formatting-of-the-man-page.patch", Size: 3344 bytes --]

From 97795839cc61476c6d0cba4351bb9a1c29491ec6 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 10 Aug 2011 22:37:31 +0200
Subject: [PATCH 16/17] script: normalize formatting of the man page

Also improve the description of the --timing option,
and discard a then superfluous paragraph.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 term-utils/script.1 |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/term-utils/script.1 b/term-utils/script.1
index f618ec3..5f96b9c 100644
--- a/term-utils/script.1
+++ b/term-utils/script.1
@@ -40,16 +40,16 @@
 .Sh SYNOPSIS
 .Nm script
 .Op Fl a
-.Op Fl c Ar COMMAND
+.Op Fl c Ar command
 .Op Fl e
 .Op Fl f
 .Op Fl q
-.Op Fl t[=FILE]
+.Op Fl t Ns Op Ns = Ns Ar file
 .Op Fl V
 .Op Fl h
 .Op Ar file
 .Sh DESCRIPTION
-.Nm Script
+.Nm script
 makes a typescript of everything printed on your terminal.
 It is useful for students who need a hardcopy record of an interactive
 session as proof of an assignment, as the typescript file 
@@ -73,32 +73,31 @@ Append the output to
 or
 .Pa typescript ,
 retaining the prior contents.
-.It Fl c, Fl Fl command Ar COMMAND
-Run the COMMAND rather than an interactive shell.
+.It Fl c, Fl Fl command Ar command
+Run the
+.Ar command
+rather than an interactive shell.
 This makes it easy for a script to capture the output of a program that
 behaves differently when its stdout is not a tty.
 .It Fl e, Fl Fl return
-Return the exit code of the child process. Uses the same format as bash
+Return the exit code of the child process.  Uses the same format as bash
 termination on signal termination exit code is 128+n.
 .It Fl f, Fl Fl flush
-Flush output after each write. This is nice for telecooperation:
-One person does `mkfifo foo; script -f foo' and another can
+Flush output after each write.  This is nice for telecooperation:
+one person does `mkfifo foo; script -f foo', and another can
 supervise real-time what is being done using `cat foo'.
 .It Fl Fl force
-Allow default output destination, e.g. typescript file, to be
-hard or symbolic link. The command will follow symbolic link.
+Allow the default output destination, i.e. the typescript file, to be a
+hard or symbolic link.  The command will follow a symbolic link.
 .It Fl q, Fl Fl quiet
 Be quiet.
-.It Fl t, Fl Fl timing[=FILE]
-Output timing data to standard error. This data contains two fields,
-separated by a space. The first field indicates how much time elapsed since
-the previous output. The second field indicates how many characters were
-output this time. This information can be used to replay typescripts with
+.It Fl t, Fl Fl timing Ns Op Ns = Ns Ar file
+Output timing data to standard error, or to \fIfile\fR when given.
+This data contains two fields, separated by a space.
+The first field indicates how much time elapsed since the previous output.
+The second field indicates how many characters were output this time.
+This information can be used to replay typescripts with
 realistic typing and output delays.
-
-The timing option is able to take file path as an argument. The
-file is used as output detination instead of standard error when
-it is supplied.
 .It Fl V, Fl Fl version
 Output version information and exit.
 .It Fl h, Fl Fl help
-- 
1.7.0.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #18: 0017-sfdisk-correct-inside-order-to-inside-outer-in-docum.patch --]
[-- Type: text/x-patch; name="0017-sfdisk-correct-inside-order-to-inside-outer-in-docum.patch", Size: 1801 bytes --]

From 43dd49413578c384a059ba7c0ffcad60dab718ed Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Thu, 11 Aug 2011 21:47:15 +0200
Subject: [PATCH 17/17] sfdisk: correct '--inside-order' to '--inside-outer' in documentation

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
 fdisk/sfdisk.8 |    4 ++--
 fdisk/sfdisk.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fdisk/sfdisk.8 b/fdisk/sfdisk.8
index c3f06b3..02e8d11 100644
--- a/fdisk/sfdisk.8
+++ b/fdisk/sfdisk.8
@@ -322,10 +322,10 @@ Caution, see warning section. To be documented.
 .B \-\-not\-in\-order
 Caution, see warning section. To be documented.
 .TP
-.B \-\-inside\-order
+.B \-\-inside\-outer
 Caution, see warning section. Chaining order.
 .TP
-.B \-\-not\-inside\-order
+.B \-\-not\-inside\-outer
 Caution, see warning section. Chaining order.
 .TP
 .B \-\-nested
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index cd494d0..08e1b0c 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -2368,8 +2368,8 @@ usage(FILE * out) {
 		   "      --IBM               same as --leave-last\n"
 		   "      --in-order          partitions are in order\n"
 		   "      --not-in-order      partitions are not in order\n"
-		   "      --inside-order      all logicals inside outermost extended\n"
-		   "      --not-inside-order  not all logicals inside outermost extended\n"
+		   "      --inside-outer      all logicals inside outermost extended\n"
+		   "      --not-inside-outer  not all logicals inside outermost extended\n"
 		   "      --nested            every partition is disjoint from all others\n"
 		   "      --chained           like nested, but extended partitions may lie outside\n"
 		   "      --onesector         partitions are mutually disjoint\n"
-- 
1.7.0.4


^ permalink raw reply related

* Re: mkswap fails to use more than 2GiB and doesn't recognize LVM
From: Florian Pritz @ 2011-08-11 18:52 UTC (permalink / raw)
  To: util-linux
In-Reply-To: <20110811181454.GD32051@nb.net.home>

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On 11.08.2011 20:14, Karel Zak wrote:
>> busybox mkswap crates the expected 8GiB swap, so I think this is a bug.
> 
>  Do you see see 8GiB swap area in /proc/swaps after swapon? I don't
>  think so...

> cat /proc/swaps
Filename                                Type            Size    Used
Priority
/dev/dm-4                               partition       8388604 0       -1

-- 
Florian Pritz


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: mkswap fails to use more than 2GiB and doesn't recognize LVM
From: Karel Zak @ 2011-08-11 18:14 UTC (permalink / raw)
  To: Florian Pritz; +Cc: util-linux
In-Reply-To: <4E43F629.6040408@xinu.at>

On Thu, Aug 11, 2011 at 05:32:57PM +0200, Florian Pritz wrote:
> mkswap displays the following output when trying to create swap on a
> 8GiB logical volume.
> > # mkswap /dev/mapper/vg_brynhild-swap
> > mkswap: warning: truncating swap area to 2097144 KiB

 It seems correct. The swap header does not allow to address more than
 UINT_MAX pages. You have to create more swap areas or use system with
 bigger pages.

> > mkswap: /dev/mapper/vg_brynhild-swap: warning: don't erase bootbits sectors
> >         on whole disk. Use -f to force.
> > Setting up swapspace version 1, size = 2097140 KiB
> > no label, UUID=5eae2d8b-f664-46f5-983c-bdcd4301fa66
> 
> I tried adding -p 8589934592 to force 8GiB, but that doesn't change
> anything.

 :-)

> busybox mkswap crates the expected 8GiB swap, so I think this is a bug.

 Do you see see 8GiB swap area in /proc/swaps after swapon? I don't
 think so...

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply

* mkswap fails to use more than 2GiB and doesn't recognize LVM
From: Florian Pritz @ 2011-08-11 15:32 UTC (permalink / raw)
  To: util-linux

[-- Attachment #1: Type: text/plain, Size: 799 bytes --]

Hi,

I'm running util-linux 2.19.1 with a x86_64 linux 3.0.1 on Arch Linux.

mkswap displays the following output when trying to create swap on a
8GiB logical volume.
> # mkswap /dev/mapper/vg_brynhild-swap
> mkswap: warning: truncating swap area to 2097144 KiB
> mkswap: /dev/mapper/vg_brynhild-swap: warning: don't erase bootbits sectors
>         on whole disk. Use -f to force.
> Setting up swapspace version 1, size = 2097140 KiB
> no label, UUID=5eae2d8b-f664-46f5-983c-bdcd4301fa66

I tried adding -p 8589934592 to force 8GiB, but that doesn't change
anything.

It also fails to see that we are using LVM so this is not a real device
and we won't overwrite any boot sectors.

busybox mkswap crates the expected 8GiB swap, so I think this is a bug.

-- 
Florian Pritz


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* [PATCH] hexdump: fix segfault due to uninitialized memory
From: Petr Uzel @ 2011-08-10 13:32 UTC (permalink / raw)
  To: util-linux

[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]

util-linux commit 85bf44b714ab184907eb448eba389218956d6a51
replaced all calls to emalloc() with xmalloc(), whose semantics
is however different - it does not zero allocated memory. This
made hexdump segfault if MALLOC_PERTURB_ was set.

Reported-by: Kyrill Detinov <lazy.kent@opensuse.org>
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=710877

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
 text-utils/display.c |    4 ++--
 text-utils/parse.c   |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/text-utils/display.c b/text-utils/display.c
index c700b02..ad638e7 100644
--- a/text-utils/display.c
+++ b/text-utils/display.c
@@ -233,8 +233,8 @@ get(void)
 	u_char *tmpp;
 
 	if (!curp) {
-		curp = xmalloc(blocksize);
-		savp = xmalloc(blocksize);
+		curp = xcalloc(1, blocksize);
+		savp = xcalloc(1, blocksize);
 	} else {
 		tmpp = curp;
 		curp = savp;
diff --git a/text-utils/parse.c b/text-utils/parse.c
index 7168aad..e41b4a0 100644
--- a/text-utils/parse.c
+++ b/text-utils/parse.c
@@ -86,7 +86,7 @@ void add(const char *fmt)
 	const char *savep;
 
 	/* Start new linked list of format units. */
-	tfs = xmalloc(sizeof(FS));
+	tfs = xcalloc(1, sizeof(FS));
 	if (!fshead)
 		fshead = tfs;
 	else
@@ -102,7 +102,7 @@ void add(const char *fmt)
 			break;
 
 		/* Allocate a new format unit and link it in. */
-		tfu = xmalloc(sizeof(FU));
+		tfu = xcalloc(1, sizeof(FU));
 		*nextfu = tfu;
 		nextfu = &tfu->nextfu;
 		tfu->reps = 1;
@@ -219,7 +219,7 @@ void rewrite(FS *fs)
 		 * conversion character gets its own.
 		 */
 		for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
-			pr = xmalloc(sizeof(PR));
+			pr = xcalloc(1, sizeof(PR));
 			if (!fu->nextpr)
 				fu->nextpr = pr;
 			else
-- 
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH] dmesg: avoid mess at the end of dmesg output
From: Petr Uzel @ 2011-08-10 12:16 UTC (permalink / raw)
  To: util-linux

[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

Since util-linux commit a7ee94f2204011f26232ed3133514bf6e0d4a62c,
dmesg incorrectly calculates number of bytes that are remaining in the
buffer in get_next_record(). This could, under specific circumstances,
cause printing mess at the end of dmesg output:

> dmesg | tail
[ 1191.478725] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
[ 1205.588331] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
\xffffffba\xffffffba

Reported-by: Glenn Doig <doiggl@velocitynet.com.au>
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=710417

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
 sys-utils/dmesg.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 94f8c11..705269d 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -494,6 +494,8 @@ static int get_next_record(struct dmesg_control *ctl, struct dmesg_record *rec)
 
 		rec->next_size -= end - rec->next;
 		rec->next = rec->next_size > 0 ? end + 1 : NULL;
+		if (rec->next_size > 0)
+			rec->next_size--;
 
 		return 0;
 	}
-- 
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [PATCH] logger.1: use simple apostrophe instead of multibyte char
From: Petr Uzel @ 2011-08-10 11:46 UTC (permalink / raw)
  To: util-linux

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]


Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
 misc-utils/logger.1 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/misc-utils/logger.1 b/misc-utils/logger.1
index 4312551..c5f8424 100644
--- a/misc-utils/logger.1
+++ b/misc-utils/logger.1
@@ -110,7 +110,7 @@ The
 utility exits 0 on success, and >0 if an error occurs.
 .Pp
 Valid facility names are: auth, authpriv (for security information of a
-sensitive nature), cron, daemon, ftp, kern (can’t be generated from user
+sensitive nature), cron, daemon, ftp, kern (can't be generated from user
 process), lpr, mail, news, security (deprecated synonym for auth), syslog,
 user, uucp, and local0 to local7, inclusive.
 .Pp
-- 
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related

* [patch 8/8] [PATCH] lscpu: add physical cpu address to parseable output
From: Heiko Carstens @ 2011-08-10  8:36 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux, Heiko Carstens
In-Reply-To: <20110810083645.135814950@de.ibm.com>

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Print also the physical cpu address for each logical cpu in parsable
output if selected and present via sysfs.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 sys-utils/lscpu.1 |    5 +++--
 sys-utils/lscpu.c |   22 ++++++++++++++++++++--
 2 files changed, 23 insertions(+), 4 deletions(-)

--- a/sys-utils/lscpu.1
+++ b/sys-utils/lscpu.1
@@ -32,8 +32,9 @@ separate CPU cache columns. If no CPU ca
 columns are not printed at all.
 
 The \fIlist\fP argument is comma delimited list of the columns. Currently
-supported are CPU, Core, Node, Socket, Book, Cache and Polarization columns. If the
-\fIlist\fP argument is given then always all requested columns are printed in
+supported are CPU, Core, Node, Socket, Book, Cache, Polarization and Address
+columns.
+If the \fIlist\fP argument is given then always all requested columns are printed in
 the defined order. The Cache columns are separated by ':'.
 
 Note that the optional \fIlist\fP argument cannot be separated from the
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -168,6 +168,7 @@ struct lscpu_desc {
 	struct cpu_cache *caches;
 
 	int		*polarization;	/* cpu polarization */
+	int		*addresses;	/* physical cpu addresses */
 };
 
 static size_t sysrootlen;
@@ -199,7 +200,8 @@ enum {
 	COL_NODE,
 	COL_BOOK,
 	COL_CACHE,
-	COL_POLARIZATION
+	COL_POLARIZATION,
+	COL_ADDRESS
 };
 
 static const char *colnames[] =
@@ -210,7 +212,8 @@ static const char *colnames[] =
 	[COL_NODE] = "Node",
 	[COL_BOOK] = "Book",
 	[COL_CACHE] = "Cache",
-	[COL_POLARIZATION] = "Polarization"
+	[COL_POLARIZATION] = "Polarization",
+	[COL_ADDRESS] = "Address"
 };
 
 
@@ -762,6 +765,16 @@ read_polarization(struct lscpu_desc *des
 		desc->polarization[num] = POLAR_UNKNOWN;
 }
 
+static void
+read_address(struct lscpu_desc *desc, int num)
+{
+	if (!path_exist(_PATH_SYS_CPU "/cpu%d/address", num))
+		return;
+	if (!desc->addresses)
+		desc->addresses = xcalloc(desc->ncpus, sizeof(int));
+	desc->addresses[num] = path_getnum(_PATH_SYS_CPU "/cpu%d/address", num);
+}
+
 static int
 cachecmp(const void *a, const void *b)
 {
@@ -916,6 +929,10 @@ print_parsable_cell(struct lscpu_desc *d
 		if (desc->polarization)
 			printf("%s", polar_modes[desc->polarization[i]]);
 		break;
+	case COL_ADDRESS:
+		if (desc->addresses)
+			printf("%d", desc->addresses[i]);
+		break;
 	}
 }
 
@@ -1230,6 +1247,7 @@ int main(int argc, char *argv[])
 		read_topology(desc, i);
 		read_cache(desc, i);
 		read_polarization(desc, i);
+		read_address(desc, i);
 	}
 
 	qsort(desc->caches, desc->ncaches, sizeof(struct cpu_cache), cachecmp);

^ permalink raw reply

* [patch 7/8] [PATCH] lscpu: add cpu polarization to parseable output
From: Heiko Carstens @ 2011-08-10  8:36 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux, Heiko Carstens
In-Reply-To: <20110810083645.135814950@de.ibm.com>

From: Heiko Carstens <heiko.carstens@de.ibm.com>

When running in different dispatching mode the virtual cpus may
have different polarizations.
E.g. in "vertical" mode cpus may have a polarization of "vertical:high"
which means the virtual cpu has dedicated physical cpu assigned.
Print this information in the parsable output.

Note that this breaks the current rule that
a) the parseable output contains only numbers
b) these numbers are equal or increased in each line

Since however this new item must be selected with the "list" argument
this shouldn't be a problem.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 sys-utils/lscpu.1 |    2 +-
 sys-utils/lscpu.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 52 insertions(+), 3 deletions(-)

--- a/sys-utils/lscpu.1
+++ b/sys-utils/lscpu.1
@@ -32,7 +32,7 @@ separate CPU cache columns. If no CPU ca
 columns are not printed at all.
 
 The \fIlist\fP argument is comma delimited list of the columns. Currently
-supported are CPU, Core, Node, Socket, Book and Cache columns. If the
+supported are CPU, Core, Node, Socket, Book, Cache and Polarization columns. If the
 \fIlist\fP argument is given then always all requested columns are printed in
 the defined order. The Cache columns are separated by ':'.
 
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -108,6 +108,23 @@ const char *disp_modes[] = {
 	[DISP_VERTICAL]		= N_("vertical")
 };
 
+/* cpu polarization */
+enum {
+	POLAR_UNKNOWN	= 0,
+	POLAR_VLOW,
+	POLAR_VMEDIUM,
+	POLAR_VHIGH,
+	POLAR_HORIZONTAL
+};
+
+const char *polar_modes[] = {
+	[POLAR_UNKNOWN]		= "U",
+	[POLAR_VLOW]		= "VL",
+	[POLAR_VMEDIUM]		= "VM",
+	[POLAR_VHIGH]		= "VH",
+	[POLAR_HORIZONTAL]	= "H"
+};
+
 /* global description */
 struct lscpu_desc {
 	char	*arch;
@@ -149,6 +166,8 @@ struct lscpu_desc {
 
 	int		ncaches;
 	struct cpu_cache *caches;
+
+	int		*polarization;	/* cpu polarization */
 };
 
 static size_t sysrootlen;
@@ -179,7 +198,8 @@ enum {
 	COL_SOCKET,
 	COL_NODE,
 	COL_BOOK,
-	COL_CACHE
+	COL_CACHE,
+	COL_POLARIZATION
 };
 
 static const char *colnames[] =
@@ -189,7 +209,8 @@ static const char *colnames[] =
 	[COL_SOCKET] = "Socket",
 	[COL_NODE] = "Node",
 	[COL_BOOK] = "Book",
-	[COL_CACHE] = "Cache"
+	[COL_CACHE] = "Cache",
+	[COL_POLARIZATION] = "Polarization"
 };
 
 
@@ -717,6 +738,29 @@ read_topology(struct lscpu_desc *desc, i
 	if (book_siblings)
 		add_cpuset_to_array(desc->bookmaps, &desc->nbooks, book_siblings);
 }
+static void
+read_polarization(struct lscpu_desc *desc, int num)
+{
+	char mode[64];
+
+	if (desc->dispatching < 0)
+		return;
+	if (!path_exist(_PATH_SYS_CPU "/cpu%d/polarization", num))
+		return;
+	if (!desc->polarization)
+		desc->polarization = xcalloc(desc->ncpus, sizeof(int));
+	path_getstr(mode, sizeof(mode), _PATH_SYS_CPU "/cpu%d/polarization", num);
+	if (strncmp(mode, "vertical:low", sizeof(mode)) == 0)
+		desc->polarization[num] = POLAR_VLOW;
+	else if (strncmp(mode, "vertical:medium", sizeof(mode)) == 0)
+		desc->polarization[num] = POLAR_VMEDIUM;
+	else if (strncmp(mode, "vertical:high", sizeof(mode)) == 0)
+		desc->polarization[num] = POLAR_VHIGH;
+	else if (strncmp(mode, "horizontal", sizeof(mode)) == 0)
+		desc->polarization[num] = POLAR_HORIZONTAL;
+	else
+		desc->polarization[num] = POLAR_UNKNOWN;
+}
 
 static int
 cachecmp(const void *a, const void *b)
@@ -868,6 +912,10 @@ print_parsable_cell(struct lscpu_desc *d
 				putchar(',');
 		}
 		break;
+	case COL_POLARIZATION:
+		if (desc->polarization)
+			printf("%s", polar_modes[desc->polarization[i]]);
+		break;
 	}
 }
 
@@ -1181,6 +1229,7 @@ int main(int argc, char *argv[])
 			continue;
 		read_topology(desc, i);
 		read_cache(desc, i);
+		read_polarization(desc, i);
 	}
 
 	qsort(desc->caches, desc->ncaches, sizeof(struct cpu_cache), cachecmp);

^ permalink raw reply

* [patch 6/8] [PATCH] lscpu: show dispatching mode
From: Heiko Carstens @ 2011-08-10  8:36 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux, Heiko Carstens
In-Reply-To: <20110810083645.135814950@de.ibm.com>

From: Heiko Carstens <heiko.carstens@de.ibm.com>

A virtual guest my run in either "horiziontal" or "vertical" mode
which is the mode in which the underlying hypervisor schedules the
guest cpu.
Since this is of interest print this in the readable output.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 sys-utils/lscpu.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -97,6 +97,17 @@ struct cpu_cache {
 	cpu_set_t	**sharedmaps;
 };
 
+/* dispatching modes */
+enum {
+	DISP_HORIZONTAL = 0,
+	DISP_VERTICAL	= 1
+};
+
+const char *disp_modes[] = {
+	[DISP_HORIZONTAL]	= N_("horizontal"),
+	[DISP_VERTICAL]		= N_("vertical")
+};
+
 /* global description */
 struct lscpu_desc {
 	char	*arch;
@@ -110,6 +121,7 @@ struct lscpu_desc {
 	char	*stepping;
 	char    *bogomips;
 	char	*flags;
+	int	dispatching;	/* none, horizontal or vertical */
 	int	mode;		/* rm, lm or/and tm */
 
 	int		ncpus;		/* number of CPUs */
@@ -478,6 +490,12 @@ read_basicinfo(struct lscpu_desc *desc)
 		desc->online = path_cpulist(_PATH_SYS_SYSTEM "/cpu/online");
 		desc->nthreads = CPU_COUNT_S(setsize, desc->online);
 	}
+
+	/* get dispatching mode */
+	if (path_exist(_PATH_SYS_SYSTEM "/cpu/dispatching"))
+		desc->dispatching = path_getnum(_PATH_SYS_SYSTEM "/cpu/dispatching");
+	else
+		desc->dispatching = -1;
 }
 
 static int
@@ -1065,6 +1083,8 @@ print_readable(struct lscpu_desc *desc,
 		print_s(_("Hypervisor vendor:"), hv_vendors[desc->hyper]);
 		print_s(_("Virtualization type:"), virt_types[desc->virtype]);
 	}
+	if (desc->dispatching >= 0)
+		print_s(_("Dispatching mode:"), disp_modes[desc->dispatching]);
 	if (desc->ncaches) {
 		char buf[512];
 		int i;

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox