svn commit: r226719 - head/sbin/geom/class/eli
Pawel Jakub Dawidek
pjd at FreeBSD.org
Tue Oct 25 07:37:03 UTC 2011
Author: pjd
Date: Tue Oct 25 07:37:02 2011
New Revision: 226719
URL: http://svn.freebsd.org/changeset/base/226719
Log:
Simplify eli_dump() function and allow to dump metadata stored in backup file.
MFC after: 3 days
Modified:
head/sbin/geom/class/eli/geom_eli.c
Modified: head/sbin/geom/class/eli/geom_eli.c
==============================================================================
--- head/sbin/geom/class/eli/geom_eli.c Tue Oct 25 07:34:35 2011 (r226718)
+++ head/sbin/geom/class/eli/geom_eli.c Tue Oct 25 07:37:02 2011 (r226719)
@@ -1528,9 +1528,9 @@ eli_clear(struct gctl_req *req)
static void
eli_dump(struct gctl_req *req)
{
- struct g_eli_metadata md, tmpmd;
+ struct g_eli_metadata md;
const char *name;
- int error, i, nargs;
+ int i, nargs;
nargs = gctl_get_int(req, "nargs");
if (nargs < 1) {
@@ -1540,17 +1540,7 @@ eli_dump(struct gctl_req *req)
for (i = 0; i < nargs; i++) {
name = gctl_get_ascii(req, "arg%d", i);
- error = g_metadata_read(name, (unsigned char *)&tmpmd,
- sizeof(tmpmd), G_ELI_MAGIC);
- if (error != 0) {
- fprintf(stderr, "Cannot read metadata from %s: %s.\n",
- name, strerror(error));
- gctl_error(req, "Not fully done.");
- continue;
- }
- if (eli_metadata_decode((unsigned char *)&tmpmd, &md) != 0) {
- fprintf(stderr, "MD5 hash mismatch for %s, skipping.\n",
- name);
+ if (eli_metadata_read(NULL, name, &md) == -1) {
gctl_error(req, "Not fully done.");
continue;
}
More information about the svn-src-head
mailing list