Addition of btrfs file-system in U-boot
Subsystems (4)
PATCH v7 1/1 Addition of btrfs file-system in U-boot
Adnan Ali (1):
Introduced btrfs file-system with btrload command
Makefile | 1 + common/Makefile | 1 + common/cmd_btr.c | 65 +++ fs/btrfs/Makefile | 51 ++ fs/btrfs/btrfs.c | 1357 ++++++++++++++++++++++++++++++++++++++++++++ fs/fs.c | 10 + include/btrfs.h | 416 ++++++++++++++ include/config_fallbacks.h | 4 + include/crc.h | 8 + include/fs.h | 1 + lib/Makefile | 1 + lib/crc32_c.c | 40 ++ 12 files changed, 1955 insertions(+) create mode 100644 common/cmd_btr.c create mode 100644 fs/btrfs/Makefile create mode 100644 fs/btrfs/btrfs.c create mode 100644 include/btrfs.h create mode 100644 lib/crc32_c.c
Signature · 1 line
1.7.9.5
PATCH v7 1/1 Introduced btrfs file-system with btrload command
Introduces btrfs file-system to read file from volume/sub-volumes with btrload command. This implementation has read-only support.
This btrfs implementation is based on syslinux btrfs code, commit 269ebc845ebc8b46ef4b0be7fa0005c7fdb95b8d.
v7: patch re-formated. v6: patch re-formated. v5: merged with master. v4: btrls command added.
--- Makefile | 1 + common/Makefile | 1 + common/cmd_btr.c | 65 +++ fs/btrfs/Makefile | 51 ++ fs/btrfs/btrfs.c | 1357 ++++++++++++++++++++++++++++++++++++++++++++ fs/fs.c | 10 + include/btrfs.h | 416 ++++++++++++++ include/config_fallbacks.h | 4 + include/crc.h | 8 + include/fs.h | 1 + lib/Makefile | 1 + lib/crc32_c.c | 40 ++ 12 files changed, 1955 insertions(+) create mode 100644 common/cmd_btr.c create mode 100644 fs/btrfs/Makefile create mode 100644 fs/btrfs/btrfs.c create mode 100644 include/btrfs.h create mode 100644 lib/crc32_c.c
Makefile +1 -0
@@ -257,6 +257,7 @@ endif LIBS-$(CONFIG_OF_EMBED) += dts/libdts.o LIBS-y += arch/$(ARCH)/lib/lib$(ARCH).o LIBS-y += fs/libfs.o \ + fs/btrfs/libbtrfs.o \ fs/cbfs/libcbfs.o \ fs/cramfs/libcramfs.o \ fs/ext4/libext4fs.o \
common/Makefile +1 -0
@@ -73,6 +73,7 @@ COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_BOOTSTAGE) += cmd_bootstage.o +COBJS-$(CONFIG_CMD_BTR) += cmd_btr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o COBJS-$(CONFIG_CMD_CBFS) += cmd_cbfs.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
common/cmd_btr.c new file +65 -0
65 lines not on this page · raw message
fs/btrfs/Makefile new file +51 -0
51 lines not on this page · raw message
fs/btrfs/btrfs.c new file +1357 -0
1,357 lines not on this page · raw message
fs/fs.c +10 -0
@@ -17,6 +17,7 @@#include <config.h> #include <common.h> #include <part.h> +#include <btrfs.h> #include <ext4fs.h> #include <fat.h> #include <fs.h>
@@ -88,6 +89,15 @@ static struct fstype_info fstypes[] = { .read = fs_read_sandbox, },#endif +#ifdef CONFIG_FS_BTR + { + .fstype = FS_TYPE_BTR, + .probe = btrfs_probe, + .close = btrfs_close, + .ls = btrfs_ls, + .read = btrfs_read_file, + }, +#endif { .fstype = FS_TYPE_ANY, .probe = fs_probe_unsupported,
include/btrfs.h new file +416 -0
416 lines not on this page · raw message
include/config_fallbacks.h +4 -0
@@ -26,4 +26,8 @@#define CONFIG_EXT4_WRITE #endif +#if defined(CONFIG_CMD_BTR ) && !defined(CONFIG_FS_BTR ) +#define CONFIG_FS_BTR +#endif +#endif /* __CONFIG_FALLBACKS_H */
include/crc.h +8 -0
@@ -97,4 +97,12 @@ cyg_ether_crc32_accumulate(uint32_t crc, unsigned char *s, int len);extern uint16_t cyg_crc16 (unsigned char *s,int len); +/* CRC init for btrfs file-system*/ + +void crc32c_init (u32 *crc32c_table,u32 pol); + +/* CRC calculate for btrfs file-system*/ + +u32 crc32c_cal (u32 crc,const char *data,size_t length,u32 *crc32c_table); +#endif /* _SERVICES_CRC_CRC_H_ */
include/fs.h +1 -0
@@ -22,6 +22,7 @@#define FS_TYPE_FAT 1#define FS_TYPE_EXT 2#define FS_TYPE_SANDBOX 3 +#define FS_TYPE_BTR 4/* * Tell the fs layer which block device an partition to use for future
lib/Makefile +1 -0
@@ -67,6 +67,7 @@ COBJS-$(CONFIG_SPL_NET_SUPPORT) += hashtable.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += net_utils.o endif COBJS-y += crc32.o +COBJS-y += crc32_c.o COBJS-y += ctype.o COBJS-y += div64.o COBJS-y += linux_string.o
lib/crc32_c.c new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Copied from Linux kernel crypto/crc32c.c +* Copyright (c) 2004 Cisco Systems, Inc. +* Copyright (c) 2008 Herbert Xu <[email protected]> +* +* 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. +* +*/ +#include <linux/stat.h> +#include <command.h> +#include <asm/byteorder.h> +#include <linux/compiler.h> +#include <common.h> +#include <config.h> + +u32 crc32c_cal (u32 crc,const char *data,size_t length,u32 *crc32c_table) +{ +while (length--) + crc = crc32c_table[(u8)(crc ^ *data++)] ^ (crc >>8 ); + +return crc; +} + +void crc32c_init (u32 *crc32c_table,u32 pol) +{ +int i, j; +u32 v; +const u32 poly = pol;/* Bit-reflected CRC32C polynomial */ + +for (i =0 ; i <256 ; i++) { + v = i; +for (j =0 ; j <8 ; j++) + v = (v >>1 ) ^ ((v &1 ) ? poly :0 ); + + crc32c_table[i] = v; + } +}
Signature · 1 line
1.7.9.5
PATCH v7 1/1 Introduced btrfs file-system with btrload command
Hi,
Quoted 6 lines · Adnan Ali
Introduces btrfs file-system to read file from volume/sub-volumes with btrload command. This implementation has read-only support.
This btrfs implementation is based on syslinux btrfs code, commit269ebc845ebc8b46ef4b0be7fa0005c7fdb95b8d.
Quoted 6 lines
v7: patch re-formated. v6: patch re-formated. v5: merged with master. v4: btrls command added.Signed-off-by Adnan Ali <[email protected]>
This is close enough I think. You shouldn't have 'char' return values on the fs.h interface functions, and no blank line after 'return'. I will leave it to Tom to see if he is happy with the command parameters.
Thanks.
Quoted 20 lines
--- Makefile | 1 + common/Makefile | 1 + common/cmd_btr.c | 65 +++ fs/btrfs/Makefile | 51 ++ fs/btrfs/btrfs.c | 1357 ++++++++++++++++++++++++++++++++++++++++++++ fs/fs.c | 10 + include/btrfs.h | 416 ++++++++++++++ include/config_fallbacks.h | 4 + include/crc.h | 8 + include/fs.h | 1 + lib/Makefile | 1 + lib/crc32_c.c | 40 ++ 12 files changed, 1955 insertions(+) create mode 100644 common/cmd_btr.c create mode 100644 fs/btrfs/Makefile create mode 100644 fs/btrfs/btrfs.c create mode 100644 include/btrfs.h create mode 100644 lib/crc32_c.c
PATCH v7 1/1 Introduced btrfs file-system with btrload command
Hi
Quoted 15 lines · Simon Glass
Hi,
Quoted 6 lines · Adnan Ali
Introduces btrfs file-system to read file from volume/sub-volumes with btrload command. This implementation has read-only support.
This btrfs implementation is based on syslinux btrfs code, commit269ebc845ebc8b46ef4b0be7fa0005c7fdb95b8d.Quoted 6 lines
v7: patch re-formated. v6: patch re-formated. v5: merged with master. v4: btrls command added.Signed-off-by Adnan Ali <[email protected]>
Quoted 8 lines
This is close enough I think. You shouldn't have 'char' return values on the
fs.hinterface functions, and no blank line after 'return'. I will leave it to Tom to see if he is happy with the command parameters.Thanks.
Acked-by Simon Glass <[email protected]>
Thanks ;)
Quoted 13 lines
Quoted 13 lines
--- Makefile | 1 + common/Makefile | 1 + common/cmd_btr.c | 65 +++ fs/btrfs/Makefile | 51 ++ fs/btrfs/btrfs.c | 1357 ++++++++++++++++++++++++++++++++++++++++++++ fs/fs.c | 10 + include/btrfs.h | 416 ++++++++++++++ include/config_fallbacks.h | 4 + include/crc.h | 8 + include/fs.h | 1 + lib/Makefile | 1 +
Quoted 8 lines
Quoted 8 lines
lib/crc32_c.c | 40 ++ 12 files changed, 1955 insertions(+)create mode 100644
common/cmd_btr.ccreate mode 100644fs/btrfs/Makefilecreate mode 100644fs/btrfs/btrfs.ccreate mode 100644include/btrfs.hcreate mode 100644lib/crc32_c.c
Thanks
Adnan Ali
PATCH v7 1/1 Introduced btrfs file-system with btrload command
In reply to Adnan AliQuoted 5 lines · Adnan Ali
Introduces btrfs file-system to read file from volume/sub-volumes with btrload command. This implementation has read-only support.
This btrfs implementation is based on syslinux btrfs code, commit269ebc845ebc8b46ef4b0be7fa0005c7fdb95b8d.
OK, sorry for not doing this part sooner, but I compared the btrfs code in syslinux to your code and there's a lot of whitespace problems in fs/btrfs/btrfs.c that you:
trini at bill-the-cat:~/work/u-boot/u-boot$ ./tools/checkpatch.pl -f fs/btrfs/btrfs.c | grep ^ERROR | wc -l
320
trini at bill-the-cat:~/work/u-boot/u-boot$ ./tools/checkpatch.pl -f ~/work/syslinux/core/fs/btrfs/btrfs.c | grep ^ERR | wc -l
7
Please fix this, use whitespace consistent with the rest of the file for the U-Boot specific functions you're adding and as Simon noted, 'char' for a return type on btrfs_ls isn't really right (please follow fat or ext* for examples).
Thanks and again, sorry for not noticing this sooner in the reviews.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130315/783f502e/attachment.pgp>