diff options
| author | Jorgen Lundman <lundman@lundman.net> | 2012-07-19 20:48:25 +0000 | 
|---|---|---|
| committer | Wolfgang Denk <wd@denx.de> | 2012-08-09 23:42:20 +0200 | 
| commit | 4d3c95f5ea7c737a21cd6b9c59435ee693b3f127 (patch) | |
| tree | d11c09245a46d3b0a55c0937874fb2debcb96490 /include/zfs/zfs.h | |
| parent | 753ac610880e6e563d0384bb114f8b41df89e520 (diff) | |
| download | olio-uboot-2014.01-4d3c95f5ea7c737a21cd6b9c59435ee693b3f127.tar.xz olio-uboot-2014.01-4d3c95f5ea7c737a21cd6b9c59435ee693b3f127.zip | |
zfs: Add ZFS filesystem support
U-Boot port is based on sources forked from GRUB-0.97 by Sun in 2004,
which can be found here:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h
Released by Sun for GRUB under the license:
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
GRUB official releases include ZFS in version:
ftp://alpha.gnu.org/gnu/grub/grub-1.99~rc1.tar.gz
And patched against GRUB Bazaar repository for ashift fixes (4KB HDDs)
more conveniently found at github:
https://github.com/pendor/grub-zfs/commit/e7b6ef3ac3b9685ac4c394c897b1d4221b7381f1
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Diffstat (limited to 'include/zfs/zfs.h')
| -rw-r--r-- | include/zfs/zfs.h | 122 | 
1 files changed, 122 insertions, 0 deletions
| diff --git a/include/zfs/zfs.h b/include/zfs/zfs.h new file mode 100644 index 000000000..319ee6abc --- /dev/null +++ b/include/zfs/zfs.h @@ -0,0 +1,122 @@ +/* + *  GRUB  --  GRand Unified Bootloader + *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc. + * + *  This program is free software; you can redistribute it and/or modify + *  it under the terms of the GNU General Public License as published by + *  the Free Software Foundation; either version 2 of the License, or + *  (at your option) any later version. + * + *  This program is distributed in the hope that it will be useful, + *  but WITHOUT ANY WARRANTY; without even the implied warranty of + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + *  GNU General Public License for more details. + * + *  You should have received a copy of the GNU General Public License + *  along with this program; if not, write to the Free Software + *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + */ + +#ifndef	GRUB_ZFS_HEADER +#define	GRUB_ZFS_HEADER 1 + + +/* + * On-disk version number. + */ +#define	SPA_VERSION			28ULL + +/* + * The following are configuration names used in the nvlist describing a pool's + * configuration. + */ +#define	ZPOOL_CONFIG_VERSION		"version" +#define	ZPOOL_CONFIG_POOL_NAME		"name" +#define	ZPOOL_CONFIG_POOL_STATE		"state" +#define	ZPOOL_CONFIG_POOL_TXG		"txg" +#define	ZPOOL_CONFIG_POOL_GUID		"pool_guid" +#define	ZPOOL_CONFIG_CREATE_TXG		"create_txg" +#define	ZPOOL_CONFIG_TOP_GUID		"top_guid" +#define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree" +#define	ZPOOL_CONFIG_TYPE		"type" +#define	ZPOOL_CONFIG_CHILDREN		"children" +#define	ZPOOL_CONFIG_ID			"id" +#define	ZPOOL_CONFIG_GUID		"guid" +#define	ZPOOL_CONFIG_PATH		"path" +#define	ZPOOL_CONFIG_DEVID		"devid" +#define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array" +#define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift" +#define	ZPOOL_CONFIG_ASHIFT		"ashift" +#define	ZPOOL_CONFIG_ASIZE		"asize" +#define	ZPOOL_CONFIG_DTL		"DTL" +#define	ZPOOL_CONFIG_STATS		"stats" +#define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk" +#define	ZPOOL_CONFIG_ERRCOUNT		"error_count" +#define	ZPOOL_CONFIG_NOT_PRESENT	"not_present" +#define	ZPOOL_CONFIG_SPARES		"spares" +#define	ZPOOL_CONFIG_IS_SPARE		"is_spare" +#define	ZPOOL_CONFIG_NPARITY		"nparity" +#define	ZPOOL_CONFIG_PHYS_PATH		"phys_path" +#define	ZPOOL_CONFIG_L2CACHE		"l2cache" +#define	ZPOOL_CONFIG_HOLE_ARRAY		"hole_array" +#define	ZPOOL_CONFIG_VDEV_CHILDREN	"vdev_children" +#define	ZPOOL_CONFIG_IS_HOLE		"is_hole" +#define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram" +#define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats" +#define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats" +/* + * The persistent vdev state is stored as separate values rather than a single + * 'vdev_state' entry.  This is because a device can be in multiple states, such + * as offline and degraded. + */ +#define	ZPOOL_CONFIG_OFFLINE		"offline" +#define	ZPOOL_CONFIG_FAULTED		"faulted" +#define	ZPOOL_CONFIG_DEGRADED		"degraded" +#define	ZPOOL_CONFIG_REMOVED		"removed" + +#define	VDEV_TYPE_ROOT			"root" +#define	VDEV_TYPE_MIRROR		"mirror" +#define	VDEV_TYPE_REPLACING		"replacing" +#define	VDEV_TYPE_RAIDZ			"raidz" +#define	VDEV_TYPE_DISK			"disk" +#define	VDEV_TYPE_FILE			"file" +#define	VDEV_TYPE_MISSING		"missing" +#define	VDEV_TYPE_HOLE			"hole" +#define	VDEV_TYPE_SPARE			"spare" +#define	VDEV_TYPE_L2CACHE		"l2cache" + +/* + * pool state.  The following states are written to disk as part of the normal + * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining + * states are software abstractions used at various levels to communicate pool + * state. + */ +typedef enum pool_state { +	POOL_STATE_ACTIVE = 0,		/* In active use		*/ +	POOL_STATE_EXPORTED,		/* Explicitly exported		*/ +	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/ +	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/ +	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/ +	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/ +	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/ +	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/ +} pool_state_t; + +struct zfs_data; + +int zfs_fetch_nvlist(device_t dev, char **nvlist); +int zfs_getmdnobj(device_t dev, const char *fsfilename, +			       uint64_t *mdnobj); + +char *zfs_nvlist_lookup_string(char *nvlist, char *name); +char *zfs_nvlist_lookup_nvlist(char *nvlist, char *name); +int zfs_nvlist_lookup_uint64(char *nvlist, char *name, +				   uint64_t *out); +char *zfs_nvlist_lookup_nvlist_array(char *nvlist, char *name, +					   size_t index); +int zfs_nvlist_lookup_nvlist_array_get_nelm(char *nvlist, char *name); + +#endif	/* ! GRUB_ZFS_HEADER */ |