Skip to contentSkip to conversation

Btrfs filesystem port to U-boot

PATCH Superseded Adnan Ali 4 participants 10 messages May 4, 2013 – May 12, 2013

Subsystems (4)
lore
Share & tools
lore

Adnan Ali

author
#0 lore raw

v12 cover Btrfs filesystem port to U-boot

Adnan Ali (2):
Enable btrfs support in mx53loco config 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           | 1347 ++++++++++++++++++++++++++++++++++++++++++++
 fs/fs.c                    |   10 +
 include/btrfs.h            |  416 ++++++++++++++
 include/config_fallbacks.h |    4 +
 include/configs/mx53loco.h |    4 +-
 include/crc.h              |    8 +
 include/fs.h               |    1 +
 lib/Makefile               |    1 +
 lib/crc32_c.c              |   40 ++
 13 files changed, 1948 insertions(+), 1 deletion(-)
 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
author
#1 lore raw

PATCH v12 1/2 Enable Btrfs support in mx53loco config

From: Adnan Ali <[email protected]>

Enable btrfs support in mx53loco config

---
 include/configs/mx53loco.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/configs/mx53loco.h +3 -1
index a4b610f..bf361a3 100644
@@ -56,6 +56,8 @@
 #define CONFIG_GENERIC_MMC
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT2
+#define CONFIG_CMD_BTR
+#define CONFIG_CMD_FS_GENERIC
 #define CONFIG_DOS_PARTITION
 
 /* Eth Configs */
@@ -128,7 +130,7 @@
 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
 	"mmcargs=setenv bootargs console=ttymxc0,${baudrate} root=${mmcroot}\0" \
 	"loadbootscript=" \
-		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
 		"source\0" \
 	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v12 2/2 Introduced btrfs file-system with btrload command

In reply to Adnan Ali

From: Adnan Ali <[email protected]>

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.

v12: Warnings removed.
v11: Mirro super block check.

v10:     patch problem reworked.
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           | 1347 ++++++++++++++++++++++++++++++++++++++++++++
 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, 1945 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
index 55bd55c..bd7981d 100644
@@ -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
index 719fc23..d1fae56 100644
@@ -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 +1347 -0

1,347 lines not on this page · raw message

fs/fs.c +10 -0
index 6f5063c..b8c3603 100644
@@ -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
index bfb9680..28a0a66 100644
@@ -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
index 10560c9..5e5b1f0 100644
@@ -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
index b6d69e5..a8b97ea 100644
@@ -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
index 86ca1a6..9518b72 100644
@@ -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
new file mode 100644
index 0000000..b97c98a
@@ -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
#3 lore raw

PATCH v12 2/2 Introduced btrfs file-system with btrload command

Dear Adnan Ali,

In message <[email protected]> you wrote:

...

 include/crc.h              |    8 +
 include/fs.h               |    1 +
 lib/Makefile               |    1 +
 lib/crc32_c.c              |   40 ++

...

These changes should be factored out into a separate commit. In any case, the code should be compiled in only when needed, i. e. when btrfs support is selected. Otherwise you just bloat the code size and build time for all systems without need.

Hm... do we really need yet another crc32 implementation?

I still see an checkpatch error and warnings; also incorrect multi-line comments - did these slip through, or is it intentional not to fix these? Why?

common/cmd_btr.c line 45

Quoted 3 lines
common/cmd_btr.c new file +3 -0
+U_BOOT_CMD(
+btrload,        7,      0,      do_btr_fsload,
+	"load binary file from a btr filesystem",

--------------^^^^^^

common/cmd_btr.c line 47

Quoted 2 lines
common/cmd_btr.c new file +2 -0
+	"<interface> [<dev[:part]>]  <addr> <filename> [subvol_name]\n"
+	"    - Load binary file 'filename' from 'dev' on 'interface'\n"

--------------------^^^^^^

Please remove the "binary" here. I guess we can also load text files and any other file tpes as well.

Also please decide how to call the B-Tree file system in descriptions like this. IIRC, Linux tends to write "btrfs" in cases like this one.

Which makes: "load file from btrfs file system", etc.

common/cmd_btr.c line 48

Quoted 1 line
common/cmd_btr.c new file +1 -0
+	"      to address 'addr' from better filesystem.\n"

"better filesystem"? "BTRFS" means B-tree file system. Pronounciation may sound like this, but we don't write it that way.

i. e. something like:

"Load file 'filename' from btrfs file system on 'dev' on 'interface' to address 'addr'"

common/cmd_btr.c line 49

Quoted 1 line
common/cmd_btr.c new file +1 -0
+	"      the load stops on end of file.\n"

Would it be easy to add support for loading only a certain (smaller) lenght?

common/cmd_btr.c line 50

Quoted 1 line
common/cmd_btr.c new file +1 -0
+	"      subvol_name is used read that file from this subvolume.\n"

It seems this sentence is not complete.

common/cmd_btr.c line 51

Quoted 1 line
common/cmd_btr.c new file +1 -0
+	"      All numeric parameters are assumed to be hex."

Drop this. This is standard in U-Boot.

lib/crc32_c.c line 2

Quoted 4 lines

+++ b/lib/crc32_c.c

lib/crc32_c.c new file +2 -0
@@ -0,0 +1,40 @@
+/*
+ * Copied from Linux kernel crypto/crc32c.c

Which exact version of the Linux kernel has this been copied from? The current version of crypto/crc32c.c does not contain any such code at all.

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
Real programmers don't comment their code. It was hard to  write,  it
should be hard to understand.
#4 lore raw

PATCH v12 2/2 Introduced btrfs file-system with btrload command

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 5 lines · Wolfgang Denk

Dear Adnan Ali,

In message <[email protected]> you wrote:

Quoted 8 lines

... include/crc.h | 8 + include/fs.h

|    1 + lib/Makefile               |    1 + lib/crc32_c.c
|   40 ++ ...

These changes should be factored out into a separate commit. In any case, the code should be compiled in only when needed, i. e. when btrfs support is selected. Otherwise you just bloat the code size and build time for all systems without need.

We should be able to make lib/crc32_c.o depend on btrfs being set, yes. But non-command stuff should be getting garbage collected out in most cases at last (Need to poke Albert about the patch for ARM).

Quoted 1 line

Hm... do we really need yet another crc32 implementation?

We talked about this before I believe and the answer is yes :(

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRhnI+AAoJENk4IS6UOR1WGRMP/inIOtRRDrzuKuUOtiykWTGr XtlODIrJNvWmXz3Vzs3zle8LhuwvCtUUs0WaXOi1VBVCCOt6fsqGjcbWYtRvfwvo PtCUfyrJE+dA+pv2UFO+vwqBJoY1ew7ehjfrl0Z9JaO5AphXyPvcxtiRHsUDRbG+ NwGgv2RiYtH8WLzxCBAV2kXsE7HXCkHbloj/kLDah/X3fXDBQ8X+OKNkSOsgs85l xg0HStiPbYkqrM+dLsCyd5/YEj9aXmlGa7g7amPAxHOC7lmFRaxI16uDw8p0hW/n BrNHyE8F3acf1tTKGAyJYvVPd9Z4icUjBU/XkXDLr9tVp1GGDJ5pcWe80//AFy+S 3LQcPul3+6yqdBks5zSTNMBmUYqOceRzhJSpsDp1c7x6uMNsB3kOauoQ/UEiCitz fn+CJND11A3fEF6XsOvzLUqw7BFnd5g7bIDXmX1Rq18tY6wwMQsZMl1jPvHkEP+R Q0SdKwsXQcuKDMgCk0pLRzuiPNd/t/PQttuRPNG/wJegFN+L+Ers4PPwc73/km5S 4aINFzTmc2NMxUgsswk/xGeKt3fE3cvrTn2v3PR2vOPqcv76v8+CKtix8hEYF6eS m5x2KJpQho9eno8VFTp52bU+zYy67mJ2k8UfWY5Ist8YG7koHtIKQIuZmGf9XMu4 RV6SbpltW+2hCcvDGHvd
=Lj6s
-----END PGP SIGNATURE-----

#5 lore raw

PATCH v12 2/2 Introduced btrfs file-system with btrload command

Dear Tom Rini,

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

These changes should be factored out into a separate commit. In any case, the code should be compiled in only when needed, i. e. when btrfs support is selected. Otherwise you just bloat the code size and build time for all systems without need.

We should be able to make lib/crc32_c.o depend on btrfs being set, yes. But non-command stuff should be getting garbage collected out in most cases at last (Need to poke Albert about the patch for ARM).

Yes, it may be garbage collected, but only after compilation - which means we add to the build time for about 1000 boards which do not use this.

Quoted 3 lines
Quoted 1 line

Hm... do we really need yet another crc32 implementation?

We talked about this before I believe and the answer is yes :(

Yes, I remember this discussion. But look at the code. It raises a number of questions:

- Why do we have to calculate the crc32c_table[] at runtime? Our regular CRC code uses a pre-calculated table; we should do the same here.

- Compare the code for crc32c_cal() in the patch with the definition of DO_CRC(x) in "lib/crc32.c" - to me, it appears to be the same for little endian code (it is redundant?), but different for big endian systems - which raises the question if this code has ever been tested on a BE machine?

- The code claims to be derived from "Linux kernel crypto/crc32c.c"; but I cannot find such code in that file.

- The implementation of crc32c_cal() suffers from a few other problems (like not triggering the watchdog, which will cause problems on systems that use one).

I think we should re-check this. My feeling is that we may eventually end up with a different CRC table, but without need for new code.

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
There are two kinds of people, those who do the work  and  those  who
take  the  credit.  Try  to  be  in  the  first  group; there is less
competition there.                                    - Indira Gandhi
#6 lore raw

PATCH v12 2/2 Introduced btrfs file-system with btrload command

Hi

Quoted 14 lines · Wolfgang Denk

Dear Tom Rini,

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

These changes should be factored out into a separate commit. In any case, the code should be compiled in only when needed, i. e. when btrfs support is selected. Otherwise you just bloat the code size and build time for all systems without need.

We should be able to make lib/crc32_c.o depend on btrfs being set, yes. But non-command stuff should be getting garbage collected out in most cases at last (Need to poke Albert about the patch for ARM).

Yes, it may be garbage collected, but only after compilation - which means we add to the build time for about 1000 boards which do not use this.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Hm... do we really need yet another crc32 implementation?

We talked about this before I believe and the answer is yes :(

Yes, I remember this discussion. But look at the code. It raises a number of questions:

- Why do we have to calculate the crc32c_table[] at runtime? Our regular CRC code uses a pre-calculated table; we should do the same here.

This is part of the port. But pre-calculated table can be manually
created.

Quoted 6 lines

- Compare the code for crc32c_cal() in the patch with the definition of DO_CRC(x) in "lib/crc32.c" - to me, it appears to be the same for little endian code (it is redundant?), but different for big endian systems - which raises the question if this code has ever been tested on a BE machine?

My code uses lib/crc32.c and i have only tested it on
mx53loco manchine.

Quoted 3 lines

- The code claims to be derived from "Linux kernel crypto/crc32c.c"; but I cannot find such code in that file.

I think yes but part of part from syslinux. I have also added
SHA1 of commit so don't know.

Quoted 4 lines

- The implementation of crc32c_cal() suffers from a few other problems (like not triggering the watchdog, which will cause problems on systems that use one).

I think that is true as its not using main line crc32 code.

Quoted 8 lines

I think we should re-check this. My feeling is that we may eventually end up with a different CRC table, but without need for new code.

Best regards,

Wolfgang Denk

Thanks
Adnan Ali

#7 lore raw

PATCH v12 2/2 Introduced btrfs file-system with btrload command

Dear Adnan Ali,

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

- Why do we have to calculate the crc32c_table[] at runtime? Our regular CRC code uses a pre-calculated table; we should do the same here.

This is part of the port. But pre-calculated table can be manually
created.

Not manually. It should be done at compile time, suing basically the same code.

Quoted 7 lines
Quoted 5 lines

- Compare the code for crc32c_cal() in the patch with the definition of DO_CRC(x) in "lib/crc32.c" - to me, it appears to be the same for little endian code (it is redundant?), but different for big endian systems - which raises the question if this code has ever been tested on a BE machine?

My code uses lib/crc32.c and i have only tested it on
mx53loco manchine.

I tend to believe thatit will not work on a big endian system, then.

Quoted 4 lines
Quoted 2 lines

- The code claims to be derived from "Linux kernel crypto/crc32c.c"; but I cannot find such code in that file.

I think yes but part of part from syslinux. I have also added
SHA1 of commit so don't know.

Please provide an exact reference where this code is coming from.

Quoted 4 lines
Quoted 3 lines

- The implementation of crc32c_cal() suffers from a few other problems (like not triggering the watchdog, which will cause problems on systems that use one).

I think that is true as its not using main line crc32 code.

We probably should do that, then.

Thanks.

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
Drawing on my fine command of language, I said nothing.
#8 lore raw

PATCH v12 2/2 Introduced btrfs file-system with btrload command

Quoted 19 lines · Wolfgang Denk

Dear Adnan Ali,

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

- Why do we have to calculate the crc32c_table[] at runtime? Our regular CRC code uses a pre-calculated table; we should do the

same

Quoted 1 line

here.

This is part of the port. But pre-calculated table can be
manually
created.

Not manually. It should be done at compile time, suing basically the same code.

Quoted 4 lines
Quoted 1 line

- Compare the code for crc32c_cal() in the patch with the

definition

Quoted 1 line

of DO_CRC(x) in "lib/crc32.c" - to me, it appears to be the

same for

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

little endian code (it is redundant?), but different for big

endian

Quoted 2 lines

systems - which raises the question if this code has ever been tested on a BE machine?

My code uses lib/crc32.c and i have only tested it on
mx53loco manchine.

I tend to believe thatit will not work on a big endian system, then.

Sorry I meant to say my code uses lib/crc32_c.c. The lib/crc32.c
is main line so you think main line code is not for big endian. What can i say.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

- The code claims to be derived from "Linux kernel

crypto/crc32c.c";

Quoted 1 line

but I cannot find such code in that file.

I think yes but part of part from syslinux. I have also added
SHA1 of commit so don't know.

Please provide an exact reference where this code is coming from.

Just clone syslinux and code is in ~/syslinux/core/fs/btrfs/crc32c.h

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

- The implementation of crc32c_cal() suffers from a few other

problems

Quoted 2 lines

(like not triggering the watchdog, which will cause problems on systems that use one).

I think that is true as its not using main line crc32 code.

We probably should do that, then.

To use that code probably i need to create static crc32 table.

Quoted 4 lines

Thanks.

Wolfgang Denk

Signature · 3 lines
Thanks

Adnan Ali
#9 lore raw

PATCH v12 2/2 Introduced btrfs file-system with btrload command

Dear Adnan Ali,

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

- Compare the code for crc32c_cal() in the patch with the

definition

Quoted 1 line

of DO_CRC(x) in "lib/crc32.c" - to me, it appears to be the

same for

Quoted 1 line

little endian code (it is redundant?), but different for big

endian

Quoted 2 lines

systems - which raises the question if this code has ever been tested on a BE machine?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

My code uses lib/crc32.c and i have only tested it on
mx53loco manchine.

I tend to believe thatit will not work on a big endian system, then.

Sorry I meant to say my code uses lib/crc32_c.c. The lib/crc32.c
is main line so you think main line code is not for big endian. What can i say.

What exactly do you mean by "my code uses lib/crc32_c.c? I was referring to the crc32c_cal() funciton in your patch. It is this function where I think it will fail on BE systems.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

- The code claims to be derived from "Linux kernel

crypto/crc32c.c";

Quoted 1 line

but I cannot find such code in that file.

I think yes but part of part from syslinux. I have also added
SHA1 of commit so don't know.

Please provide an exact reference where this code is coming from.

Just clone syslinux and code is in ~/syslinux/core/fs/btrfs/crc32c.h

The pelase fix the comment, and provide exact reference (commit ID etc. as described at bullet # 4 at [1]) for that code.

[1] http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

- The implementation of crc32c_cal() suffers from a few other problems (like not triggering the watchdog, which will cause problems on systems that use one).

I think that is true as its not using main line crc32 code.

We probably should do that, then.

To use that code probably i need to create static crc32 table.

Indeed. This should also reduce boot time.

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
Real computer scientists don't comment their  code.  The  identifiers
are so long they can't afford the disk space.