Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] Fix install-exec-hook to check whether wall and write were built
From: Kirill Elagin @ 2011-07-05 17:13 UTC (permalink / raw)
  To: util-linux

Signed-off-by: Kirill Elagin <kirelagin@gmail.com>
---
 term-utils/Makefile.am |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/term-utils/Makefile.am b/term-utils/Makefile.am
index 5e03560..8ab9d0b 100644
--- a/term-utils/Makefile.am
+++ b/term-utils/Makefile.am
@@ -66,9 +66,15 @@ endif

 if USE_TTY_GROUP
 if MAKEINSTALL_DO_CHOWN
+if BUILD_WALL
 install-exec-hook::
-   chgrp tty $(DESTDIR)$(usrbin_execdir)/wall $(DESTDIR)$(usrbin_execdir)/write
-   chmod g+s $(DESTDIR)$(usrbin_execdir)/wall $(DESTDIR)$(usrbin_execdir)/write
-
+   chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
+   chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
+endif
+if BUILD_WRITE
+install-exec-hook::
+   chgrp tty $(DESTDIR)$(usrbin_execdir)/write
+   chmod g+s $(DESTDIR)$(usrbin_execdir)/write
+endif
 endif
 endif
--
1.7.3.4

^ permalink raw reply related

* [PATCH] lscpu: add support for books
From: Heiko Carstens @ 2011-07-05 11:29 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

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

This patch adds support for books in cpu topology output. Books are
currently only present on the s390 architecture, however it looks like
others will follow to use the extra scheduling domain of the kernel.

Books are logically between sockets and nodes. Therefore change the
parseable output accordingly to reflect this. Please note that I assume
that other programs that get fed by the output of lscpu actually parse
the last comment line and react in a sane way if new entries appear in
the cpu list.

Also the readable output is changed from
"CPU socket(s):" to "Socket(s) per book:" or simply "Socket(s):" in the
absence of books.
    
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---

 sys-utils/lscpu.c |   46 +++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 0c49b54..91cf97d 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -113,6 +113,11 @@ struct lscpu_desc {
 	int		nnodes;		/* number of NUMA modes */
 	cpu_set_t	**nodemaps;	/* array with NUMA nodes */
 
+	/* books -- based on book_siblings (internal kernel map of cpuX's
+	 * hardware threads within the same book */
+	int		nbooks;		/* number of all online books */
+	cpu_set_t	**bookmaps;	/* unique book_siblings */
+
 	/* sockets -- based on core_siblings (internal kernel map of cpuX's
 	 * hardware threads within the same physical_package_id (socket)) */
 	int		nsockets;	/* number of all online sockets */
@@ -583,7 +588,7 @@ static int add_cpuset_to_array(cpu_set_t **ary, int *items, cpu_set_t *set)
 static void
 read_topology(struct lscpu_desc *desc, int num)
 {
-	cpu_set_t *thread_siblings, *core_siblings;
+	cpu_set_t *thread_siblings, *core_siblings, *book_siblings;
 
 	if (!path_exist(_PATH_SYS_CPU "/cpu%d/topology/thread_siblings", num))
 		return;
@@ -592,17 +597,24 @@ read_topology(struct lscpu_desc *desc, int num)
 					"/cpu%d/topology/thread_siblings", num);
 	core_siblings = path_cpuset(_PATH_SYS_CPU
 					"/cpu%d/topology/core_siblings", num);
+	book_siblings = NULL;
+	if (path_exist(_PATH_SYS_CPU "/cpu%d/topology/book_siblings", num)) {
+		book_siblings = path_cpuset(_PATH_SYS_CPU
+					    "/cpu%d/topology/book_siblings", num);
+	}
 
 	if (!desc->coremaps) {
-		int ncores, nsockets, nthreads;
+		int nbooks, nsockets, ncores, nthreads;
 		size_t setsize = CPU_ALLOC_SIZE(maxcpus);
 
 		/* threads within one core */
 		nthreads = CPU_COUNT_S(setsize, thread_siblings);
 		/* cores within one socket */
 		ncores = CPU_COUNT_S(setsize, core_siblings) / nthreads;
-		/* number of sockets */
+		/* number of sockets within one book */
 		nsockets = desc->ncpus / nthreads / ncores;
+		/* number of books */
+		nbooks = desc->ncpus / nthreads / ncores / nsockets;
 
 		/* all threads, see also read_basicinfo()
 		 * -- this is fallback for kernels where is not
@@ -610,7 +622,11 @@ read_topology(struct lscpu_desc *desc, int num)
 		 */
 		if (!desc->nthreads)
 			desc->nthreads = nsockets * ncores * nthreads;
-
+		if (book_siblings) {
+			desc->bookmaps = calloc(nbooks, sizeof(cpu_set_t *));
+			if (!desc->bookmaps)
+				err(EXIT_FAILURE, _("error: calloc failed"));
+		}
 		desc->socketmaps = calloc(nsockets, sizeof(cpu_set_t *));
 		if (!desc->socketmaps)
 			err(EXIT_FAILURE, _("error: calloc failed"));
@@ -621,6 +637,8 @@ read_topology(struct lscpu_desc *desc, int num)
 
 	add_cpuset_to_array(desc->socketmaps, &desc->nsockets, core_siblings);
 	add_cpuset_to_array(desc->coremaps, &desc->ncores, thread_siblings);
+	if (book_siblings)
+		add_cpuset_to_array(desc->bookmaps, &desc->nbooks, book_siblings);
 }
 
 static int
@@ -732,7 +750,7 @@ print_parsable(struct lscpu_desc *desc)
 	"# The following is the parsable format, which can be fed to other\n"
 	"# programs. Each different item in every column has an unique ID\n"
 	"# starting from zero.\n"
-	"# CPU,Core,Socket,Node"));
+	"# CPU,Core,Socket,Book,Node"));
 
 	if (desc->ncaches) {
 		/* separator between CPU topology and cache information */
@@ -771,6 +789,16 @@ print_parsable(struct lscpu_desc *desc)
 		if (j == desc->nsockets)
 			putchar(',');
 
+		/* Book */
+		for (j = 0; j < desc->nbooks; j++) {
+			if (CPU_ISSET_S(i, setsize, desc->bookmaps[j])) {
+				printf(",%d", j);
+				break;
+			}
+		}
+		if (j == desc->nbooks)
+			putchar(',');
+
 		/* Nodes */
 		for (j = 0; j < desc->nnodes; j++) {
 			if (CPU_ISSET_S(i, setsize, desc->nodemaps[j])) {
@@ -883,9 +911,13 @@ print_readable(struct lscpu_desc *desc, int hex)
 	if (desc->nsockets) {
 		print_n(_("Thread(s) per core:"), desc->nthreads / desc->ncores);
 		print_n(_("Core(s) per socket:"), desc->ncores / desc->nsockets);
-		print_n(_("CPU socket(s):"), desc->nsockets);
+		if (desc->nbooks) {
+			print_n(_("Socket(s) per book:"), desc->nsockets / desc->nbooks);
+ 			print_n(_("Book(s):"), desc->nbooks);
+		} else {
+			print_n(_("Socket(s):"), desc->nsockets);
+		}
 	}
-
 	if (desc->nnodes)
 		print_n(_("NUMA node(s):"), desc->nnodes);
 	if (desc->vendor)

^ permalink raw reply related

* [PATCH] fdisk: use a single variable for the current disklabel
From: Francesco Cosoleto @ 2011-07-03 10:01 UTC (permalink / raw)
  To: util-linux; +Cc: Francesco Cosoleto

Using a variable for each supported partition table type doesn't seem necessary.

This fixes also a minor bug in switching from SGI label to SUN label: the expert
menu isn't available as sgi_label variable remains set to true.

Code a bit more clear as *_label names have similarity with names such as
"sgilabel", "struct sun_label".

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
 fdisk/fdisk.c         |  142 ++++++++++++++++++++++++-------------------------
 fdisk/fdisk.h         |   15 ++++--
 fdisk/fdiskaixlabel.c |    5 +--
 fdisk/fdiskmaclabel.c |    5 +--
 fdisk/fdisksgilabel.c |    6 +--
 fdisk/fdisksunlabel.c |    4 +-
 6 files changed, 85 insertions(+), 92 deletions(-)

diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index f62fd0f..f6a2bc4 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -235,12 +235,8 @@ unsigned long grain = DEFAULT_SECTOR_SIZE,
 	      alignment_offset;
 int has_topology;
 
-#define dos_label (!sun_label && !sgi_label && !aix_label && !mac_label && !osf_label)
-int	sun_label = 0;			/* looking at sun disklabel */
-int	sgi_label = 0;			/* looking at sgi disklabel */
-int	aix_label = 0;			/* looking at aix disklabel */
-int	osf_label = 0;			/* looking at OSF/1 disklabel */
-int	mac_label = 0;			/* looking at mac disklabel */
+enum labeltype disklabel = DOS_LABEL;	/* Current disklabel */
+
 int	possibly_osf_label = 0;
 
 jmp_buf listingbuf;
@@ -379,7 +375,7 @@ is_dos_partition(int t) {
 
 static void
 menu(void) {
-	if (sun_label) {
+	if (disklabel == SUN_LABEL) {
 	   puts(_("Command action"));
 	   puts(_("   a   toggle a read only flag"));		/* sun */
 	   puts(_("   b   edit bsd disklabel"));
@@ -398,7 +394,7 @@ menu(void) {
 	   puts(_("   w   write table to disk and exit"));
 	   puts(_("   x   extra functionality (experts only)"));
 	}
-	else if (sgi_label) {
+	else if (disklabel == SGI_LABEL) {
 	   puts(_("Command action"));
 	   puts(_("   a   select bootable partition"));    /* sgi flavour */
 	   puts(_("   b   edit bootfile entry"));          /* sgi */
@@ -416,7 +412,7 @@ menu(void) {
 	   puts(_("   v   verify the partition table"));
 	   puts(_("   w   write table to disk and exit"));
 	}
-	else if (aix_label || mac_label) {
+	else if (disklabel == AIX_LABEL || disklabel == MAC_LABEL) {
 	   puts(_("Command action"));
 	   puts(_("   m   print this menu"));
 	   puts(_("   o   create a new empty DOS partition table"));
@@ -446,7 +442,7 @@ menu(void) {
 
 static void
 xmenu(void) {
-	if (sun_label) {
+	if (disklabel == SUN_LABEL) {
 	   puts(_("Command action"));
 	   puts(_("   a   change number of alternate cylinders"));      /*sun*/
 	   puts(_("   c   change number of cylinders"));
@@ -464,7 +460,7 @@ xmenu(void) {
 	   puts(_("   w   write table to disk and exit"));
 	   puts(_("   y   change number of physical cylinders"));	/*sun*/
 	}
-	else if (sgi_label) {
+	else if (disklabel == SGI_LABEL) {
 	   puts(_("Command action"));
 	   puts(_("   b   move beginning of data in a partition")); /* !sun */
 	   puts(_("   c   change number of cylinders"));
@@ -480,7 +476,7 @@ xmenu(void) {
 	   puts(_("   v   verify the partition table"));
 	   puts(_("   w   write table to disk and exit"));
 	}
-	else if (aix_label || mac_label) {
+	else if (disklabel == AIX_LABEL || disklabel == MAC_LABEL) {
 	   puts(_("Command action"));
 	   puts(_("   b   move beginning of data in a partition")); /* !sun */
 	   puts(_("   c   change number of cylinders"));
@@ -519,16 +515,16 @@ xmenu(void) {
 static int
 get_sysid(int i) {
 	return (
-		sun_label ? sun_get_sysid(i) :
-		sgi_label ? sgi_get_sysid(i) :
+		disklabel == SUN_LABEL ? sun_get_sysid(i) :
+		disklabel == SGI_LABEL ? sgi_get_sysid(i) :
 		ptes[i].part_table->sys_ind);
 }
 
 static struct systypes *
 get_sys_types(void) {
 	return (
-		sun_label ? sun_sys_types :
-		sgi_label ? sgi_sys_types :
+		disklabel == SUN_LABEL ? sun_sys_types :
+		disklabel == SGI_LABEL ? sgi_sys_types :
 		i386_sys_types);
 }
 
@@ -729,7 +725,7 @@ warn_geometry(void) {
 	char *m = NULL;
 	int prev = 0;
 
-	if (sgi_label)	/* cannot set cylinders etc anyway */
+	if (disklabel == SGI_LABEL)	/* cannot set cylinders etc anyway */
 		return 0;
 	if (!heads)
 		prev = test_c(&m, _("heads"));
@@ -938,7 +934,8 @@ create_doslabel(void) {
 		id);
 	sun_nolabel();  /* otherwise always recognised as sun */
 	sgi_nolabel();  /* otherwise always recognised as sgi */
-	mac_label = aix_label = osf_label = possibly_osf_label = 0;
+	disklabel = DOS_LABEL;
+	possibly_osf_label = 0;
 	partitions = 4;
 
 	/* Zero out the MBR buffer */
@@ -1233,7 +1230,7 @@ get_boot(enum action what) {
 	if (check_osf_label()) {
 		possibly_osf_label = 1;
 		if (!valid_part_table_flag(MBRbuffer)) {
-			osf_label = 1;
+			disklabel = OSF_LABEL;
 			return 0;
 		}
 		printf(_("This disk has both DOS and BSD magic.\n"
@@ -1543,11 +1540,11 @@ get_partition_dflt(int warn, int max, int dflt) {
 	pe = &ptes[i];
 
 	if (warn) {
-		if ((!sun_label && !sgi_label && !pe->part_table->sys_ind)
-		    || (sun_label &&
+		if ((disklabel != SUN_LABEL && disklabel != SGI_LABEL && !pe->part_table->sys_ind)
+		    || (disklabel == SUN_LABEL &&
 			(!sunlabel->partitions[i].num_sectors ||
 			 !sunlabel->part_tags[i].tag))
-		    || (sgi_label && (!sgi_get_num_sectors(i)))
+		    || (disklabel == SGI_LABEL && (!sgi_get_num_sectors(i)))
 		   )
 			fprintf(stderr,
 				_("Warning: partition %d has empty type\n"),
@@ -1576,6 +1573,7 @@ get_existing_partition(int warn, int max) {
 			pno = i;
 		}
 	}
+
 	if (pno >= 0) {
 		printf(_("Selected partition %d\n"), pno+1);
 		return pno;
@@ -1673,12 +1671,12 @@ delete_partition(int i) {
 		return;		/* C/H/S not set */
 	pe->changed = 1;
 
-	if (sun_label) {
+	if (disklabel == SUN_LABEL) {
 		sun_delete_partition(i);
 		return;
 	}
 
-	if (sgi_label) {
+	if (disklabel == SGI_LABEL) {
 		sgi_delete_partition(i);
 		return;
 	}
@@ -1741,7 +1739,7 @@ change_sysid(void) {
 	/* If sgi_label then don't use get_existing_partition,
 	   let the user select a partition, since get_existing_partition()
 	   only works for Linux like partition tables. */
-	if (!sgi_label) {
+	if (disklabel != SGI_LABEL) {
 		i = get_existing_partition(0, partitions);
 	} else {
 		i = get_partition(0, partitions);
@@ -1754,12 +1752,12 @@ change_sysid(void) {
 
 	/* if changing types T to 0 is allowed, then
 	   the reverse change must be allowed, too */
-	if (!sys && !sgi_label && !sun_label && !get_nr_sects(p))
+	if (!sys && disklabel != SGI_LABEL && disklabel != SUN_LABEL && !get_nr_sects(p))
                 printf(_("Partition %d does not exist yet!\n"), i + 1);
         else while (1) {
 		sys = read_hex (get_sys_types());
 
-		if (!sys && !sgi_label && !sun_label) {
+		if (!sys && disklabel != SGI_LABEL && disklabel != SUN_LABEL) {
 			printf(_("Type 0 means free space to many systems\n"
 			       "(but not to Linux). Having partitions of\n"
 			       "type 0 is probably unwise. You can delete\n"
@@ -1767,7 +1765,7 @@ change_sysid(void) {
 			/* break; */
 		}
 
-		if (!sun_label && !sgi_label) {
+		if (disklabel != SGI_LABEL && disklabel != SUN_LABEL) {
 			if (IS_EXTENDED (sys) != IS_EXTENDED (p->sys_ind)) {
 				printf(_("You cannot change a partition into"
 				       " an extended one or vice versa\n"
@@ -1777,12 +1775,12 @@ change_sysid(void) {
 		}
 
                 if (sys < 256) {
-			if (sun_label && i == 2 && sys != SUN_TAG_BACKUP)
+			if (disklabel == SUN_LABEL && i == 2 && sys != SUN_TAG_BACKUP)
 				printf(_("Consider leaving partition 3 "
 				       "as Whole disk (5),\n"
 				       "as SunOS/Solaris expects it and "
 				       "even Linux likes it.\n\n"));
-			if (sgi_label && ((i == 10 && sys != ENTIRE_DISK)
+			if (disklabel == SGI_LABEL && ((i == 10 && sys != ENTIRE_DISK)
 					  || (i == 8 && sys != 0)))
 				printf(_("Consider leaving partition 9 "
 				       "as volume header (0),\nand "
@@ -1790,10 +1788,10 @@ change_sysid(void) {
 				       "as IRIX expects it.\n\n"));
                         if (sys == origsys)
 				break;
-			if (sun_label) {
+			if (disklabel == SUN_LABEL) {
 				ptes[i].changed = sun_change_sysid(i, sys);
 			} else
-			if (sgi_label) {
+			if (disklabel == SGI_LABEL) {
 				ptes[i].changed = sgi_change_sysid(i, sys);
 			} else {
 				p->sys_ind = sys;
@@ -1931,7 +1929,7 @@ list_disk_geometry(void) {
 				min_io_size, io_size);
 	if (alignment_offset)
 		printf(_("Alignment offset: %lu bytes\n"), alignment_offset);
-	if (dos_label)
+	if (disklabel == DOS_LABEL)
 		dos_print_mbr_id();
 	printf("\n");
 }
@@ -2077,19 +2075,19 @@ list_table(int xtra) {
 	char *type;
 	int i, w;
 
-	if (sun_label) {
+	if (disklabel == SUN_LABEL) {
 		sun_list_table(xtra);
 		return;
 	}
 
-	if (sgi_label) {
+	if (disklabel == SGI_LABEL) {
 		sgi_list_table(xtra);
 		return;
 	}
 
 	list_disk_geometry();
 
-	if (osf_label) {
+	if (disklabel == OSF_LABEL) {
 		xbsd_print_disklabel(xtra);
 		return;
 	}
@@ -2146,7 +2144,7 @@ list_table(int xtra) {
 	/* Is partition table in disk order? It need not be, but... */
 	/* partition table entries are not checked for correct order if this
 	   is a sgi, sun or aix labeled disk... */
-	if (dos_label && wrong_p_order(NULL)) {
+	if (disklabel == DOS_LABEL && wrong_p_order(NULL)) {
 		printf(_("\nPartition table entries are not in disk order\n"));
 	}
 }
@@ -2235,12 +2233,12 @@ verify(void) {
 	if (warn_geometry())
 		return;
 
-	if (sun_label) {
+	if (disklabel == SUN_LABEL) {
 		verify_sun();
 		return;
 	}
 
-	if (sgi_label) {
+	if (disklabel == SGI_LABEL) {
 		verify_sgi(1);
 		return;
 	}
@@ -2489,17 +2487,17 @@ new_partition(void) {
 	if (warn_geometry())
 		return;
 
-	if (sun_label) {
+	if (disklabel == SUN_LABEL) {
 		add_sun_partition(get_partition(0, partitions), LINUX_NATIVE);
 		return;
 	}
 
-	if (sgi_label) {
+	if (disklabel == SGI_LABEL) {
 		sgi_add_partition(get_partition(0, partitions), LINUX_NATIVE);
 		return;
 	}
 
-	if (aix_label) {
+	if (disklabel == AIX_LABEL) {
 		printf(_("\tSorry - this fdisk cannot handle AIX disk labels."
 			 "\n\tIf you want to add DOS-type partitions, create"
 			 "\n\ta new empty DOS partition table first. (Use o.)"
@@ -2508,7 +2506,7 @@ new_partition(void) {
 		return;
 	}
 
-	if (mac_label) {
+	if (disklabel == MAC_LABEL) {
 		printf(_("\tSorry - this fdisk cannot handle Mac disk labels."
 		         "\n\tIf you want to add DOS-type partitions, create"
 		         "\n\ta new empty DOS partition table first. (Use o.)"
@@ -2576,7 +2574,7 @@ static void
 write_table(void) {
 	int i;
 
-	if (dos_label) {
+	if (disklabel == DOS_LABEL) {
 		/* MBR (primary partitions) */
 		if (!MBRbuffer_changed) {
 			for (i = 0; i < 4; i++)
@@ -2597,10 +2595,10 @@ write_table(void) {
 			}
 		}
 	}
-	else if (sgi_label) {
+	else if (disklabel == SGI_LABEL) {
 		/* no test on change? the printf below might be mistaken */
 		sgi_write_table();
-	} else if (sun_label) {
+	} else if (disklabel == SUN_LABEL) {
 		int needw = 0;
 
 		for (i=0; i<8; i++)
@@ -2681,7 +2679,7 @@ print_raw(void) {
 	int i;
 
 	printf(_("Device: %s\n"), disk_device);
-	if (sun_label || sgi_label)
+	if (disklabel == SUN_LABEL || disklabel == SGI_LABEL)
 		print_buffer(MBRbuffer);
 	else for (i = 3; i < partitions; i++)
 		print_buffer(ptes[i].sectorbuffer);
@@ -2745,34 +2743,34 @@ xselect(void) {
 		c = tolower(read_char(_("Expert command (m for help): ")));
 		switch (c) {
 		case 'a':
-			if (sun_label)
+			if (disklabel == SUN_LABEL)
 				sun_set_alt_cyl();
 			break;
 		case 'b':
-			if (dos_label)
+			if (disklabel == DOS_LABEL)
 				move_begin(get_partition(0, partitions));
 			break;
 		case 'c':
 			user_cylinders = cylinders =
 				read_int(1, cylinders, 1048576, 0,
 					 _("Number of cylinders"));
-			if (sun_label)
+			if (disklabel == SUN_LABEL)
 				sun_set_ncyl(cylinders);
 			break;
 		case 'd':
 			print_raw();
 			break;
 		case 'e':
-			if (sgi_label)
+			if (disklabel == SGI_LABEL)
 				sgi_set_xcyl();
-			else if (sun_label)
+			else if (disklabel == SUN_LABEL)
 				sun_set_xcyl();
 			else
-			if (dos_label)
+			if (disklabel == DOS_LABEL)
 				x_list_table(1);
 			break;
 		case 'f':
-			if (dos_label)
+			if (disklabel == DOS_LABEL)
 				fix_partition_table_order();
 			break;
 		case 'g':
@@ -2784,17 +2782,17 @@ xselect(void) {
 			update_units();
 			break;
 		case 'i':
-			if (sun_label)
+			if (disklabel == SUN_LABEL)
 				sun_set_ilfact();
-			if (dos_label)
+			else if (disklabel == DOS_LABEL)
 				dos_set_mbr_id();
 			break;
 		case 'o':
-			if (sun_label)
+			if (disklabel == SUN_LABEL)
 				sun_set_rspeed();
 			break;
 		case 'p':
-			if (sun_label)
+			if (disklabel == SUN_LABEL)
 				list_table(1);
 			else
 				x_list_table(0);
@@ -2822,7 +2820,7 @@ xselect(void) {
 			write_table(); 	/* does not return */
 			break;
 		case 'y':
-			if (sun_label)
+			if (disklabel == SUN_LABEL)
 				sun_set_pcylcount();
 			break;
 		default:
@@ -2888,7 +2886,7 @@ try(char *device, int user_specified) {
 		if (gb > 0) { /* I/O error */
 		} else if (gb < 0) { /* no DOS signature */
 			list_disk_geometry();
-			if (!aix_label && !mac_label && btrydev(device) < 0)
+			if (disklabel != AIX_LABEL && disklabel != MAC_LABEL && btrydev(device) < 0)
 				fprintf(stderr,
 					_("Disk %s doesn't contain a valid "
 					  "partition table\n"), device);
@@ -3082,14 +3080,14 @@ main(int argc, char **argv) {
 	gpt_warning(disk_device);
 	get_boot(fdisk);
 
-	if (osf_label) {
+	if (disklabel == OSF_LABEL) {
 		/* OSF label, and no DOS label */
 		printf(_("Detected an OSF/1 disklabel on %s, entering "
 			 "disklabel mode.\n"),
 		       disk_device);
 		bselect();
-		osf_label = 0;
 		/* If we return we may want to make an empty DOS label? */
+		disklabel = DOS_LABEL;
 	}
 
 	while (1) {
@@ -3097,19 +3095,19 @@ main(int argc, char **argv) {
 		c = tolower(read_char(_("Command (m for help): ")));
 		switch (c) {
 		case 'a':
-			if (dos_label)
+			if (disklabel == DOS_LABEL)
 				toggle_active(get_partition(1, partitions));
-			else if (sun_label)
+			else if (disklabel == SUN_LABEL)
 				toggle_sunflags(get_partition(1, partitions),
 						SUN_FLAG_UNMNT);
-			else if (sgi_label)
+			else if (disklabel == SGI_LABEL)
 				sgi_set_bootpartition(
 					get_partition(1, partitions));
 			else
 				unknown_command(c);
 			break;
 		case 'b':
-			if (sgi_label) {
+			if (disklabel == SGI_LABEL) {
 				printf(_("\nThe current boot file is: %s\n"),
 				       sgi_get_bootfile());
 				if (read_chars(_("Please enter the name of the "
@@ -3121,12 +3119,12 @@ main(int argc, char **argv) {
 				bselect();
 			break;
 		case 'c':
-			if (dos_label)
+			if (disklabel == DOS_LABEL)
 				toggle_dos_compatibility_flag();
-			else if (sun_label)
+			else if (disklabel == SUN_LABEL)
 				toggle_sunflags(get_partition(1, partitions),
 						SUN_FLAG_RONLY);
-			else if (sgi_label)
+			else if (disklabel == SGI_LABEL)
 				sgi_set_swappartition(
 						get_partition(1, partitions));
 			else
@@ -3137,7 +3135,7 @@ main(int argc, char **argv) {
 			   let the user select a partition, since
 			   get_existing_partition() only works for Linux-like
 			   partition tables */
-        		if (!sgi_label) {
+			if (disklabel != SGI_LABEL) {
                 		j = get_existing_partition(1, partitions);
         		} else {
                 		j = get_partition(1, partitions);
@@ -3146,7 +3144,7 @@ main(int argc, char **argv) {
 				delete_partition(j);
 			break;
 		case 'i':
-			if (sgi_label)
+			if (disklabel == SGI_LABEL)
 				create_sgiinfo();
 			else
 				unknown_command(c);
@@ -3185,7 +3183,7 @@ main(int argc, char **argv) {
 			write_table(); 		/* does not return */
 			break;
 		case 'x':
-			if (sgi_label) {
+			if (disklabel == SGI_LABEL) {
 				fprintf(stderr,
 					_("\n\tSorry, no experts menu for SGI "
 					"partition tables available.\n\n"));
diff --git a/fdisk/fdisk.h b/fdisk/fdisk.h
index 302a7a7..9b7f4c7 100644
--- a/fdisk/fdisk.h
+++ b/fdisk/fdisk.h
@@ -94,11 +94,16 @@ extern const char * str_units(int);
 extern unsigned long long get_start_sect(struct partition *p);
 extern unsigned long long get_nr_sects(struct partition *p);
 
-extern int osf_label;
-extern int sun_label;
-extern int sgi_label;
-extern int aix_label;
-extern int mac_label;
+enum labeltype {
+	DOS_LABEL,
+	SUN_LABEL,
+	SGI_LABEL,
+	AIX_LABEL,
+	OSF_LABEL,
+	MAC_LABEL
+};
+
+extern enum labeltype disklabel;
 
 /* prototypes for fdiskbsdlabel.c */
 extern void bselect(void);
diff --git a/fdisk/fdiskaixlabel.c b/fdisk/fdiskaixlabel.c
index e7ee95d..9fde61f 100644
--- a/fdisk/fdiskaixlabel.c
+++ b/fdisk/fdiskaixlabel.c
@@ -42,7 +42,6 @@ void
 aix_nolabel( void )
 {
     aixlabel->magic = 0;
-    aix_label = 0;
     partitions = 4;
     zeroize_mbr_buffer();
     return;
@@ -53,17 +52,15 @@ check_aix_label( void )
 {
     if (aixlabel->magic != AIX_LABEL_MAGIC &&
 	aixlabel->magic != AIX_LABEL_MAGIC_SWAPPED) {
-	aix_label = 0;
 	other_endian = 0;
 	return 0;
     }
     other_endian = (aixlabel->magic == AIX_LABEL_MAGIC_SWAPPED);
     update_units();
-    aix_label = 1;
+    disklabel = AIX_LABEL;
     partitions= 1016;
     volumes = 15;
     aix_info();
     aix_nolabel();		/* %% */
-    aix_label = 1;		/* %% */
     return 1;
 }
diff --git a/fdisk/fdiskmaclabel.c b/fdisk/fdiskmaclabel.c
index 4e3db20..e82347d 100644
--- a/fdisk/fdiskmaclabel.c
+++ b/fdisk/fdiskmaclabel.c
@@ -42,7 +42,6 @@ void
 mac_nolabel( void )
 {
     maclabel->magic = 0;
-    mac_label = 0;
     partitions = 4;
     zeroize_mbr_buffer();
     return;
@@ -65,7 +64,6 @@ check_mac_label( void )
 			goto IS_MAC;
 			break;
 		default:
-			mac_label = 0;
 			other_endian = 0;
 			return 0;
 
@@ -75,12 +73,11 @@ check_mac_label( void )
 IS_MAC:
     other_endian = (maclabel->magic == MAC_LABEL_MAGIC_SWAPPED); // =?
     update_units();
-    mac_label = 1;
+    disklabel = MAC_LABEL;
     partitions= 1016; // =?
     volumes = 15;	// =?
     mac_info();
     mac_nolabel();		/* %% */
-    mac_label = 1;		/* %% */
     return 1;
 }
 
diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c
index b5cbadb..cb00e76 100644
--- a/fdisk/fdisksgilabel.c
+++ b/fdisk/fdisksgilabel.c
@@ -132,7 +132,6 @@ sgi_get_pcylcount(void) {
 void
 sgi_nolabel() {
 	sgilabel->magic = 0;
-	sgi_label = 0;
 	partitions = 4;
 }
 
@@ -158,7 +157,6 @@ check_sgi_label() {
 
 	if (sgilabel->magic != SGI_LABEL_MAGIC &&
 	    sgilabel->magic != SGI_LABEL_MAGIC_SWAPPED) {
-		sgi_label = 0;
 		other_endian = 0;
 		return 0;
 	}
@@ -173,7 +171,7 @@ check_sgi_label() {
 			_("Detected sgi disklabel with wrong checksum.\n"));
 	}
 	update_units();
-	sgi_label = 1;
+	disklabel = SGI_LABEL;
 	partitions= 16;
 	volumes = 15;
 	return 1;
@@ -780,7 +778,7 @@ create_sgilabel(void)
 	sgilabel->devparam.xylogics_writecont	= SSWAP16(0);
 	memset(&(sgilabel->directory), 0, sizeof(struct volume_directory)*15);
 	memset(&(sgilabel->partitions), 0, sizeof(struct sgi_partition)*16);
-	sgi_label  =  1;
+	disklabel  = SGI_LABEL;
 	partitions = 16;
 	volumes    = 15;
 	sgi_set_entire();
diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c
index 68596ee..e43d168 100644
--- a/fdisk/fdisksunlabel.c
+++ b/fdisk/fdisksunlabel.c
@@ -110,7 +110,6 @@ static void set_sun_partition(int i, uint32_t start, uint32_t stop, uint16_t sys
 
 void sun_nolabel(void)
 {
-	sun_label = 0;
 	sunlabel->magic = 0;
 	partitions = 4;
 }
@@ -122,7 +121,6 @@ int check_sun_label(void)
 
 	if (sunlabel->magic != SUN_LABEL_MAGIC &&
 	    sunlabel->magic != SUN_LABEL_MAGIC_SWAPPED) {
-		sun_label = 0;
 		other_endian = 0;
 		return 0;
 	}
@@ -177,7 +175,7 @@ int check_sun_label(void)
 		}
 	}
 	update_units();
-	sun_label = 1;
+	disklabel = SUN_LABEL;
 	partitions = SUN_NUM_PARTITIONS;
 	return 1;
 }
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 6/6] mount.8: fix typos
From: Petr Uzel @ 2011-07-01 13:51 UTC (permalink / raw)
  To: util-linux; +Cc: lamont
In-Reply-To: <1309528305-12626-1-git-send-email-petr.uzel@suse.cz>

Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530681#15
From: Nicolas Francois <nicolas.francois@centraliens.net>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
 mount/mount.8 |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mount/mount.8 b/mount/mount.8
index 886e6b4..b1666cb 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -804,7 +804,7 @@ and
 mount options.
 .TP
 .B noatime
-Do not update inode access times on this filesystem (e.g, for faster
+Do not update inode access times on this filesystem (e.g., for faster
 access on the news spool to speed up news servers).
 .TP
 .B auto
@@ -2408,7 +2408,7 @@ before trying
 .TP
 .B utf8
 UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the
-console. It can be be enabled for the filesystem with this option or disabled
+console. It can be enabled for the filesystem with this option or disabled
 with utf8=0, utf8=no or utf8=false. If `uni_xlate' gets set, UTF8 gets
 disabled.
 .TP
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 5/6] mount: make the error message clear
From: Petr Uzel @ 2011-07-01 13:51 UTC (permalink / raw)
  To: util-linux; +Cc: lamont
In-Reply-To: <1309528305-12626-1-git-send-email-petr.uzel@suse.cz>

Reported-by: Micah Anderson <micah@debian.org>
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558653

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

diff --git a/mount/mount.c b/mount/mount.c
index 00637f5..cb04d9d 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1765,7 +1765,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
       unsigned long long size = 0;
 
       if (flags & MS_REMOUNT) {
-	error (_("mount: %s not mounted already, or bad option"), node);
+	error (_("mount: %s not mounted or bad option"), node);
       } else {
 	error (_("mount: wrong fs type, bad option, bad superblock on %s,\n"
 	       "       missing codepage or helper program, or other error"),
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 4/6] mount.8: fix typo
From: Petr Uzel @ 2011-07-01 13:51 UTC (permalink / raw)
  To: util-linux; +Cc: lamont
In-Reply-To: <1309528305-12626-1-git-send-email-petr.uzel@suse.cz>

Reported-by: Reuben Thomas <rrt@sc3d.org>
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=603096

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

diff --git a/mount/mount.8 b/mount/mount.8
index 4259824..886e6b4 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -150,7 +150,7 @@ udev symlinks in the /etc/fstab file. The tags are
 more readable, robust and portable. The
 .BR mount (8)
 command internally uses udev
-symlinks, so use the symlinks in /etc/fstab is not advantage over LABEL=/UUID=.
+symlinks, so use the symlinks in /etc/fstab has no advantage over LABEL=/UUID=.
 For more details see
 .BR libblkid (3).
 
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 3/6] mount.8: fix typo
From: Petr Uzel @ 2011-07-01 13:51 UTC (permalink / raw)
  To: util-linux; +Cc: lamont
In-Reply-To: <1309528305-12626-1-git-send-email-petr.uzel@suse.cz>

Reported-by: Lars Wirzenius <liw@liw.fi>
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605007

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

diff --git a/mount/mount.8 b/mount/mount.8
index 598280c..4259824 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -1451,7 +1451,7 @@ RAID chunk size in filesystem blocks.
 Deferring block allocation until write-out time.
 .TP
 .BR nodelalloc
-Disable delayed allocation. Blocks are allocation when data is copied from user
+Disable delayed allocation. Blocks are allocated when data is copied from user
 to page cache.
 .TP
 .BI max_batch_time= usec
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 2/6] mount.8: remove accidental extra word in ext4 documentation
From: Petr Uzel @ 2011-07-01 13:51 UTC (permalink / raw)
  To: util-linux; +Cc: lamont
In-Reply-To: <1309528305-12626-1-git-send-email-petr.uzel@suse.cz>

Reported-by: Francis Russell <francis+dbts@unchartedbackwaters.co.uk>
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=599550

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

diff --git a/mount/mount.8 b/mount/mount.8
index 767ff51..598280c 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -1487,7 +1487,7 @@ debugging purposes.  This is normally used while
 remounting a filesystem which is already mounted.
 .TP
 .BR auto_da_alloc | noauto_da_alloc
-Many broken applications don't use fsync() when noauto_da_alloc
+Many broken applications don't use fsync() when
 replacing existing files via patterns such as
 
 fd = open("foo.new")/write(fd,..)/close(fd)/ rename("foo.new", "foo")
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 1/6] mount.8: fix reference to sharedsubtree documentation
From: Petr Uzel @ 2011-07-01 13:51 UTC (permalink / raw)
  To: util-linux; +Cc: lamont
In-Reply-To: <1309528305-12626-1-git-send-email-petr.uzel@suse.cz>

From: Mike Hommey <mh+reportbug@glandium.org>
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508572
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572403
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508412

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

diff --git a/mount/mount.8 b/mount/mount.8
index e9a52dd..767ff51 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -439,7 +439,7 @@ of that mount such that mounts and umounts within any of the mirrors propagate
 to the other mirror. A slave mount receives propagation from its master, but
 any not vice-versa.  A private mount carries no propagation abilities.  A
 unbindable mount is a private mount which cannot be cloned through a bind
-operation. Detailed semantics is documented in Documentation/sharedsubtree.txt
+operation. Detailed semantics is documented in Documentation/filesystems/sharedsubtree.txt
 file in the kernel source tree.
 
 .RS
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 0/6] Trivial documentation fixes
From: Petr Uzel @ 2011-07-01 13:51 UTC (permalink / raw)
  To: util-linux; +Cc: lamont

Hi,

this series contains trivial low-priority documentation fixes
for bugs in Debian BTS. References to bugs addressed
are mentioned in the commit messages.


Petr Uzel (6):
  mount.8: fix reference to sharedsubtree documentation
  mount.8: remove accidental extra word in ext4 documentation
  mount.8: fix typo
  mount.8: fix typo
  mount: make the error message clear
  mount.8: fix typos

 mount/mount.8 |   12 ++++++------
 mount/mount.c |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

-- 
1.7.3.4


^ permalink raw reply

* Re: [PATCH] sfdisk: warn if partition starts above 2 TiB limit
From: Petr Uzel @ 2011-07-01 13:33 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux
In-Reply-To: <20110701131140.GQ6418@nb.net.home>

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

On Fri, Jul 01, 2011 at 03:11:40PM +0200, Karel Zak wrote:
> On Fri, Jul 01, 2011 at 01:11:56PM +0200, Petr Uzel wrote:
> > 
> > Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
> > ---
> >  fdisk/sfdisk.c |   11 +++++++++++
> >  1 files changed, 11 insertions(+), 0 deletions(-)
> > 
> > diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
> > index 4ed5d37..d498371 100644
> > --- a/fdisk/sfdisk.c
> > +++ b/fdisk/sfdisk.c
> > @@ -1304,6 +1304,17 @@ partitions_ok(struct disk_desc *z) {
> >  	    }
> >      }
> >  
> > +    /* Do the partitions start below the DOS 2TiB limit? */
> > +    {
> > +	for (p = partitions; p < partitions + partno; p++)
> > +	    if (p->size && p->start > (unsigned long) UINT32_MAX) {
> 
>  ULONG_MAX is not greater than UINT32_MAX on 32-bit archs ;-)
> 
>  IMHO you have to use 64-bit number for the p->size or you have 
>  move the check to the place where (before) p->start is incremented.
> 
> > +	        my_warn(_("Warning: partition %s has starting sector %lu, "
> > +		          "which is above the DOS 2 TiB limit\n"),
> 
>  The warning is incorrect. The limit is not 2 TiB, but UINT32_MAX
>  *sectors*. It's 2TiB for 512-byte sectors, but for 4K sectors is it
>  more...
> 
>  See fdisk.fdisk.c: warn_limits().
> 
>     Karel

Thanks for the review! I'll rework the patch and resubmit.

Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

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

^ permalink raw reply

* Re: [PATCH] sfdisk: warn if partition starts above 2 TiB limit
From: Karel Zak @ 2011-07-01 13:11 UTC (permalink / raw)
  To: util-linux
In-Reply-To: <20110701111154.GA24105@foxbat.suse.cz>

On Fri, Jul 01, 2011 at 01:11:56PM +0200, Petr Uzel wrote:
> 
> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
> ---
>  fdisk/sfdisk.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
> index 4ed5d37..d498371 100644
> --- a/fdisk/sfdisk.c
> +++ b/fdisk/sfdisk.c
> @@ -1304,6 +1304,17 @@ partitions_ok(struct disk_desc *z) {
>  	    }
>      }
>  
> +    /* Do the partitions start below the DOS 2TiB limit? */
> +    {
> +	for (p = partitions; p < partitions + partno; p++)
> +	    if (p->size && p->start > (unsigned long) UINT32_MAX) {

 ULONG_MAX is not greater than UINT32_MAX on 32-bit archs ;-)

 IMHO you have to use 64-bit number for the p->size or you have 
 move the check to the place where (before) p->start is incremented.

> +	        my_warn(_("Warning: partition %s has starting sector %lu, "
> +		          "which is above the DOS 2 TiB limit\n"),

 The warning is incorrect. The limit is not 2 TiB, but UINT32_MAX
 *sectors*. It's 2TiB for 512-byte sectors, but for 4K sectors is it
 more...

 See fdisk.fdisk.c: warn_limits().

    Karel


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

^ permalink raw reply

* [PATCH] sfdisk: warn if partition starts above 2 TiB limit
From: Petr Uzel @ 2011-07-01 11:11 UTC (permalink / raw)
  To: util-linux

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


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

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 4ed5d37..d498371 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1304,6 +1304,17 @@ partitions_ok(struct disk_desc *z) {
 	    }
     }
 
+    /* Do the partitions start below the DOS 2TiB limit? */
+    {
+	for (p = partitions; p < partitions + partno; p++)
+	    if (p->size && p->start > (unsigned long) UINT32_MAX) {
+	        my_warn(_("Warning: partition %s has starting sector %lu, "
+		          "which is above the DOS 2 TiB limit\n"),
+			PNO(p), p->start);
+		return 0;
+	    }
+    }
+
     /* At most one chain of DOS extended partitions ? */
     /* It seems that the OS/2 fdisk has the additional requirement
        that the extended partition must be the fourth one */
-- 
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] sfdisk: warn if partition size exceeds 2 TiB limit
From: Petr Uzel @ 2011-07-01 11:11 UTC (permalink / raw)
  To: util-linux; +Cc: rangelino

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

From: Roberto Angelino <rangelino@novell.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
 fdisk/sfdisk.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 6cd85a2..4ed5d37 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1293,6 +1293,17 @@ partitions_ok(struct disk_desc *z) {
 	    }
     }
 
+    /* Are the partitions within the DOS 2TiB limit? */
+    {
+	for (p = partitions; p < partitions + partno; p++)
+	    if (p->size > (unsigned long) UINT32_MAX) {
+	        my_warn(_("Warning: partition %s of size %lu sectors exceeds "
+		          "msdos 2TiB limit\n"),
+		        PNO(p), p->size);
+	        return 0;
+	    }
+    }
+
     /* At most one chain of DOS extended partitions ? */
     /* It seems that the OS/2 fdisk has the additional requirement
        that the extended partition must be the fourth one */
-- 
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

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

^ permalink raw reply related

* Re: [PATCH] Don't try to chgrp write or wall if they are not built
From: Olaf Hering @ 2011-06-30 11:00 UTC (permalink / raw)
  To: Karel Zak; +Cc: Marc-Antoine Perennou, util-linux
In-Reply-To: <20110630103325.GN6418@nb.net.home>

On Thu, Jun 30, Karel Zak wrote:

>  Why do you expect that everyone uses any packaging system? The "make
>  install" result should be usable. Note that this all is controlled by
>  --disable-makeinstall-chown and --disable-makeinstall-setuid options.

Karel,

after I sent the mail I noticed the if MAKEINSTALL_DO_CHOWN,
so all should be fine.

Olaf

^ permalink raw reply

* Re: [PATCH] Don't try to chgrp write or wall if they are not built
From: Karel Zak @ 2011-06-30 10:33 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Marc-Antoine Perennou, util-linux
In-Reply-To: <20110630085327.GA8274@aepfle.de>

On Thu, Jun 30, 2011 at 10:53:27AM +0200, Olaf Hering wrote:
> On Thu, Jun 30, Marc-Antoine Perennou wrote:
> 
> > Fix regression from commit 4aa9d65bfa76afd0d886ca410ae83428a490d4ea
> > 
> > Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
> > ---
> >  term-utils/Makefile.am |   10 ++++++++--
> 
> > -       chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
> > $(DESTDIR)$(usrbin_execdir)/write
> > -       chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
> > $(DESTDIR)$(usrbin_execdir)/write
> > +if BUILD_WALL
> > +       chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
> 
> This is wrong and should part of the packaging system, not part of make
> install. The userid building util-linux is not neccessary part of the
> tty group.

 Why do you expect that everyone uses any packaging system? The "make
 install" result should be usable. Note that this all is controlled by
 --disable-makeinstall-chown and --disable-makeinstall-setuid options.

    Karel

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

^ permalink raw reply

* [git pull] blockdev fixes
From: Sami Kerola @ 2011-06-30  9:38 UTC (permalink / raw)
  To: util-linux

The following changes since commit 37b94458bd0f4a178233ad0366a727bf5bde879f:

  sfdisk: fix coding style. (2011-06-29 12:47:38 +0200)

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

Sami Kerola (8):
      blockdev: set options read only
      blockdev: remove progname
      blockdev: add --help option
      blockdev: use libc error facilities
      blockdev: use pathnames.h to find partitions
      blockdev: broken compiler warning circumvention removed
      blockdev: type mismatch fix
      blockdev: coding style fix

 disk-utils/blockdev.c |  158 +++++++++++++++++++++---------------------------
 1 files changed, 69 insertions(+), 89 deletions(-)

diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c
index 27b1a0a..cb9a296 100644
--- a/disk-utils/blockdev.c
+++ b/disk-utils/blockdev.c
@@ -14,9 +14,7 @@
 #include "c.h"
 #include "nls.h"
 #include "blkdev.h"
-
-const char *progname;
-
+#include "pathnames.h"

 struct bdc {
 	long		ioc;		/* ioctl code */
@@ -52,7 +50,7 @@ enum {

 #define IOCTL_ENTRY( io )	.ioc = io, .iocname = # io

-struct bdc bdcms[] =
+static const struct bdc bdcms[] =
 {
 	{
 		IOCTL_ENTRY(BLKROSET),
@@ -178,35 +176,32 @@ struct bdc bdcms[] =
 	}
 };

-static void
-usage(void) {
-	int i;
-	fputc('\n', stderr);
-	fprintf(stderr, _("Usage:\n"));
-	fprintf(stderr, _("  %s -V\n"), progname);
-	fprintf(stderr, _("  %s --report [devices]\n"), progname);
-	fprintf(stderr, _("  %s [-v|-q] commands devices\n"), progname);
-	fputc('\n', stderr);
-
-	fprintf(stderr, _("Available commands:\n"));
-	fprintf(stderr, "  %-25s %s\n", "--getsz",
-			_("get size in 512-byte sectors"));
+static void __attribute__ ((__noreturn__)) usage(FILE * out)
+{
+	size_t i;
+	fprintf(out, _("\nUsage:\n"
+		       "  %1$s -V\n"
+		       "  %1$s --report [devices]\n"
+		       "  %1$s [-v|-q] commands devices\n\n"
+		       "Available commands:\n"), program_invocation_short_name);
+
+	fprintf(out, _("  %-25s get size in 512-byte sectors\n"), "--getsz");
 	for (i = 0; i < ARRAY_SIZE(bdcms); i++) {
 		if (bdcms[i].argname)
-			fprintf(stderr, "  %s %-*s %s\n", bdcms[i].name,
-					(int) (24 - strlen(bdcms[i].name)),
-					bdcms[i].argname, _(bdcms[i].help));
+			fprintf(out, "  %s %-*s %s\n", bdcms[i].name,
+				(int)(24 - strlen(bdcms[i].name)),
+				bdcms[i].argname, _(bdcms[i].help));
 		else
-			fprintf(stderr, "  %-25s %s\n", bdcms[i].name,
-					_(bdcms[i].help));
+			fprintf(out, "  %-25s %s\n", bdcms[i].name,
+				_(bdcms[i].help));
 	}
-	fputc('\n', stderr);
-	exit(1);
+	fputc('\n', out);
+	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }

-static int
-find_cmd(char *s) {
-	int j;
+static int find_cmd(char *s)
+{
+	size_t j;

 	for (j = 0; j < ARRAY_SIZE(bdcms); j++)
 		if (!strcmp(s, bdcms[j].name))
@@ -219,31 +214,25 @@ void report_header(void);
 void report_device(char *device, int quiet);
 void report_all_devices(void);

-int
-main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 	int fd, d, j, k;
-	char *p;
-
-	/* egcs-2.91.66 is buggy and says:
-	   blockdev.c:93: warning: `d' might be used uninitialized */
-	d = 0;
-
-	progname = argv[0];
-	if ((p = strrchr(progname, '/')) != NULL)
-		progname = p+1;

 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);

 	if (argc < 2)
-		usage();
+		usage(stderr);

 	/* -V not together with commands */
 	if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) {
-		printf(_("%s (%s)\n"), progname, PACKAGE_STRING);
-		exit(0);
+		printf(_("%s (%s)\n"), program_invocation_short_name,
+		       PACKAGE_STRING);
+		return EXIT_SUCCESS;
 	}
+	if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
+		usage(stdout);

 	/* --report not together with other commands */
 	if (!strcmp(argv[1], "--report")) {
@@ -254,7 +243,7 @@ main(int argc, char **argv) {
 		} else {
 			report_all_devices();
 		}
-		exit(0);
+		return EXIT_SUCCESS;
 	}

 	/* do each of the commands on each of the devices */
@@ -277,22 +266,20 @@ main(int argc, char **argv) {
 	}

 	if (d >= argc)
-		usage();
+		usage(stderr);

 	for (k = d; k < argc; k++) {
 		fd = open(argv[k], O_RDONLY, 0);
-		if (fd < 0) {
-			perror(argv[k]);
-			exit(1);
-		}
+		if (fd < 0)
+			err(EXIT_FAILURE, _("cannot open %s"), argv[k]);
 		do_commands(fd, argv, d);
 		close(fd);
 	}
-	return 0;
+	return EXIT_SUCCESS;
 }

-void
-do_commands(int fd, char **argv, int d) {
+void do_commands(int fd, char **argv, int d)
+{
 	int res, i, j;
 	int iarg;
 	unsigned int uarg;
@@ -318,18 +305,18 @@ do_commands(int fd, char **argv, int d) {
 			if (res == 0)
 				printf("%lld\n", llu);
 			else
-				exit(1);
+				errx(EXIT_FAILURE,
+				     _("could not get device size"));
 			continue;
 		}

 		j = find_cmd(argv[i]);
 		if (j == -1) {
-			fprintf(stderr, _("%s: Unknown command: %s\n"),
-				progname, argv[i]);
-			usage();
+			warnx(_("Unknown command: %s"), argv[i]);
+			usage(stderr);
 		}

-		switch(bdcms[j].argtype) {
+		switch (bdcms[j].argtype) {
 		default:
 		case ARG_NONE:
 			res = ioctl(fd, bdcms[j].ioc, 0);
@@ -340,18 +327,18 @@ do_commands(int fd, char **argv, int d) {
 			break;
 		case ARG_INT:
 			if (bdcms[j].argname) {
-				if (i == d-1) {
-					fprintf(stderr, _("%s requires an argument\n"),
-						bdcms[j].name);
-					usage();
+				if (i == d - 1) {
+					warnx(_("%s requires an argument"),
+					      bdcms[j].name);
+					usage(stderr);
 				}
 				iarg = atoi(argv[++i]);
 			} else
 				iarg = bdcms[j].argval;

 			res = bdcms[j].flags & FL_NOPTR ?
-					ioctl(fd, bdcms[j].ioc, iarg) :
-					ioctl(fd, bdcms[j].ioc, &iarg);
+			    ioctl(fd, bdcms[j].ioc, iarg) :
+			    ioctl(fd, bdcms[j].ioc, &iarg);
 			break;
 		case ARG_UINT:
 			uarg = bdcms[j].argval;
@@ -379,7 +366,7 @@ do_commands(int fd, char **argv, int d) {
 			perror(bdcms[j].iocname);
 			if (verbose)
 				printf(_("%s failed.\n"), _(bdcms[j].help));
-			exit(1);
+			exit(EXIT_FAILURE);
 		}

 		if (bdcms[j].argtype == ARG_NONE ||
@@ -392,7 +379,7 @@ do_commands(int fd, char **argv, int d) {
 		if (verbose)
 			printf("%s: ", _(bdcms[j].help));

-		switch(bdcms[j].argtype) {
+		switch (bdcms[j].argtype) {
 		case ARG_USHRT:
 			printf("%hu\n", huarg);
 			break;
@@ -418,26 +405,21 @@ do_commands(int fd, char **argv, int d) {
 	}
 }

-#define PROC_PARTITIONS "/proc/partitions"
-
-void
-report_all_devices(void) {
+void report_all_devices(void)
+{
 	FILE *procpt;
 	char line[200];
 	char ptname[200];
 	char device[210];
 	int ma, mi, sz;

-	procpt = fopen(PROC_PARTITIONS, "r");
-	if (!procpt) {
-		fprintf(stderr, _("%s: cannot open %s\n"),
-			progname, PROC_PARTITIONS);
-		exit(1);
-	}
+	procpt = fopen(_PATH_PROC_PARTITIONS, "r");
+	if (!procpt)
+		err(EXIT_FAILURE, _("cannot open %s"), _PATH_PROC_PARTITIONS);

 	while (fgets(line, sizeof(line), procpt)) {
-		if (sscanf (line, " %d %d %d %200[^\n ]",
-			    &ma, &mi, &sz, ptname) != 4)
+		if (sscanf(line, " %d %d %d %200[^\n ]",
+			   &ma, &mi, &sz, ptname) != 4)
 			continue;

 		sprintf(device, "/dev/%s", ptname);
@@ -447,8 +429,8 @@ report_all_devices(void) {
 	fclose(procpt);
 }

-void
-report_device(char *device, int quiet) {
+void report_device(char *device, int quiet)
+{
 	int fd;
 	int ro, ssz, bsz;
 	long ra;
@@ -458,31 +440,29 @@ report_device(char *device, int quiet) {
 	fd = open(device, O_RDONLY | O_NONBLOCK);
 	if (fd < 0) {
 		if (!quiet)
-			fprintf(stderr, _("%s: cannot open %s\n"),
-				progname, device);
+			warn(_("cannot open %s"), device);
 		return;
 	}

 	ro = ssz = bsz = 0;
 	g.start = ra = 0;
-	if (ioctl (fd, BLKROGET, &ro) == 0 &&
-	    ioctl (fd, BLKRAGET, &ra) == 0 &&
-	    ioctl (fd, BLKSSZGET, &ssz) == 0 &&
-	    ioctl (fd, BLKBSZGET, &bsz) == 0 &&
-	    ioctl (fd, HDIO_GETGEO, &g) == 0 &&
-	    blkdev_get_size (fd, &bytes) == 0) {
+	if (ioctl(fd, BLKROGET, &ro) == 0 &&
+	    ioctl(fd, BLKRAGET, &ra) == 0 &&
+	    ioctl(fd, BLKSSZGET, &ssz) == 0 &&
+	    ioctl(fd, BLKBSZGET, &bsz) == 0 &&
+	    ioctl(fd, HDIO_GETGEO, &g) == 0 &&
+	    blkdev_get_size(fd, &bytes) == 0) {
 		printf("%s %5ld %5d %5d %10ld %15lld   %s\n",
 		       ro ? "ro" : "rw", ra, ssz, bsz, g.start, bytes, device);
 	} else {
 		if (!quiet)
-			fprintf(stderr, _("%s: ioctl error on %s\n"),
-				progname, device);
+			warnx(_("ioctl error on %s"), device);
 	}

 	close(fd);
 }

-void
-report_header() {
+void report_header()
+{
 	printf(_("RO    RA   SSZ   BSZ   StartSec            Size   Device\n"));
 }

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/

^ permalink raw reply related

* Re: [PATCH] Don't try to chgrp write or wall if they are not built
From: Olaf Hering @ 2011-06-30  8:53 UTC (permalink / raw)
  To: Marc-Antoine Perennou; +Cc: util-linux
In-Reply-To: <BANLkTikpHa-0aVp7G7cpRw_ePOQQiuXSEYnrV-AgssjhFEf2zg@mail.gmail.com>

On Thu, Jun 30, Marc-Antoine Perennou wrote:

> Fix regression from commit 4aa9d65bfa76afd0d886ca410ae83428a490d4ea
> 
> Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
> ---
>  term-utils/Makefile.am |   10 ++++++++--

> -       chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
> $(DESTDIR)$(usrbin_execdir)/write
> -       chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
> $(DESTDIR)$(usrbin_execdir)/write
> +if BUILD_WALL
> +       chgrp tty $(DESTDIR)$(usrbin_execdir)/wall

This is wrong and should part of the packaging system, not part of make
install. The userid building util-linux is not neccessary part of the
tty group.

Olaf

^ permalink raw reply

* [PATCH] Don't try to chgrp write or wall if they are not built
From: Marc-Antoine Perennou @ 2011-06-30  0:26 UTC (permalink / raw)
  To: util-linux

Fix regression from commit 4aa9d65bfa76afd0d886ca410ae83428a490d4ea

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
---
 term-utils/Makefile.am |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/term-utils/Makefile.am b/term-utils/Makefile.am
index 5e03560..d5ba479 100644
--- a/term-utils/Makefile.am
+++ b/term-utils/Makefile.am
@@ -67,8 +67,14 @@ endif
 if USE_TTY_GROUP
 if MAKEINSTALL_DO_CHOWN
 install-exec-hook::
-       chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
$(DESTDIR)$(usrbin_execdir)/write
-       chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
$(DESTDIR)$(usrbin_execdir)/write
+if BUILD_WALL
+       chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
+       chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
+endif
+if BUILD_WRITE
+       chgrp tty $(DESTDIR)$(usrbin_execdir)/write
+       chmod g+s $(DESTDIR)$(usrbin_execdir)/write
+endif

 endif
 endif
-- 
1.7.6

^ permalink raw reply related

* [PATCH 3/3] mkfs.minix: document -3 option
From: Davidlohr Bueso @ 2011-06-29 17:28 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>
Date: Wed, 29 Jun 2011 13:01:10 -0400

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 disk-utils/mkfs.minix.8 |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/disk-utils/mkfs.minix.8 b/disk-utils/mkfs.minix.8
index add59c8..6a8ebae 100644
--- a/disk-utils/mkfs.minix.8
+++ b/disk-utils/mkfs.minix.8
@@ -64,6 +64,9 @@ Make a Minix version 1 filesystem.
 .TP
 .B  \-2,\-v
 Make a Minix version 2 filesystem.
+.TP
+.B \-3
+Make a Minix version 3 filesystem.
 .SH "EXIT CODES"
 The exit code returned by
 .B mkfs.minix
--=20
1.7.4.1

^ permalink raw reply related

* [PATCH 2/3] mkfs.minix: add minix v3 support
From: Davidlohr Bueso @ 2011-06-29 17:28 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>
Date: Wed, 29 Jun 2011 12:55:49 -0400

We can now create minix v3 filesystems. Support for this fs was added a few=
 years ago in the Linux kernel. One of the most important benefits is the a=
bility to handle file names up to 60 characters long.
With this change we also introduce the -3 option which naturally indicates =
which version to create. Version 1 is still left as the default one for bac=
kwards compatibility reasons.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 disk-utils/Makefile.am  |    2 +-
 disk-utils/mkfs.minix.c |  142 ++++++++++++++++++++++++++++++++++++-------=
----
 2 files changed, 110 insertions(+), 34 deletions(-)

diff --git a/disk-utils/Makefile.am b/disk-utils/Makefile.am
index cf4a3e8..7d018b5 100644
--- a/disk-utils/Makefile.am
+++ b/disk-utils/Makefile.am
@@ -16,7 +16,7 @@ dist_man_MANS =3D isosize.8 mkfs.8 mkswap.8 \
 sbin_PROGRAMS =3D mkfs mkswap fsck.minix mkfs.minix mkfs.bfs
=20
 fsck_minix_SOURCES =3D fsck.minix.c minix.h $(top_srcdir)/lib/ismounted.c
-mkfs_minix_SOURCES =3D mkfs.minix.c minix.h mkfs.h $(utils_common)
+mkfs_minix_SOURCES =3D mkfs.minix.c minix.h mkfs.h $(utils_common) $(top_s=
rcdir)/lib/strutils.c
 mkfs_bfs_SOURCES =3D mkfs.bfs.c $(utils_common)
=20
 swaplabel_SOURCES =3D swaplabel.c $(utils_common)
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 24b84db..fe7e53e 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -46,13 +46,18 @@
  * 02.07.96  -  Added small patch from Russell King to make the program a
  *		good deal more portable (janl@math.uio.no)
  *
- * Usage:  mkfs [-c | -l filename ] [-v] [-nXX] [-iXX] device [size-in-blo=
cks]
+ * 06.29.11  -  Overall cleanups for util-linux and v3 support
+ *              Davidlohr Bueso <dave@gnu.org>
+ *
+ * Usage:  mkfs [-c | -l filename ] [-12v3] [-nXX] [-iXX] device [size-in-=
blocks]
  *
  *	-c for readablility checking (SLOW!)
  *      -l for getting a list of bad blocks from a file.
  *	-n for namelength (currently the kernel only uses 14 or 30)
  *	-i for number of inodes
- *	-v for v2 filesystem
+ *      -1 for v1 filesystem
+ *	-2,-v for v2 filesystem
+ *      -3 for v3 filesystem
  *
  * The device may be a block device or a image of one, but this isn't
  * enforced (but it's not much fun on a character device :-).=20
@@ -78,6 +83,7 @@
 #include "pathnames.h"
 #include "bitops.h"
 #include "mkfs.h"
+#include "strutils.h"
=20
 #define MINIX_ROOT_INO 1
 #define MINIX_BAD_INO 2
@@ -93,8 +99,16 @@ static int DEV =3D -1;
 static unsigned long long BLOCKS =3D 0;
 static int check =3D 0;
 static int badblocks =3D 0;
-static int namelen =3D 30;	/* default (changed to 30, per Linus's
-				   suggestion, Sun Nov 21 08:05:07 1993) */
+
+/*=20
+ * default (changed to 30, per Linus's
+ * suggestion, Sun Nov 21 08:05:07 1993)=20
+ * This should be changed in the future to 60,=20
+ * since v3 needs to be the default nowadays (2011)=20
+ */
+static int namelen =3D 30;
+
+static unsigned long long blksz =3D 0;
 static int dirsize =3D 32;
 static int magic =3D MINIX_SUPER_MAGIC2;
 static int version2 =3D 0;
@@ -145,14 +159,27 @@ static void check_mount(void) {
 			device_name);
 }
=20
+static int *super_set_state_ptr(void)
+{
+	switch (fs_version) {
+	case 3:
+		Super3.s_state |=3D MINIX_VALID_FS;
+		Super3.s_state &=3D ~MINIX_ERROR_FS;
+		break;
+	default:
+		Super.s_state |=3D MINIX_VALID_FS;
+		Super.s_state &=3D ~MINIX_ERROR_FS;
+		break;
+	}
+}
+
 static void write_tables(void) {
 	unsigned long imaps =3D get_nimaps();
 	unsigned long zmaps =3D get_nzmaps();
 	unsigned long buffsz =3D get_inode_buffer_size();
=20
 	/* Mark the super block valid. */
-	Super.s_state |=3D MINIX_VALID_FS;
-	Super.s_state &=3D ~MINIX_ERROR_FS;
+	int *state =3D super_set_state_ptr();
=20
 	if (lseek(DEV, 0, SEEK_SET))
 		err(MKFS_ERROR, _("%s: seek to boot block failed "
@@ -217,7 +244,8 @@ static inline int next(int zone) {
 	return 0;
 }
=20
-static void make_bad_inode_v1(void) {
+static void make_bad_inode_v1(void)
+{
 	struct minix_inode * inode =3D &Inode[MINIX_BAD_INO];
 	int i,j,zone;
 	int ind=3D0,dind=3D0;
@@ -266,7 +294,8 @@ end_bad:
 		write_block(dind, (char *) dind_block);
 }
=20
-static void make_bad_inode_v2 (void) {
+static void make_bad_inode_v2_v3 (void)
+{
 	struct minix2_inode *inode =3D &Inode2[MINIX_BAD_INO];
 	int i, j, zone;
 	int ind =3D 0, dind =3D 0;
@@ -318,7 +347,7 @@ static void make_bad_inode(void)
 {
 	if (fs_version < 2)
 		return make_bad_inode_v1();
-	return make_bad_inode_v2();
+	return make_bad_inode_v2_v3();
 }
=20
 static void make_root_inode_v1(void) {
@@ -342,20 +371,22 @@ static void make_root_inode_v1(void) {
 	write_block(inode->i_zone[0],root_block);
 }
=20
-static void make_root_inode_v2 (void) {
+static void make_root_inode_v2_v3 (void) {
 	struct minix2_inode *inode =3D &Inode2[MINIX_ROOT_INO];
=20
 	mark_inode (MINIX_ROOT_INO);
 	inode->i_zone[0] =3D get_free_block ();
 	inode->i_nlinks =3D 2;
 	inode->i_atime =3D inode->i_mtime =3D inode->i_ctime =3D time (NULL);
+
 	if (badblocks)
 		inode->i_size =3D 3 * dirsize;
 	else {
 		root_block[2 * dirsize] =3D '\0';
-		root_block[2 * dirsize + 1] =3D '\0';
-		inode->i_size =3D 2 * dirsize;
+		if (fs_version =3D=3D 2)
+			inode->i_size =3D 2 * dirsize;
 	}
+
 	inode->i_mode =3D S_IFDIR + 0755;
 	inode->i_uid =3D getuid();
 	if (inode->i_uid)
@@ -367,12 +398,13 @@ static void make_root_inode(void)
 {
 	if (fs_version < 2)
 		return make_root_inode_v1();
-	return make_root_inode_v2();
+	return make_root_inode_v2_v3();
 }
=20
 static void super_set_nzones(void)
 {
 	switch (fs_version) {
+	case 3:
 	case 2:
 		Super.s_zones =3D BLOCKS;
 		break;
@@ -385,14 +417,48 @@ static void super_set_nzones(void)
 static void super_init_maxsize(void)
 {
 	switch (fs_version) {
+	case 3:
+		Super3.s_max_size =3D 2147483647L;
+		break;
 	case 2:
 		Super.s_max_size =3D  0x7fffffff;
+		break;
 	default: /* v1 */
 		Super.s_max_size =3D (7+512+512*512)*1024;
 		break;
 	}
 }
=20
+static void super_set_map_blocks(unsigned long inodes)
+{
+	switch (fs_version) {
+	case 3:
+		Super3.s_imap_blocks =3D UPPER(inodes + 1, BITS_PER_BLOCK);
+		Super3.s_zmap_blocks =3D UPPER(BLOCKS - (1+get_nimaps()+inode_blocks()),
+					     BITS_PER_BLOCK+1);
+		Super3.s_firstdatazone =3D first_zone_data();
+		break;
+	default:
+		Super.s_imap_blocks =3D UPPER(inodes + 1, BITS_PER_BLOCK);
+		Super.s_zmap_blocks =3D UPPER(BLOCKS - (1+get_nimaps()+inode_blocks()),
+					     BITS_PER_BLOCK+1);
+		Super.s_firstdatazone =3D first_zone_data();
+		break;
+	}
+}
+
+static void super_set_magic(void)
+{
+	switch (fs_version) {
+	case 3:
+		Super3.s_magic =3D magic;
+		break;
+	default:
+		Super.s_magic =3D magic;
+		break;
+	}
+}
+
 static void setup_tables(void) {
 	int i;
 	unsigned long inodes, zmaps, imaps, zones;
@@ -403,39 +469,42 @@ static void setup_tables(void) {
 				device_name);
=20
 	memset(boot_block_buffer,0,512);
-	Super.s_magic =3D magic;
-	Super.s_log_zone_size =3D 0;
+	super_set_magic();
+=09
+	if (fs_version =3D=3D 3) {
+		Super3.s_log_zone_size =3D 0;
+		Super3.s_blocksize =3D BLOCKS;
+	}
+	else {
+		Super.s_log_zone_size =3D 0;
+	}
=20
 	super_init_maxsize();
 	super_set_nzones();
 	zones =3D get_nzones();
=20
-/* some magic nrs: 1 inode / 3 blocks */
+	/* some magic nrs: 1 inode / 3 blocks */
 	if ( req_nr_inodes =3D=3D 0 )=20
 		inodes =3D BLOCKS/3;
 	else
 		inodes =3D req_nr_inodes;
 	/* Round up inode count to fill block size */
-	if (fs_version =3D=3D 2)
+	if (fs_version =3D=3D 2 || fs_version =3D=3D 3)
 		inodes =3D ((inodes + MINIX2_INODES_PER_BLOCK - 1) &
 			  ~(MINIX2_INODES_PER_BLOCK - 1));
 	else
 		inodes =3D ((inodes + MINIX_INODES_PER_BLOCK - 1) &
 			  ~(MINIX_INODES_PER_BLOCK - 1));
-	if (inodes > 65535)
-		inodes =3D 65535;
-	Super.s_ninodes =3D inodes;
-
-	/* The old code here
-	 * ZMAPS =3D 0;
-	 * while (ZMAPS !=3D UPPER(BLOCKS - NORM_FIRSTZONE + 1,BITS_PER_BLOCK))
-	 *	  ZMAPS =3D UPPER(BLOCKS - NORM_FIRSTZONE + 1,BITS_PER_BLOCK);
-	 * was no good, since it may loop. - aeb
-	 */
-	imaps =3D Super.s_imap_blocks =3D UPPER(inodes + 1, BITS_PER_BLOCK);
-	zmaps =3D Super.s_zmap_blocks =3D UPPER(BLOCKS - (1+get_nimaps()+inode_bl=
ocks()),
-				    BITS_PER_BLOCK+1);
-	Super.s_firstdatazone =3D first_zone_data();
+	if (inodes > MAX_INODES)
+		inodes =3D MAX_INODES;
+	if (fs_version =3D=3D 3)
+		Super3.s_ninodes =3D inodes;
+	else
+		Super.s_ninodes =3D inodes;
+
+	super_set_map_blocks(inodes);
+	imaps =3D get_nimaps();
+	zmaps =3D get_nzmaps();
=20
 	inode_map =3D malloc(imaps * BLOCK_SIZE);
 	zone_map =3D malloc(zmaps * BLOCK_SIZE);
@@ -586,7 +655,7 @@ int main(int argc, char ** argv) {
 		errx(MKFS_ERROR, _("%s: bad inode size"), device_name);
=20
 	opterr =3D 0;
-	while ((i =3D getopt(argc, argv, "ci:l:n:v12")) !=3D -1)
+	while ((i =3D getopt(argc, argv, "ci:l:n:v123")) !=3D -1)
 		switch (i) {
 		case 'c':
 			check=3D1; break;
@@ -616,6 +685,9 @@ int main(int argc, char ** argv) {
 			fs_version =3D 2;
 			version2 =3D 1;
 			break;
+		case '3':
+			fs_version =3D 3;
+			break;
 		default:
 			usage();
 		}
@@ -659,7 +731,7 @@ int main(int argc, char ** argv) {
 	if (S_ISBLK(statbuf.st_mode)) {
 		int sectorsize;
=20
-		if (blkdev_get_sector_size(DEV, &sectorsize) =3D=3D -1)
+	if (blkdev_get_sector_size(DEV, &sectorsize) =3D=3D -1)
 			sectorsize =3D DEFAULT_SECTOR_SIZE;		/* kernel < 2.3.3 */
=20
 		if (blkdev_is_misaligned(DEV))
@@ -682,6 +754,10 @@ int main(int argc, char ** argv) {
 		errx(MKFS_ERROR, _("will not try to make filesystem on '%s'"), device_na=
me);
 	if (BLOCKS < 10)
 		errx(MKFS_ERROR, _("%s: number of blocks too small"), device_name);
+
+	if (fs_version =3D=3D 3)
+		magic =3D MINIX3_SUPER_MAGIC;
+=09
 	if (fs_version =3D=3D 2) {
 		if (namelen =3D=3D 14)
 			magic =3D MINIX2_SUPER_MAGIC;
--=20
1.7.4.1

^ permalink raw reply related

* [PATCH 1/3] minix: add version 3 layout
From: Davidlohr Bueso @ 2011-06-29 17:28 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>
Date: Wed, 29 Jun 2011 12:55:18 -0400

Create a specific minix v3 superblock structure and adjust the attribute wr=
apper functions to handle it.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 disk-utils/minix.h |   83 +++++++++++++++++++++++++++++++++++++++++++++---=
----
 1 files changed, 72 insertions(+), 11 deletions(-)

diff --git a/disk-utils/minix.h b/disk-utils/minix.h
index 0ebaa26..fc1d1c0 100644
--- a/disk-utils/minix.h
+++ b/disk-utils/minix.h
@@ -47,10 +47,29 @@ struct minix_super_block {
         u32 s_zones;
 };
=20
+/* V3 minix super-block data on disk */
+struct minix3_super_block {
+	u32 s_ninodes;
+	u16 s_pad0;
+	u16 s_imap_blocks;
+	u16 s_zmap_blocks;
+	u16 s_firstdatazone;
+	u16 s_log_zone_size;
+	u16 s_pad1;
+	u32 s_max_size;
+	u32 s_zones;
+	u16 s_magic;
+	u16 s_pad2;
+	u16 s_blocksize;
+	u8  s_disk_version;
+        u16 s_state;
+};
+
 #define BLOCK_SIZE_BITS 10
 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
=20
-#define NAME_MAX         255   /* # chars in a file name */
+#define NAME_MAX   255   /* # chars in a file name */
+#define MAX_INODES 65535
=20
 #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))=
)
 #define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode=
)))
@@ -62,6 +81,7 @@ struct minix_super_block {
 #define MINIX_SUPER_MAGIC2   0x138F          /* minix fs, 30 char names */
 #define MINIX2_SUPER_MAGIC   0x2468	     /* minix V2 fs */
 #define MINIX2_SUPER_MAGIC2  0x2478	     /* minix V2 fs, 30 char names */
+#define MINIX3_SUPER_MAGIC   0x4d5a          /* minix V3 fs (60 char names=
) */
=20
 #endif /* KERNEL_INCLUDES_ARE_CLEAN */
=20
@@ -71,7 +91,7 @@ struct minix_super_block {
 #define INODE_SIZE (sizeof(struct minix_inode))
 #define INODE2_SIZE (sizeof(struct minix2_inode))
=20
-int fs_version =3D 1;
+int fs_version =3D 1; /* this default value needs to change in a near futu=
re */
 char *super_block_buffer, *inode_buffer =3D NULL;
=20
 static char *inode_map;
@@ -85,48 +105,89 @@ static char *zone_map;
  * wrappers to different superblock attributes
  */
 #define Super (*(struct minix_super_block *)super_block_buffer)
+#define Super3 (*(struct minix3_super_block *)super_block_buffer)
=20
 static inline unsigned long get_ninodes(void)
 {
-	return (unsigned long) Super.s_ninodes;
+	switch (fs_version) {
+	case 3:
+		return Super3.s_ninodes;
+	default:
+		return (unsigned long) Super.s_ninodes;
+	}
 }
=20
 static inline unsigned long get_nzones(void)
 {
-	return (unsigned long) fs_version =3D=3D 2 ? Super.s_zones : Super.s_nzon=
es;
+	switch (fs_version) {
+	case 3:
+		return (unsigned long) Super3.s_zones;
+	case 2:
+		return (unsigned long) Super.s_zones;
+	default:
+		return (unsigned long) Super.s_nzones;
+	}
 }
=20
 static inline unsigned long get_nimaps(void)
 {
-	return (unsigned long)Super.s_imap_blocks;
+	switch (fs_version) {
+	case 3:
+		return (unsigned long) Super3.s_imap_blocks;
+	default:
+		return (unsigned long) Super.s_imap_blocks;
+	}
 }
=20
 static inline unsigned long get_nzmaps(void)
 {
-	return (unsigned long)Super.s_zmap_blocks;
+	switch (fs_version) {
+	case 3:
+		return (unsigned long) Super3.s_zmap_blocks;
+	default:
+		return (unsigned long) Super.s_zmap_blocks;
+	}
 }
=20
 static inline unsigned long get_first_zone(void)
 {
-	return (unsigned long)Super.s_firstdatazone;
+	switch (fs_version) {
+	case 3:
+		return (unsigned long) Super3.s_firstdatazone;
+	default:
+		return (unsigned long) Super.s_firstdatazone;
+	}
 }
=20
 static inline unsigned long get_zone_size(void)
 {
-	return (unsigned long)Super.s_log_zone_size;
+	switch (fs_version) {
+	case 3:
+		return (unsigned long) Super3.s_log_zone_size;
+	default:
+		return (unsigned long) Super.s_log_zone_size;
+	}
 }
=20
 static inline unsigned long get_max_size(void)
 {
-	return (unsigned long)Super.s_max_size;
+	switch (fs_version) {
+	case 3:
+		return (unsigned long) Super3.s_max_size;
+	default:
+		return (unsigned long) Super.s_max_size;
+	}
 }
=20
 static unsigned long inode_blocks(void)
 {
-	if (fs_version =3D=3D 2)
+	switch (fs_version) {
+	case 3:
+	case 2:
 		return UPPER(get_ninodes(), MINIX2_INODES_PER_BLOCK);
-	else
+	default:
 		return UPPER(get_ninodes(), MINIX_INODES_PER_BLOCK);
+	}
 }
=20
 static inline unsigned long first_zone_data(void)
--=20
1.7.4.1

^ permalink raw reply related

* Re: [PATCH] dmesg.c: print human readable timestamp
From: Karel Zak @ 2011-06-29 14:59 UTC (permalink / raw)
  To: corentin.labbe; +Cc: util-linux
In-Reply-To: <4DD6593D.2090202@geomatys.fr>

On Fri, May 20, 2011 at 02:06:21PM +0200, corentin.labbe wrote:
> 
> This patch add the -H option to dmesg which allow to print human
> readable time instead of the number of seconds since boot.

 Nice idea, but it's not so simple :-(

 The time stamp used for printk() is not based on normal system time
 (as you know from gettimeofday()). It uses cpu_clock() (IMHO to
 keep printk() robust and without xtime_lock).

 The problem is that the cpu_clock is not updated after system resume,
 so if you suspend (e.g. pm-suspend(8)) and resume than the dmesg -H
 command prints nonsenses...

 For example (copy & past from /var/log/messages):

  Jun 27 23:39:53 nb kernel: [50065.238635] PM: Syncing filesystems  ... done.
  Jun 28 20:23:29 nb kernel: [50065.284226] Freezing user space  processes ... (elapsed 0.09 seconds) done.
                              ^^^^^
 The first line is before suspend and second is after resume. The time
 stamp [50065.xxxxxx] is still the same although the system was
 suspended for almost whole day.
 
 The same system, the latest kernel message:

    # date
    Wed Jun 29 16:29:28 CEST 2011

    # mount /dev/sdb1 /mnt/test

    # ./sys-utils/dmesg -H | tail -1 
    [Tue Jun 28 11:10:41 2011] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)


  Karel


^ permalink raw reply

* [git pull] mkfs fixes
From: Sami Kerola @ 2011-06-29 12:03 UTC (permalink / raw)
  To: util-linux

The following changes since commit 37b94458bd0f4a178233ad0366a727bf5bde879f:

  sfdisk: fix coding style. (2011-06-29 12:47:38 +0200)

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

Sami Kerola (4):
      mkfs: add long options
      docs: add long options to mkfs.8
      mkfs: include-what-you-use header check
      mkfs: coding style fixes

 disk-utils/mkfs.8 |   44 ++++++-------
 disk-utils/mkfs.c |  189 +++++++++++++++++++++++++++++++---------------------
 2 files changed, 133 insertions(+), 100 deletions(-)

diff --git a/disk-utils/mkfs.8 b/disk-utils/mkfs.8
index 6a39633..88699c1 100644
--- a/disk-utils/mkfs.8
+++ b/disk-utils/mkfs.8
@@ -1,15 +1,12 @@
 .\" -*- nroff -*-
 .TH MKFS 8 "Jun 1995" "Version 1.9"
+.TH MKFS "8" "June 2011" "util-linux" "System Administration Utilities"
 .SH NAME
 mkfs \- build a Linux file system
 .SH SYNOPSIS
+.SH SYNOPSIS
 .B mkfs
-.RB [ \-V ]
-.RB [ \-t
-.IR fstype ]
-.RI [ fs-options ]
-.I filesys
-.RI [ blocks ]
+[\fIoptions\fR] [\fI-t type fs-options\fR] \fIdevice \fR[\fIsize\fR]
 .SH DESCRIPTION
 .B mkfs
 is used to build a Linux file system on a device, usually
@@ -19,8 +16,9 @@ is either the device name (e.g.
 .IR /dev/hda1 ,
 .IR /dev/sdb2 ),
 or a regular file that shall contain the file system.
-.I blocks
-is the number of blocks to be used for the file system.
+The
+.I size
+argument is the number of blocks to be used for the file system.
 .PP
 The exit code returned by
 .B mkfs
@@ -49,14 +47,7 @@ Please see the file system-specific builder manual pages for
 further details.
 .SH OPTIONS
 .TP
-.B -V
-Produce verbose output, including all file system-specific commands
-that are executed.
-Specifying this option more than once inhibits execution of any
-file system-specific commands.
-This is really only useful for testing.
-.TP
-.BI -t \ fstype
+\fB\-t\fR, \fB\-\-type\fR=\fITYPE\fR
 Specifies the type of file system to be built.
 If not specified, the default file system type
 (currently ext2) is used.
@@ -67,20 +58,25 @@ system builder.
 Although not guaranteed, the following options are supported
 by most file system builders.
 .TP
-.B -c
-Check the device for bad blocks before building the file system.
+\fB\-V\fR, \fB\-\-verbose\fR
+Produce verbose output, including all file system-specific commands
+that are executed.
+Specifying this option more than once inhibits execution of any
+file system-specific commands.
+This is really only useful for testing.
 .TP
-.BI -l \ filename
-Read the bad blocks list from
-.I filename
+\fB\-V\fR, \fB\-\-version\fR
+output version information and exit
+\fB\-V\fR will output version information only when it is the
+only parameter.
 .TP
-.B -v
-Produce verbose output.
+\fB\-h\fR, \fB\-\-help\fR
+Display help and exit.
 .SH BUGS
 All generic options must precede and not be combined with
 file system-specific options.
 Some file system-specific programs do not support the
-.I -v
+.I -V
 (verbose) option, nor return meaningful exit codes.
 Also, some file system-specific programs do not automatically
 detect the device size and require the
diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c
index e22c512..ce845a5 100644
--- a/disk-utils/mkfs.c
+++ b/disk-utils/mkfs.c
@@ -2,8 +2,6 @@
  * mkfs		A simple generic frontend for the for the mkfs program
  *		under Linux.  See the manual page for details.
  *
- * Usage:	mkfs [-V] [-t fstype] [fs-options] device [size]
- *
  * Authors:	David Engel, <david@ods.com>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  *		Ron Sommeling, <sommel@sci.kun.nl>
@@ -15,91 +13,130 @@
  *	
  */

-
+#include <getopt.h>
+#include <limits.h>
 #include <stdio.h>
-#include <unistd.h>
+#include <stdlib.h>
 #include <string.h>
-#include <nls.h>
+#include <unistd.h>

+#include "c.h"
+#include "nls.h"
 #include "xalloc.h"

 #ifndef DEFAULT_FSTYPE
-# define DEFAULT_FSTYPE		"ext2"
+#define DEFAULT_FSTYPE	"ext2"
 #endif

 #define SEARCH_PATH	"PATH=" FS_SEARCH_PATH
 #define PROGNAME	"mkfs.%s"


-int main(int argc, char *argv[])
+static void __attribute__ ((__noreturn__)) usage(FILE * out)
+{
+	fprintf(out,
+		_("Usage: %s [options] [-t type fs-options] device [size]\n"),
+		program_invocation_short_name);
+
+	fprintf(out, _("\nOptions:\n"
+		       " -t, --type=TYPE  file system type, when undefined ext2 is used\n"
+		       "     fs-options   parameters to real file system builder\n"
+		       "     device       path to a device\n"
+		       "     size         number of blocks on the device\n"
+		       " -V, --verbose    explain what is done\n"
+		       "                  defining -V more than once will cause a dry-run\n"
+		       " -V, --version    output version information and exit\n"
+		       "                  -V as version must be only option\n"
+		       " -h, --help       display this help and exit\n"));
+
+	fprintf(out, _("\nFor more information see mkfs(8).\n"));
+
+	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
+static void __attribute__ ((__noreturn__)) print_version(void)
+{
+	printf(_("%s (%s)\n"),
+	       program_invocation_short_name, PACKAGE_STRING);
+	exit(EXIT_SUCCESS);
+}
+
+int main(int argc, char **argv)
 {
-  char *progname;	/* name of executable to be called */
-  char *fstype = NULL;
-  int i, more = 0, verbose = 0;
-  char *oldpath, *newpath;
-  char *program_name, *p;
-
-  program_name = argv[0];
-  if ((p = strrchr(program_name, '/')) != NULL)
-	  program_name = p+1;
-
-  setlocale(LC_ALL, "");
-  bindtextdomain(PACKAGE, LOCALEDIR);
-  textdomain(PACKAGE);
-
-  if (argc == 2 &&
-      (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) {
-	  printf(_("%s (%s)\n"), program_name, PACKAGE_STRING);
-	  exit(EXIT_SUCCESS);
-  }
-
-  /* Check commandline options. */
-  opterr = 0;
-  while ((more == 0) && ((i = getopt(argc, argv, "Vt:")) != -1))
-    switch (i) {
-    case 'V':
-      verbose++;
-      break;
-    case 't':
-      fstype = optarg;
-      break;
-    default:
-      optind--;
-      more = 1;
-      break;		/* start of specific arguments */
-    }
-  if (optind == argc)
-	  errx(EXIT_FAILURE, _("Usage: mkfs [-V] [-t fstype] [fs-options]
device [size]"));
-
-  /* If -t wasn't specified, use the default */
-  if (fstype == NULL)
-    fstype = DEFAULT_FSTYPE;
-
-  /* Set PATH and program name */
-  oldpath = getenv("PATH");
-  if (!oldpath)
-	  oldpath = "/bin";
-
-  newpath = xmalloc(strlen(oldpath) + sizeof(SEARCH_PATH) + 3);
-  sprintf(newpath, "%s:%s\n", SEARCH_PATH, oldpath);
-  putenv(newpath);
-
-  progname = xmalloc(sizeof(PROGNAME) + strlen(fstype) + 1);
-  sprintf(progname, PROGNAME, fstype);
-  argv[--optind] = progname;
-
-  if (verbose) {
-    printf(_("mkfs (%s)\n"), PACKAGE_STRING);
-    i = optind;
-    while (argv[i])
-      printf("%s ", argv[i++]);
-    printf("\n");
-    if (verbose > 1)
-      return 0;
-  }
-
-  /* Execute the program */
-  execvp(progname, argv+optind);
-  perror(progname);
-  return 1;
+	char *progname;		/* name of executable to be called */
+	char *fstype = NULL;
+	int i, more = 0, verbose = 0;
+	char *oldpath, *newpath;
+
+	enum { VERSION_OPTION = CHAR_MAX + 1 };
+
+	static const struct option longopts[] = {
+		{"type", required_argument, NULL, 't'},
+		{"version", no_argument, NULL, VERSION_OPTION},
+		{"help", no_argument, NULL, 'h'},
+		{NULL, 0, NULL, 0}
+	};
+
+	setlocale(LC_ALL, "");
+	bindtextdomain(PACKAGE, LOCALEDIR);
+	textdomain(PACKAGE);
+
+	if (argc == 2 && !strcmp(argv[1], "-V"))
+		print_version();
+
+	/* Check commandline options. */
+	opterr = 0;
+	while ((more == 0)
+	       && ((i = getopt_long(argc, argv, "Vt:h", longopts, NULL))
+		   != -1))
+		switch (i) {
+		case 'V':
+			verbose++;
+			break;
+		case 't':
+			fstype = optarg;
+			break;
+		case 'h':
+			usage(stdout);
+		case VERSION_OPTION:
+			print_version();
+		default:
+			optind--;
+			more = 1;
+			break;	/* start of specific arguments */
+		}
+	if (optind == argc)
+		usage(stderr);
+
+	/* If -t wasn't specified, use the default */
+	if (fstype == NULL)
+		fstype = DEFAULT_FSTYPE;
+
+	/* Set PATH and program name */
+	oldpath = getenv("PATH");
+	if (!oldpath)
+		oldpath = "/bin";
+
+	newpath = xmalloc(strlen(oldpath) + sizeof(SEARCH_PATH) + 3);
+	sprintf(newpath, "%s:%s\n", SEARCH_PATH, oldpath);
+	putenv(newpath);
+
+	progname = xmalloc(sizeof(PROGNAME) + strlen(fstype) + 1);
+	sprintf(progname, PROGNAME, fstype);
+	argv[--optind] = progname;
+
+	if (verbose) {
+		printf(_("mkfs (%s)\n"), PACKAGE_STRING);
+		i = optind;
+		while (argv[i])
+			printf("%s ", argv[i++]);
+		printf("\n");
+		if (verbose > 1)
+			return EXIT_SUCCESS;
+	}
+
+	/* Execute the program */
+	execvp(progname, argv + optind);
+	perror(progname);
+	return EXIT_FAILURE;
 }

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/

^ permalink raw reply related

* Re: [PATCH 6/6] sfdisk: fix for data type mismatches
From: Karel Zak @ 2011-06-29 10:50 UTC (permalink / raw)
  To: kerolasa; +Cc: util-linux
In-Reply-To: <BANLkTik2HR3BCHFta13hg_QK6nXEZm19Pw@mail.gmail.com>

On Tue, Jun 14, 2011 at 10:00:56PM +0200, Sami Kerola wrote:
> Yes are right, that was silly. I reviewed the patch and changed data
> types to size_t. The fix is pushed with force to my git.

 Merged.

> p.s. The style in the file is really horrible. How about doing the
> following, which will unify the style within the file without changing
> everything.
> 
> indent -linux -i4 -psl -brf sfdisk.c

 Hmm.. I don't like such patches, but you're right that the file is
 horrible. Fixed....

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

^ 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