stand/zfs: Move spa_find_by_dev from zfsimpl.c to zfs.c

zfsimpl.c doesn't know about devdesc at all, but zfs.c does. Move it to
zfs.c, which is the only user. Keep it static for now, but it could be
exposed later if something else were to need it.

Sponsored by:		Netflix
Reviewed by:		tsoome, kevans
Differential Revision:	https://reviews.freebsd.org/D39408
This commit is contained in:
Warner Losh 2023-05-01 09:26:44 -06:00
parent 91ac713b64
commit 439a9766ad
2 changed files with 13 additions and 13 deletions

View file

@ -373,6 +373,19 @@ zfs_readdir(struct open_file *f, struct dirent *d)
}
}
static spa_t *
spa_find_by_dev(struct zfs_devdesc *dev)
{
if (dev->dd.d_dev->dv_type != DEVT_ZFS)
return (NULL);
if (dev->pool_guid == 0)
return (STAILQ_FIRST(&zfs_pools));
return (spa_find_by_guid(dev->pool_guid));
}
/*
* if path is NULL, create mount structure, but do not add it to list.
*/

View file

@ -1367,19 +1367,6 @@ spa_find_by_name(const char *name)
return (NULL);
}
static spa_t *
spa_find_by_dev(struct zfs_devdesc *dev)
{
if (dev->dd.d_dev->dv_type != DEVT_ZFS)
return (NULL);
if (dev->pool_guid == 0)
return (STAILQ_FIRST(&zfs_pools));
return (spa_find_by_guid(dev->pool_guid));
}
static spa_t *
spa_create(uint64_t guid, const char *name)
{