RFC1350 uses the 'opcode' term for the first 2-bytes field
of TFTP packet. But the U-boot tftp code uses the 'proto' term
for the same thing.
The patch takes back original term and makes opcode calculation
more clear.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The separation of incoming packets handling makes it much easier
to run barebox tftp client on top of picotcp network stack in the future.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add the root= parameter for NFS filesystems. We currently hardcode
v3 and tcp which probably needs to become configurable at some point.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add the parameter to boot from ubifs fileystems. This assumes that
there will be only one UBI device registered in the kernel, otherwise
there is no way to predict the ubi number.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When registering a filesystem device add a device parameter suitable
for the Linux root= option to boot from exactly this filesystem. Currently
the fs layer sets this parameter to the root=PARTUUID= mechanism if a
partuuid is available. Other filesystems like NFS and UBIFS which do
not have a PARTUUID can overwrite this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
- Drop usage of 'ulong', use unsigned long
- remove unnecessary intermediate casting to unsigned long
- Use proper u8/u16/u32 types. Fixes 64bit systems on which ulong is 64bit
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Linux uses SHRT_* instead of SHORT_*. The <limits.h> of C does
the same. Let's follow this standard.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
fs/ubifs/ubifs.h includes <common.h> and the macros INT_MAX, INT_MIN,
LLONG_MAX are already defined there.
The same defines in fs/ubifs/ubifs.h are redundant.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This file originates in Linux. Linux has it under include/linux/
directory since commit dccd2304cc90.
Let's move it to the same place as well in barebox.
This commit was generated by the following commands:
find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:'
git mv include/sizes.h include/linux/
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Implement the standard FS ops for writing/manipulating
efivars.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We don't have a use-case yet where we need to manipulate
the attributes of a variable and it confuses "normal"
users of the variables.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Preserve info needed for easy manipulation of variables.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cleans the code a bit and will allow us to implement
removing of vars quite a bit easier.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The struct device_d * in struct filep is never of interest, instead
it is always converted to a struct fs_device_d *, so simplify the code
by storing the struct fs_device_d * directly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We have our file helper functions in several places. Move them
all to lib/libfile.c.
With this we no longer have file helpers in fs/fs.c which contains
the core fs functions and no functions in lib/libbb.c which are
not from busybox.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
From U-Boot commit:
| commit 8b415f703f88d1d3b0466830047affbbf7f24913
| Author: Rommel Custodio <sessyargc+uboot@gmail.com>
| Date: Sun Jul 21 10:53:25 2013 +0200
|
| ext4fs: le32_to_cpu() used on a 16-bit field
|
| Fix reading ext4_extent_header struture on BE machines. Some 16 bit
| fields where converted to 32 bit fields, due to the byte swap on BE
| machines the containing value was corrupted. Therefore reading ext4
| filesystems on BE machines where broken before.
|
| Signed-off-by: Rommel Custodio <sessyargc+uboot@gmail.com>
| [sent via git-send-email; rework commit message]
| Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
| Reviewed-by: Simon Glass <sjg@chromium.org>
| Tested-by: Simon Glass <sjg@chromium.org>
| Tested-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
From U-Boot commit:
| commit 470173274d9ceb18a7140ef93e20be6c2236e7d9
| Author: Ionut Nicu <ioan.nicu.ext@nsn.com>
| Date: Mon Jan 13 11:59:24 2014 +0100
|
| ext4fs: use EXT2_BLOCK_SIZE instead of fs->blksz
|
| Using fs->blksz in ext4fs_get_extent_block() is not
| correct since fs->blksz is not initialized on the
| read path. Use EXT2_BLOCK_SIZE() instead which will
| produce the desired output.
|
| Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com>
| Signed-off-by: Mathias Rulf <mathias.rulf@nsn.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
From U-Boot commit:
| commit b5bbac1a9b07016602559ff483df265fef6c1f83
| Author: Ionut Nicu <ioan.nicu.ext@nsn.com>
| Date: Mon Jan 13 12:00:08 2014 +0100
|
| ext4fs: fix "invalid extent block" error
|
| For files where we actually have extent indexes following
| an extent header (ext_block->eh_depth != 0), the do/while
| loop from ext4fs_get_extent_block() does not select the
| proper extent index structure.
|
| For example, if we have:
|
| ext_block->eh_depth = 1
| ext_block->eh_entries = 1
| fileblock = 0
| index[0].ei_block = 0
|
| the do/while loop will exit with i set to 0 and the
| ext4fs_get_extent_block() function will return 0, even if
| there was a valid extent index structure following the
| header.
|
| Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com>
| Signed-off-by: Mathias Rulf <mathias.rulf@nsn.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This implements a filesystem for accessing EFI variables.
It is compatible to the Linux Kernel efivarfs filesystem.
Currently the variables can only be accessed readonly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This implements a filesystem driver which uses the EFI Simple File
System Protocol to provide files from EFI to barebox.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
automount_mount calls run_command which may trigger an automount
again. This results in an endless loop. A simple way to trigger
this is:
mkdir /x; automount /x false; cd /x; something
Use a static variable to detect if we are currently in automount_mount()
and bail out if we are.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
With CONFIG_PARTITION_NEED_MTD enabled we use mtd rather than devfs
directly to create partitions on mtd devices. Since:
| commit b32cd8df87
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date: Wed Apr 9 15:49:32 2014 +0200
|
| mtd: nand: bb: use mtd api directly
|
| The devfs layer just adds an addition indirection between mtd
| and the bb devices with no purpose. Drop it.
|
| Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The bad block aware device creation doesn't work if this option
is disabled. With this we remove CONFIG_PARTITION_NEED_MTD and always
use mtd partitions on mtd devices.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
If there's packet loss and the remote server needs to retransmit,
there is falsely no timeframe left because TIMEOUT (server wait time)
and TFTP_TIMEOUT (abort timer) are the same.
This patch increases TFTP_TIMEOUT.
See RFC2349 for more info: http://tools.ietf.org/html/rfc2349
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
__devfs_add_partition returns the newly created cdev, but in case
of mtd partitions it accidently returns 0. Fix this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>