public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc
@ 2012-12-16 10:43 Sami Kerola
  2012-12-16 10:43 ` [PATCH 01/14] docs: swapon.8 option name fix Sami Kerola
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Hello Karel && all,

This review / pull request is partial resubmission.  The ipc stuff was
sent to list earlier, but it got to be modified after initial review so
here comes the modified version.

In these patches there are two documentation bug fixes (0001, 0005), and
one code bug fix (0013).  There is also one policy change (0008), which
makes tunelp not to be part of default build.  My feeling is that the
utility is not much in use.  Please correct if I am wrong, and drop the
patch.

Minix changes aimed to remove a TODO item.  I did not remove the task
yet, just in case someone wants to double check the code for that there
are no remaining variables using not-optimal types.

That was the week that was.


The following changes since commit 7cdfc45f99c04797aa0838310dae4e7bf95f6c9d:

  docs: fix typo (2012-12-14 16:12:47 +0100)

are available in the git repository at:

  git://github.com/kerolasa/lelux-utiliteetit.git 2012wk50

for you to fetch changes up to fa72dc4d91085705647b285e1b319ffc3bbe2daf:

  docs: fsck(8), mkfs(8): update manual references (2012-12-16 10:25:46 +0000)

----------------------------------------------------------------
Sami Kerola (14):
      docs: swapon.8 option name fix
      ipcs: assist debugging
      ipcs: add --human readable size conversion option
      ipcs: add --bytes size output option
      isosize: fix usage() -h option print out
      isosize: inform if file does not look like iso file system
      more: remove unnecessary variable
      tunelp: deprecation: remove command from default build
      minix: change types in header file
      minix: use off_t, size_t, etc appropriate types
      minix: replace magic constants with macro names
      docs: add missing exit value to fsck.minix(8)
      lib/ismounted: detect loopback mounts
      docs: fsck(8), mkfs(8): update manual references

 Documentation/deprecated.txt |   4 ++
 configure.ac                 |  10 ++++
 disk-utils/fsck.8            |  16 ++-----
 disk-utils/fsck.minix.8      |   6 +--
 disk-utils/fsck.minix.c      |  26 +++++-----
 disk-utils/isosize.c         |  31 ++++++++----
 disk-utils/minix_programs.h  |  40 ++++++++--------
 disk-utils/mkfs.8            |  10 ++--
 disk-utils/mkfs.minix.c      |  12 ++---
 lib/Makemodule.am            |   1 +
 lib/ismounted.c              |   8 +++-
 sys-utils/Makemodule.am      |   2 +
 sys-utils/ipcs.1             |   6 +++
 sys-utils/ipcs.c             | 112 +++++++++++++++++++++++++++----------------
 sys-utils/ipcutils.c         |  40 ++++++++++++++++
 sys-utils/ipcutils.h         |   9 ++++
 sys-utils/swapon.8           |   2 +-
 text-utils/more.c            |   4 +-
 18 files changed, 222 insertions(+), 117 deletions(-)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 01/14] docs: swapon.8 option name fix
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 02/14] ipcs: assist debugging Sami Kerola
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

The commit 7ae8b469adda598fda28e4ea647d47905b43e172 added option --bytes,
not the initial proposal which was changed after maillist discussion.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/swapon.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-utils/swapon.8 b/sys-utils/swapon.8
index 2fbf855..be1f34a 100644
--- a/sys-utils/swapon.8
+++ b/sys-utils/swapon.8
@@ -182,7 +182,7 @@ Display
 .B \-\-show
 output without aligning table columns.
 .TP
-.B \-\-inhuman
+.B \-\-bytes
 Display swap size in bytes in
 .B \-\-show
 output instead of user friendly size and unit.
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 02/14] ipcs: assist debugging
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
  2012-12-16 10:43 ` [PATCH 01/14] docs: swapon.8 option name fix Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 03/14] ipcs: add --human readable size conversion option Sami Kerola
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

One will be able to see enum symbols when debugging, which is not the
case when values are specified as define list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/ipcs.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 6ef0bbe..889c868 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -25,11 +25,14 @@
 
 #include "ipcutils.h"
 
-#define LIMITS 1
-#define STATUS 2
-#define CREATOR 3
-#define TIME 4
-#define PID 5
+enum output_formats {
+	NOTSPECIFIED,
+	LIMITS,
+	STATUS,
+	CREATOR,
+	TIME,
+	PID
+};
 
 static void do_shm (char format);
 static void print_shm (int id);
@@ -68,7 +71,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
 int main (int argc, char **argv)
 {
 	int opt, msg = 0, sem = 0, shm = 0, id=0, print=0;
-	char format = 0;
+	char format = NOTSPECIFIED;
 	static const struct option longopts[] = {
 		{"id", required_argument, NULL, 'i'},
 		{"shmems", no_argument, NULL, 'm'},
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 03/14] ipcs: add --human readable size conversion option
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
  2012-12-16 10:43 ` [PATCH 01/14] docs: swapon.8 option name fix Sami Kerola
  2012-12-16 10:43 ` [PATCH 02/14] ipcs: assist debugging Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 04/14] ipcs: add --bytes size output option Sami Kerola
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Introduces new function ipc_print_size() which will call
size_to_human_string(), and handles the occasional '([k]bytes)' printing
if default size format is requested.

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/ipcs.1     |  3 ++
 sys-utils/ipcs.c     | 88 ++++++++++++++++++++++++++++++++--------------------
 sys-utils/ipcutils.c | 40 ++++++++++++++++++++++++
 sys-utils/ipcutils.h |  9 ++++++
 4 files changed, 106 insertions(+), 34 deletions(-)

diff --git a/sys-utils/ipcs.1 b/sys-utils/ipcs.1
index 7c094c8..0a617d6 100644
--- a/sys-utils/ipcs.1
+++ b/sys-utils/ipcs.1
@@ -65,6 +65,9 @@ Show resource limits.
 .TP
 \fB\-u\fR, \fB\-\-summary\fR
 Show status summary.
+.TP
+.B \-\-human
+Print sizes in human readable format.
 .SH SEE ALSO
 .BR ipcrm (1),
 .BR ipcmk (1),
diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 889c868..66c6302 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -33,14 +33,16 @@ enum output_formats {
 	TIME,
 	PID
 };
+enum {
+	OPT_HUMAN = CHAR_MAX + 1
+};
 
-static void do_shm (char format);
-static void print_shm (int id);
+static void do_shm (char format, int unit);
+static void print_shm (int id, int unit);
 static void do_sem (char format);
 static void print_sem (int id);
-static void do_msg (char format);
-
-void print_msg (int id);
+static void do_msg (char format, int unit);
+static void print_msg (int id, int unit);
 
 static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
@@ -64,6 +66,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
 	fputs(_(" -c, --creator     show creator and owner\n"), out);
 	fputs(_(" -l, --limits      show resource limits\n"), out);
 	fputs(_(" -u, --summary     show status summary\n"), out);
+	fputs(_("     --human       show sizes in human readable format\n"), out);
 	fprintf(out, USAGE_MAN_TAIL("ipcs(1)"));
 	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
@@ -72,6 +75,7 @@ int main (int argc, char **argv)
 {
 	int opt, msg = 0, sem = 0, shm = 0, id=0, print=0;
 	char format = NOTSPECIFIED;
+	int unit = IPC_UNIT_DEFAULT;
 	static const struct option longopts[] = {
 		{"id", required_argument, NULL, 'i'},
 		{"shmems", no_argument, NULL, 'm'},
@@ -83,6 +87,7 @@ int main (int argc, char **argv)
 		{"creator", no_argument, NULL, 'c'},
 		{"limits", no_argument, NULL, 'l'},
 		{"summary", no_argument, NULL, 'u'},
+		{"human", no_argument, NULL, OPT_HUMAN},
 		{"version", no_argument, NULL, 'V'},
 		{"help", no_argument, NULL, 'h'},
 		{NULL, 0, NULL, 0}
@@ -127,6 +132,9 @@ int main (int argc, char **argv)
 		case 'u':
 			format = STATUS;
 			break;
+		case OPT_HUMAN:
+			unit = IPC_UNIT_HUMAN;
+			break;
 		case 'h':
 			usage(stdout);
 		case 'V':
@@ -139,11 +147,11 @@ int main (int argc, char **argv)
 
 	if  (print) {
 		if (shm)
-			print_shm (id);
+			print_shm (id, unit);
 		if (sem)
 			print_sem (id);
 		if (msg)
-			print_msg (id);
+			print_msg (id, unit);
 		if (!shm && !sem && !msg )
 			usage (stderr);
 	} else {
@@ -152,7 +160,7 @@ int main (int argc, char **argv)
 		printf ("\n");
 
 		if (shm) {
-			do_shm (format);
+			do_shm (format, unit);
 			printf ("\n");
 		}
 		if (sem) {
@@ -160,14 +168,14 @@ int main (int argc, char **argv)
 			printf ("\n");
 		}
 		if (msg) {
-			do_msg (format);
+			do_msg (format, unit);
 			printf ("\n");
 		}
 	}
 	return EXIT_SUCCESS;
 }
 
-static void do_shm (char format)
+static void do_shm (char format, int unit)
 {
 	struct passwd *pw;
 	struct shm_data *shmds, *shmdsp;
@@ -181,10 +189,13 @@ static void do_shm (char format)
 		if (ipc_shm_get_limits(&lim))
 			return;
 		printf (_("max number of segments = %ju\n"), lim.shmmni);
-		printf (_("max seg size (kbytes) = %ju\n"), lim.shmmax / 1024);
-		printf (_("max total shared memory (kbytes) = %ju\n"),
-					(lim.shmall / 1024) * getpagesize());
-		printf (_("min seg size (bytes) = %ju\n"), lim.shmmin);
+		ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_KB : unit,
+			       _("max seg size"), lim.shmmax, "\n", 0);
+		ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_KB : unit,
+			       _("max total shared memory"),
+			       lim.shmall * getpagesize(), "\n", 0);
+		ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_BYTES : unit,
+			       _("min seg size"), lim.shmmin, "\n", 0);
 		return;
 	}
 	case STATUS:
@@ -248,7 +259,8 @@ static void do_shm (char format)
 	default:
 		printf (_("------ Shared Memory Segments --------\n"));
 		printf ("%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n",
-			_("key"),_("shmid"),_("owner"),_("perms"),_("bytes"),
+			_("key"),_("shmid"),_("owner"),_("perms"),
+			unit == IPC_UNIT_HUMAN ? _("size") : _("bytes"),
 			_("nattch"),_("status"));
 		break;
 	}
@@ -295,9 +307,9 @@ static void do_shm (char format)
 				printf ("%-10d %-10.10s", shmdsp->shm_perm.id, pw->pw_name);
 			else
 				printf ("%-10d %-10u", shmdsp->shm_perm.id, shmdsp->shm_perm.uid);
-			printf (" %-10o %-10lu %-10ld %-6s %-6s\n",
-				shmdsp->shm_perm.mode & 0777,
-				shmdsp->shm_segsz,
+			printf (" %-10o ", shmdsp->shm_perm.mode & 0777);
+			ipc_print_size(unit, NULL, shmdsp->shm_segsz, NULL, -10);
+			printf (" %-10ld %-6s %-6s\n",
 				shmdsp->shm_nattch,
 				shmdsp->shm_perm.mode & SHM_DEST ? _("dest") : " ",
 				shmdsp->shm_perm.mode & SHM_LOCKED ? _("locked") : " ");
@@ -410,7 +422,7 @@ static void do_sem (char format)
 	return;
 }
 
-static void do_msg (char format)
+static void do_msg (char format, int unit)
 {
 	struct passwd *pw;
 	struct msg_data *msgds, *msgdsp;
@@ -424,8 +436,10 @@ static void do_msg (char format)
 			return;
 		printf (_("------ Messages Limits --------\n"));
 		printf (_("max queues system wide = %d\n"), lim.msgmni);
-		printf (_("max size of message (bytes) = %zu\n"), lim.msgmax);
-		printf (_("default max size of queue (bytes) = %d\n"), lim.msgmnb);
+		ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_BYTES : unit,
+			       _("max size of message"), lim.msgmax, "\n", 0);
+		ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_BYTES : unit,
+			       _("default max size of queue"), lim.msgmnb, "\n", 0);
 		return;
 	}
 	case STATUS:
@@ -438,7 +452,8 @@ static void do_msg (char format)
 		printf (_("------ Messages Status --------\n"));
 		printf (_("allocated queues = %d\n"), msginfo.msgpool);
 		printf (_("used headers = %d\n"), msginfo.msgmap);
-		printf (_("used space = %d bytes\n"), msginfo.msgtql);
+		ipc_print_size(unit, _("used space ="), msginfo.msgtql,
+			       unit == IPC_UNIT_DEFAULT ? _(" bytes\n") : "\n", 0);
 		return;
 	}
 	case CREATOR:
@@ -463,7 +478,8 @@ static void do_msg (char format)
 		printf (_("------ Message Queues --------\n"));
 		printf ("%-10s %-10s %-10s %-10s %-12s %-12s\n",
 			_("key"), _("msqid"), _("owner"), _("perms"),
-			_("used-bytes"), _("messages"));
+			unit == IPC_UNIT_HUMAN ? _("size") : _("used-bytes"),
+			_("messages"));
 		break;
 	}
 
@@ -508,10 +524,9 @@ static void do_msg (char format)
 				printf ("%-10d %-10.10s", msgdsp->msg_perm.id, pw->pw_name);
 			else
 				printf ("%-10d %-10u", msgdsp->msg_perm.id, msgdsp->msg_perm.uid);
-			printf (" %-10o %-12ld %-12ld\n",
-				msgdsp->msg_perm.mode & 0777,
-				msgdsp->q_cbytes,
-				msgdsp->q_qnum);
+			printf (" %-10o ", msgdsp->msg_perm.mode & 0777);
+			ipc_print_size(unit, NULL, msgdsp->q_cbytes, NULL, -12);
+			printf (" %-12ld\n", msgdsp->q_qnum);
 			break;
 		}
 	}
@@ -520,7 +535,7 @@ static void do_msg (char format)
 	return;
 }
 
-static void print_shm(int shmid)
+static void print_shm(int shmid, int unit)
 {
 	struct shm_data *shmdata;
 
@@ -535,8 +550,10 @@ static void print_shm(int shmid)
 	       shmdata->shm_perm.cuid, shmdata->shm_perm.cgid);
 	printf(_("mode=%#o\taccess_perms=%#o\n"), shmdata->shm_perm.mode,
 	       shmdata->shm_perm.mode & 0777);
-	printf(_("bytes=%ju\tlpid=%u\tcpid=%u\tnattch=%jd\n"),
-	       shmdata->shm_segsz, shmdata->shm_lprid, shmdata->shm_cprid,
+	ipc_print_size(unit, unit == IPC_UNIT_HUMAN ? _("size=") : _("bytes="),
+		       shmdata->shm_segsz, "\t", 0);
+	printf(_("lpid=%u\tcpid=%u\tnattch=%jd\n"),
+	       shmdata->shm_lprid, shmdata->shm_cprid,
 	       shmdata->shm_nattch);
 	printf(_("att_time=%-26.24s\n"),
 	       shmdata->shm_atim ? ctime(&(shmdata->shm_atim)) : _("Not set"));
@@ -548,8 +565,7 @@ static void print_shm(int shmid)
 	ipc_shm_free_info(shmdata);
 }
 
-
-void print_msg(int msgid)
+void print_msg(int msgid, int unit)
 {
 	struct msg_data *msgdata;
 
@@ -563,8 +579,12 @@ void print_msg(int msgid)
 	       msgdata->msg_perm.uid, msgdata->msg_perm.uid,
 	       msgdata->msg_perm.cuid, msgdata->msg_perm.cgid,
 	       msgdata->msg_perm.mode);
-	printf(_("cbytes=%jd\tqbytes=%jd\tqnum=%jd\tlspid=%d\tlrpid=%d\n"),
-	       msgdata->q_cbytes, msgdata->q_qbytes, msgdata->q_qnum,
+	ipc_print_size(unit, unit == IPC_UNIT_HUMAN ? _("csize=") : _("cbytes="),
+		       msgdata->q_cbytes, "\t", 0);
+	ipc_print_size(unit, unit == IPC_UNIT_HUMAN ? _("qsize=") : _("qbytes="),
+		       msgdata->q_qbytes, "\t", 0);
+	printf("qnum=%jd\tlspid=%d\tlrpid=%d\n",
+	       msgdata->q_qnum,
 	       msgdata->q_lspid, msgdata->q_lrpid);
 	printf(_("send_time=%-26.24s\n"),
 	       msgdata->q_stime ? ctime(&msgdata->q_stime) : _("Not set"));
diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c
index 7d1f0d1..d81ca20 100644
--- a/sys-utils/ipcutils.c
+++ b/sys-utils/ipcutils.c
@@ -7,6 +7,7 @@
 #include "path.h"
 #include "pathnames.h"
 #include "ipcutils.h"
+#include "strutils.h"
 
 #ifndef SEMVMX
 # define SEMVMX  32767	/* <= 32767 semaphore maximum value */
@@ -504,3 +505,42 @@ void ipc_print_perms(FILE *f, struct ipc_stat *is)
 	else
 		fprintf(f, " %-10u\n", is->gid);
 }
+
+void ipc_print_size(int unit, char *msg, size_t size, const char *end,
+		    int width)
+{
+	char format[16];
+
+	if (!msg)
+		/* NULL */ ;
+	else if (msg[strlen(msg) - 1] == '=')
+		printf("%s", msg);
+	else if (unit == IPC_UNIT_BYTES)
+		printf(_("%s (bytes) = "), msg);
+	else if (unit == IPC_UNIT_KB)
+		printf(_("%s (kbytes) = "), msg);
+	else
+		printf("%s = ", msg);
+
+	switch (unit) {
+	case IPC_UNIT_DEFAULT:
+	case IPC_UNIT_BYTES:
+		sprintf(format, "%%%dzu", width);
+		printf(format, size);
+		break;
+	case IPC_UNIT_KB:
+		sprintf(format, "%%%dzu", width);
+		printf(format, size / 1024);
+		break;
+	case IPC_UNIT_HUMAN:
+		sprintf(format, "%%%ds", width);
+		printf(format, size_to_human_string(SIZE_SUFFIX_1LETTER, size));
+		break;
+	default:
+		/* impossible occurred */
+		abort();
+	}
+
+	if (end)
+		printf("%s", end);
+}
diff --git a/sys-utils/ipcutils.h b/sys-utils/ipcutils.h
index 28b35c1..6383124 100644
--- a/sys-utils/ipcutils.h
+++ b/sys-utils/ipcutils.h
@@ -78,6 +78,14 @@ union semun {
 # define KEY key
 #endif
 
+/* Size printing in ipcs is using these. */
+enum {
+	IPC_UNIT_DEFAULT,
+	IPC_UNIT_BYTES,
+	IPC_UNIT_KB,
+	IPC_UNIT_HUMAN
+};
+
 struct ipc_limits {
 	uint64_t	shmmni;		/* max number of segments */
 	uint64_t	shmmax;		/* max segment size */
@@ -110,6 +118,7 @@ struct ipc_stat {
 };
 
 extern void ipc_print_perms(FILE *f, struct ipc_stat *is);
+extern void ipc_print_size(int unit, char *msg, size_t size, const char *end, int width);
 
 /* See 'struct shmid_kernel' in kernel sources
  */
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 04/14] ipcs: add --bytes size output option
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (2 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 03/14] ipcs: add --human readable size conversion option Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 05/14] isosize: fix usage() -h option print out Sami Kerola
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

This makes the command being a little closer standard compliant.  See
IEEE Std 1003.1 referral link below for more information.

References: http://pubs.opengroup.org/onlinepubs/009696799/utilities/ipcs.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/ipcs.1 | 3 +++
 sys-utils/ipcs.c | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys-utils/ipcs.1 b/sys-utils/ipcs.1
index 0a617d6..5fc3a81 100644
--- a/sys-utils/ipcs.1
+++ b/sys-utils/ipcs.1
@@ -68,6 +68,9 @@ Show status summary.
 .TP
 .B \-\-human
 Print sizes in human readable format.
+.TP
+\fB\-b\fR, \fB\-\-bytes\fR
+Print sizes in bytes.
 .SH SEE ALSO
 .BR ipcrm (1),
 .BR ipcmk (1),
diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 66c6302..d611354 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -67,6 +67,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
 	fputs(_(" -l, --limits      show resource limits\n"), out);
 	fputs(_(" -u, --summary     show status summary\n"), out);
 	fputs(_("     --human       show sizes in human readable format\n"), out);
+	fputs(_(" -b, --bytes       show sizes in bytes\n"), out);
 	fprintf(out, USAGE_MAN_TAIL("ipcs(1)"));
 	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
@@ -88,11 +89,12 @@ int main (int argc, char **argv)
 		{"limits", no_argument, NULL, 'l'},
 		{"summary", no_argument, NULL, 'u'},
 		{"human", no_argument, NULL, OPT_HUMAN},
+		{"bytes", no_argument, NULL, 'b'},
 		{"version", no_argument, NULL, 'V'},
 		{"help", no_argument, NULL, 'h'},
 		{NULL, 0, NULL, 0}
 	};
-	char options[] = "i:mqsatpcluVh";
+	char options[] = "i:mqsatpclubVh";
 
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
@@ -135,6 +137,9 @@ int main (int argc, char **argv)
 		case OPT_HUMAN:
 			unit = IPC_UNIT_HUMAN;
 			break;
+		case 'b':
+			unit = IPC_UNIT_BYTES;
+			break;
 		case 'h':
 			usage(stdout);
 		case 'V':
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 05/14] isosize: fix usage() -h option print out
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (3 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 04/14] ipcs: add --bytes size output option Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 06/14] isosize: inform if file does not look like iso file system Sami Kerola
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Fixes usage() bug from commit 4eba43a7 which claimed sort option for
--help being -H.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/isosize.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c
index e5defae..625dd42 100644
--- a/disk-utils/isosize.c
+++ b/disk-utils/isosize.c
@@ -153,15 +153,17 @@ static void isosize(char *filenamep, int xflag, long divisor)
 
 static void __attribute__((__noreturn__)) usage(FILE *out)
 {
-	fprintf(out, _("\nUsage:\n"
-		       " %s [options] iso9660_image_file\n"),
+	fputs(USAGE_HEADER, out);
+	fprintf(out,
+		_(" %s [options] iso9660_image_file\n"),
 		program_invocation_short_name);
-
-	fprintf(out, _("\nOptions:\n"
-		       " -d, --divisor=NUM      divide bytes NUM\n"
-		       " -x, --sectors          show sector count and size\n"
-		       " -V, --version          output version information and exit\n"
-		       " -H, --help             display this help and exit\n\n"));
+	fputs(USAGE_OPTIONS, out);
+	fputs(_(" -d, --divisor=NUM      divide bytes NUM\n"), out);
+	fputs(_(" -x, --sectors          show sector count and size\n"), out);
+	fputs(USAGE_SEPARATOR, out);
+	fputs(USAGE_HELP, out);
+	fputs(USAGE_VERSION, out);
+	fprintf(out, USAGE_MAN_TAIL("isosize(8)"));
 
 	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
@@ -195,8 +197,7 @@ int main(int argc, char **argv)
 			xflag = 1;
 			break;
 		case 'V':
-			printf(_("%s (%s)\n"), program_invocation_short_name,
-			       PACKAGE_STRING);
+			printf(UTIL_LINUX_VERSION);
 			return EXIT_SUCCESS;
 		case 'h':
 			usage(stdout);
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 06/14] isosize: inform if file does not look like iso file system
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (4 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 05/14] isosize: fix usage() -h option print out Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 07/14] more: remove unnecessary variable Sami Kerola
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

$ isosize /dev/urandom
isosize: /dev/urandom: might not be iso file system
-67690643227260

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/isosize.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c
index 625dd42..5f1a297 100644
--- a/disk-utils/isosize.c
+++ b/disk-utils/isosize.c
@@ -32,6 +32,14 @@
 
 #define ISODCL(from, to) (to - from + 1)
 
+static int is_iso(int fd)
+{
+	char label[8];
+	if (pread(fd, &label, 8, 0x8000) == -1)
+		return 1;
+	return memcmp(&label, &"\1CD001\1", 8);
+}
+
 static int isonum_721(unsigned char *p)
 {
 	return ((p[0] & 0xff)
@@ -124,6 +132,8 @@ static void isosize(char *filenamep, int xflag, long divisor)
 
 	if ((fd = open(filenamep, O_RDONLY)) < 0)
 		err(EXIT_FAILURE, _("cannot open %s"), filenamep);
+	if (is_iso(fd))
+		warnx(_("%s: might not be iso file system"), filenamep);
 
 	if (lseek(fd, 16 << 11, 0) == (off_t) - 1)
 		err(EXIT_FAILURE, _("seek error on %s"), filenamep);
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 07/14] more: remove unnecessary variable
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (5 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 06/14] isosize: inform if file does not look like iso file system Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 08/14] tunelp: deprecation: remove command from default build Sami Kerola
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 text-utils/more.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/text-utils/more.c b/text-utils/more.c
index 163f016..41caeb1 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -1578,7 +1578,7 @@ void search(char buf[], FILE *file, register int n)
 	register long line2 = startline;
 	register long line3 = startline;
 	register int lncount;
-	int saveln, rv, rc;
+	int saveln, rc;
 	regex_t re;
 
 	context.line = saveln = Currline;
@@ -1595,7 +1595,7 @@ void search(char buf[], FILE *file, register int n)
 		line1 = Ftell(file);
 		rdline(file);
 		lncount++;
-		if ((rv = regexec(&re, Line, 0, NULL, 0)) == 0) {
+		if (regexec(&re, Line, 0, NULL, 0) == 0) {
 			if (--n == 0) {
 				if (lncount > 3 || (lncount > 1 && no_intty)) {
 					putchar('\n');
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 08/14] tunelp: deprecation: remove command from default build
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (6 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 07/14] more: remove unnecessary variable Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 09/14] minix: change types in header file Sami Kerola
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

It is difficult to think think tunelp command being in use a lot.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 Documentation/deprecated.txt |  4 ++++
 configure.ac                 | 10 ++++++++++
 sys-utils/Makemodule.am      |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/Documentation/deprecated.txt b/Documentation/deprecated.txt
index 7d2dac1..666ed63 100644
--- a/Documentation/deprecated.txt
+++ b/Documentation/deprecated.txt
@@ -41,6 +41,10 @@ What:   losetup output format without --list
 
 --------------------------
 
+What:	tunelp
+Why:	parallel port printers are probably almost extinct devices
+
+--------------------------
 
 What:	elvtune
 Why:	useless for kernel >= 2.6.9
diff --git a/configure.ac b/configure.ac
index 3be3715..3e4f23c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -671,6 +671,7 @@ AC_ARG_ENABLE([most-builds],
 if test "x$enable_most_builds" = xyes; then
   enable_arch=check
   enable_elvtune=check
+  enable_tunelp=yes
   enable_last=yes
   enable_line=yes
   enable_mesg=yes
@@ -989,6 +990,15 @@ UL_REQUIRES_LINUX([elvtune])
 AM_CONDITIONAL(BUILD_ELVTUNE, test "x$build_elvtune" = xyes)
 
 
+AC_ARG_ENABLE([tunelp],
+  AS_HELP_STRING([--enable-tunelp], [build tunelp]),
+  [], enable_tunelp=no
+)
+UL_BUILD_INIT([tunelp])
+UL_REQUIRES_LINUX([tunelp])
+AM_CONDITIONAL(BUILD_TUNELP, test "x$build_tunelp" = xyes)
+
+
 AC_ARG_ENABLE([kill],
   AS_HELP_STRING([--disable-kill], [do not build kill]),
   [], enable_kill=check
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
index c7b1eb3..33112fb 100644
--- a/sys-utils/Makemodule.am
+++ b/sys-utils/Makemodule.am
@@ -73,9 +73,11 @@ dist_man_MANS += sys-utils/ldattach.8
 ldattach_SOURCES = sys-utils/ldattach.c
 ldattach_LDADD = $(LDADD) libcommon.la
 
+if BUILD_TUNELP
 usrsbin_exec_PROGRAMS += tunelp
 dist_man_MANS += sys-utils/tunelp.8
 tunelp_SOURCES = sys-utils/tunelp.c sys-utils/lp.h
+endif
 
 usrsbin_exec_PROGRAMS += rtcwake
 dist_man_MANS += sys-utils/rtcwake.8
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 09/14] minix: change types in header file
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (7 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 08/14] tunelp: deprecation: remove command from default build Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 10/14] minix: use off_t, size_t, etc appropriate types Sami Kerola
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/minix_programs.h | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/disk-utils/minix_programs.h b/disk-utils/minix_programs.h
index 4af1a34..7ad308d 100644
--- a/disk-utils/minix_programs.h
+++ b/disk-utils/minix_programs.h
@@ -28,7 +28,7 @@ static inline unsigned long get_ninodes(void)
 	case 3:
 		return Super3.s_ninodes;
 	default:
-		return (unsigned long)Super.s_ninodes;
+		return Super.s_ninodes;
 	}
 }
 
@@ -36,11 +36,11 @@ static inline unsigned long get_nzones(void)
 {
 	switch (fs_version) {
 	case 3:
-		return (unsigned long)Super3.s_zones;
+		return Super3.s_zones;
 	case 2:
-		return (unsigned long)Super.s_zones;
+		return Super.s_zones;
 	default:
-		return (unsigned long)Super.s_nzones;
+		return Super.s_nzones;
 	}
 }
 
@@ -48,9 +48,9 @@ static inline unsigned long get_nimaps(void)
 {
 	switch (fs_version) {
 	case 3:
-		return (unsigned long)Super3.s_imap_blocks;
+		return Super3.s_imap_blocks;
 	default:
-		return (unsigned long)Super.s_imap_blocks;
+		return Super.s_imap_blocks;
 	}
 }
 
@@ -58,43 +58,43 @@ static inline unsigned long get_nzmaps(void)
 {
 	switch (fs_version) {
 	case 3:
-		return (unsigned long)Super3.s_zmap_blocks;
+		return Super3.s_zmap_blocks;
 	default:
-		return (unsigned long)Super.s_zmap_blocks;
+		return Super.s_zmap_blocks;
 	}
 }
 
-static inline unsigned long get_first_zone(void)
+static inline off_t get_first_zone(void)
 {
 	switch (fs_version) {
 	case 3:
-		return (unsigned long)Super3.s_firstdatazone;
+		return Super3.s_firstdatazone;
 	default:
-		return (unsigned long)Super.s_firstdatazone;
+		return Super.s_firstdatazone;
 	}
 }
 
-static inline unsigned long get_zone_size(void)
+static inline size_t get_zone_size(void)
 {
 	switch (fs_version) {
 	case 3:
-		return (unsigned long)Super3.s_log_zone_size;
+		return Super3.s_log_zone_size;
 	default:
-		return (unsigned long)Super.s_log_zone_size;
+		return Super.s_log_zone_size;
 	}
 }
 
-static inline unsigned long get_max_size(void)
+static inline size_t get_max_size(void)
 {
 	switch (fs_version) {
 	case 3:
-		return (unsigned long)Super3.s_max_size;
+		return Super3.s_max_size;
 	default:
-		return (unsigned long)Super.s_max_size;
+		return Super.s_max_size;
 	}
 }
 
-static unsigned long inode_blocks(void)
+static inline unsigned long inode_blocks(void)
 {
 	switch (fs_version) {
 	case 3:
@@ -105,12 +105,12 @@ static unsigned long inode_blocks(void)
 	}
 }
 
-static inline unsigned long first_zone_data(void)
+static inline off_t first_zone_data(void)
 {
 	return 2 + get_nimaps() + get_nzmaps() + inode_blocks();
 }
 
-static inline unsigned long get_inode_buffer_size(void)
+static inline size_t get_inode_buffer_size(void)
 {
 	return inode_blocks() * MINIX_BLOCK_SIZE;
 }
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 10/14] minix: use off_t, size_t, etc appropriate types
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (8 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 09/14] minix: change types in header file Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:43 ` [PATCH 11/14] minix: replace magic constants with macro names Sami Kerola
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/fsck.minix.c | 12 ++++++------
 disk-utils/mkfs.minix.c |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index f24a9f2..6189b0b 100644
--- a/disk-utils/fsck.minix.c
+++ b/disk-utils/fsck.minix.c
@@ -584,9 +584,9 @@ read_superblock(void) {
 static void
 read_tables(void) {
 	unsigned long inodes = get_ninodes();
-	unsigned long buffsz = get_inode_buffer_size();
-	unsigned long norm_first_zone = first_zone_data();
-	unsigned long first_zone = get_first_zone();
+	size_t buffsz = get_inode_buffer_size();
+	off_t norm_first_zone = first_zone_data();
+	off_t first_zone = get_first_zone();
 	unsigned long zones = get_nzones();
 	unsigned long imaps = get_nimaps();
 	unsigned long zmaps = get_nzmaps();
@@ -999,7 +999,7 @@ static void
 check_file2(struct minix2_inode *dir, unsigned int offset) {
 	static char blk[MINIX_BLOCK_SIZE];
 	struct minix2_inode *inode;
-	unsigned long ino;
+	ino_t ino;
 	char *name;
 	int block;
 
@@ -1064,7 +1064,7 @@ check_file2(struct minix2_inode *dir, unsigned int offset) {
 static void
 recursive_check(unsigned int ino) {
 	struct minix_inode *dir;
-	unsigned int offset;
+	off_t offset;
 
 	dir = Inode + ino;
 	if (!S_ISDIR(dir->i_mode))
@@ -1081,7 +1081,7 @@ recursive_check(unsigned int ino) {
 static void
 recursive_check2(unsigned int ino) {
 	struct minix2_inode *dir;
-	unsigned int offset;
+	off_t offset;
 
 	dir = Inode2 + ino;
 	if (!S_ISDIR(dir->i_mode))
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 343ec68..b445c0c 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -188,7 +188,7 @@ static void super_set_state(void)
 static void write_tables(void) {
 	unsigned long imaps = get_nimaps();
 	unsigned long zmaps = get_nzmaps();
-	unsigned long buffsz = get_inode_buffer_size();
+	size_t buffsz = get_inode_buffer_size();
 
 	/* Mark the super block valid. */
 	super_set_state();
@@ -552,8 +552,8 @@ static void setup_tables(void) {
  * Perform a test of a block; return the number of
  * blocks readable/writeable.
  */
-static long do_check(char * buffer, int try, unsigned int current_block) {
-	long got;
+static size_t do_check(char * buffer, int try, unsigned int current_block) {
+	ssize_t got;
 	
 	/* Seek to the correct loc. */
 	if (lseek(DEV, current_block * MINIX_BLOCK_SIZE, SEEK_SET) !=
@@ -587,7 +587,7 @@ static void alarm_intr(int alnum __attribute__ ((__unused__))) {
 }
 
 static void check_blocks(void) {
-	int try,got;
+	size_t try, got;
 	static char buffer[MINIX_BLOCK_SIZE * TEST_BUFFER_BLOCKS];
 	unsigned long zones = get_nzones();
 	unsigned long first_zone = get_first_zone();
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 11/14] minix: replace magic constants with macro names
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (9 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 10/14] minix: use off_t, size_t, etc appropriate types Sami Kerola
@ 2012-12-16 10:43 ` Sami Kerola
  2012-12-16 10:44 ` [PATCH 12/14] docs: add missing exit value to fsck.minix(8) Sami Kerola
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:43 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/fsck.minix.c | 14 +++++++-------
 disk-utils/mkfs.minix.c |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index 6189b0b..8e9ee22 100644
--- a/disk-utils/fsck.minix.c
+++ b/disk-utils/fsck.minix.c
@@ -168,7 +168,7 @@ static char *zone_map;
 static void
 reset(void) {
 	if (termios_set)
-		tcsetattr(0, TCSANOW, &termios);
+		tcsetattr(STDIN_FILENO, TCSANOW, &termios);
 }
 
 static void
@@ -294,7 +294,7 @@ check_mount(void) {
 		return;
 
 	printf(_("%s is mounted.	 "), device_name);
-	if (isatty(0) && isatty(1))
+	if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO))
 		cont = ask(_("Do you really want to continue"), 0);
 	else
 		cont = 0;
@@ -1238,7 +1238,7 @@ int
 main(int argc, char **argv) {
 	struct termios tmp;
 	int count;
-	int retcode = 0;
+	int retcode = FSCK_EX_OK;
 
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
@@ -1297,7 +1297,7 @@ main(int argc, char **argv) {
 		usage();
 	check_mount();		/* trying to check a mounted filesystem? */
 	if (repair && !automatic) {
-		if (!isatty(0) || !isatty(1))
+		if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO))
 			die(_("need terminal for interactive repairs"));
 	}
 	IN = open(device_name, repair ? O_RDWR : O_RDONLY);
@@ -1330,10 +1330,10 @@ main(int argc, char **argv) {
 	signal(SIGTERM, fatalsig);
 
 	if (repair && !automatic) {
-		tcgetattr(0, &termios);
+		tcgetattr(STDIN_FILENO, &termios);
 		tmp = termios;
 		tmp.c_lflag &= ~(ICANON | ECHO);
-		tcsetattr(0, TCSANOW, &tmp);
+		tcsetattr(STDIN_FILENO, TCSANOW, &tmp);
 		termios_set = 1;
 	}
 
@@ -1381,7 +1381,7 @@ main(int argc, char **argv) {
 		write_super_block();
 
 	if (repair && !automatic)
-		tcsetattr(0, TCSANOW, &termios);
+		tcsetattr(STDIN_FILENO, TCSANOW, &termios);
 
 	if (changed)
 		retcode += 3;
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index b445c0c..bbfee32 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -666,7 +666,7 @@ int main(int argc, char ** argv) {
 	if (argc == 2 &&
 	    (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) {
 		printf(_("%s (%s)\n"), program_name, PACKAGE_STRING);
-		exit(0);
+		exit(MKFS_EX_OK);
 	}
 
 	if (INODE_SIZE * MINIX_INODES_PER_BLOCK != MINIX_BLOCK_SIZE)
@@ -806,5 +806,5 @@ int main(int argc, char ** argv) {
 	write_tables();
 	close(DEV);
 
-	return 0;
+	return MKFS_EX_OK;
 }
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 12/14] docs: add missing exit value to fsck.minix(8)
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (10 preceding siblings ...)
  2012-12-16 10:43 ` [PATCH 11/14] minix: replace magic constants with macro names Sami Kerola
@ 2012-12-16 10:44 ` Sami Kerola
  2012-12-16 10:44 ` [PATCH 13/14] lib/ismounted: detect loopback mounts Sami Kerola
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:44 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

And remove references to manual pages which has not been part of commonly
used distributions for a while.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/fsck.minix.8 | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/disk-utils/fsck.minix.8 b/disk-utils/fsck.minix.8
index e84b82b..4458f09 100644
--- a/disk-utils/fsck.minix.8
+++ b/disk-utils/fsck.minix.8
@@ -79,14 +79,10 @@ Force a filesystem check even if the filesystem was marked as valid (this
 marking is done by the kernel when the filesystem is unmounted).
 .SH "SEE ALSO"
 .BR fsck (8),
-.BR fsck.ext (8),
 .BR fsck.ext2 (8),
-.BR fsck.xiafs (8),
 .BR mkfs (8),
 .BR mkfs.minix (8),
-.BR mkfs.ext (8),
 .BR mkfs.ext2 (8),
-.BR mkfs.xiafs (8),
 .BR reboot (8)
 .SH DIAGNOSTICS
 There are numerous diagnostic messages.  The ones mentioned here are the
@@ -109,6 +105,8 @@ Filesystem errors corrected, system should be rebooted if filesystem was
 mounted
 .IP 4
 Filesystem errors left uncorrected
+.IP 7
+Combination of exit codes 3 and 4
 .IP 8
 Operational error
 .IP 16
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 13/14] lib/ismounted: detect loopback mounts
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (11 preceding siblings ...)
  2012-12-16 10:44 ` [PATCH 12/14] docs: add missing exit value to fsck.minix(8) Sami Kerola
@ 2012-12-16 10:44 ` Sami Kerola
  2012-12-19 13:38   ` Karel Zak
  2012-12-16 10:44 ` [PATCH 14/14] docs: fsck(8), mkfs(8): update manual references Sami Kerola
  2012-12-19 14:29 ` [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Karel Zak
  14 siblings, 1 reply; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:44 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

While double checking the minix changes worked I noticed fsck.minix not
to abort check if the file system was mounted using loopback device.  The
commands before this commit which one needs to reproduce the issue are:

dd if=/dev/zero count=100 of=minixfs
./mkfs.minix ./minixfs
mkdir x
./mount ./minixfs x
./fsck.minix minixfs

One would expect to see following print out.

minixfs is mounted.
check aborted.

Neither did that appear, nor the fsck check got to be aborted.  It seems
the generic fsck, and mkswap had same problem as they rely on
is_mounted().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 lib/Makemodule.am | 1 +
 lib/ismounted.c   | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index 806f9e5..244a9e8 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -76,6 +76,7 @@ test_blkdev_LDADD = libcommon.la
 
 test_ismounted_SOURCES = lib/ismounted.c
 test_ismounted_CFLAGS = -DTEST_PROGRAM
+test_ismounted_LDADD = $(LDADD) libcommon.la libmount.la
 
 test_wholedisk_SOURCES = lib/wholedisk.c
 test_wholedisk_CFLAGS = -DTEST_PROGRAM
diff --git a/lib/ismounted.c b/lib/ismounted.c
index 273a7d9..c3545bb 100644
--- a/lib/ismounted.c
+++ b/lib/ismounted.c
@@ -25,6 +25,7 @@
 
 #include "pathnames.h"
 #include "ismounted.h"
+#include "loopdev.h"
 #include "c.h"
 
 #ifdef HAVE_MNTENT_H
@@ -42,7 +43,7 @@ static int check_mntent_file(const char *mtab_file, const char *file,
 	dev_t		file_dev=0, file_rdev=0;
 	ino_t		file_ino=0;
 	FILE		*f;
-	int		fd;
+	int		fd, src_is_file = 1;
 
 	*mount_flags = 0;
 	if ((f = setmntent (mtab_file, "r")) == NULL)
@@ -55,6 +56,7 @@ static int check_mntent_file(const char *mtab_file, const char *file,
 		} else {
 			file_dev = st_buf.st_dev;
 			file_ino = st_buf.st_ino;
+			src_is_file = 0;
 		}
 	}
 	while ((mnt = getmntent (f)) != NULL) {
@@ -63,12 +65,14 @@ static int check_mntent_file(const char *mtab_file, const char *file,
 		if (strcmp(file, mnt->mnt_fsname) == 0)
 			break;
 		if (stat(mnt->mnt_fsname, &st_buf) == 0) {
-			if (S_ISBLK(st_buf.st_mode)) {
+			if (S_ISBLK(st_buf.st_mode) && src_is_file) {
 #ifndef __GNU__
 				if (file_rdev && (file_rdev == st_buf.st_rdev))
 					break;
 #endif	/* __GNU__ */
 			} else {
+				if (is_loopdev(mnt->mnt_fsname))
+					stat(loopdev_get_backing_file(mnt->mnt_fsname), &st_buf);
 				if (file_dev && ((file_dev == st_buf.st_dev) &&
 						 (file_ino == st_buf.st_ino)))
 					break;
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 14/14] docs: fsck(8), mkfs(8): update manual references
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (12 preceding siblings ...)
  2012-12-16 10:44 ` [PATCH 13/14] lib/ismounted: detect loopback mounts Sami Kerola
@ 2012-12-16 10:44 ` Sami Kerola
  2012-12-19 13:54   ` Karel Zak
  2012-12-19 14:29 ` [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Karel Zak
  14 siblings, 1 reply; 18+ messages in thread
From: Sami Kerola @ 2012-12-16 10:44 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/fsck.8 | 16 +++++-----------
 disk-utils/mkfs.8 | 10 ++++------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/disk-utils/fsck.8 b/disk-utils/fsck.8
index 344a06f..21e79da 100644
--- a/disk-utils/fsck.8
+++ b/disk-utils/fsck.8
@@ -451,17 +451,11 @@ enables debug output.
 .SH SEE ALSO
 .BR fstab (5),
 .BR mkfs (8),
-.BR fsck.ext2 (8)
-or
-.BR fsck.ext3 (8)
-or
 .BR e2fsck (8),
-.BR cramfsck (8),
-.BR fsck.minix (8),
-.BR fsck.msdos (8),
+.BR e2fsck.conf (5),
+.BR jfs_fsck (8),
+.BR jfs_fscklog (8),
 .BR fsck.jfs (8),
-.BR fsck.nfs (8),
-.BR fsck.vfat (8),
+.BR fsck.minix (8),
 .BR fsck.xfs (8),
-.BR fsck.xiafs (8),
-.BR reiserfsck (8).
+.BR reiserfsck (8)
diff --git a/disk-utils/mkfs.8 b/disk-utils/mkfs.8
index af9304b..c8e3d22 100644
--- a/disk-utils/mkfs.8
+++ b/disk-utils/mkfs.8
@@ -94,17 +94,15 @@ for the ext2 filesystem.
 .BR fs (5),
 .BR badblocks (8),
 .BR fsck (8),
-.BR mkdosfs (8),
-.BR mke2fs (8),
 .BR mkfs.bfs (8),
 .BR mkfs.ext2 (8),
 .BR mkfs.ext3 (8),
 .BR mkfs.ext4 (8),
+.BR mkfs.ext4dev (8),
+.BR mkfs.jfs (8),
+.BR jfs_mkfs (8),
 .BR mkfs.minix (8),
-.BR mkfs.msdos (8),
-.BR mkfs.vfat (8),
-.BR mkfs.xfs (8),
-.BR mkfs.xiafs (8)
+.BR mkfs.xfs (8)
 .SH AVAILABILITY
 The mkfs command is part of the util-linux package and is available from
 ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 13/14] lib/ismounted: detect loopback mounts
  2012-12-16 10:44 ` [PATCH 13/14] lib/ismounted: detect loopback mounts Sami Kerola
@ 2012-12-19 13:38   ` Karel Zak
  0 siblings, 0 replies; 18+ messages in thread
From: Karel Zak @ 2012-12-19 13:38 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Dec 16, 2012 at 10:44:01AM +0000, Sami Kerola wrote:
> While double checking the minix changes worked I noticed fsck.minix not
> to abort check if the file system was mounted using loopback device.  The
> commands before this commit which one needs to reproduce the issue are:
> 
> dd if=/dev/zero count=100 of=minixfs
> ./mkfs.minix ./minixfs
> mkdir x
> ./mount ./minixfs x
> ./fsck.minix minixfs

 Nice catch, although I have doubts that this is expected way how use
 fsck ;-)

> Neither did that appear, nor the fsck check got to be aborted.  It seems
> the generic fsck, and mkswap had same problem as they rely on
> is_mounted().

 fsck(8) uses libmount and this use case (fsck <fs image>) is ignored
 there. Not sure if we want to support it... 
 
 (It's not so easy, because you can use --offset and --sizelimit in losetup, 
  and you need these information to (reliable) found connection between 
  the image and a filesystem. It's already implemented in libmount,
  but it seems like overkill for fsck. I'll think about it.... :-)

>  lib/Makemodule.am | 1 +
>  lib/ismounted.c   | 8 ++++++--
>  2 files changed, 7 insertions(+), 2 deletions(-)

 I have applied a little different solution. Thanks.

    Karel

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 14/14] docs: fsck(8), mkfs(8): update manual references
  2012-12-16 10:44 ` [PATCH 14/14] docs: fsck(8), mkfs(8): update manual references Sami Kerola
@ 2012-12-19 13:54   ` Karel Zak
  0 siblings, 0 replies; 18+ messages in thread
From: Karel Zak @ 2012-12-19 13:54 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Dec 16, 2012 at 10:44:02AM +0000, Sami Kerola wrote:
>  .SH SEE ALSO
>  .BR fstab (5),
>  .BR mkfs (8),
> -.BR fsck.ext2 (8)
> -or
> -.BR fsck.ext3 (8)
> -or
>  .BR e2fsck (8),
> -.BR cramfsck (8),
> -.BR fsck.minix (8),
> -.BR fsck.msdos (8),
> +.BR e2fsck.conf (5),
> +.BR jfs_fsck (8),
> +.BR jfs_fscklog (8),

 Everything other than fsck.<type> (mkfs.<type>, mount.<type>) is
 wrong and invisible for the regular system tools.

 The question is if we really need the references to the filesystem
 specific fsck man pages (the list of supported filesystems is disto
 specific) ... why jfs, why not xfs, etc.
 
 Maybe it would be better to add a note that "description for the
 filesystem specific fsck programs is possible to found in
 fsck.<type>(8) man pages where <type> is filesystem name".

    Karel

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc
  2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
                   ` (13 preceding siblings ...)
  2012-12-16 10:44 ` [PATCH 14/14] docs: fsck(8), mkfs(8): update manual references Sami Kerola
@ 2012-12-19 14:29 ` Karel Zak
  14 siblings, 0 replies; 18+ messages in thread
From: Karel Zak @ 2012-12-19 14:29 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Sun, Dec 16, 2012 at 10:43:48AM +0000, Sami Kerola wrote:
> This review / pull request is partial resubmission.  The ipc stuff was
> sent to list earlier, but it got to be modified after initial review so
> here comes the modified version.
> 
> In these patches there are two documentation bug fixes (0001, 0005), and
> one code bug fix (0013).  There is also one policy change (0008), which
> makes tunelp not to be part of default build.  My feeling is that the
> utility is not much in use.  Please correct if I am wrong, and drop the
> patch.

 That's probably good idea, --enable-tunelp should be enough.

>       docs: swapon.8 option name fix

 This reminds me, what about to use "swapon --show" by default if no
 option is specified? Now "swapon" prints help...

 We did the same change for "losetup", if nothing is requested then
 it prints the list of the loop devices.

>       ipcs: assist debugging
>       ipcs: add --human readable size conversion option

 I have aligned the "size" columns to the right. It's more readable.

>       ipcs: add --bytes size output option
>       isosize: fix usage() -h option print out
>       isosize: inform if file does not look like iso file system
>       more: remove unnecessary variable
>       tunelp: deprecation: remove command from default build
>       minix: change types in header file
>       minix: use off_t, size_t, etc appropriate types
>       minix: replace magic constants with macro names
>       docs: add missing exit value to fsck.minix(8)
>       lib/ismounted: detect loopback mounts

applied

>       docs: fsck(8), mkfs(8): update manual references

not applied

    Karel

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-12-19 15:56 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-16 10:43 [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Sami Kerola
2012-12-16 10:43 ` [PATCH 01/14] docs: swapon.8 option name fix Sami Kerola
2012-12-16 10:43 ` [PATCH 02/14] ipcs: assist debugging Sami Kerola
2012-12-16 10:43 ` [PATCH 03/14] ipcs: add --human readable size conversion option Sami Kerola
2012-12-16 10:43 ` [PATCH 04/14] ipcs: add --bytes size output option Sami Kerola
2012-12-16 10:43 ` [PATCH 05/14] isosize: fix usage() -h option print out Sami Kerola
2012-12-16 10:43 ` [PATCH 06/14] isosize: inform if file does not look like iso file system Sami Kerola
2012-12-16 10:43 ` [PATCH 07/14] more: remove unnecessary variable Sami Kerola
2012-12-16 10:43 ` [PATCH 08/14] tunelp: deprecation: remove command from default build Sami Kerola
2012-12-16 10:43 ` [PATCH 09/14] minix: change types in header file Sami Kerola
2012-12-16 10:43 ` [PATCH 10/14] minix: use off_t, size_t, etc appropriate types Sami Kerola
2012-12-16 10:43 ` [PATCH 11/14] minix: replace magic constants with macro names Sami Kerola
2012-12-16 10:44 ` [PATCH 12/14] docs: add missing exit value to fsck.minix(8) Sami Kerola
2012-12-16 10:44 ` [PATCH 13/14] lib/ismounted: detect loopback mounts Sami Kerola
2012-12-19 13:38   ` Karel Zak
2012-12-16 10:44 ` [PATCH 14/14] docs: fsck(8), mkfs(8): update manual references Sami Kerola
2012-12-19 13:54   ` Karel Zak
2012-12-19 14:29 ` [00/14]: pull: ipcs resubmission, bug fixes, minix todo, etc Karel Zak

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