Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Feb 2007 13:11:10 +0100
From:      Pieter de Goeje <pieter@degoeje.nl>
To:        freebsd-current@freebsd.org
Cc:        Ivan Voras <ivoras@fer.hr>, freebsd-geom@freebsd.org
Subject:   Re: First steps towards importing gvirstor into -current
Message-ID:  <200702021311.10339.pieter@degoeje.nl>
In-Reply-To: <epspv7$a9e$1@sea.gmane.org>
References:  <epspv7$a9e$1@sea.gmane.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_epywF30SSJkq3Nj
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi, I tried the beta3a version from the wiki on an amd64 -CURRENT machine.
I made some changes (attached) to g_virstor.c and geom_virstor.c to let them 
compile cleanly on AMD64. Both files contained instances of some printf 
variant with format "%u" while the parameter was a size_t, so I changed the 
format to "%zu".

Also, I needed to add -fPIC to the gcc command line to build geom_virstor.so. 
For some reason, it wasnt able to find "path.h" so I included that one in the 
search path.

After successfully building gvirstor (and loading it), I tried to use it:
# ./gvirstor label -s 10000 test /dev/ad0s3b
Assertion failed: (G_OPT_TYPE(opt) != 0), function parse_arguments, 
file /usr/src/sbin/geom/core/geom.c, line 272.
Abort (core dumped)

Basically I'm stuck here.

Regards,
Pieter de Goeje

PS.
How do I download the latest sources from the p4 repository?

--Boundary-00=_epywF30SSJkq3Nj
Content-Type: text/x-diff;
  charset="utf-8";
  name="g_virstor-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="g_virstor-patch"

--- gvirstor.orig/g_virstor.c	Fri Aug 25 16:03:58 2006
+++ gvirstor/g_virstor.c	Fri Feb  2 11:43:34 2007
@@ -1418,7 +1418,7 @@
 				sc->n_components, virstor_valid_components(sc));
 		sbuf_printf(sb, "%s<State>%u%% physical free</State>\n",
 				indent, 100-(used * 100) / count);
-		sbuf_printf(sb, "%s<ChunkSize>%u</ChunkSize>\n", indent,
+		sbuf_printf(sb, "%s<ChunkSize>%zu</ChunkSize>\n", indent,
 				sc->chunk_size);
 		sbuf_printf(sb, "%s<PhysicalFree>%u%%</PhysicalFree>\n",
 				indent, 
@@ -1426,9 +1426,9 @@
 				: 100);
 		sbuf_printf(sb, "%s<ChunkPhysicalCount>%u</ChunkPhysicalCount>\n",
 				indent, count);
-		sbuf_printf(sb, "%s<ChunkVirtualCount>%u</ChunkVirtualCount>\n", 
+		sbuf_printf(sb, "%s<ChunkVirtualCount>%zu</ChunkVirtualCount>\n", 
 				indent,	sc->chunk_count);
-		sbuf_printf(sb, "%s<PhysicalBacking>%u%%</PhysicalBacking>\n",
+		sbuf_printf(sb, "%s<PhysicalBacking>%zu%%</PhysicalBacking>\n",
 				indent,
 				(count * 100) / sc->chunk_count);
 		sbuf_printf(sb, "%s<PhysicalBackingSize>%jd</PhysicalBackingSize>\n",
@@ -1521,7 +1521,7 @@
 		chunk_index = offset / chunk_size;
 		in_chunk_offset = offset % chunk_size;
 		in_chunk_length = min(length, chunk_size - in_chunk_offset);
-		LOG_MSG(LVL_DEBUG, "Mapped (%ju, %ju) to (%u,%u,%u)",
+		LOG_MSG(LVL_DEBUG, "Mapped (%ju, %ju) to (%zu,%zu,%zu)",
 				offset, length, 
 				chunk_index, in_chunk_offset, in_chunk_length);
 		me = &sc->map[chunk_index];

--Boundary-00=_epywF30SSJkq3Nj
Content-Type: text/x-diff;
  charset="utf-8";
  name="geom_virstor-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="geom_virstor-patch"

--- gvirstor.orig/geom_virstor.c	Fri Nov 24 12:47:33 2006
+++ gvirstor/geom_virstor.c	Fri Feb  2 11:47:05 2007
@@ -166,7 +166,7 @@
 
 	nargs = gctl_get_int(req, "nargs");
 	if (nargs < 2) {
-		gctl_error(req, "Too few arguments: expecting: name provider0 [provider1 ...]", nargs);
+		gctl_error(req, "Too few arguments: expecting: name provider0 [provider1 ...]");
 		return;
 	}
 	
@@ -205,7 +205,7 @@
 			new_size += MAXPHYS;
 		fprintf(stderr, "Resizing chunk size to be a multiple of MAXPHYS "
 				"(%d KB).\n", MAXPHYS / 1024);
-		fprintf(stderr, "New chunk size: %u KB\n", new_size / 1024);
+		fprintf(stderr, "New chunk size: %zu KB\n", new_size / 1024);
 		md.md_chunk_size = new_size;
 	}
 
@@ -309,7 +309,7 @@
 	if (map_size % md.md_chunk_size != 0)
 		map_chunks++;
 	if (verbose) {
-		printf(" (%u MB, %d chunks) ", map_size/(1024*1024), map_chunks);
+		printf(" (%zu MB, %d chunks) ", map_size/(1024*1024), map_chunks);
 		fflush(stdout);
 	}
 
@@ -326,7 +326,7 @@
 	 * in the future */
 	map = calloc(total_chunks, sizeof *map);
 	if (map == NULL)
-		gctl_error(req, "Out of memory (need %u bytes for allocation map)",
+		gctl_error(req, "Out of memory (need %zu bytes for allocation map)",
 				map_size);
 	
 	written = pwrite(fd, map, map_size, 0);
@@ -393,7 +393,7 @@
 		sect = malloc(ssize);
 		bzero(sect, ssize);
 		if (sect == NULL)
-			err(1, "Cannot allocate sector of %u bytes", ssize);
+			err(1, "Cannot allocate sector of %zu bytes", ssize);
 		virstor_metadata_encode(&md, sect);
 		error = g_metadata_store(name, sect, ssize);
 		free(sect);

--Boundary-00=_epywF30SSJkq3Nj--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702021311.10339.pieter>