summaryrefslogtreecommitdiffstats
path: root/sbin/geom
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-10-25 07:37:02 +0000
committerpjd <pjd@FreeBSD.org>2011-10-25 07:37:02 +0000
commitaa3a4f205db17e19a66aa0a9490d636f161497b2 (patch)
tree9718b9b21f88469b4e07f7fe5f20ddad2b347dd6 /sbin/geom
parentb6b8505c014f3f7ccd1ef206bcb23e2773711261 (diff)
downloadFreeBSD-src-aa3a4f205db17e19a66aa0a9490d636f161497b2.zip
FreeBSD-src-aa3a4f205db17e19a66aa0a9490d636f161497b2.tar.gz
Simplify eli_dump() function and allow to dump metadata stored in backup file.
MFC after: 3 days
Diffstat (limited to 'sbin/geom')
-rw-r--r--sbin/geom/class/eli/geom_eli.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c
index 3f136e1..11c8ce0 100644
--- a/sbin/geom/class/eli/geom_eli.c
+++ b/sbin/geom/class/eli/geom_eli.c
@@ -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;
}
OpenPOWER on IntegriCloud