[U-Boot] [PATCH v2] Introduced btrfs file-system with btrload command

Stefan Roese sr at denx.de
Thu Feb 14 14:32:45 CET 2013


On 14.02.2013 14:04, Adnan Ali wrote:
> 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.

Signed-off-by missing. And could you please add a more complete/exact
comment about the source of this code (revision etc). Please see:

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

More comments below (apart from Otavio's):

> ---
>  Makefile                   |    3 +-
>  common/Makefile            |    1 +
>  common/cmd_btr.c           |   52 ++
>  fs/btrfs/Makefile          |   51 ++
>  fs/btrfs/btrfs.c           | 1131 ++++++++++++++++++++++++++++++++++++++++++++
>  fs/fs.c                    |  117 ++++-
>  include/btrfs.h            |  398 ++++++++++++++++
>  include/config_fallbacks.h |    4 +
>  include/crc32c.h           |   48 ++
>  include/fs.h               |    1 +
>  10 files changed, 1786 insertions(+), 20 deletions(-)
>  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 include/crc32c.h
> 
> diff --git a/Makefile b/Makefile
> index 3305e8c..a34905e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -261,6 +261,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 \
> @@ -270,7 +271,7 @@ LIBS-y += fs/libfs.o \
>  	fs/reiserfs/libreiserfs.o \
>  	fs/ubifs/libubifs.o \
>  	fs/yaffs2/libyaffs2.o \
> -	fs/zfs/libzfs.o
> +	fs/zfs/libzfs.o 
>  LIBS-y += net/libnet.o
>  LIBS-y += disk/libdisk.o
>  LIBS-y += drivers/bios_emulator/libatibiosemu.o
> diff --git a/common/Makefile b/common/Makefile
> index 54fcc81..c7af839 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -96,6 +96,7 @@ COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o
>  COBJS-$(CONFIG_CMD_EXT4) += cmd_ext4.o
>  COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o
>  COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o
> +COBJS-$(CONFIG_CMD_BTR) += cmd_btr.o

Again, please keep this list alphabetically sorted.

>  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
> diff --git a/common/cmd_btr.c b/common/cmd_btr.c
> new file mode 100644
> index 0000000..f65261c
> --- /dev/null
> +++ b/common/cmd_btr.c
> @@ -0,0 +1,52 @@
> +/*
> + * (C) Copyright 2013 Codethink Limited
> + * Btrfs port to Uboot by
> + * Adnan Ali <adnan.ali at codethink.co.uk>
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * 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,
> + * MA 02111-1307 USA
> + */
> +
> +/*
> + * Boot support
> + */
> +#include <fs.h>
> +#include <btrfs.h>
> +
> +char SubvolName[MAX_SUBVOL_NAME];

No ChamelCase please. This is most likely code not copied from
syslinux, so all rules for coding style apply here.

> +
> +int do_btr_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> +{
> +        if(argc>5)
> +          strcpy(SubvolName, argv[5]); 

Indention.

> +        else strcpy(SubvolName, ""); //no subvol defined

No "//" comments.

> +
> +        return do_load(cmdtp, flag, argc, argv, FS_TYPE_BTR, 16);
> +}
> +
> +
> +U_BOOT_CMD(
> +        btrload,        7,      0,      do_btr_fsload,
> +        "load binary file from a btr filesystem",
> +        "<interface> [<dev[:part]>]  <addr> <filename> [subvol_name]\n"
> +        "    - Load binary file 'filename' from 'dev' on 'interface'\n"
> +        "      to address 'addr' from better filesystem.\n"
> +        "      the load stops on end of file.\n"
> +        "      subvol_name is used read that file from this subvolume.\n"
> +        "      All numeric parameters are assumed to be hex."
> +);

I suggest you run this file through checkpatch before the
next submission.

I didn't review the "real" btrfs support code for now (lack of
time now).

Best regards,
Stefan



More information about the U-Boot mailing list