Re: d2d4e1271b33 - main - stand: Change zfs_fmtdev to take a struct devdesc *
- In reply to: Ravi Pokala : "Re: d2d4e1271b33 - main - stand: Change zfs_fmtdev to take a struct devdesc *"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Aug 2022 23:53:53 UTC
On Thu, Aug 11, 2022 at 5:47 PM Ravi Pokala <rpokala@freebsd.org> wrote:
> -----Original Message-----
> From: <owner-src-committers@freebsd.org> on behalf of Warner Losh
> <imp@FreeBSD.org>
> Date: 2022-08-11, Thursday at 09:27
> To: <src-committers@FreeBSD.org>, <dev-commits-src-all@FreeBSD.org>,
> <dev-commits-src-main@FreeBSD.org>
> Subject: git: d2d4e1271b33 - main - stand: Change zfs_fmtdev to take a
> struct devdesc *
>
> The branch main has been updated by imp:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=d2d4e1271b33b233f57fd18a61a1b5c1b0aeb355
>
> commit d2d4e1271b33b233f57fd18a61a1b5c1b0aeb355
> Author: Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2022-08-11 15:05:15 +0000
> Commit: Warner Losh <imp@FreeBSD.org>
> CommitDate: 2022-08-11 16:27:15 +0000
>
> stand: Change zfs_fmtdev to take a struct devdesc *
>
> Yes, but why?
>
So it can be used in the newly minted (though after this commit) dv_fmtdev.
I did so many I didn't
put that reason in each and every commit message.
> Also, shouldn't the other places in zfs_fmtdev() that use 'dev->dd.' be
> updated to use 'vdev->'?
>
I believe I updated everything that should be updated. But if I've missed
something, I'm happy to discuss it.
Warner
> Thanks,
>
> Ravi (rpokala@)
>
> Sponsored by: Netflix
> Differential Revision: https://reviews.freebsd.org/D35974
> ---
> stand/i386/loader/main.c | 2 +-
> stand/i386/zfsboot/zfsboot.c | 2 +-
> stand/libsa/zfs/devicename_stubs.c | 2 +-
> stand/libsa/zfs/libzfs.h | 2 +-
> stand/libsa/zfs/zfs.c | 6 +++---
> stand/userboot/userboot/main.c | 2 +-
> 6 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c
> index 29c40921a85a..4d5a0a98a08e 100644
> --- a/stand/i386/loader/main.c
> +++ b/stand/i386/loader/main.c
> @@ -387,7 +387,7 @@ extract_currdev(void)
>
> #ifdef LOADER_ZFS_SUPPORT
> if (new_currdev.dd.d_dev->dv_type == DEVT_ZFS)
> - init_zfs_boot_options(zfs_fmtdev(&new_currdev));
> + init_zfs_boot_options(zfs_fmtdev(&new_currdev.dd));
> #endif
>
> env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev),
> diff --git a/stand/i386/zfsboot/zfsboot.c
> b/stand/i386/zfsboot/zfsboot.c
> index b68d80e802c2..52fd41688a17 100644
> --- a/stand/i386/zfsboot/zfsboot.c
> +++ b/stand/i386/zfsboot/zfsboot.c
> @@ -226,7 +226,7 @@ main(void)
> */
> if (bdev != NULL && bdev->dd.d_dev->dv_type == DEVT_ZFS) {
> /* set up proper device name string for ZFS */
> - strncpy(boot_devname, zfs_fmtdev(bdev), sizeof
> (boot_devname));
> + strncpy(boot_devname, zfs_fmtdev(&bdev->dd), sizeof
> (boot_devname));
> if (zfs_get_bootonce(bdev, OS_BOOTONCE, cmd,
> sizeof(cmd)) == 0) {
> nvlist_t *benv;
> diff --git a/stand/libsa/zfs/devicename_stubs.c
> b/stand/libsa/zfs/devicename_stubs.c
> index 41bf907e0cf1..e58bc9c40e35 100644
> --- a/stand/libsa/zfs/devicename_stubs.c
> +++ b/stand/libsa/zfs/devicename_stubs.c
> @@ -39,7 +39,7 @@ zfs_parsedev(struct zfs_devdesc *dev, const char
> *devspec, const char **path)
>
> __attribute__((weak))
> char *
> -zfs_fmtdev(void *vdev)
> +zfs_fmtdev(struct devdesc *vdev)
> {
> static char buf[128];
>
> diff --git a/stand/libsa/zfs/libzfs.h b/stand/libsa/zfs/libzfs.h
> index e8676c0d53b8..2f0dfd8afc86 100644
> --- a/stand/libsa/zfs/libzfs.h
> +++ b/stand/libsa/zfs/libzfs.h
> @@ -50,7 +50,7 @@ struct zfs_devdesc {
>
> int zfs_parsedev(struct zfs_devdesc *dev, const char *devspec,
> const char **path);
> -char *zfs_fmtdev(void *vdev);
> +char *zfs_fmtdev(struct devdesc *);
> int zfs_probe_dev(const char *devname, uint64_t *pool_guid);
> int zfs_list(const char *name);
> int zfs_get_bootonce(void *, const char *, char *, size_t);
> diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c
> index 71e3a49c2929..5392bcaa4fb1 100644
> --- a/stand/libsa/zfs/zfs.c
> +++ b/stand/libsa/zfs/zfs.c
> @@ -1583,7 +1583,7 @@ zfs_dev_open(struct open_file *f, ...)
> rv = 0;
> /* This device is not set as currdev, mount us private copy. */
> if (mount == NULL)
> - rv = zfs_mount(zfs_fmtdev(dev), NULL, (void **)&mount);
> + rv = zfs_mount(zfs_fmtdev(&dev->dd), NULL, (void
> **)&mount);
>
> if (rv == 0) {
> f->f_devdata = mount;
> @@ -1681,7 +1681,7 @@ zfs_parsedev(struct zfs_devdesc *dev, const char
> *devspec, const char **path)
> }
>
> char *
> -zfs_fmtdev(void *vdev)
> +zfs_fmtdev(struct devdesc *vdev)
> {
> static char rootname[ZFS_MAXNAMELEN];
> static char buf[2 * ZFS_MAXNAMELEN + 8];
> @@ -1689,7 +1689,7 @@ zfs_fmtdev(void *vdev)
> spa_t *spa;
>
> buf[0] = '\0';
> - if (dev->dd.d_dev->dv_type != DEVT_ZFS)
> + if (vdev->d_dev->dv_type != DEVT_ZFS)
> return (buf);
>
> /* Do we have any pools? */
> diff --git a/stand/userboot/userboot/main.c
> b/stand/userboot/userboot/main.c
> index 07630945cf80..d3f12ab1675e 100644
> --- a/stand/userboot/userboot/main.c
> +++ b/stand/userboot/userboot/main.c
> @@ -260,7 +260,7 @@ extract_currdev(void)
> bzero(&zdev, sizeof(zdev));
> zdev.dd.d_dev = &zfs_dev;
>
> - init_zfs_boot_options(zfs_fmtdev(&zdev));
> + init_zfs_boot_options(zfs_fmtdev(&zdev.dd));
> dd = &zdev.dd;
> } else
> #endif
>
>
>