Skip to contentSkip to conversation

zfs: Add filesystem ZFS support

PATCH Superseded Jorgen Lundman 5 participants 35 messages May 23, 2012 – Aug 10, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover zfs: Add filesystem ZFS support

ZFS filesystem support from GRUB. Adding 'zfsload' and 'zfsls' commands for ZFS filesystem support. ZFS pool notation syntax is in the format '/POOLNAME/@/directory/directory/file', also explained in help output.

Initial revision given to GRUB is found:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h

Using "either version 2 of the License, or (at your option) any later version."

Jorgen Lundman (2):
ZFS header files
zfs: Add ZFS filesystem support

 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  244 +++++
 fs/Makefile                  |    1 +
 fs/{ => zfs}/Makefile        |   43 +-
 fs/zfs/dev.c                 |  139 +++
 fs/zfs/zfs.c                 | 2414 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   84 ++
 fs/zfs/zfs_lzjb.c            |   94 ++
 fs/zfs/zfs_sha256.c          |  145 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  119 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   80 ++
 include/zfs/dsl_dataset.h    |   52 +
 include/zfs/dsl_dir.h        |   48 +
 include/zfs/sa_impl.h        |   34 +
 include/zfs/spa.h            |  311 ++++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   69 ++
 include/zfs/zap_impl.h       |  112 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   70 ++
 include/zfs/zil.h            |   56 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   49 +
 include/zfs_common.h         |   94 ++
 29 files changed, 4718 insertions(+), 16 deletions(-)
 create mode 100644 common/cmd_zfs.c
 copy fs/{ => zfs}/Makefile (52%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h
#1 lore raw

PATCH 1/2 ZFS header files

---
 include/zfs/dmu.h            |  119 ++++++++++++++++
 include/zfs/dmu_objset.h     |   43 ++++++
 include/zfs/dnode.h          |   80 +++++++++++
 include/zfs/dsl_dataset.h    |   52 +++++++
 include/zfs/dsl_dir.h        |   48 +++++++
 include/zfs/sa_impl.h        |   34 +++++
 include/zfs/spa.h            |  311 ++++++++++++++++++++++++++++++++++++++++++
 include/zfs/uberblock_impl.h |   57 ++++++++
 include/zfs/vdev_impl.h      |   69 +++++++++
 include/zfs/zap_impl.h       |  112 +++++++++++++++
 include/zfs/zap_leaf.h       |  103 ++++++++++++++
 include/zfs/zfs.h            |  122 +++++++++++++++++
 include/zfs/zfs_acl.h        |   55 ++++++++
 include/zfs/zfs_znode.h      |   70 ++++++++++
 include/zfs/zil.h            |   56 ++++++++
 include/zfs/zio.h            |   92 +++++++++++++
 include/zfs/zio_checksum.h   |   49 +++++++
 17 files changed, 1472 insertions(+), 0 deletions(-)
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
include/zfs/dmu.h new file +119 -0
new file mode 100644
index 0000000..bee317e
@@ -0,0 +1,119 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_DMU_H
+#define	_SYS_DMU_H
+
+/*
+ * This file describes the interface that the DMU provides for its
+ * consumers.
+ *
+ * The DMU also interacts with the SPA.  That interface is described in
+ * dmu_spa.h.
+ */
+typedef enum dmu_object_type {
+	DMU_OT_NONE,
+	/* general: */
+	DMU_OT_OBJECT_DIRECTORY,	/* ZAP */
+	DMU_OT_OBJECT_ARRAY,		/* UINT64 */
+	DMU_OT_PACKED_NVLIST,		/* UINT8 (XDR by nvlist_pack/unpack) */
+	DMU_OT_PACKED_NVLIST_SIZE,	/* UINT64 */
+	DMU_OT_BPLIST,			/* UINT64 */
+	DMU_OT_BPLIST_HDR,		/* UINT64 */
+	/* spa: */
+	DMU_OT_SPACE_MAP_HEADER,	/* UINT64 */
+	DMU_OT_SPACE_MAP,		/* UINT64 */
+	/* zil: */
+	DMU_OT_INTENT_LOG,		/* UINT64 */
+	/* dmu: */
+	DMU_OT_DNODE,			/* DNODE */
+	DMU_OT_OBJSET,			/* OBJSET */
+	/* dsl: */
+	DMU_OT_DSL_DIR,			/* UINT64 */
+	DMU_OT_DSL_DIR_CHILD_MAP,	/* ZAP */
+	DMU_OT_DSL_DS_SNAP_MAP,		/* ZAP */
+	DMU_OT_DSL_PROPS,		/* ZAP */
+	DMU_OT_DSL_DATASET,		/* UINT64 */
+	/* zpl: */
+	DMU_OT_ZNODE,			/* ZNODE */
+	DMU_OT_OLDACL,			/* OLD ACL */
+	DMU_OT_PLAIN_FILE_CONTENTS,	/* UINT8 */
+	DMU_OT_DIRECTORY_CONTENTS,	/* ZAP */
+	DMU_OT_MASTER_NODE,		/* ZAP */
+	DMU_OT_UNLINKED_SET,		/* ZAP */
+	/* zvol: */
+	DMU_OT_ZVOL,			/* UINT8 */
+	DMU_OT_ZVOL_PROP,		/* ZAP */
+	/* other; for testing only! */
+	DMU_OT_PLAIN_OTHER,		/* UINT8 */
+	DMU_OT_UINT64_OTHER,		/* UINT64 */
+	DMU_OT_ZAP_OTHER,		/* ZAP */
+	/* new object types: */
+	DMU_OT_ERROR_LOG,		/* ZAP */
+	DMU_OT_SPA_HISTORY,		/* UINT8 */
+	DMU_OT_SPA_HISTORY_OFFSETS,	/* spa_his_phys_t */
+	DMU_OT_POOL_PROPS,		/* ZAP */
+	DMU_OT_DSL_PERMS,		/* ZAP */
+	DMU_OT_ACL,			/* ACL */
+	DMU_OT_SYSACL,			/* SYSACL */
+	DMU_OT_FUID,			/* FUID table (Packed NVLIST UINT8) */
+	DMU_OT_FUID_SIZE,		/* FUID table size UINT64 */
+	DMU_OT_NEXT_CLONES,		/* ZAP */
+	DMU_OT_SCRUB_QUEUE,		/* ZAP */
+	DMU_OT_USERGROUP_USED,		/* ZAP */
+	DMU_OT_USERGROUP_QUOTA,		/* ZAP */
+	DMU_OT_USERREFS,		/* ZAP */
+	DMU_OT_DDT_ZAP,			/* ZAP */
+	DMU_OT_DDT_STATS,		/* ZAP */
+	DMU_OT_SA,			/* System attr */
+	DMU_OT_SA_MASTER_NODE,		/* ZAP */
+	DMU_OT_SA_ATTR_REGISTRATION,	/* ZAP */
+	DMU_OT_SA_ATTR_LAYOUTS,		/* ZAP */
+	DMU_OT_NUMTYPES
+} dmu_object_type_t;
+
+typedef enum dmu_objset_type {
+	DMU_OST_NONE,
+	DMU_OST_META,
+	DMU_OST_ZFS,
+	DMU_OST_ZVOL,
+	DMU_OST_OTHER,			/* For testing only! */
+	DMU_OST_ANY,			/* Be careful! */
+	DMU_OST_NUMTYPES
+} dmu_objset_type_t;
+
+/*
+ * The names of zap entries in the DIRECTORY_OBJECT of the MOS.
+ */
+#define	DMU_POOL_DIRECTORY_OBJECT	1
+#define	DMU_POOL_CONFIG			"config"
+#define	DMU_POOL_ROOT_DATASET		"root_dataset"
+#define	DMU_POOL_SYNC_BPLIST		"sync_bplist"
+#define	DMU_POOL_ERRLOG_SCRUB		"errlog_scrub"
+#define	DMU_POOL_ERRLOG_LAST		"errlog_last"
+#define	DMU_POOL_SPARES			"spares"
+#define	DMU_POOL_DEFLATE		"deflate"
+#define	DMU_POOL_HISTORY		"history"
+#define	DMU_POOL_PROPS			"pool_props"
+#define	DMU_POOL_L2CACHE		"l2cache"
+
+#endif	/* _SYS_DMU_H */
include/zfs/dmu_objset.h new file +43 -0

43 lines not on this page · raw message

include/zfs/dnode.h new file +80 -0

80 lines not on this page · raw message

include/zfs/dsl_dataset.h new file +52 -0

52 lines not on this page · raw message

include/zfs/dsl_dir.h new file +48 -0

48 lines not on this page · raw message

include/zfs/sa_impl.h new file +34 -0
new file mode 100644
index 0000000..4ec49fe
@@ -0,0 +1,34 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#ifndef	_SYS_SA_IMPL_H
+#define	_SYS_SA_IMPL_H
+
+typedef struct sa_hdr_phys {
+	uint32_t sa_magic;
+	uint16_t sa_layout_info;
+	uint16_t sa_lengths[1];
+} sa_hdr_phys_t;
+
+#define	SA_HDR_SIZE(hdr)	BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0)
+#define	SA_SIZE_OFFSET	0x8
+
+#endif	/* _SYS_SA_IMPL_H */
include/zfs/spa.h new file +311 -0

311 lines not on this page · raw message

include/zfs/uberblock_impl.h new file +57 -0

57 lines not on this page · raw message

include/zfs/vdev_impl.h new file +69 -0

69 lines not on this page · raw message

include/zfs/zap_impl.h new file +112 -0

112 lines not on this page · raw message

include/zfs/zap_leaf.h new file +103 -0

103 lines not on this page · raw message

include/zfs/zfs.h new file +122 -0

122 lines not on this page · raw message

include/zfs/zfs_acl.h new file +55 -0

55 lines not on this page · raw message

include/zfs/zfs_znode.h new file +70 -0

70 lines not on this page · raw message

include/zfs/zil.h new file +56 -0

56 lines not on this page · raw message

include/zfs/zio.h new file +92 -0

92 lines not on this page · raw message

include/zfs/zio_checksum.h new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/2 zfs: Add ZFS filesystem support

In reply to Jorgen Lundman

commit bc192bb0716b02b2b711dc2df62ed15e1160ea50

Author: Jorgen Lundman <[email protected]>
Date:   Wed May 23 01:55:02 2012 +0000

typedef changes to decompress

commit bb131ecb4d8e0f3cdc0658457193bb246086bd85

Author: Jorgen Lundman <[email protected]>
Date:   Wed May 23 01:22:17 2012 +0000

Minor style changes

commit 4faac896fc0bdd7cf4eb4669ce9d4a706d8c19ac

Author: Jorgen Lundman <[email protected]>
Date:   Wed May 23 00:23:26 2012 +0000

Style fixes

commit 5fdd1858f1b578067d2e063f2ec88a72f89c5925

Author: Jorgen Lundman <[email protected]>
Date:   Wed May 23 00:07:28 2012 +0000

ZFS

commit 22f35810e150eef0e0a0ce024fca8e7a53b93e71

Author: Jorgen Lundman <[email protected]>
Date:   Tue May 22 08:00:30 2012 +0000

code changes

commit 91652ac002d0e78b3a70d5cbcb3a3aef63273c66

Author: Jorgen Lundman <[email protected]>
Date:   Tue May 22 07:22:55 2012 +0000

code syntax

commit ed20af0a540dba68b8d11b7c069fc51d14d1a195

Author: Jorgen Lundman <[email protected]>
Date:   Tue May 22 06:50:42 2012 +0000

tabify

commit 7ce43d7c3621f8ca9d55bd6ce190bd7663a04a29

Author: Jorgen Lundman <[email protected]>
Date:   Tue May 22 06:38:23 2012 +0000

Coding style changes

commit 0adcf5d595044a06dfaa948cab6db3a4a880f5a9

Author: Jorgen Lundman <[email protected]>
Date:   Mon May 21 08:42:48 2012 +0000

importing ZFS

commit 258052be456f8b3de18d389fb8ac215eb87f7aeb

Author: Jorgen Lundman <[email protected]>
Date:   Thu May 10 07:31:04 2012 +0000

Remove local debug file

commit 9e22da44e013963f9dac13e6da9d134ae8f4e164

Author: Jorgen Lundman <[email protected]>
Date:   Thu May 10 05:46:50 2012 +0000

Missing header files

commit 0428d7116788ea1e9375cbdef7ba357199930e76

Author: Jorgen Lundman <[email protected]>
Date:   Thu May 10 05:30:47 2012 +0000

Update

commit 766e5ecb8db0cbb6cd073d6ce32b03f51f249062

Author: Jorgen Lundman <[email protected]>
Date:   Thu May 10 05:19:52 2012 +0000

ZFS changes

commit bea9588d98f52d95a325f3b71a7ae448242c7b64

Author: Jorgen Lundman <[email protected]>
Date:   Thu May 10 05:11:03 2012 +0000

Adding ZFS

---
 Makefile                 |    2 +-
 common/Makefile          |    1 +
 common/cmd_zfs.c         |  244 +++++
 fs/Makefile              |    1 +
 fs/{ => zfs}/Makefile    |   43 +-
 fs/zfs/dev.c             |  139 +++
 fs/zfs/zfs.c             | 2414 ++++++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c    |   84 ++
 fs/zfs/zfs_lzjb.c        |   94 ++
 fs/zfs/zfs_sha256.c      |  145 +++
 include/config_cmd_all.h |    1 +
 include/zfs_common.h     |   94 ++
 12 files changed, 3246 insertions(+), 16 deletions(-)
 create mode 100644 common/cmd_zfs.c
 copy fs/{ => zfs}/Makefile (52%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs_common.h
Makefile +1 -1
index 351a8f0..d3b84bf 100644
@@ -244,7 +244,7 @@ endif
 LIBS += arch/$(ARCH)/lib/lib$(ARCH).o
 LIBS += fs/cramfs/libcramfs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o \
 	fs/reiserfs/libreiserfs.o fs/ext2/libext2fs.o fs/yaffs2/libyaffs2.o \
-	fs/ubifs/libubifs.o
+	fs/ubifs/libubifs.o fs/zfs/libzfs.o
 LIBS += net/libnet.o
 LIBS += disk/libdisk.o
 LIBS += drivers/bios_emulator/libatibiosemu.o
common/Makefile +1 -0
index 6e23baa..181a9ad 100644
@@ -90,6 +90,7 @@ COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o
 COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o
 COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o
 COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o
+COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
 COBJS-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o
 COBJS-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o
 COBJS-$(CONFIG_CMD_FDOS) += cmd_fdos.o
common/cmd_zfs.c new file +244 -0

244 lines not on this page · raw message

fs/Makefile +1 -0
index 22aad12..b0d62c6 100644
@@ -25,6 +25,7 @@
 subdirs-$(CONFIG_CMD_CRAMFS) := cramfs
 subdirs-$(CONFIG_CMD_EXT2) += ext2
 subdirs-$(CONFIG_CMD_FAT) += fat
+subdirs-$(CONFIG_CMD_ZFS) += zfs
 subdirs-$(CONFIG_CMD_FDOS) += fdos
 subdirs-$(CONFIG_CMD_JFFS2) += jffs2
 subdirs-$(CONFIG_CMD_REISER) += reiserfs
fs/zfs/Makefile renamed from fs/Makefile +28 -15

53 lines not on this page · raw message

fs/zfs/dev.c new file +139 -0

139 lines not on this page · raw message

fs/zfs/zfs.c new file +2414 -0

2,414 lines not on this page · raw message

fs/zfs/zfs_fletcher.c new file +84 -0

84 lines not on this page · raw message

fs/zfs/zfs_lzjb.c new file +94 -0

44 lines not on this page · raw message

fs/zfs/zfs_sha256.c new file +145 -0

145 lines not on this page · raw message

include/config_cmd_all.h +1 -0
index 55f4f7a..5933ae9 100644

Lines of this file are not shown. View the raw message.

include/zfs_common.h new file +94 -0

94 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#3 lore raw

PATCH 2/2 zfs: Add ZFS filesystem support

Hi Jorgen,

Quoted 4 lines · Jorgen Lundman

commit bc192bb0716b02b2b711dc2df62ed15e1160ea50
Author: Jorgen Lundman <[email protected]>
Date: ? Wed May 23 01:55:02 2012 +0000

[snip]

Quoted 4 lines

commit bea9588d98f52d95a325f3b71a7ae448242c7b64
Author: Jorgen Lundman <[email protected]>
Date: ? Thu May 10 05:11:03 2012 +0000

What are all these commit references? Are they from an external git-repo? If so I think the commit message might make more sense if you simply summarise what you have done to adapt the original source code in order to integrate it into U-Boot

Quoted 43 lines

? ?Adding ZFS
---

?Makefile ? ? ? ? ? ? ? ? | ? ?2 +-
?common/Makefile ? ? ? ? ?| ? ?1 +
?common/cmd_zfs.c ? ? ? ? | ?244 +++++
?fs/Makefile ? ? ? ? ? ? ?| ? ?1 +
?fs/{ => zfs}/Makefile ? ?| ? 43 +-
?fs/zfs/dev.c ? ? ? ? ? ? | ?139 +++
?fs/zfs/zfs.c ? ? ? ? ? ? | 2414 ++++++++++++++++++++++++++++++++++++++++++++++
?fs/zfs/zfs_fletcher.c ? ?| ? 84 ++
?fs/zfs/zfs_lzjb.c ? ? ? ?| ? 94 ++
?fs/zfs/zfs_sha256.c ? ? ?| ?145 +++
?include/config_cmd_all.h | ? ?1 +
?include/zfs_common.h ? ? | ? 94 ++

?12 files changed, 3246 insertions(+), 16 deletions(-) ?create mode 100644 common/cmd_zfs.c
?copy fs/{ => zfs}/Makefile (52%)
?create mode 100644 fs/zfs/dev.c
?create mode 100644 fs/zfs/zfs.c
?create mode 100644 fs/zfs/zfs_fletcher.c ?create mode 100644 fs/zfs/zfs_lzjb.c
?create mode 100644 fs/zfs/zfs_sha256.c ?create mode 100644 include/zfs_common.h

Makefile +0 -0
index 351a8f0..d3b84bf 100644
@@ -244,7 +244,7 @@ endif

?LIBS += arch/$(ARCH)/lib/lib$(ARCH).o
?LIBS += fs/cramfs/libcramfs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o \
? ? ? ?fs/reiserfs/libreiserfs.o fs/ext2/libext2fs.o fs/yaffs2/libyaffs2.o \
- ? ? ? fs/ubifs/libubifs.o
+ ? ? ? fs/ubifs/libubifs.o fs/zfs/libzfs.o
?LIBS += net/libnet.o
?LIBS += disk/libdisk.o
?LIBS += drivers/bios_emulator/libatibiosemu.o

common/Makefile +0 -0
index 6e23baa..181a9ad 100644
@@ -90,6 +90,7 @@ COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o
Quoted 7 lines

?COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o ?COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o ?COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o +COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o ?COBJS-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o ?COBJS-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o ?COBJS-$(CONFIG_CMD_FDOS) += cmd_fdos.o

Please keep list sorted

Quoted 27 lines
common/cmd_zfs.c new file +21 -0
new file mode 100644
index 0000000..99c4318
@@ -0,0 +1,244 @@
+/*
+ *
+ * ZFS filesystem implementation in Uboot by
+ * Jorgen Lundman <[email protected]>
+ *
+ * zfsfs support
+ * made from existing GRUB Sources by Sun, GNU and others.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,

common/cmd_zfs.c line 31

Quoted 10 lines
common/cmd_zfs.c new file +10 -0
+ * MA 02111-1307 USA
+ *
+ */
+
+
+/*
+ * Changelog:
+ * ? ? 0.1 - The Epoch
+ * ? ? ? ? ? ? ? ? ? ? - lundman
+ */

Don't include changelogs in source files - We have git for that :)

Quoted 16 lines
common/cmd_zfs.c new file +16 -0
+
+#include <common.h>
+#include <part.h>
+#include <config.h>
+#include <command.h>
+#include <image.h>
+#include <linux/ctype.h>
+#include <asm/byteorder.h>
+#include <zfs_common.h>
+#include <linux/stat.h>
+#include <malloc.h>
+
+#if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
+#include <usb.h>
+#endif
+

common/cmd_zfs.c

Quoted 10 lines
common/cmd_zfs.c new file +10 -0
+#if !defined(CONFIG_DOS_PARTITION) && !defined(CONFIG_EFI_PARTITION)
+#error DOS or EFI partition support must be selected
+#endif
+
+#define DOS_PART_MAGIC_OFFSET ?0x1fe
+#define DOS_FS_TYPE_OFFSET ? ? 0x36
+#define DOS_FS32_TYPE_OFFSET ? 0x52
+
+static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?char *argv[])

Can this be aligned better? Personally I prefer to put each parameter on it's own line once I hit the 80 character limit

Quoted 1 line
common/cmd_zfs.c new file +1 -0
+{

[snip]

Quoted 5 lines
fs/Makefile +0 -0
index 22aad12..b0d62c6 100644
@@ -25,6 +25,7 @@
Quoted 7 lines

?subdirs-$(CONFIG_CMD_CRAMFS) := cramfs ?subdirs-$(CONFIG_CMD_EXT2) += ext2 ?subdirs-$(CONFIG_CMD_FAT) += fat +subdirs-$(CONFIG_CMD_ZFS) += zfs ?subdirs-$(CONFIG_CMD_FDOS) += fdos ?subdirs-$(CONFIG_CMD_JFFS2) += jffs2 ?subdirs-$(CONFIG_CMD_REISER) += reiserfs

Keep sorted

fs/zfs/Makefile line 3

Quoted 13 lines
fs/zfs/Makefile renamed from fs/Makefile +0 -0
similarity index 52%
copy from fs/Makefile
copy to fs/zfs/Makefile
index 22aad12..00ab9e6 100644
@@ -1,6 +1,10 @@

?#

fs/zfs/Makefile renamed from fs/Makefile +2 -2
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# (C) Copyright 2006
+# Wolfgang Denk, DENX Software Engineering, <[email protected]>

Please don't mess with other devs copyright lines

Quoted 39 lines
fs/zfs/Makefile renamed from fs/Makefile +4 -0
+#
+# (C) Copyright 2003
+# Pavel Bartusek, Sysgo Real-Time Solutions AG, <[email protected]>
+#

?#
?# See file CREDITS for list of people who contributed to this ?# project.

fs/zfs/Makefile renamed from fs/Makefile +0 -0
@@ -20,19 +24,28 @@
 ?# Foundation, Inc., 59 Temple Place, Suite 330, Boston,

?# MA 02111-1307 USA
?#

fs/zfs/Makefile renamed from fs/Makefile +18 -9
-#
 
-subdirs-$(CONFIG_CMD_CRAMFS) := cramfs
-subdirs-$(CONFIG_CMD_EXT2) += ext2
-subdirs-$(CONFIG_CMD_FAT) += fat
-subdirs-$(CONFIG_CMD_FDOS) += fdos
-subdirs-$(CONFIG_CMD_JFFS2) += jffs2
-subdirs-$(CONFIG_CMD_REISER) += reiserfs
-subdirs-$(CONFIG_YAFFS2) += yaffs2
-subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+include $(TOPDIR)/config.mk
+
+LIB ? ?= $(obj)libzfs.o
+
+AOBJS ?=
+COBJS-$(CONFIG_CMD_ZFS) := dev.o zfs.o zfs_fletcher.o zfs_sha256.o zfs_lzjb.o
+
+SRCS ? := $(AOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS ? := $(addprefix $(obj),$(AOBJS) $(COBJS-y))
+
+
+all: ? $(LIB) $(AOBJS)
+
+$(LIB): ? ? ? ?$(obj).depend $(OBJS)
+ ? ? ? $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+

fs/zfs/Makefile line 51

Quoted 10 lines
fs/zfs/Makefile renamed from fs/Makefile +4 -4
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
 
-SUBDIRS ? ? ? ?:= $(subdirs-y)
+sinclude $(obj).depend
 
-$(obj).depend all:
- ? ? ? @for dir in $(SUBDIRS) ; do \
- ? ? ? ? ? ? ? $(MAKE) -C $$dir $@ ; done
+#########################################################################

This looks to be an unrelated change - If needed, move this into a seperate patch

Quoted 13 lines
fs/zfs/dev.c new file +6 -0
new file mode 100644
index 0000000..d61ff80
@@ -0,0 +1,139 @@
 
+
+int zfs_set_blk_dev(block_dev_desc_t *rbdd, int part)
+{
+ ? ? ? zfs_block_dev_desc = rbdd;
+
+ ? ? ? if (part == 0) {

fs/zfs/dev.c

Quoted 10 lines
fs/zfs/dev.c new file +10 -0
+ ? ? ? ? ? ? ? /* disk doesn't use partition table */
+ ? ? ? ? ? ? ? part_info.start = 0;
+ ? ? ? ? ? ? ? part_info.size = rbdd->lba;
+ ? ? ? ? ? ? ? part_info.blksz = rbdd->blksz;
+ ? ? ? } else {
+ ? ? ? ? ? ? ? if (get_partition_info
+ ? ? ? ? ? ? ? ? ? ? ? (zfs_block_dev_desc, part, &part_info)) {
+ ? ? ? ? ? ? ? ? ? ? ? return 0;
+ ? ? ? ? ? ? ? }
+ ? ? ? }

Insert a blank line

Quoted 6 lines

+ ? ? ? return part_info.size;

fs/zfs/dev.c new file +5 -0
+}
+
+/* err */
+int zfs_devread(int sector, int byte_offset, int byte_len, char *buf)
+{

fs/zfs/dev.c

Quoted 10 lines
fs/zfs/dev.c new file +10 -0
+ ? ? ? short sec_buffer[SECTOR_SIZE/sizeof(short)];
+ ? ? ? char *sec_buf = sec_buffer;
+ ? ? ? unsigned block_len;
+
+ ? ? ? /*
+ ? ? ? ?* ? ? ?Check partition boundaries
+ ? ? ? ?*/
+ ? ? ? if ((sector < 0)
+ ? ? ? ? ? ? ? || ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS)) >=
+ ? ? ? ? ? ? ? ? ? ? ? part_info.size)) {

Put the || operator on the previous line and fix vertical alignment of subsequent lines

Quoted 11 lines

+ ? ? ? ? ? ? ? /* ? ? ? ? ? ? ?errnum = ERR_OUTSIDE_PART; */
+ ? ? ? ? ? ? ? printf(" ** zfs_devread() read outside partition sector %d\n", sector);
+ ? ? ? ? ? ? ? return 1;
+ ? ? ? }

fs/zfs/dev.c new file +7 -0
+
+ ? ? ? /*
+ ? ? ? ?* ? ? ?Get the read to the beginning of a partition.
+ ? ? ? ?*/
+ ? ? ? sector += byte_offset >> SECTOR_BITS;
+ ? ? ? byte_offset &= SECTOR_SIZE - 1;
+

fs/zfs/dev.c

Quoted 10 lines
fs/zfs/dev.c new file +10 -0
+ ? ? ? debug(" <%d, %d, %d>\n", sector, byte_offset, byte_len);
+
+ ? ? ? if (zfs_block_dev_desc == NULL) {
+ ? ? ? ? ? ? ? printf("** Invalid Block Device Descriptor (NULL)\n");
+ ? ? ? ? ? ? ? return 1;
+ ? ? ? }
+
+ ? ? ? if (byte_offset != 0) {
+ ? ? ? ? ? ? ? /* read first part which isn't aligned with start of sector */
+ ? ? ? ? ? ? ? if (zfs_block_dev_desc->

Ewww, that's a very ugly split

Quoted 3 lines

+ ? ? ? ? ? ? ? ? ? ? ? block_read(zfs_block_dev_desc->dev,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?part_info.start + sector, 1,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(unsigned long *) sec_buf) != 1) {

alignment - should look more like:

+ ? ? ? ? ? ? ? if (zfs_block_dev_desc->block_read(zfs_block_dev_desc->dev,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? part_info.start + sector,
+ 1,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(unsigned long *)
sec_buf) != 1) {

[snip]

fs/zfs/zfs.c line 2

Quoted 8 lines
fs/zfs/zfs.c new file +2 -0
new file mode 100644
index 0000000..e7369cd
@@ -0,0 +1,2414 @@
+/*
+ * ZFS filesystem implementation in u-boot by

'ported to' versus 'implementation' ?

fs/zfs/zfs.c line 6

Quoted 4 lines
fs/zfs/zfs.c new file +4 -0
+ * Jorgen Lundman <[email protected]>
+ *
+ * ZFS-fs support
+ * made from existing GRUB Sources by Sun, GNU and others.

Is this an identical copyright attribution from the original source?

Quoted 37 lines
fs/zfs/zfs.c new file +37 -0
+ *
+ * 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.
+ */
+
+
+#include <common.h>
+#include <malloc.h>
+#include <linux/stat.h>
+#include <linux/time.h>
+#include <linux/ctype.h>
+#include <asm/byteorder.h>
+#include "zfs_common.h"
+
+
+block_dev_desc_t *zfs_dev_desc;
+
+/*
+ * ? ? GRUB ?-- ?GRand Unified Bootloader
+ * ? ? Copyright (C) 1999,2000,2001,2002,2003,2004,2009,2010
+ * ? ? Free Software Foundation, Inc.
+ * ? ? Copyright 2010 ?Sun Microsystems, Inc.
+ *
+ * ? ? GRUB 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 3 of the License, or

fs/zfs/zfs.c line 53

Quoted 10 lines
fs/zfs/zfs.c new file +10 -0
+ * ? ? (at your option) any later version.
+ *
+ * ? ? GRUB 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 GRUB. ?If not, see <http://www.gnu.org/licenses/>.
+ */

Wow, I can't believe they put the copyright notice here! Maybe move it above the #includes

I quickly scanned the rest - nothing else not mentioned above jumped out at me. For a first cut, this looks pretty good

Regards,

Graeme

#4 lore raw

PATCH 2/2 zfs: Add ZFS filesystem support

Quoted 6 lines

What are all these commit references? Are they from an external git-repo? If so I think the commit message might make more sense if you simply summarise what you have done to adapt the original source code in order to integrate it into U-Boot

Hmm I assumed --squash would git rid of that history, I guess not. I'll find a way.

Quoted 1 line

Please keep list sorted

I didn't even notice it was sorted. Of course this leave the issue of:

COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o

Not sure if I was supposed to go before or after that dangling spl.

Quoted 6 lines

Don't include changelogs in source files - We have git for that :)

Can this be aligned better? Personally I prefer to put each parameter on it's own line once I hit the 80 character limit

Keep sorted

All done.

Quoted 1 line

Please don't mess with other devs copyright lines

Oops.

Quoted 2 lines

This looks to be an unrelated change - If needed, move this into a seperate patch

Actually, git noticed I copied the ../Makefile and changed it for zfs/Makefile. That's pretty neat.

Quoted 6 lines

Insert a blank line

Put the || operator on the previous line and fix vertical alignment of subsequent lines

Ewww, that's a very ugly split

Lesson here is don't assume file taken from ext2/dev.c to be ok :)

Quoted 1 line

'ported to' versus 'implementation' ?

Ah of course.

Quoted 1 line

Is this an identical copyright attribution from the original source?

Changed it to only have original license.

Once I test compile and compliance again, I will resend for your scrutiny.

Lund

Signature · 4 lines
Jorgen Lundman       | <[email protected]>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)
#5 lore raw

PATCH 2/2 zfs: Add ZFS filesystem support

Hi Jorgen,

Quoted 15 lines · Jorgen Lundman
Quoted 6 lines

What are all these commit references? Are they from an external git-repo? If so I think the commit message might make more sense if you simply summarise what you have done to adapt the original source code in order to integrate it into U-Boot

Hmm I assumed --squash would git rid of that history, I guess not. I'll find a way.

Quoted 1 line

Please keep list sorted

Quoted 7 lines

I didn't even notice it was sorted. Of course this leave the issue of:

COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o

Not sure if I was supposed to go before or after that dangling spl.

Have a patch that sorts the list then add zfs :)

Quoted 7 lines
Quoted 3 lines

This looks to be an unrelated change - If needed, move this into a seperate
patch

Actually, git noticed I copied the ../Makefile and changed it for zfs/Makefile. That's pretty neat.

Thats OK - It just looked odd

Quoted 1 line

Once I test compile and compliance again, I will resend for your scrutiny.

Best to wait a couple of days - I'm sure there will be other comments

And don't forget to rev you patch series and add revision notes below the ---

Regards,

Graeme

#6 lore raw

PATCH v2 2/2 zfs: Add ZFS filesystem support

In reply to Jorgen Lundman

Dear Jorgen Lundman,

Quoted 8 lines · In message <[email protected]> you wrote:

I didn't even notice it was sorted. Of course this leave the issue of:

COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o

Not sure if I was supposed to go before or after that dangling spl.

CONFIG_YAFFS2 should be renamed into CONFIG_CMD_YAFFS2, and both CONFIG_CMD_YAFFS2 and CONFIG_CMD_SPL should be sorted, too. But that would be a separate patch.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Mirrors should reflect a little before throwing back images.
- Jean Cocteau
#7 lore raw

v2 cover zfs: Add filesystem ZFS support

In reply to Jorgen Lundman

ZFS filesystem support from GRUB. Adding 'zfsload' and 'zfsls' commands for filesystem access. ZFS pool notation syntax is in the format '/POOLNAME/@/directory/directory/file', also explained in help output.

Initial revision given to GRUB is found:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h

Using "either version 2 of the License, or (at your option) any later version."

Jorgen Lundman (2):
ZFS header files
zfs: Add ZFS support

 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  236 +++++
 fs/Makefile                  |    3 +-
 fs/{ => zfs}/Makefile        |   39 +-
 fs/zfs/dev.c                 |  137 +++
 fs/zfs/zfs.c                 | 2396 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   84 ++
 fs/zfs/zfs_lzjb.c            |   94 ++
 fs/zfs/zfs_sha256.c          |  145 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  119 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   80 ++
 include/zfs/dsl_dataset.h    |   52 +
 include/zfs/dsl_dir.h        |   48 +
 include/zfs/sa_impl.h        |   34 +
 include/zfs/spa.h            |  311 ++++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   69 ++
 include/zfs/zap_impl.h       |  112 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   70 ++
 include/zfs/zil.h            |   56 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   49 +
 include/zfs_common.h         |   94 ++
 29 files changed, 4687 insertions(+), 17 deletions(-)
 create mode 100644 common/cmd_zfs.c
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h
#8 lore raw

v2 cover zfs: Add filesystem ZFS support

Dear Jorgen Lundman,

Quoted 8 lines · In message <[email protected]> you wrote:

ZFS filesystem support from GRUB. Adding 'zfsload' and 'zfsls' commands for filesystem access. ZFS pool notation syntax is in the format '/POOLNAME/@/directory/directory/file', also explained in help output.

Initial revision given to GRUB is found:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h

Using "either version 2 of the License, or (at your option) any later version."

Please move this information into the actual patch commit messages. This cover letter is lost in the git history.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"In matrimony, to hesitate is sometimes to be saved."        - Butler
#9 lore raw

PATCH v2 1/2 ZFS header files

In reply to Jorgen Lundman
---
 include/zfs/dmu.h            |  119 ++++++++++++++++
 include/zfs/dmu_objset.h     |   43 ++++++
 include/zfs/dnode.h          |   80 +++++++++++
 include/zfs/dsl_dataset.h    |   52 +++++++
 include/zfs/dsl_dir.h        |   48 +++++++
 include/zfs/sa_impl.h        |   34 +++++
 include/zfs/spa.h            |  311 ++++++++++++++++++++++++++++++++++++++++++
 include/zfs/uberblock_impl.h |   57 ++++++++
 include/zfs/vdev_impl.h      |   69 +++++++++
 include/zfs/zap_impl.h       |  112 +++++++++++++++
 include/zfs/zap_leaf.h       |  103 ++++++++++++++
 include/zfs/zfs.h            |  122 +++++++++++++++++
 include/zfs/zfs_acl.h        |   55 ++++++++
 include/zfs/zfs_znode.h      |   70 ++++++++++
 include/zfs/zil.h            |   56 ++++++++
 include/zfs/zio.h            |   92 +++++++++++++
 include/zfs/zio_checksum.h   |   49 +++++++
 17 files changed, 1472 insertions(+), 0 deletions(-)
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
include/zfs/dmu.h new file +119 -0
new file mode 100644
index 0000000..bee317e
@@ -0,0 +1,119 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_SYS_DMU_H
+#define	_SYS_DMU_H
+
+/*
+ * This file describes the interface that the DMU provides for its
+ * consumers.
+ *
+ * The DMU also interacts with the SPA.  That interface is described in
+ * dmu_spa.h.
+ */
+typedef enum dmu_object_type {
+	DMU_OT_NONE,
+	/* general: */
+	DMU_OT_OBJECT_DIRECTORY,	/* ZAP */
+	DMU_OT_OBJECT_ARRAY,		/* UINT64 */
+	DMU_OT_PACKED_NVLIST,		/* UINT8 (XDR by nvlist_pack/unpack) */
+	DMU_OT_PACKED_NVLIST_SIZE,	/* UINT64 */
+	DMU_OT_BPLIST,			/* UINT64 */
+	DMU_OT_BPLIST_HDR,		/* UINT64 */
+	/* spa: */
+	DMU_OT_SPACE_MAP_HEADER,	/* UINT64 */
+	DMU_OT_SPACE_MAP,		/* UINT64 */
+	/* zil: */
+	DMU_OT_INTENT_LOG,		/* UINT64 */
+	/* dmu: */
+	DMU_OT_DNODE,			/* DNODE */
+	DMU_OT_OBJSET,			/* OBJSET */
+	/* dsl: */
+	DMU_OT_DSL_DIR,			/* UINT64 */
+	DMU_OT_DSL_DIR_CHILD_MAP,	/* ZAP */
+	DMU_OT_DSL_DS_SNAP_MAP,		/* ZAP */
+	DMU_OT_DSL_PROPS,		/* ZAP */
+	DMU_OT_DSL_DATASET,		/* UINT64 */
+	/* zpl: */
+	DMU_OT_ZNODE,			/* ZNODE */
+	DMU_OT_OLDACL,			/* OLD ACL */
+	DMU_OT_PLAIN_FILE_CONTENTS,	/* UINT8 */
+	DMU_OT_DIRECTORY_CONTENTS,	/* ZAP */
+	DMU_OT_MASTER_NODE,		/* ZAP */
+	DMU_OT_UNLINKED_SET,		/* ZAP */
+	/* zvol: */
+	DMU_OT_ZVOL,			/* UINT8 */
+	DMU_OT_ZVOL_PROP,		/* ZAP */
+	/* other; for testing only! */
+	DMU_OT_PLAIN_OTHER,		/* UINT8 */
+	DMU_OT_UINT64_OTHER,		/* UINT64 */
+	DMU_OT_ZAP_OTHER,		/* ZAP */
+	/* new object types: */
+	DMU_OT_ERROR_LOG,		/* ZAP */
+	DMU_OT_SPA_HISTORY,		/* UINT8 */
+	DMU_OT_SPA_HISTORY_OFFSETS,	/* spa_his_phys_t */
+	DMU_OT_POOL_PROPS,		/* ZAP */
+	DMU_OT_DSL_PERMS,		/* ZAP */
+	DMU_OT_ACL,			/* ACL */
+	DMU_OT_SYSACL,			/* SYSACL */
+	DMU_OT_FUID,			/* FUID table (Packed NVLIST UINT8) */
+	DMU_OT_FUID_SIZE,		/* FUID table size UINT64 */
+	DMU_OT_NEXT_CLONES,		/* ZAP */
+	DMU_OT_SCRUB_QUEUE,		/* ZAP */
+	DMU_OT_USERGROUP_USED,		/* ZAP */
+	DMU_OT_USERGROUP_QUOTA,		/* ZAP */
+	DMU_OT_USERREFS,		/* ZAP */
+	DMU_OT_DDT_ZAP,			/* ZAP */
+	DMU_OT_DDT_STATS,		/* ZAP */
+	DMU_OT_SA,			/* System attr */
+	DMU_OT_SA_MASTER_NODE,		/* ZAP */
+	DMU_OT_SA_ATTR_REGISTRATION,	/* ZAP */
+	DMU_OT_SA_ATTR_LAYOUTS,		/* ZAP */
+	DMU_OT_NUMTYPES
+} dmu_object_type_t;
+
+typedef enum dmu_objset_type {
+	DMU_OST_NONE,
+	DMU_OST_META,
+	DMU_OST_ZFS,
+	DMU_OST_ZVOL,
+	DMU_OST_OTHER,			/* For testing only! */
+	DMU_OST_ANY,			/* Be careful! */
+	DMU_OST_NUMTYPES
+} dmu_objset_type_t;
+
+/*
+ * The names of zap entries in the DIRECTORY_OBJECT of the MOS.
+ */
+#define	DMU_POOL_DIRECTORY_OBJECT	1
+#define	DMU_POOL_CONFIG			"config"
+#define	DMU_POOL_ROOT_DATASET		"root_dataset"
+#define	DMU_POOL_SYNC_BPLIST		"sync_bplist"
+#define	DMU_POOL_ERRLOG_SCRUB		"errlog_scrub"
+#define	DMU_POOL_ERRLOG_LAST		"errlog_last"
+#define	DMU_POOL_SPARES			"spares"
+#define	DMU_POOL_DEFLATE		"deflate"
+#define	DMU_POOL_HISTORY		"history"
+#define	DMU_POOL_PROPS			"pool_props"
+#define	DMU_POOL_L2CACHE		"l2cache"
+
+#endif	/* _SYS_DMU_H */
include/zfs/dmu_objset.h new file +43 -0

43 lines not on this page · raw message

include/zfs/dnode.h new file +80 -0

80 lines not on this page · raw message

include/zfs/dsl_dataset.h new file +52 -0

52 lines not on this page · raw message

include/zfs/dsl_dir.h new file +48 -0

48 lines not on this page · raw message

include/zfs/sa_impl.h new file +34 -0
new file mode 100644
index 0000000..4ec49fe
@@ -0,0 +1,34 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *
+ *  GRUB 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 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#ifndef	_SYS_SA_IMPL_H
+#define	_SYS_SA_IMPL_H
+
+typedef struct sa_hdr_phys {
+	uint32_t sa_magic;
+	uint16_t sa_layout_info;
+	uint16_t sa_lengths[1];
+} sa_hdr_phys_t;
+
+#define	SA_HDR_SIZE(hdr)	BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0)
+#define	SA_SIZE_OFFSET	0x8
+
+#endif	/* _SYS_SA_IMPL_H */
include/zfs/spa.h new file +311 -0

311 lines not on this page · raw message

include/zfs/uberblock_impl.h new file +57 -0

57 lines not on this page · raw message

include/zfs/vdev_impl.h new file +69 -0

69 lines not on this page · raw message

include/zfs/zap_impl.h new file +112 -0

112 lines not on this page · raw message

include/zfs/zap_leaf.h new file +103 -0

103 lines not on this page · raw message

include/zfs/zfs.h new file +122 -0

122 lines not on this page · raw message

include/zfs/zfs_acl.h new file +55 -0

55 lines not on this page · raw message

include/zfs/zfs_znode.h new file +70 -0

70 lines not on this page · raw message

include/zfs/zil.h new file +56 -0

56 lines not on this page · raw message

include/zfs/zio.h new file +92 -0

92 lines not on this page · raw message

include/zfs/zio_checksum.h new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#10 lore raw

PATCH v2 1/2 ZFS header files

Dear Jorgen Lundman,

Quoted 2 lines · In message <[email protected]> you wrote:

---

Please provide a useful commit message.

Also, this being a V2 patch, you are supposed to provide a history of changes. Please see
http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Finally, it makes little sense to add the headers separately. Please squash both patches into on.

And please add information where _exactly_ the code has been copied from; for an example how to do this please see
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
i. e. pleaseinclude information about download resp. reposity URL plus exact version that was used as base for this work.

Thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The most difficult thing in the world is to know how to  do  a  thing
and to watch someone else doing it wrong, without commenting.
                                                        -- T.H. White
#11 lore raw

PATCH v2 1/2 ZFS header files

Quoted 5 lines
Quoted 2 lines · In message<[email protected]> you wrote:

---

Please provide a useful commit message.

Graeme has been schooling me on this and I believe I know what to do in V3. He also recommend I wait a day or so, so that others can't have a chance to comment.

Quoted 2 lines

Finally, it makes little sense to add the headers separately. Please squash both patches into on.

The wiki mention a strict 100KB limit per mail, so I made 2 patches to avoid it. The headers split was just an arbitrary logical split I made.

Quoted 6 lines

And please add information where _exactly_ the code has been copied from; for an example how to do this please see
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
i. e. pleaseinclude information about download resp. reposity URL plus exact version that was used as base for this work.

Understood.

Signature · 4 lines
Jorgen Lundman       | <[email protected]>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)
#12 lore raw

PATCH v2 2/2 zfs: Add ZFS support

In reply to Jorgen Lundman
---
 Makefile                 |    2 +-
 common/Makefile          |    1 +
 common/cmd_zfs.c         |  236 +++++
 fs/Makefile              |    3 +-
 fs/{ => zfs}/Makefile    |   39 +-
 fs/zfs/dev.c             |  137 +++
 fs/zfs/zfs.c             | 2396 ++++++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c    |   84 ++
 fs/zfs/zfs_lzjb.c        |   94 ++
 fs/zfs/zfs_sha256.c      |  145 +++
 include/config_cmd_all.h |    1 +
 include/zfs_common.h     |   94 ++
 12 files changed, 3215 insertions(+), 17 deletions(-)
 create mode 100644 common/cmd_zfs.c
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs_common.h
Makefile +1 -1
index 351a8f0..d3b84bf 100644
@@ -244,7 +244,7 @@ endif
 LIBS += arch/$(ARCH)/lib/lib$(ARCH).o
 LIBS += fs/cramfs/libcramfs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o \
 	fs/reiserfs/libreiserfs.o fs/ext2/libext2fs.o fs/yaffs2/libyaffs2.o \
-	fs/ubifs/libubifs.o
+	fs/ubifs/libubifs.o fs/zfs/libzfs.o
 LIBS += net/libnet.o
 LIBS += disk/libdisk.o
 LIBS += drivers/bios_emulator/libatibiosemu.o
common/Makefile +1 -0
index 6e23baa..4de03da 100644
@@ -164,6 +164,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o
 endif
 COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o
 COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
+COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
 COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o
 
 # others
common/cmd_zfs.c new file +236 -0

236 lines not on this page · raw message

fs/Makefile +2 -1
index 22aad12..baa7e96 100644
@@ -1,6 +1,6 @@
 #
 # (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# Wolfgang Denk, DENX Software Engineering, <[email protected]>
 #
 # See file CREDITS for list of people who contributed to this
 # project.
@@ -30,6 +30,7 @@ subdirs-$(CONFIG_CMD_JFFS2) += jffs2
 subdirs-$(CONFIG_CMD_REISER) += reiserfs
 subdirs-$(CONFIG_YAFFS2) += yaffs2
 subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+subdirs-$(CONFIG_CMD_ZFS) += zfs
 
 SUBDIRS	:= $(subdirs-y)
 
fs/zfs/Makefile renamed from fs/Makefile +24 -15
similarity index 56%
copy from fs/Makefile
copy to fs/zfs/Makefile
index 22aad12..938fc5e 100644
@@ -1,6 +1,6 @@
 #
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# (C) Copyright 2012
+# Jorgen Lundman <[email protected]>
 #
 # See file CREDITS for list of people who contributed to this
 # project.
@@ -20,19 +20,28 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-#
 
-subdirs-$(CONFIG_CMD_CRAMFS) := cramfs
-subdirs-$(CONFIG_CMD_EXT2) += ext2
-subdirs-$(CONFIG_CMD_FAT) += fat
-subdirs-$(CONFIG_CMD_FDOS) += fdos
-subdirs-$(CONFIG_CMD_JFFS2) += jffs2
-subdirs-$(CONFIG_CMD_REISER) += reiserfs
-subdirs-$(CONFIG_YAFFS2) += yaffs2
-subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)libzfs.o
+
+AOBJS	=
+COBJS-$(CONFIG_CMD_ZFS) := dev.o zfs.o zfs_fletcher.o zfs_sha256.o zfs_lzjb.o
+
+SRCS	:= $(AOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS-y))
+
+
+all:	$(LIB) $(AOBJS)
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
 
-SUBDIRS	:= $(subdirs-y)
+sinclude $(obj).depend
 
-$(obj).depend all:
-	@for dir in $(SUBDIRS) ; do \
-		$(MAKE) -C $$dir $@ ; done
+#########################################################################
fs/zfs/dev.c new file +137 -0

137 lines not on this page · raw message

fs/zfs/zfs.c new file +2396 -0

2,396 lines not on this page · raw message

fs/zfs/zfs_fletcher.c new file +84 -0

84 lines not on this page · raw message

fs/zfs/zfs_lzjb.c new file +94 -0

69 lines not on this page · raw message

fs/zfs/zfs_sha256.c new file +145 -0

145 lines not on this page · raw message

include/config_cmd_all.h +1 -0
index 55f4f7a..5933ae9 100644

Lines of this file are not shown. View the raw message.

include/zfs_common.h new file +94 -0

94 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#13 lore raw

PATCH v2 2/2 zfs: Add ZFS support

Hi Jorgen,

Quoted 3 lines · Jorgen Lundman

---
?Makefile ? ? ? ? ? ? ? ? | ? ?2 +-

You just committed a major ML no-no

Always out a revision summary below the --- (even if it's a 'no change')

Regards,

Graeme

#14 lore raw

v3 cover zfs: Add ZFS filesystem support

In reply to Jorgen Lundman

Patch to add ZFS filesystem support to u-boot, based on GRUB sources. Thank you for your patience.

Jorgen Lundman (1):
Add ZFS filesystem support

 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  236 +++++
 fs/Makefile                  |    3 +-
 fs/{ => zfs}/Makefile        |   39 +-
 fs/zfs/dev.c                 |  137 +++
 fs/zfs/zfs.c                 | 2396 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   84 ++
 fs/zfs/zfs_lzjb.c            |   94 ++
 fs/zfs/zfs_sha256.c          |  145 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  119 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   80 ++
 include/zfs/dsl_dataset.h    |   52 +
 include/zfs/dsl_dir.h        |   48 +
 include/zfs/sa_impl.h        |   34 +
 include/zfs/spa.h            |  311 ++++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   69 ++
 include/zfs/zap_impl.h       |  112 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   70 ++
 include/zfs/zil.h            |   56 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   49 +
 include/zfs_common.h         |   94 ++
 29 files changed, 4687 insertions(+), 17 deletions(-)
 create mode 100644 common/cmd_zfs.c
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h
#15 lore raw

PATCH v3 1/1 Add ZFS filesystem support

In reply to Jorgen Lundman

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

---

v3: * add missing patch revision history (this text)
* Submitted as single patch per Wolfgang Denk instructions

v2: * Keep Makefile placement alphabetically sorted.
* Clean ugly line breaks and indentation errors
* Fix license corruption in fs/Makefile

---
 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  236 +++++
 fs/Makefile                  |    3 +-
 fs/{ => zfs}/Makefile        |   39 +-
 fs/zfs/dev.c                 |  137 +++
 fs/zfs/zfs.c                 | 2396 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   84 ++
 fs/zfs/zfs_lzjb.c            |   94 ++
 fs/zfs/zfs_sha256.c          |  145 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  119 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   80 ++
 include/zfs/dsl_dataset.h    |   52 +
 include/zfs/dsl_dir.h        |   48 +
 include/zfs/sa_impl.h        |   34 +
 include/zfs/spa.h            |  311 ++++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   69 ++
 include/zfs/zap_impl.h       |  112 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   70 ++
 include/zfs/zil.h            |   56 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   49 +
 include/zfs_common.h         |   94 ++
 29 files changed, 4687 insertions(+), 17 deletions(-)
 create mode 100644 common/cmd_zfs.c
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h
Makefile +1 -1
index 351a8f0..d3b84bf 100644
@@ -244,7 +244,7 @@ endif
 LIBS += arch/$(ARCH)/lib/lib$(ARCH).o
 LIBS += fs/cramfs/libcramfs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o \
 	fs/reiserfs/libreiserfs.o fs/ext2/libext2fs.o fs/yaffs2/libyaffs2.o \
-	fs/ubifs/libubifs.o
+	fs/ubifs/libubifs.o fs/zfs/libzfs.o
 LIBS += net/libnet.o
 LIBS += disk/libdisk.o
 LIBS += drivers/bios_emulator/libatibiosemu.o
common/Makefile +1 -0
index 6e23baa..4de03da 100644
@@ -164,6 +164,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o
 endif
 COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o
 COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
+COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
 COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o
 
 # others
common/cmd_zfs.c new file +236 -0

236 lines not on this page · raw message

fs/Makefile +2 -1
index 22aad12..baa7e96 100644
@@ -1,6 +1,6 @@
 #
 # (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# Wolfgang Denk, DENX Software Engineering, <[email protected]>
 #
 # See file CREDITS for list of people who contributed to this
 # project.
@@ -30,6 +30,7 @@ subdirs-$(CONFIG_CMD_JFFS2) += jffs2
 subdirs-$(CONFIG_CMD_REISER) += reiserfs
 subdirs-$(CONFIG_YAFFS2) += yaffs2
 subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+subdirs-$(CONFIG_CMD_ZFS) += zfs
 
 SUBDIRS	:= $(subdirs-y)
 
fs/zfs/Makefile renamed from fs/Makefile +24 -15
similarity index 56%
copy from fs/Makefile
copy to fs/zfs/Makefile
index 22aad12..938fc5e 100644
@@ -1,6 +1,6 @@
 #
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# (C) Copyright 2012
+# Jorgen Lundman <[email protected]>
 #
 # See file CREDITS for list of people who contributed to this
 # project.
@@ -20,19 +20,28 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-#
 
-subdirs-$(CONFIG_CMD_CRAMFS) := cramfs
-subdirs-$(CONFIG_CMD_EXT2) += ext2
-subdirs-$(CONFIG_CMD_FAT) += fat
-subdirs-$(CONFIG_CMD_FDOS) += fdos
-subdirs-$(CONFIG_CMD_JFFS2) += jffs2
-subdirs-$(CONFIG_CMD_REISER) += reiserfs
-subdirs-$(CONFIG_YAFFS2) += yaffs2
-subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)libzfs.o
+
+AOBJS	=
+COBJS-$(CONFIG_CMD_ZFS) := dev.o zfs.o zfs_fletcher.o zfs_sha256.o zfs_lzjb.o
+
+SRCS	:= $(AOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS-y))
+
+
+all:	$(LIB) $(AOBJS)
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
 
-SUBDIRS	:= $(subdirs-y)
+sinclude $(obj).depend
 
-$(obj).depend all:
-	@for dir in $(SUBDIRS) ; do \
-		$(MAKE) -C $$dir $@ ; done
+#########################################################################
fs/zfs/dev.c new file +137 -0

137 lines not on this page · raw message

fs/zfs/zfs.c new file +2396 -0

2,396 lines not on this page · raw message

fs/zfs/zfs_fletcher.c new file +84 -0

84 lines not on this page · raw message

fs/zfs/zfs_lzjb.c new file +94 -0

69 lines not on this page · raw message

fs/zfs/zfs_sha256.c new file +145 -0

145 lines not on this page · raw message

include/config_cmd_all.h +1 -0
index 55f4f7a..5933ae9 100644

Lines of this file are not shown. View the raw message.

include/zfs/dmu.h new file +119 -0

119 lines not on this page · raw message

include/zfs/dmu_objset.h new file +43 -0

43 lines not on this page · raw message

include/zfs/dnode.h new file +80 -0

80 lines not on this page · raw message

include/zfs/dsl_dataset.h new file +52 -0

52 lines not on this page · raw message

include/zfs/dsl_dir.h new file +48 -0

48 lines not on this page · raw message

include/zfs/sa_impl.h new file +34 -0
new file mode 100644
index 0000000..4ec49fe

Lines of this file are not shown. View the raw message.

include/zfs/spa.h new file +311 -0

311 lines not on this page · raw message

include/zfs/uberblock_impl.h new file +57 -0

57 lines not on this page · raw message

include/zfs/vdev_impl.h new file +69 -0

69 lines not on this page · raw message

include/zfs/zap_impl.h new file +112 -0

112 lines not on this page · raw message

include/zfs/zap_leaf.h new file +103 -0

103 lines not on this page · raw message

include/zfs/zfs.h new file +122 -0

122 lines not on this page · raw message

include/zfs/zfs_acl.h new file +55 -0

55 lines not on this page · raw message

include/zfs/zfs_znode.h new file +70 -0

70 lines not on this page · raw message

include/zfs/zil.h new file +56 -0

56 lines not on this page · raw message

include/zfs/zio.h new file +92 -0

92 lines not on this page · raw message

include/zfs/zio_checksum.h new file +49 -0

49 lines not on this page · raw message

include/zfs_common.h new file +94 -0

94 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#16 lore raw

PATCH v3 1/1 Add ZFS filesystem support

Hi Jorgen,

Quoted 75 lines · Jorgen Lundman

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

---

v3: * add missing patch revision history (this text) ? ?* Submitted as single patch per Wolfgang Denk instructions

v2: * Keep Makefile placement alphabetically sorted. ? ?* Clean ugly line breaks and indentation errors ? ?* Fix license corruption in fs/Makefile
---

?Makefile ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
?common/Makefile ? ? ? ? ? ? ?| ? ?1 +
?common/cmd_zfs.c ? ? ? ? ? ? | ?236 +++++
?fs/Makefile ? ? ? ? ? ? ? ? ?| ? ?3 +-
?fs/{ => zfs}/Makefile ? ? ? ?| ? 39 +-
?fs/zfs/dev.c ? ? ? ? ? ? ? ? | ?137 +++
?fs/zfs/zfs.c ? ? ? ? ? ? ? ? | 2396 ++++++++++++++++++++++++++++++++++++++++++
?fs/zfs/zfs_fletcher.c ? ? ? ?| ? 84 ++
?fs/zfs/zfs_lzjb.c ? ? ? ? ? ?| ? 94 ++
?fs/zfs/zfs_sha256.c ? ? ? ? ?| ?145 +++
?include/config_cmd_all.h ? ? | ? ?1 +
?include/zfs/dmu.h ? ? ? ? ? ?| ?119 +++
?include/zfs/dmu_objset.h ? ? | ? 43 +
?include/zfs/dnode.h ? ? ? ? ?| ? 80 ++
?include/zfs/dsl_dataset.h ? ?| ? 52 +
?include/zfs/dsl_dir.h ? ? ? ?| ? 48 +
?include/zfs/sa_impl.h ? ? ? ?| ? 34 +
?include/zfs/spa.h ? ? ? ? ? ?| ?311 ++++++
?include/zfs/uberblock_impl.h | ? 57 +
?include/zfs/vdev_impl.h ? ? ?| ? 69 ++
?include/zfs/zap_impl.h ? ? ? | ?112 ++
?include/zfs/zap_leaf.h ? ? ? | ?103 ++
?include/zfs/zfs.h ? ? ? ? ? ?| ?122 +++
?include/zfs/zfs_acl.h ? ? ? ?| ? 55 +
?include/zfs/zfs_znode.h ? ? ?| ? 70 ++
?include/zfs/zil.h ? ? ? ? ? ?| ? 56 +
?include/zfs/zio.h ? ? ? ? ? ?| ? 92 ++
?include/zfs/zio_checksum.h ? | ? 49 +
?include/zfs_common.h ? ? ? ? | ? 94 ++

?29 files changed, 4687 insertions(+), 17 deletions(-) ?create mode 100644 common/cmd_zfs.c
?copy fs/{ => zfs}/Makefile (56%)
?create mode 100644 fs/zfs/dev.c
?create mode 100644 fs/zfs/zfs.c
?create mode 100644 fs/zfs/zfs_fletcher.c ?create mode 100644 fs/zfs/zfs_lzjb.c
?create mode 100644 fs/zfs/zfs_sha256.c ?create mode 100644 include/zfs/dmu.h
?create mode 100644 include/zfs/dmu_objset.h ?create mode 100644 include/zfs/dnode.h ?create mode 100644 include/zfs/dsl_dataset.h ?create mode 100644 include/zfs/dsl_dir.h ?create mode 100644 include/zfs/sa_impl.h ?create mode 100644 include/zfs/spa.h
?create mode 100644 include/zfs/uberblock_impl.h ?create mode 100644 include/zfs/vdev_impl.h ?create mode 100644 include/zfs/zap_impl.h

Quoted 8 lines

?create mode 100644 include/zfs/zap_leaf.h
?create mode 100644 include/zfs/zfs.h
?create mode 100644 include/zfs/zfs_acl.h
?create mode 100644 include/zfs/zfs_znode.h
?create mode 100644 include/zfs/zil.h
?create mode 100644 include/zfs/zio.h
?create mode 100644 include/zfs/zio_checksum.h
?create mode 100644 include/zfs_common.h

..
[snip]
..

A README entry in the doc folder would be very much helpful for the users to use ZFS..

Thx,
--Prabhakar Lad
http://in.linkedin.com/pub/prabhakar-lad/19/92b/955

Quoted 9 lines
include/zfs_common.h new file +2 -1
+int lzjb_decompress(void *, void *, uint32_t, uint32_t);
+#endif
--

1.7.0.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#17 lore raw

PATCH v3 1/1 Add ZFS filesystem support

Quoted 5 lines

..

A README entry in the doc folder would be very much helpful for the users to use ZFS..

Oh hey, there is a whole bunch of READMEs in there. Good idea, I'll add to v4 tomorrow.

Lund

#18 lore raw

v4 cover zfs: Add ZFS filesystem support

In reply to Jorgen Lundman

Patch to add ZFS filesystem support to u-boot, based on GRUB sources. Thank you for your patience.

Jorgen Lundman (1):
zfs: Add ZFS filesystem support

 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  236 +++++
 doc/README.zfs               |   30 +
 fs/Makefile                  |    3 +-
 fs/{ => zfs}/Makefile        |   39 +-
 fs/zfs/dev.c                 |  137 +++
 fs/zfs/zfs.c                 | 2396 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   84 ++
 fs/zfs/zfs_lzjb.c            |   94 ++
 fs/zfs/zfs_sha256.c          |  145 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  119 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   80 ++
 include/zfs/dsl_dataset.h    |   52 +
 include/zfs/dsl_dir.h        |   48 +
 include/zfs/sa_impl.h        |   34 +
 include/zfs/spa.h            |  311 ++++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   69 ++
 include/zfs/zap_impl.h       |  112 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   70 ++
 include/zfs/zil.h            |   56 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   49 +
 include/zfs_common.h         |   94 ++
 30 files changed, 4717 insertions(+), 17 deletions(-)
 create mode 100644 common/cmd_zfs.c
 create mode 100644 doc/README.zfs
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h
#19 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

In reply to Jorgen Lundman

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

---

v4: * Add doc/README.zfs documentation

v3: * add missing patch revision history (this text)
* Submitted as single patch per Wolfgang Denk instructions

v2: * Keep Makefile placement alphabetically sorted.
* Clean ugly line breaks and indentation errors
* Fix license corruption in fs/Makefile

---
 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  236 +++++
 doc/README.zfs               |   30 +
 fs/Makefile                  |    3 +-
 fs/{ => zfs}/Makefile        |   39 +-
 fs/zfs/dev.c                 |  137 +++
 fs/zfs/zfs.c                 | 2396 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   84 ++
 fs/zfs/zfs_lzjb.c            |   94 ++
 fs/zfs/zfs_sha256.c          |  145 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  119 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   80 ++
 include/zfs/dsl_dataset.h    |   52 +
 include/zfs/dsl_dir.h        |   48 +
 include/zfs/sa_impl.h        |   34 +
 include/zfs/spa.h            |  311 ++++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   69 ++
 include/zfs/zap_impl.h       |  112 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   70 ++
 include/zfs/zil.h            |   56 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   49 +
 include/zfs_common.h         |   94 ++
 30 files changed, 4717 insertions(+), 17 deletions(-)
 create mode 100644 common/cmd_zfs.c
 create mode 100644 doc/README.zfs
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h
Makefile +1 -1
index 351a8f0..d3b84bf 100644
@@ -244,7 +244,7 @@ endif
 LIBS += arch/$(ARCH)/lib/lib$(ARCH).o
 LIBS += fs/cramfs/libcramfs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o \
 	fs/reiserfs/libreiserfs.o fs/ext2/libext2fs.o fs/yaffs2/libyaffs2.o \
-	fs/ubifs/libubifs.o
+	fs/ubifs/libubifs.o fs/zfs/libzfs.o
 LIBS += net/libnet.o
 LIBS += disk/libdisk.o
 LIBS += drivers/bios_emulator/libatibiosemu.o
common/Makefile +1 -0
index 6e23baa..4de03da 100644
@@ -164,6 +164,7 @@ COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o
 endif
 COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o
 COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
+COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
 COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o
 
 # others
common/cmd_zfs.c new file +236 -0

236 lines not on this page · raw message

doc/README.zfs new file +30 -0
new file mode 100644
index 0000000..4b0e8a5
@@ -0,0 +1,30 @@
+This patch series adds support for ZFS listing and load to u-boot.
+
+To Enable zfs ls and load commands, modify the board specific config file with
+#define CONFIG_CMD_ZFS
+
+Steps to test:
+
+1. After applying the patch, zfs specific commands can be seen
+   in the boot loader prompt using
+        UBOOT #help
+
+        zfsload- load binary file from a ZFS file system
+        zfsls  - list files in a directory (default /)
+
+2. To list the files in zfs pool, device or partition, execute
+        zfsls <interface> <dev[:part]> [POOL/@/dir/file]
+        For example:
+        UBOOT #zfsls mmc 0:5 /rpool/@/usr/bin/
+
+3. To read and load a file from an ZFS formatted partition to RAM, execute
+        zfsload <interface> <dev[:part]> [addr] [filename] [bytes]
+        For example:
+        UBOOT #zfsload mmc 2:2 0x30007fc0 /rpool/@/boot/uImage
+
+References :
+	-- ZFS GRUB sources from Solaris GRUB-0.97
+	-- GRUB Bazaar repository
+
+Jorgen Lundman <[email protected]> 2012.
+
fs/Makefile +2 -1
index 22aad12..baa7e96 100644
@@ -1,6 +1,6 @@
 #
 # (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# Wolfgang Denk, DENX Software Engineering, <[email protected]>
 #
 # See file CREDITS for list of people who contributed to this
 # project.
@@ -30,6 +30,7 @@ subdirs-$(CONFIG_CMD_JFFS2) += jffs2
 subdirs-$(CONFIG_CMD_REISER) += reiserfs
 subdirs-$(CONFIG_YAFFS2) += yaffs2
 subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+subdirs-$(CONFIG_CMD_ZFS) += zfs
 
 SUBDIRS	:= $(subdirs-y)
 
fs/zfs/Makefile renamed from fs/Makefile +24 -15
similarity index 56%
copy from fs/Makefile
copy to fs/zfs/Makefile
index 22aad12..938fc5e 100644
@@ -1,6 +1,6 @@
 #
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# (C) Copyright 2012
+# Jorgen Lundman <[email protected]>
 #
 # See file CREDITS for list of people who contributed to this
 # project.
@@ -20,19 +20,28 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-#
 
-subdirs-$(CONFIG_CMD_CRAMFS) := cramfs
-subdirs-$(CONFIG_CMD_EXT2) += ext2
-subdirs-$(CONFIG_CMD_FAT) += fat
-subdirs-$(CONFIG_CMD_FDOS) += fdos
-subdirs-$(CONFIG_CMD_JFFS2) += jffs2
-subdirs-$(CONFIG_CMD_REISER) += reiserfs
-subdirs-$(CONFIG_YAFFS2) += yaffs2
-subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)libzfs.o
+
+AOBJS	=
+COBJS-$(CONFIG_CMD_ZFS) := dev.o zfs.o zfs_fletcher.o zfs_sha256.o zfs_lzjb.o
+
+SRCS	:= $(AOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS-y))
+
+
+all:	$(LIB) $(AOBJS)
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
 
-SUBDIRS	:= $(subdirs-y)
+sinclude $(obj).depend
 
-$(obj).depend all:
-	@for dir in $(SUBDIRS) ; do \
-		$(MAKE) -C $$dir $@ ; done
+#########################################################################
fs/zfs/dev.c new file +137 -0

137 lines not on this page · raw message

fs/zfs/zfs.c new file +2396 -0

2,396 lines not on this page · raw message

fs/zfs/zfs_fletcher.c new file +84 -0

84 lines not on this page · raw message

fs/zfs/zfs_lzjb.c new file +94 -0

39 lines not on this page · raw message

fs/zfs/zfs_sha256.c new file +145 -0

145 lines not on this page · raw message

include/config_cmd_all.h +1 -0
index 55f4f7a..5933ae9 100644

Lines of this file are not shown. View the raw message.

include/zfs/dmu.h new file +119 -0

119 lines not on this page · raw message

include/zfs/dmu_objset.h new file +43 -0

43 lines not on this page · raw message

include/zfs/dnode.h new file +80 -0

80 lines not on this page · raw message

include/zfs/dsl_dataset.h new file +52 -0

52 lines not on this page · raw message

include/zfs/dsl_dir.h new file +48 -0

48 lines not on this page · raw message

include/zfs/sa_impl.h new file +34 -0
new file mode 100644
index 0000000..4ec49fe

Lines of this file are not shown. View the raw message.

include/zfs/spa.h new file +311 -0

311 lines not on this page · raw message

include/zfs/uberblock_impl.h new file +57 -0

57 lines not on this page · raw message

include/zfs/vdev_impl.h new file +69 -0

69 lines not on this page · raw message

include/zfs/zap_impl.h new file +112 -0

112 lines not on this page · raw message

include/zfs/zap_leaf.h new file +103 -0

103 lines not on this page · raw message

include/zfs/zfs.h new file +122 -0

122 lines not on this page · raw message

include/zfs/zfs_acl.h new file +55 -0

55 lines not on this page · raw message

include/zfs/zfs_znode.h new file +70 -0

70 lines not on this page · raw message

include/zfs/zil.h new file +56 -0

56 lines not on this page · raw message

include/zfs/zio.h new file +92 -0

92 lines not on this page · raw message

include/zfs/zio_checksum.h new file +49 -0

49 lines not on this page · raw message

include/zfs_common.h new file +94 -0

94 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#20 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

Do I have to do anything special at this point, or can I assume everything is going according to plan?

Lund

#21 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

Hi Lund,

Quoted 3 lines · Jorgen Lundman

Do I have to do anything special at this point, or can I assume everything is going according to plan?

I've had a quick look - the intrusion into common code is minimal (additions to Makefiles) so the risk to U-Boot stability is extremely low and there is now impact on code size of ZFS is not enabled. I see no reason it can't be integrated.

I don't know where your original submission sat within the release cycle. If is was before the closing of the merge window then maybe Wolfgang will include it in the upcoming RC.

The only thing you need to do now is wait :)

Oh, and maybe prod the mailing list every now and again ;)

Regards,

Graeme

#22 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

In reply to Jorgen Lundman
Quoted 10 lines · On Thursday 24 May 2012 22:11:46 Jorgen Lundman wrote:

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.9
7/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.

good ...

fs/zfs/zfs_fletcher.c line 10

Quoted 13 lines
fs/zfs/zfs_fletcher.c new file +10 -0
@@ -0,0 +1,84 @@
+/*
+ *	GRUB  --  GRand Unified Bootloader
+ *	Copyright (C) 1999,2000,2001,2002,2003,2004,2009
+ *	Free Software Foundation, Inc.
+ *	Copyright 2007 Sun Microsystems, Inc.
+ *
+ *	GRUB 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 3 of the License, or
+ *	(at your option) any later version.

... but it looks like you still have some GPL-3 gremlins lurking. this must be sorted out before we can consider the code for merging. i suspect simply changing "version 3" to "version 2" isn't the right answer, otherwise i wonder where you copied this code from such that i has "version 3" in the first place. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120718/8ceb7756/attachment.pgp>

#23 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

Quoted 6 lines

... but it looks like you still have some GPL-3 gremlins lurking. this must be sorted out before we can consider the code for merging. i suspect simply changing "version 3" to "version 2" isn't the right answer, otherwise i wonder where you copied this code from such that i has "version 3" in the first place. -mike

The code submitted by Sun to GRUB is version 2, and you can see that in the first GRUB version with ZFS (0.97 - I posted the url earlier).

However, GRUB opted to go higher ("or at your option any later version") sometime before the GRUB 2 release. I took the latest version available or the sources at the time of porting.

However, there is only one functional source change between the versions, and that is adding ashift support, which was supplied as a patch.

That "ZFS" and "license" produces a knee-jerk reaction is a little tedious. It is not the problem everyone thinks, and I invite you to run ZFS on Linux native. http://zfsonlinux.org/

Lund

Signature · 4 lines
Jorgen Lundman       | <[email protected]>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)
#24 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

Hi Lund,

Quoted 10 lines · Jorgen Lundman
Quoted 10 lines

... but it looks like you still have some GPL-3 gremlins lurking. this must
be sorted out before we can consider the code for merging. i suspect simply
changing "version 3" to "version 2" isn't the right answer, otherwise i wonder
where you copied this code from such that i has "version 3" in the first place.
-mike

Damb, I totally missed this - my appologies

Quoted 2 lines

The code submitted by Sun to GRUB is version 2, and you can see that in the first GRUB version with ZFS (0.97 - I posted the url earlier).

OK, so we have a specific version of GRUB where all ZFS code is GPL version 2 or later (i.e. no extraneous GPL version 3 license text)

Quoted 3 lines

However, GRUB opted to go higher ("or at your option any later version") sometime before the GRUB 2 release. I took the latest version available or the sources at the time of porting.

Unfortunately, what you need to do is pull from the version of GRUB prior to the license text changes and explicitly note the commit ID in the commit comment

Quoted 2 lines

However, there is only one functional source change between the versions, and that is adding ashift support, which was supplied as a patch.

Sorry, I don't know if quite follow - What I am guessing is the following sequence:
- Intial ZFS port to GRUB under GPLv2 or later
- GRUB changed to GPLv3 or later
- ZFS ashift support added to GRUB

If this is the case, ashift support is GPLv3 and cannot be added to U-Boot unless the author of the patch agrees

Quoted 1 line

That "ZFS" and "license" produces a knee-jerk reaction is a little tedious.

Yes, I agree that it is tedious, but it is a legal issue and we cannot simply side-step it

Quoted 2 lines

It is not the problem everyone thinks, and I invite you to run ZFS on Linux native. http://zfsonlinux.org/

See http://zfsonlinux.org/faq.html#WhatAboutTheLicensingIssue

ZFS on Linux bypasses the GPL restrictions by being implemented in a loadable module. And as such, using it will taint the kernel...

Regards,

Graeme

#25 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

In reply to Jorgen Lundman
Quoted 1 line · On Wednesday 18 July 2012 20:14:21 Jorgen Lundman wrote:

That "ZFS" and "license" produces a knee-jerk reaction is a little tedious.

i could care less about ZFS. i think you missed the entire point i
highlighted: we cannot accept GPLv3 code. u-boot is currently GPLv2, so adding GPLv3 simply won't work.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120718/f2dea810/attachment.pgp>

#26 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

Quoted 4 lines · Mike Frysinger

i could care less about ZFS. i think you missed the entire point i
highlighted: we cannot accept GPLv3 code. u-boot is currently GPLv2, so adding GPLv3 simply won't work.
-mike

Very well, to attempt to go around this I would then have to use the original file, and port it forward to u-boot;

Original Sun Version;
: solaris11/usr/src/grub/grub-0.97/stage2/zfs_fletcher.c

* the Free Software Foundation; either version 2 of the License, or

fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp) fletcher_2_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp)

Current u-boot patch version;

* the Free Software Foundation; either version 3 of the License, or

fletcher_2(const void *buf, uint64_t size, grub_zfs_endian_t endian,zio_cksum_t *zcp)
fletcher_4(const void *buf, uint64_t size, grub_zfs_endian_t endian, zio_cksum_t *zcp)

Which _effectively_ changes the "3" to "2", and renames two functions. The file only contains 2 functions, and refers to the "checksumming algorithm the user can chose to use on a filesystem".

Then, it is acceptable?

Signature · 4 lines
Jorgen Lundman       | <[email protected]>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)
#27 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

Quoted 7 lines · On Wednesday 18 July 2012 23:20:05 Jorgen Lundman wrote:
Quoted 3 lines · Mike Frysinger

i could care less about ZFS. i think you missed the entire point i
highlighted: we cannot accept GPLv3 code. u-boot is currently GPLv2, so adding GPLv3 simply won't work.

Very well, to attempt to go around this I would then have to use the original file, and port it forward to u-boot;

i just picked out the first "version 3" i saw in your patch. going back to it and searching again shows more than just one file.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120719/fd13e7c3/attachment.pgp>

#28 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

Quoted 5 lines · Mike Frysinger

i just picked out the first "version 3" i saw in your patch. going back to it and searching again shows more than just one file.
-mike

You are correct, 3 files to be precise:

zfs_fletcher.c zfs_lzjb.c zfs_sha256.c

but the other two are functionally not changed.

Syntactically, they have gone through a "unsigned char *" to "grub_uint8_t *" to "uint8_t *".

Not entirely sure how I would "re-write" my "uint8_t *" change to be more clearly from "unsigned char *", as opposed to "grub_uint_8 *", to show it is based on the version 2 of the license.

Signature · 4 lines
Jorgen Lundman       | <[email protected]>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)
#29 lore raw

PATCH v4 1/1 zfs: Add ZFS filesystem support

Quoted 4 lines · On Thursday 19 July 2012 00:51:23 Jorgen Lundman wrote:
Quoted 2 lines · Mike Frysinger

i just picked out the first "version 3" i saw in your patch. going back to it and searching again shows more than just one file.

Quoted 8 lines

You are correct, 3 files to be precise:

zfs_fletcher.c zfs_lzjb.c zfs_sha256.c

but the other two are functionally not changed.

Syntactically, they have gone through a "unsigned char *" to "grub_uint8_t *" to "uint8_t *".

that's fine

Quoted 3 lines

Not entirely sure how I would "re-write" my "uint8_t *" change to be more clearly from "unsigned char *", as opposed to "grub_uint_8 *", to show it is based on the version 2 of the license.

post a new patchset with the correct version, and detail these things justifying the content/license shifts
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120719/6913de6b/attachment.pgp>

#30 lore raw

v5 cover zfs: Add ZFS filesystem support

In reply to Jorgen Lundman

Took a few hours to go back and start from GPL2 versions, but in the end we got rid of the grub_ defines as a bonus.

Patch to add ZFS filesystem support to u-boot, based on GRUB sources. Thank you for your patience.

Jorgen Lundman (1):
Add ZFS support

 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  236 +++++
 doc/README.zfs               |   30 +
 fs/Makefile                  |    1 +
 fs/{ => zfs}/Makefile        |   39 +-
 fs/zfs/dev.c                 |  137 +++
 fs/zfs/zfs.c                 | 2396 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   88 ++
 fs/zfs/zfs_lzjb.c            |   97 ++
 fs/zfs/zfs_sha256.c          |  148 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  120 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   81 ++
 include/zfs/dsl_dataset.h    |   53 +
 include/zfs/dsl_dir.h        |   49 +
 include/zfs/sa_impl.h        |   35 +
 include/zfs/spa.h            |  292 +++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   70 ++
 include/zfs/zap_impl.h       |  111 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   71 ++
 include/zfs/zil.h            |   57 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   50 +
 include/zfs_common.h         |  109 ++
 30 files changed, 4730 insertions(+), 16 deletions(-)
 create mode 100644 common/cmd_zfs.c
 create mode 100644 doc/README.zfs
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h
#31 lore raw

PATCH v5 1/1 zfs: Add ZFS filesystem support

In reply to Jorgen Lundman

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

---

v5: * Re-port based on GPLv2 license files, from original Sun GRUB-0.97
and patch forward. Headers remained untouched, minor style changes in some function. No logic changes required.

v4: * Add doc/README.zfs documentation

v3: * add missing patch revision history (this text)
* Submitted as single patch per Wolfgang Denk instructions

v2: * Keep Makefile placement alphabetically sorted.
* Clean ugly line breaks and indentation errors
* Fix license corruption in fs/Makefile

---

---
 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  236 +++++
 doc/README.zfs               |   30 +
 fs/Makefile                  |    1 +
 fs/{ => zfs}/Makefile        |   39 +-
 fs/zfs/dev.c                 |  137 +++
 fs/zfs/zfs.c                 | 2396 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   88 ++
 fs/zfs/zfs_lzjb.c            |   97 ++
 fs/zfs/zfs_sha256.c          |  148 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  120 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   81 ++
 include/zfs/dsl_dataset.h    |   53 +
 include/zfs/dsl_dir.h        |   49 +
 include/zfs/sa_impl.h        |   35 +
 include/zfs/spa.h            |  292 +++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   70 ++
 include/zfs/zap_impl.h       |  111 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   71 ++
 include/zfs/zil.h            |   57 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   50 +
 include/zfs_common.h         |  109 ++
 30 files changed, 4730 insertions(+), 16 deletions(-)
 create mode 100644 common/cmd_zfs.c
 create mode 100644 doc/README.zfs
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h
Makefile +1 -1
index 6e8b5a7..48800c3 100644
@@ -247,7 +247,7 @@ endif
 LIBS += arch/$(ARCH)/lib/lib$(ARCH).o
 LIBS += fs/cramfs/libcramfs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o \
 	fs/reiserfs/libreiserfs.o fs/ext2/libext2fs.o fs/yaffs2/libyaffs2.o \
-	fs/ubifs/libubifs.o
+	fs/ubifs/libubifs.o fs/zfs/libzfs.o
 LIBS += net/libnet.o
 LIBS += disk/libdisk.o
 LIBS += drivers/bios_emulator/libatibiosemu.o
common/Makefile +1 -0
index 483eb4d..3d62775 100644
@@ -162,6 +162,7 @@ endif
 COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o
 COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
 COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o
+COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
 
 # others
 ifdef CONFIG_DDR_SPD
common/cmd_zfs.c new file +236 -0

236 lines not on this page · raw message

doc/README.zfs new file +30 -0
new file mode 100644
index 0000000..4b0e8a5
@@ -0,0 +1,30 @@
+This patch series adds support for ZFS listing and load to u-boot.
+
+To Enable zfs ls and load commands, modify the board specific config file with
+#define CONFIG_CMD_ZFS
+
+Steps to test:
+
+1. After applying the patch, zfs specific commands can be seen
+   in the boot loader prompt using
+        UBOOT #help
+
+        zfsload- load binary file from a ZFS file system
+        zfsls  - list files in a directory (default /)
+
+2. To list the files in zfs pool, device or partition, execute
+        zfsls <interface> <dev[:part]> [POOL/@/dir/file]
+        For example:
+        UBOOT #zfsls mmc 0:5 /rpool/@/usr/bin/
+
+3. To read and load a file from an ZFS formatted partition to RAM, execute
+        zfsload <interface> <dev[:part]> [addr] [filename] [bytes]
+        For example:
+        UBOOT #zfsload mmc 2:2 0x30007fc0 /rpool/@/boot/uImage
+
+References :
+	-- ZFS GRUB sources from Solaris GRUB-0.97
+	-- GRUB Bazaar repository
+
+Jorgen Lundman <[email protected]> 2012.
+
fs/Makefile +1 -0
index 22aad12..28da76e 100644
@@ -30,6 +30,7 @@ subdirs-$(CONFIG_CMD_JFFS2) += jffs2
 subdirs-$(CONFIG_CMD_REISER) += reiserfs
 subdirs-$(CONFIG_YAFFS2) += yaffs2
 subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+subdirs-$(CONFIG_CMD_ZFS) += zfs
 
 SUBDIRS	:= $(subdirs-y)
 
fs/zfs/Makefile renamed from fs/Makefile +24 -15
similarity index 56%
copy from fs/Makefile
copy to fs/zfs/Makefile
index 22aad12..938fc5e 100644
@@ -1,6 +1,6 @@
 #
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+# (C) Copyright 2012
+# Jorgen Lundman <[email protected]>
 #
 # See file CREDITS for list of people who contributed to this
 # project.
@@ -20,19 +20,28 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-#
 
-subdirs-$(CONFIG_CMD_CRAMFS) := cramfs
-subdirs-$(CONFIG_CMD_EXT2) += ext2
-subdirs-$(CONFIG_CMD_FAT) += fat
-subdirs-$(CONFIG_CMD_FDOS) += fdos
-subdirs-$(CONFIG_CMD_JFFS2) += jffs2
-subdirs-$(CONFIG_CMD_REISER) += reiserfs
-subdirs-$(CONFIG_YAFFS2) += yaffs2
-subdirs-$(CONFIG_CMD_UBIFS) += ubifs
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)libzfs.o
+
+AOBJS	=
+COBJS-$(CONFIG_CMD_ZFS) := dev.o zfs.o zfs_fletcher.o zfs_sha256.o zfs_lzjb.o
+
+SRCS	:= $(AOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS-y))
+
+
+all:	$(LIB) $(AOBJS)
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
 
-SUBDIRS	:= $(subdirs-y)
+sinclude $(obj).depend
 
-$(obj).depend all:
-	@for dir in $(SUBDIRS) ; do \
-		$(MAKE) -C $$dir $@ ; done
+#########################################################################
fs/zfs/dev.c new file +137 -0

137 lines not on this page · raw message

fs/zfs/zfs.c new file +2396 -0

2,396 lines not on this page · raw message

fs/zfs/zfs_fletcher.c new file +88 -0

88 lines not on this page · raw message

fs/zfs/zfs_lzjb.c new file +97 -0

42 lines not on this page · raw message

fs/zfs/zfs_sha256.c new file +148 -0

148 lines not on this page · raw message

include/config_cmd_all.h +1 -0
index 73c0558..f434cd0 100644

Lines of this file are not shown. View the raw message.

include/zfs/dmu.h new file +120 -0

120 lines not on this page · raw message

include/zfs/dmu_objset.h new file +43 -0

43 lines not on this page · raw message

include/zfs/dnode.h new file +81 -0

81 lines not on this page · raw message

include/zfs/dsl_dataset.h new file +53 -0

53 lines not on this page · raw message

include/zfs/dsl_dir.h new file +49 -0

49 lines not on this page · raw message

include/zfs/sa_impl.h new file +35 -0
new file mode 100644
index 0000000..4d93558

Lines of this file are not shown. View the raw message.

include/zfs/spa.h new file +292 -0

292 lines not on this page · raw message

include/zfs/uberblock_impl.h new file +57 -0

57 lines not on this page · raw message

include/zfs/vdev_impl.h new file +70 -0

70 lines not on this page · raw message

include/zfs/zap_impl.h new file +111 -0

111 lines not on this page · raw message

include/zfs/zap_leaf.h new file +103 -0

103 lines not on this page · raw message

include/zfs/zfs.h new file +122 -0

122 lines not on this page · raw message

include/zfs/zfs_acl.h new file +55 -0

55 lines not on this page · raw message

include/zfs/zfs_znode.h new file +71 -0

71 lines not on this page · raw message

include/zfs/zil.h new file +57 -0

57 lines not on this page · raw message

include/zfs/zio.h new file +92 -0

92 lines not on this page · raw message

include/zfs/zio_checksum.h new file +50 -0

50 lines not on this page · raw message

include/zfs_common.h new file +109 -0

109 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#32 lore raw

PATCH v5 1/1 zfs: Add ZFS filesystem support

Dear Jorgen Lundman,

Quoted 85 lines · In message <[email protected]> you wrote:

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

---

v5: * Re-port based on GPLv2 license files, from original Sun GRUB-0.97
and patch forward. Headers remained untouched, minor style changes in some function. No logic changes required.

v4: * Add doc/README.zfs documentation

v3: * add missing patch revision history (this text)
* Submitted as single patch per Wolfgang Denk instructions

v2: * Keep Makefile placement alphabetically sorted.
* Clean ugly line breaks and indentation errors
* Fix license corruption in fs/Makefile

---

---
 Makefile                     |    2 +-
 common/Makefile              |    1 +
 common/cmd_zfs.c             |  236 +++++
 doc/README.zfs               |   30 +
 fs/Makefile                  |    1 +
 fs/{ => zfs}/Makefile        |   39 +-
 fs/zfs/dev.c                 |  137 +++
 fs/zfs/zfs.c                 | 2396 ++++++++++++++++++++++++++++++++++++++++++
 fs/zfs/zfs_fletcher.c        |   88 ++
 fs/zfs/zfs_lzjb.c            |   97 ++
 fs/zfs/zfs_sha256.c          |  148 +++
 include/config_cmd_all.h     |    1 +
 include/zfs/dmu.h            |  120 +++
 include/zfs/dmu_objset.h     |   43 +
 include/zfs/dnode.h          |   81 ++
 include/zfs/dsl_dataset.h    |   53 +
 include/zfs/dsl_dir.h        |   49 +
 include/zfs/sa_impl.h        |   35 +
 include/zfs/spa.h            |  292 +++++
 include/zfs/uberblock_impl.h |   57 +
 include/zfs/vdev_impl.h      |   70 ++
 include/zfs/zap_impl.h       |  111 ++
 include/zfs/zap_leaf.h       |  103 ++
 include/zfs/zfs.h            |  122 +++
 include/zfs/zfs_acl.h        |   55 +
 include/zfs/zfs_znode.h      |   71 ++
 include/zfs/zil.h            |   57 +
 include/zfs/zio.h            |   92 ++
 include/zfs/zio_checksum.h   |   50 +
 include/zfs_common.h         |  109 ++
 30 files changed, 4730 insertions(+), 16 deletions(-)
 create mode 100644 common/cmd_zfs.c
 create mode 100644 doc/README.zfs
 copy fs/{ => zfs}/Makefile (56%)
 create mode 100644 fs/zfs/dev.c
 create mode 100644 fs/zfs/zfs.c
 create mode 100644 fs/zfs/zfs_fletcher.c
 create mode 100644 fs/zfs/zfs_lzjb.c
 create mode 100644 fs/zfs/zfs_sha256.c
 create mode 100644 include/zfs/dmu.h
 create mode 100644 include/zfs/dmu_objset.h
 create mode 100644 include/zfs/dnode.h
 create mode 100644 include/zfs/dsl_dataset.h
 create mode 100644 include/zfs/dsl_dir.h
 create mode 100644 include/zfs/sa_impl.h
 create mode 100644 include/zfs/spa.h
 create mode 100644 include/zfs/uberblock_impl.h
 create mode 100644 include/zfs/vdev_impl.h
 create mode 100644 include/zfs/zap_impl.h
Quoted 8 lines
 create mode 100644 include/zfs/zap_leaf.h
 create mode 100644 include/zfs/zfs.h
 create mode 100644 include/zfs/zfs_acl.h
 create mode 100644 include/zfs/zfs_znode.h
 create mode 100644 include/zfs/zil.h
 create mode 100644 include/zfs/zio.h
 create mode 100644 include/zfs/zio_checksum.h
 create mode 100644 include/zfs_common.h

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In C we had to code our own bugs, in C++ we can inherit them.
#33 lore raw

PATCH v5 1/1 zfs: Add ZFS filesystem support

Quoted 5 lines

Applied, thanks.

Best regards,

That is the best news ever, thanks! Also thanks to Graeme for all the help.

Lund

Signature · 4 lines
Jorgen Lundman       | <[email protected]>
Unix Administrator   | +81 (0)3 -5456-2687 ext 1017 (work)
Shibuya-ku, Tokyo    | +81 (0)90-5578-8500          (cell)
Japan                | +81 (0)3 -3375-1767          (home)
#34 lore raw

PATCH v5 1/1 zfs: Add ZFS filesystem support

Dear Jorgen Lundman,

Quoted 2 lines · In message <[email protected]> you wrote:

That is the best news ever, thanks! Also thanks to Graeme for all the help.

Thanks for your hard work, it's highly appreciated (even though it sometimes doesn't look like that - it really is).

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Advice is seldom welcome; and those who want it the most always like
it the least.                         -- Philip Earl of Chesterfield