summaryrefslogtreecommitdiffstats
path: root/sys/boot/sparc64
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2012-05-12 09:03:30 +0000
committeravg <avg@FreeBSD.org>2012-05-12 09:03:30 +0000
commita1cf7817fdc316198beb7e881a16684b20ea9ab8 (patch)
treedf061398b6750e42dc38884e817fdece2299ea9e /sys/boot/sparc64
parent8f2a8ac2b1384a6b3dd4d5d11d4522ea728f9882 (diff)
downloadFreeBSD-src-a1cf7817fdc316198beb7e881a16684b20ea9ab8.zip
FreeBSD-src-a1cf7817fdc316198beb7e881a16684b20ea9ab8.tar.gz
zfsboot/zfsloader: support accessing filesystems within a pool
In zfs loader zfs device name format now is "zfs:pool/fs", fully qualified file path is "zfs:pool/fs:/path/to/file" loader allows accessing files from various pools and filesystems as well as changing currdev to a different pool/filesystem. zfsboot accepts kernel/loader name in a format pool:fs:path/to/file or, as before, pool:path/to/file; in the latter case a default filesystem is used (pool root or bootfs). zfsboot passes guids of the selected pool and dataset to zfsloader to be used as its defaults. zfs support should be architecture independent and is provided in a separate library, but architectures wishing to use this zfs support still have to provide some glue code and their devdesc should be compatible with zfs_devdesc. arch_zfs_probe method is used to discover all disk devices that may be part of ZFS pool(s). libi386 unconditionally includes zfs support, but some zfs-specific functions are stubbed out as weak symbols. The strong definitions are provided in libzfsboot. This change mean that the size of i386_devspec becomes larger to match zfs_devspec. Backward-compatibility shims are provided for recently added sparc64 zfs boot support. Currently that architecture still works the old way and does not support the new features. TODO: - clear up pool root filesystem vs pool bootfs filesystem distinction - update sparc64 support - set vfs.root.mountfrom based on currdev (for zfs) Mid-future TODO: - loader sub-menu for selecting alternative boot environment Distant future TODO: - support accessing snapshots, using a snapshot as readonly root Reviewed by: marius (sparc64), Gavin Mu <gavin.mu@gmail.com> (sparc64) Tested by: Florian Wagner <florian@wagner-flo.net> (x86), marius (sparc64) No objections: fs@, hackers@ MFC after: 1 month
Diffstat (limited to 'sys/boot/sparc64')
-rw-r--r--sys/boot/sparc64/loader/main.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c
index cb0dda2..14cf6d6 100644
--- a/sys/boot/sparc64/loader/main.c
+++ b/sys/boot/sparc64/loader/main.c
@@ -74,6 +74,8 @@ __FBSDID("$FreeBSD$");
#include "libofw.h"
#include "dev_net.h"
+#define MAXBDDEV 31
+
extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[];
enum {
@@ -141,7 +143,7 @@ static vm_offset_t heapva;
static phandle_t root;
#ifdef LOADER_ZFS_SUPPORT
-static int zfs_dev_init(void);
+static int sparc64_zfs_dev_init(void);
#include "zfs.c"
#endif
@@ -157,7 +159,7 @@ struct devsw *devsw[] = {
&netdev,
#endif
#ifdef LOADER_ZFS_SUPPORT
- &zfs_dev,
+ &zfs_dev_compat,
#endif
0
};
@@ -733,7 +735,7 @@ tlb_init_sun4u(void)
#ifdef LOADER_ZFS_SUPPORT
static int
-zfs_dev_init(void)
+sparc64_zfs_dev_init(void)
{
struct vtoc8 vtoc;
char devname[512];
@@ -868,6 +870,13 @@ main(int (*openfirm)(void *))
env_setenv("loaddev", EV_VOLATILE, bootpath,
env_noset, env_nounset);
+#ifdef LOADER_ZFS_SUPPORT
+ /*
+ * Patch up ZFS.
+ */
+ zfs_dev_compat.dv_init = sparc64_zfs_dev_init;
+#endif
+
/*
* Initialize devices.
*/
OpenPOWER on IntegriCloud