From c08cd0ca15d216d8bb915355aaa840a6483006ce Mon Sep 17 00:00:00 2001 From: avg Date: Fri, 29 Jun 2012 10:28:46 +0000 Subject: [PATCH] MFC r235392,235394,235395: fixes and cleanups for zfs boot MFC git-svn-id: svn://svn.freebsd.org/base/stable/9@237770 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/boot/pc98/libpc98/Makefile | 2 ++ sys/boot/zfs/zfs.c | 3 +-- tools/tools/zfsboottest/zfsboottest.c | 24 +++++++++++++++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/sys/boot/pc98/libpc98/Makefile b/sys/boot/pc98/libpc98/Makefile index 6c6ce892f..0de2e0836 100644 --- a/sys/boot/pc98/libpc98/Makefile +++ b/sys/boot/pc98/libpc98/Makefile @@ -10,6 +10,8 @@ SRCS= bioscd.c biosdisk.c biosmem.c biospnp.c \ comconsole.c devicename.c elf32_freebsd.c \ i386_copy.c i386_module.c nullconsole.c pc98_sys.c pxe.c pxetramp.s \ time.c vidconsole.c +.PATH: ${.CURDIR}/../../zfs +SRCS+= devicename_stubs.c # Enable PXE TFTP or NFS support, not both. .if defined(LOADER_TFTP_SUPPORT) diff --git a/sys/boot/zfs/zfs.c b/sys/boot/zfs/zfs.c index 50a74b391..9f4050741 100644 --- a/sys/boot/zfs/zfs.c +++ b/sys/boot/zfs/zfs.c @@ -56,7 +56,6 @@ static int zfs_stat(struct open_file *f, struct stat *sb); static int zfs_readdir(struct open_file *f, struct dirent *d); struct devsw zfs_dev; -struct devsw zfs_dev_compat; struct fs_ops zfs_fsops = { "zfs", @@ -90,7 +89,7 @@ zfs_open(const char *upath, struct open_file *f) struct file *fp; int rc; - if (f->f_dev != &zfs_dev && f->f_dev != &zfs_dev_compat) + if (f->f_dev != &zfs_dev) return (EINVAL); /* allocate file system specific data structure */ diff --git a/tools/tools/zfsboottest/zfsboottest.c b/tools/tools/zfsboottest/zfsboottest.c index 4b29f9494..305804698 100644 --- a/tools/tools/zfsboottest/zfsboottest.c +++ b/tools/tools/zfsboottest/zfsboottest.c @@ -89,7 +89,11 @@ main(int argc, char** argv) char buf[512], hash[33]; MD5_CTX ctx; struct stat sb; + struct zfsmount zfsmnt; dnode_phys_t dn; +#if 0 + uint64_t rootobj; +#endif spa_t *spa; off_t off; ssize_t n; @@ -138,14 +142,28 @@ main(int argc, char** argv) exit(1); } - if (zfs_mount_pool(spa)) { - fprintf(stderr, "can't mount pool\n"); + if (zfs_spa_init(spa)) { + fprintf(stderr, "can't init pool\n"); exit(1); } +#if 0 + if (zfs_get_root(spa, &rootobj)) { + fprintf(stderr, "can't get root\n"); + exit(1); + } + + if (zfs_mount(spa, rootobj, &zfsmnt)) { +#else + if (zfs_mount(spa, 0, &zfsmnt)) { + fprintf(stderr, "can't mount\n"); + exit(1); + } +#endif + printf("\n"); for (++i, failures = 0; i < argc; i++) { - if (zfs_lookup(spa, argv[i], &dn)) { + if (zfs_lookup(&zfsmnt, argv[i], &dn)) { fprintf(stderr, "%s: can't lookup\n", argv[i]); failures++; continue; -- 2.45.0