loader: zfsimpl.c cstyle cleanup
No functional changes intended. MFC after: 1 week
This commit is contained in:
parent
d29f674f2e
commit
2e6bb6553b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355773
@ -251,7 +251,7 @@ nvlist_find(const unsigned char *nvlist, const char *name, int type,
|
||||
p += roundup(namelen, 4);
|
||||
xdr_int(&p, &pairtype);
|
||||
|
||||
if (!memcmp(name, pairname, namelen) && type == pairtype) {
|
||||
if (memcmp(name, pairname, namelen) == 0 && type == pairtype) {
|
||||
xdr_int(&p, &elements);
|
||||
if (elementsp)
|
||||
*elementsp = elements;
|
||||
@ -263,8 +263,8 @@ nvlist_find(const unsigned char *nvlist, const char *name, int type,
|
||||
xdr_int(&p, &len);
|
||||
(*(const char**)valuep) = (const char*)p;
|
||||
return (0);
|
||||
} else if (type == DATA_TYPE_NVLIST
|
||||
|| type == DATA_TYPE_NVLIST_ARRAY) {
|
||||
} else if (type == DATA_TYPE_NVLIST ||
|
||||
type == DATA_TYPE_NVLIST_ARRAY) {
|
||||
(*(const unsigned char**)valuep) =
|
||||
(const unsigned char*)p;
|
||||
return (0);
|
||||
@ -273,7 +273,8 @@ nvlist_find(const unsigned char *nvlist, const char *name, int type,
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Not the pair we are looking for, skip to the next one.
|
||||
* Not the pair we are looking for, skip to the
|
||||
* next one.
|
||||
*/
|
||||
p = pair + encoded_size;
|
||||
}
|
||||
@ -316,7 +317,8 @@ nvlist_check_features_for_read(const unsigned char *nvlist)
|
||||
xdr_int(&p, &pairtype);
|
||||
|
||||
for (i = 0; features_for_read[i] != NULL; i++) {
|
||||
if (!memcmp(pairname, features_for_read[i], namelen)) {
|
||||
if (memcmp(pairname, features_for_read[i],
|
||||
namelen) == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
@ -362,7 +364,7 @@ nvlist_next(const unsigned char *nvlist)
|
||||
xdr_int(&p, &decoded_size);
|
||||
}
|
||||
|
||||
return p;
|
||||
return (p);
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
@ -453,7 +455,8 @@ nvlist_print(const unsigned char *nvlist, unsigned int indent)
|
||||
if (j != elements - 1) {
|
||||
for (i = 0; i < indent; i++)
|
||||
printf(" ");
|
||||
printf("%s %s", typenames[pairtype], pairname);
|
||||
printf("%s %s", typenames[pairtype],
|
||||
pairname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -469,7 +472,7 @@ nvlist_print(const unsigned char *nvlist, unsigned int indent)
|
||||
xdr_int(&p, &decoded_size);
|
||||
}
|
||||
|
||||
return p;
|
||||
return (p);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -490,7 +493,6 @@ vdev_read_phys(vdev_t *vdev, const blkptr_t *bp, void *buf,
|
||||
psize = size;
|
||||
}
|
||||
|
||||
/*printf("ZFS: reading %zu bytes at 0x%jx to %p\n", psize, (uintmax_t)offset, buf);*/
|
||||
rc = vdev->v_phys_read(vdev, vdev->v_read_priv, offset, buf, psize);
|
||||
if (rc)
|
||||
return (rc);
|
||||
@ -1121,15 +1123,16 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev,
|
||||
return (ENOENT);
|
||||
}
|
||||
|
||||
if (strcmp(type, VDEV_TYPE_MIRROR)
|
||||
&& strcmp(type, VDEV_TYPE_DISK)
|
||||
if (strcmp(type, VDEV_TYPE_MIRROR) != 0 &&
|
||||
strcmp(type, VDEV_TYPE_DISK) != 0 &&
|
||||
#ifdef ZFS_TEST
|
||||
&& strcmp(type, VDEV_TYPE_FILE)
|
||||
strcmp(type, VDEV_TYPE_FILE) != 0 &&
|
||||
#endif
|
||||
&& strcmp(type, VDEV_TYPE_RAIDZ)
|
||||
&& strcmp(type, VDEV_TYPE_INDIRECT)
|
||||
&& strcmp(type, VDEV_TYPE_REPLACING)) {
|
||||
printf("ZFS: can only boot from disk, mirror, raidz1, raidz2 and raidz3 vdevs\n");
|
||||
strcmp(type, VDEV_TYPE_RAIDZ) != 0 &&
|
||||
strcmp(type, VDEV_TYPE_INDIRECT) != 0 &&
|
||||
strcmp(type, VDEV_TYPE_REPLACING) != 0) {
|
||||
printf("ZFS: can only boot from disk, mirror, raidz1, "
|
||||
"raidz2 and raidz3 vdevs\n");
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
@ -1153,13 +1156,13 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev,
|
||||
if (!vdev) {
|
||||
is_new = 1;
|
||||
|
||||
if (!strcmp(type, VDEV_TYPE_MIRROR))
|
||||
if (strcmp(type, VDEV_TYPE_MIRROR) == 0)
|
||||
vdev = vdev_create(guid, vdev_mirror_read);
|
||||
else if (!strcmp(type, VDEV_TYPE_RAIDZ))
|
||||
else if (strcmp(type, VDEV_TYPE_RAIDZ) == 0)
|
||||
vdev = vdev_create(guid, vdev_raidz_read);
|
||||
else if (!strcmp(type, VDEV_TYPE_REPLACING))
|
||||
else if (strcmp(type, VDEV_TYPE_REPLACING) == 0)
|
||||
vdev = vdev_create(guid, vdev_replacing_read);
|
||||
else if (!strcmp(type, VDEV_TYPE_INDIRECT)) {
|
||||
else if (strcmp(type, VDEV_TYPE_INDIRECT) == 0) {
|
||||
vdev_indirect_config_t *vic;
|
||||
|
||||
vdev = vdev_create(guid, vdev_indirect_read);
|
||||
@ -1205,7 +1208,7 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev,
|
||||
} else {
|
||||
char *name;
|
||||
|
||||
if (!strcmp(type, "raidz")) {
|
||||
if (strcmp(type, "raidz") == 0) {
|
||||
if (vdev->v_nparity < 1 ||
|
||||
vdev->v_nparity > 3) {
|
||||
printf("ZFS: can only boot from disk, "
|
||||
@ -1213,12 +1216,12 @@ vdev_init_from_nvlist(const unsigned char *nvlist, vdev_t *pvdev,
|
||||
"vdevs\n");
|
||||
return (EIO);
|
||||
}
|
||||
asprintf(&name, "%s%d-%jd", type,
|
||||
rc = asprintf(&name, "%s%d-%jd", type,
|
||||
vdev->v_nparity, id);
|
||||
} else {
|
||||
asprintf(&name, "%s-%jd", type, id);
|
||||
rc = asprintf(&name, "%s-%jd", type, id);
|
||||
}
|
||||
if (name == NULL)
|
||||
if (rc < 0)
|
||||
return (ENOMEM);
|
||||
vdev->v_name = name;
|
||||
}
|
||||
@ -1320,7 +1323,7 @@ spa_find_by_guid(uint64_t guid)
|
||||
if (spa->spa_guid == guid)
|
||||
return (spa);
|
||||
|
||||
return (0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static spa_t *
|
||||
@ -1329,10 +1332,10 @@ spa_find_by_name(const char *name)
|
||||
spa_t *spa;
|
||||
|
||||
STAILQ_FOREACH(spa, &zfs_pools, spa_link)
|
||||
if (!strcmp(spa->spa_name, name))
|
||||
if (strcmp(spa->spa_name, name) == 0)
|
||||
return (spa);
|
||||
|
||||
return (0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#ifdef BOOT2
|
||||
@ -1394,7 +1397,7 @@ state_name(vdev_state_t state)
|
||||
"DEGRADED",
|
||||
"ONLINE"
|
||||
};
|
||||
return names[state];
|
||||
return (names[state]);
|
||||
}
|
||||
|
||||
#ifdef BOOT2
|
||||
@ -1877,8 +1880,8 @@ ilog2(int n)
|
||||
|
||||
for (v = 0; v < 32; v++)
|
||||
if (n == (1 << v))
|
||||
return v;
|
||||
return -1;
|
||||
return (v);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1949,8 +1952,8 @@ zio_read(const spa_t *spa, const blkptr_t *bp, void *buf)
|
||||
zfs_free(pbuf, size);
|
||||
}
|
||||
if (error != 0)
|
||||
printf("ZFS: i/o error - unable to decompress block pointer data, error %d\n",
|
||||
error);
|
||||
printf("ZFS: i/o error - unable to decompress "
|
||||
"block pointer data, error %d\n", error);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -2007,7 +2010,8 @@ zio_read(const spa_t *spa, const blkptr_t *bp, void *buf)
|
||||
}
|
||||
|
||||
static int
|
||||
dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset, void *buf, size_t buflen)
|
||||
dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset,
|
||||
void *buf, size_t buflen)
|
||||
{
|
||||
int ibshift = dnode->dn_indblkshift - SPA_BLKPTRSHIFT;
|
||||
int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT;
|
||||
@ -2098,7 +2102,7 @@ mzap_lookup(const dnode_phys_t *dnode, const char *name, uint64_t *value)
|
||||
|
||||
for (i = 0; i < chunks; i++) {
|
||||
mze = &mz->mz_chunk[i];
|
||||
if (!strcmp(mze->mze_name, name)) {
|
||||
if (strcmp(mze->mze_name, name) == 0) {
|
||||
*value = mze->mze_value;
|
||||
return (0);
|
||||
}
|
||||
@ -2112,7 +2116,8 @@ mzap_lookup(const dnode_phys_t *dnode, const char *name, uint64_t *value)
|
||||
* matches.
|
||||
*/
|
||||
static int
|
||||
fzap_name_equal(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, const char *name)
|
||||
fzap_name_equal(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc,
|
||||
const char *name)
|
||||
{
|
||||
size_t namelen;
|
||||
const zap_leaf_chunk_t *nc;
|
||||
@ -2124,6 +2129,7 @@ fzap_name_equal(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, const char *na
|
||||
p = name;
|
||||
while (namelen > 0) {
|
||||
size_t len;
|
||||
|
||||
len = namelen;
|
||||
if (len > ZAP_LEAF_ARRAY_BYTES)
|
||||
len = ZAP_LEAF_ARRAY_BYTES;
|
||||
@ -2134,7 +2140,7 @@ fzap_name_equal(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, const char *na
|
||||
nc = &ZAP_LEAF_CHUNK(zl, nc->l_array.la_next);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2153,7 +2159,7 @@ fzap_leaf_value(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc)
|
||||
value = (value << 8) | p[i];
|
||||
}
|
||||
|
||||
return value;
|
||||
return (value);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2267,15 +2273,16 @@ fzap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name,
|
||||
/*
|
||||
* Make sure this chunk matches our hash.
|
||||
*/
|
||||
if (zl.l_phys->l_hdr.lh_prefix_len > 0
|
||||
&& zl.l_phys->l_hdr.lh_prefix
|
||||
!= hash >> (64 - zl.l_phys->l_hdr.lh_prefix_len))
|
||||
if (zl.l_phys->l_hdr.lh_prefix_len > 0 &&
|
||||
zl.l_phys->l_hdr.lh_prefix !=
|
||||
hash >> (64 - zl.l_phys->l_hdr.lh_prefix_len))
|
||||
return (ENOENT);
|
||||
|
||||
/*
|
||||
* Hash within the chunk to find our entry.
|
||||
*/
|
||||
int shift = (64 - ZAP_LEAF_HASH_SHIFT(&zl) - zl.l_phys->l_hdr.lh_prefix_len);
|
||||
int shift = (64 - ZAP_LEAF_HASH_SHIFT(&zl) -
|
||||
zl.l_phys->l_hdr.lh_prefix_len);
|
||||
int h = (hash >> shift) & ((1 << ZAP_LEAF_HASH_SHIFT(&zl)) - 1);
|
||||
h = zl.l_phys->l_hash[h];
|
||||
if (h == 0xffff)
|
||||
@ -2314,10 +2321,10 @@ zap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name,
|
||||
|
||||
zap_type = *(uint64_t *)zap_scratch;
|
||||
if (zap_type == ZBT_MICRO)
|
||||
return mzap_lookup(dnode, name, value);
|
||||
return (mzap_lookup(dnode, name, value));
|
||||
else if (zap_type == ZBT_HEADER) {
|
||||
return fzap_lookup(spa, dnode, name, integer_size,
|
||||
num_integers, value);
|
||||
return (fzap_lookup(spa, dnode, name, integer_size,
|
||||
num_integers, value));
|
||||
}
|
||||
printf("ZFS: invalid zap_type=%d\n", (int)zap_type);
|
||||
return (EIO);
|
||||
@ -2360,7 +2367,8 @@ mzap_list(const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t))
|
||||
* the directory header.
|
||||
*/
|
||||
static int
|
||||
fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const char *, uint64_t))
|
||||
fzap_list(const spa_t *spa, const dnode_phys_t *dnode,
|
||||
int (*callback)(const char *, uint64_t))
|
||||
{
|
||||
int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT;
|
||||
zap_phys_t zh = *(zap_phys_t *)zap_scratch;
|
||||
@ -2422,7 +2430,7 @@ fzap_list(const spa_t *spa, const dnode_phys_t *dnode, int (*callback)(const cha
|
||||
*/
|
||||
value = fzap_leaf_value(&zl, zc);
|
||||
|
||||
//printf("%s 0x%jx\n", name, (uintmax_t)value);
|
||||
/* printf("%s 0x%jx\n", name, (uintmax_t)value); */
|
||||
rc = callback((const char *)name, value);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
@ -2454,13 +2462,14 @@ zap_list(const spa_t *spa, const dnode_phys_t *dnode)
|
||||
|
||||
zap_type = *(uint64_t *)zap_scratch;
|
||||
if (zap_type == ZBT_MICRO)
|
||||
return mzap_list(dnode, zfs_printf);
|
||||
return (mzap_list(dnode, zfs_printf));
|
||||
else
|
||||
return fzap_list(spa, dnode, zfs_printf);
|
||||
return (fzap_list(spa, dnode, zfs_printf));
|
||||
}
|
||||
|
||||
static int
|
||||
objset_get_dnode(const spa_t *spa, const objset_phys_t *os, uint64_t objnum, dnode_phys_t *dnode)
|
||||
objset_get_dnode(const spa_t *spa, const objset_phys_t *os, uint64_t objnum,
|
||||
dnode_phys_t *dnode)
|
||||
{
|
||||
off_t offset;
|
||||
|
||||
@ -2470,7 +2479,8 @@ objset_get_dnode(const spa_t *spa, const objset_phys_t *os, uint64_t objnum, dno
|
||||
}
|
||||
|
||||
static int
|
||||
mzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value)
|
||||
mzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name,
|
||||
uint64_t value)
|
||||
{
|
||||
const mzap_phys_t *mz;
|
||||
const mzap_ent_phys_t *mze;
|
||||
@ -2523,7 +2533,8 @@ fzap_name_copy(const zap_leaf_t *zl, const zap_leaf_chunk_t *zc, char *name)
|
||||
}
|
||||
|
||||
static int
|
||||
fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value)
|
||||
fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name,
|
||||
uint64_t value)
|
||||
{
|
||||
int bsize = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT;
|
||||
zap_phys_t zh = *(zap_phys_t *) zap_scratch;
|
||||
@ -2571,7 +2582,8 @@ fzap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t v
|
||||
}
|
||||
|
||||
static int
|
||||
zap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t value)
|
||||
zap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name,
|
||||
uint64_t value)
|
||||
{
|
||||
int rc;
|
||||
uint64_t zap_type;
|
||||
@ -2583,9 +2595,9 @@ zap_rlookup(const spa_t *spa, const dnode_phys_t *dnode, char *name, uint64_t va
|
||||
|
||||
zap_type = *(uint64_t *)zap_scratch;
|
||||
if (zap_type == ZBT_MICRO)
|
||||
return mzap_rlookup(spa, dnode, name, value);
|
||||
return (mzap_rlookup(spa, dnode, name, value));
|
||||
else
|
||||
return fzap_rlookup(spa, dnode, name, value);
|
||||
return (fzap_rlookup(spa, dnode, name, value));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -2620,11 +2632,13 @@ zfs_rlookup(const spa_t *spa, uint64_t objnum, char *result)
|
||||
if (parent_obj == 0)
|
||||
break;
|
||||
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, parent_obj, &parent) != 0)
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, parent_obj,
|
||||
&parent) != 0)
|
||||
return (EIO);
|
||||
dd = (dsl_dir_phys_t *)&parent.dn_bonus;
|
||||
child_dir_zapobj = dd->dd_child_dir_zapobj;
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap) != 0)
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj,
|
||||
&child_dir_zap) != 0)
|
||||
return (EIO);
|
||||
if (zap_rlookup(spa, &child_dir_zap, component, dir_obj) != 0)
|
||||
return (EIO);
|
||||
@ -2655,7 +2669,8 @@ zfs_lookup_dataset(const spa_t *spa, const char *name, uint64_t *objnum)
|
||||
dsl_dir_phys_t *dd;
|
||||
const char *p, *q;
|
||||
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, DMU_POOL_DIRECTORY_OBJECT, &dir))
|
||||
if (objset_get_dnode(spa, &spa->spa_mos,
|
||||
DMU_POOL_DIRECTORY_OBJECT, &dir))
|
||||
return (EIO);
|
||||
if (zap_lookup(spa, &dir, DMU_POOL_ROOT_DATASET, sizeof (dir_obj),
|
||||
1, &dir_obj))
|
||||
@ -2684,7 +2699,8 @@ zfs_lookup_dataset(const spa_t *spa, const char *name, uint64_t *objnum)
|
||||
}
|
||||
|
||||
child_dir_zapobj = dd->dd_child_dir_zapobj;
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap) != 0)
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj,
|
||||
&child_dir_zap) != 0)
|
||||
return (EIO);
|
||||
|
||||
/* Actual loop condition #2. */
|
||||
@ -2720,7 +2736,8 @@ zfs_list_dataset(const spa_t *spa, uint64_t objnum/*, int pos, char *entry*/)
|
||||
dd = (dsl_dir_phys_t *)&dir.dn_bonus;
|
||||
|
||||
child_dir_zapobj = dd->dd_child_dir_zapobj;
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap) != 0) {
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj,
|
||||
&child_dir_zap) != 0) {
|
||||
printf("ZFS: can't find child zap %ju\n", (uintmax_t)dir_obj);
|
||||
return (EIO);
|
||||
}
|
||||
@ -2729,7 +2746,8 @@ zfs_list_dataset(const spa_t *spa, uint64_t objnum/*, int pos, char *entry*/)
|
||||
}
|
||||
|
||||
int
|
||||
zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const char *, uint64_t))
|
||||
zfs_callback_dataset(const spa_t *spa, uint64_t objnum,
|
||||
int (*callback)(const char *, uint64_t))
|
||||
{
|
||||
uint64_t dir_obj, child_dir_zapobj, zap_type;
|
||||
dnode_phys_t child_dir_zap, dir, dataset;
|
||||
@ -2753,21 +2771,23 @@ zfs_callback_dataset(const spa_t *spa, uint64_t objnum, int (*callback)(const ch
|
||||
dd = (dsl_dir_phys_t *)&dir.dn_bonus;
|
||||
|
||||
child_dir_zapobj = dd->dd_child_dir_zapobj;
|
||||
err = objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj, &child_dir_zap);
|
||||
err = objset_get_dnode(spa, &spa->spa_mos, child_dir_zapobj,
|
||||
&child_dir_zap);
|
||||
if (err != 0) {
|
||||
printf("ZFS: can't find child zap %ju\n", (uintmax_t)dir_obj);
|
||||
return (err);
|
||||
}
|
||||
|
||||
err = dnode_read(spa, &child_dir_zap, 0, zap_scratch, child_dir_zap.dn_datablkszsec * 512);
|
||||
err = dnode_read(spa, &child_dir_zap, 0, zap_scratch,
|
||||
child_dir_zap.dn_datablkszsec * 512);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
|
||||
zap_type = *(uint64_t *)zap_scratch;
|
||||
if (zap_type == ZBT_MICRO)
|
||||
return mzap_list(&child_dir_zap, callback);
|
||||
return (mzap_list(&child_dir_zap, callback));
|
||||
else
|
||||
return fzap_list(spa, &child_dir_zap, callback);
|
||||
return (fzap_list(spa, &child_dir_zap, callback));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2811,7 +2831,8 @@ zfs_get_root(const spa_t *spa, uint64_t *objid)
|
||||
/*
|
||||
* Start with the MOS directory object.
|
||||
*/
|
||||
if (objset_get_dnode(spa, &spa->spa_mos, DMU_POOL_DIRECTORY_OBJECT, &dir)) {
|
||||
if (objset_get_dnode(spa, &spa->spa_mos,
|
||||
DMU_POOL_DIRECTORY_OBJECT, &dir)) {
|
||||
printf("ZFS: can't read MOS object directory\n");
|
||||
return (EIO);
|
||||
}
|
||||
@ -2819,19 +2840,21 @@ zfs_get_root(const spa_t *spa, uint64_t *objid)
|
||||
/*
|
||||
* Lookup the pool_props and see if we can find a bootfs.
|
||||
*/
|
||||
if (zap_lookup(spa, &dir, DMU_POOL_PROPS, sizeof (props), 1, &props) == 0
|
||||
&& objset_get_dnode(spa, &spa->spa_mos, props, &propdir) == 0
|
||||
&& zap_lookup(spa, &propdir, "bootfs", sizeof (bootfs), 1, &bootfs) == 0
|
||||
&& bootfs != 0)
|
||||
{
|
||||
if (zap_lookup(spa, &dir, DMU_POOL_PROPS,
|
||||
sizeof(props), 1, &props) == 0 &&
|
||||
objset_get_dnode(spa, &spa->spa_mos, props, &propdir) == 0 &&
|
||||
zap_lookup(spa, &propdir, "bootfs",
|
||||
sizeof(bootfs), 1, &bootfs) == 0 &&
|
||||
bootfs != 0) {
|
||||
*objid = bootfs;
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Lookup the root dataset directory
|
||||
*/
|
||||
if (zap_lookup(spa, &dir, DMU_POOL_ROOT_DATASET, sizeof (root), 1, &root)
|
||||
|| objset_get_dnode(spa, &spa->spa_mos, root, &dir)) {
|
||||
if (zap_lookup(spa, &dir, DMU_POOL_ROOT_DATASET,
|
||||
sizeof(root), 1, &root) ||
|
||||
objset_get_dnode(spa, &spa->spa_mos, root, &dir)) {
|
||||
printf("ZFS: can't find root dsl_dir\n");
|
||||
return (EIO);
|
||||
}
|
||||
@ -3019,8 +3042,7 @@ zfs_spa_init(spa_t *spa)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (nvlist_find(nv, ZPOOL_CONFIG_TYPE, DATA_TYPE_STRING,
|
||||
NULL, &type)) {
|
||||
if (nvlist_find(nv, ZPOOL_CONFIG_TYPE, DATA_TYPE_STRING, NULL, &type)) {
|
||||
printf("ZFS: can't find vdev details\n");
|
||||
rc = ENOENT;
|
||||
goto done;
|
||||
|
Loading…
Reference in New Issue
Block a user