Skip to content

Commit

Permalink
6574286 removing a slog doesn't work
Browse files Browse the repository at this point in the history
6856566 zpool import -F can cause panic
6863456 system panic by load_nvlist(spa, spa->spa_config_object, &nv) == 0 while running zfs test suite
6882947 dump_nvlist() should live in libnvpair
  • Loading branch information
George Wilson authored and George Wilson committed Sep 21, 2009
1 parent 53520bf commit 88ecc94
Show file tree
Hide file tree
Showing 33 changed files with 1,047 additions and 381 deletions.
2 changes: 1 addition & 1 deletion usr/src/cmd/fm/modules/common/zfs-retire/zfs_retire.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ replace_with_spare(zpool_handle_t *zhp, nvlist_t *vdev)
return;
}

dev_name = zpool_vdev_name(NULL, zhp, vdev);
dev_name = zpool_vdev_name(NULL, zhp, vdev, B_FALSE);

/*
* Try to replace each spare, ending when we successfully
Expand Down
148 changes: 1 addition & 147 deletions usr/src/cmd/fstyp/fstyp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

Expand Down Expand Up @@ -50,7 +50,6 @@

static const char *getmodfsname();
static char *getexecpathname();
static void dump_nvlist(nvlist_t *list, int indent);
static boolean_t dos_to_dev(char *path, char **devpath, int *num);
static boolean_t find_dos_drive(int fd, int num, off_t *offset);
static void run_legacy_cmds(int fd, char *device, int vflag);
Expand Down Expand Up @@ -177,151 +176,6 @@ main(int argc, char **argv)

}

#define NVP(elem, type, vtype, ptype, format) { \
vtype value; \
\
(void) nvpair_value_##type(elem, &value); \
(void) printf("%*s%s: " format "\n", indent, "", \
nvpair_name(elem), (ptype)value); \
}

#define NVPA(elem, type, vtype, ptype, format) { \
uint_t i, count; \
vtype *value; \
\
(void) nvpair_value_##type(elem, &value, &count); \
for (i = 0; i < count; i++) { \
(void) printf("%*s%s[%d]: " format "\n", indent, "", \
nvpair_name(elem), i, (ptype)value[i]); \
} \
}

static void
dump_nvlist(nvlist_t *list, int indent)
{
nvpair_t *elem = NULL;
boolean_t bool_value;
nvlist_t *nvlist_value;
nvlist_t **nvlist_array_value;
uint_t i, count;

if (list == NULL) {
return;
}

while ((elem = nvlist_next_nvpair(list, elem)) != NULL) {
switch (nvpair_type(elem)) {
case DATA_TYPE_BOOLEAN_VALUE:
(void) nvpair_value_boolean_value(elem, &bool_value);
(void) printf("%*s%s: %s\n", indent, "",
nvpair_name(elem), bool_value ? "true" : "false");
break;

case DATA_TYPE_BYTE:
NVP(elem, byte, uchar_t, int, "%u");
break;

case DATA_TYPE_INT8:
NVP(elem, int8, int8_t, int, "%d");
break;

case DATA_TYPE_UINT8:
NVP(elem, uint8, uint8_t, int, "%u");
break;

case DATA_TYPE_INT16:
NVP(elem, int16, int16_t, int, "%d");
break;

case DATA_TYPE_UINT16:
NVP(elem, uint16, uint16_t, int, "%u");
break;

case DATA_TYPE_INT32:
NVP(elem, int32, int32_t, long, "%ld");
break;

case DATA_TYPE_UINT32:
NVP(elem, uint32, uint32_t, ulong_t, "%lu");
break;

case DATA_TYPE_INT64:
NVP(elem, int64, int64_t, longlong_t, "%lld");
break;

case DATA_TYPE_UINT64:
NVP(elem, uint64, uint64_t, u_longlong_t, "%llu");
break;

case DATA_TYPE_STRING:
NVP(elem, string, char *, char *, "'%s'");
break;

case DATA_TYPE_BYTE_ARRAY:
NVPA(elem, byte_array, uchar_t, int, "%u");
break;

case DATA_TYPE_INT8_ARRAY:
NVPA(elem, int8_array, int8_t, int, "%d");
break;

case DATA_TYPE_UINT8_ARRAY:
NVPA(elem, uint8_array, uint8_t, int, "%u");
break;

case DATA_TYPE_INT16_ARRAY:
NVPA(elem, int16_array, int16_t, int, "%d");
break;

case DATA_TYPE_UINT16_ARRAY:
NVPA(elem, uint16_array, uint16_t, int, "%u");
break;

case DATA_TYPE_INT32_ARRAY:
NVPA(elem, int32_array, int32_t, long, "%ld");
break;

case DATA_TYPE_UINT32_ARRAY:
NVPA(elem, uint32_array, uint32_t, ulong_t, "%lu");
break;

case DATA_TYPE_INT64_ARRAY:
NVPA(elem, int64_array, int64_t, longlong_t, "%lld");
break;

case DATA_TYPE_UINT64_ARRAY:
NVPA(elem, uint64_array, uint64_t, u_longlong_t,
"%llu");
break;

case DATA_TYPE_STRING_ARRAY:
NVPA(elem, string_array, char *, char *, "'%s'");
break;

case DATA_TYPE_NVLIST:
(void) nvpair_value_nvlist(elem, &nvlist_value);
(void) printf("%*s%s:\n", indent, "",
nvpair_name(elem));
dump_nvlist(nvlist_value, indent + 4);
break;

case DATA_TYPE_NVLIST_ARRAY:
(void) nvpair_value_nvlist_array(elem,
&nvlist_array_value, &count);
for (i = 0; i < count; i++) {
(void) printf("%*s%s[%u]:\n", indent, "",
nvpair_name(elem), i);
dump_nvlist(nvlist_array_value[i], indent + 4);
}
break;

default:
(void) printf(gettext("bad config type %d for %s\n"),
nvpair_type(elem), nvpair_name(elem));
}
}
}

/*
* If the executable is a fs-specific hardlink, /usr/lib/fs/<fsname>/fstyp,
* return that fsname; otherwise return NULL.
Expand Down
2 changes: 1 addition & 1 deletion usr/src/cmd/power/handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ ztop(char *arg, char *diskname)
libzfs_fini(lzfs);
return (-1);
}
vname = zpool_vdev_name(lzfs, zpool_handle, child[0]);
vname = zpool_vdev_name(lzfs, zpool_handle, child[0], B_FALSE);
if (vname == NULL) {
mesg(MERR, "couldn't determine vdev name\n");
zpool_close(zpool_handle);
Expand Down
62 changes: 0 additions & 62 deletions usr/src/cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,68 +146,6 @@ fatal(const char *fmt, ...)
exit(1);
}

static void
dump_nvlist(nvlist_t *list, int indent)
{
nvpair_t *elem = NULL;

while ((elem = nvlist_next_nvpair(list, elem)) != NULL) {
switch (nvpair_type(elem)) {
case DATA_TYPE_STRING:
{
char *value;

VERIFY(nvpair_value_string(elem, &value) == 0);
(void) printf("%*s%s='%s'\n", indent, "",
nvpair_name(elem), value);
}
break;

case DATA_TYPE_UINT64:
{
uint64_t value;

VERIFY(nvpair_value_uint64(elem, &value) == 0);
(void) printf("%*s%s=%llu\n", indent, "",
nvpair_name(elem), (u_longlong_t)value);
}
break;

case DATA_TYPE_NVLIST:
{
nvlist_t *value;

VERIFY(nvpair_value_nvlist(elem, &value) == 0);
(void) printf("%*s%s\n", indent, "",
nvpair_name(elem));
dump_nvlist(value, indent + 4);
}
break;

case DATA_TYPE_NVLIST_ARRAY:
{
nvlist_t **value;
uint_t c, count;

VERIFY(nvpair_value_nvlist_array(elem, &value,
&count) == 0);

for (c = 0; c < count; c++) {
(void) printf("%*s%s[%u]\n", indent, "",
nvpair_name(elem), c);
dump_nvlist(value[c], indent + 8);
}
}
break;

default:

(void) printf("bad config type %d for %s\n",
nvpair_type(elem), nvpair_name(elem));
}
}
}

/* ARGSUSED */
static void
dump_packed_nvlist(objset_t *os, uint64_t object, void *data, size_t size)
Expand Down
Loading

0 comments on commit 88ecc94

Please sign in to comment.