9
0
Fork 0
Commit Graph

350 Commits

Author SHA1 Message Date
Sascha Hauer 052d9ac0cf blspec: automatically append bootargs
When bootloader spec is used to boot devices it is often desirable
to boot the same image from different media. Since the fs images
need to contain the root= parameters to tell Linux where to boot
from the images can't be identical on different media.

This patch changes this by introducing a 'appendroot' option for
bootloader spec. If set to true, barebox will construct a Linux
commandline option for the device the bootloader spec entry is found
on.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-13 14:35:03 +02:00
Sascha Hauer ac1bffb220 Merge branch 'for-next/fs' 2015-03-09 08:30:24 +01:00
Sascha Hauer 6977292a34 fs: rename inode member of struct filep to priv
Because that's what it is. 'inode' will become confusing
once we support real inodes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-09 08:06:41 +01:00
Marc Kleine-Budde 89fc8c31ff fs: make "offset" parameter of erase() and protect() 64 bit safe
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-03 08:23:46 +01:00
Masahiro Yamada d27077bd76 linux/kernel.h: rename USHORT_MAX, SHORT_MAX, SHORT_MIN
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>
2015-01-21 14:58:07 +01:00
Masahiro Yamada 150cf52a3e fs: ubifs: remove redundant macro defines
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>
2015-01-21 14:58:07 +01:00
Sascha Hauer ff6383c8e4 Merge branch 'for-next/misc' 2015-01-09 17:38:26 +01:00
Masahiro Yamada d8753571b2 sizes.h: move include/sizes.h to include/linux/sizes.h
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>
2015-01-08 14:00:26 +01:00
Lucas Stach 46b5a6d652 fs: efivars: implement write support
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>
2014-12-09 09:59:10 +01:00
Lucas Stach c296bef5ed fs: efivars: don't store attributes in file
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>
2014-12-09 09:59:10 +01:00
Lucas Stach eb15ab159f fs: efivar: preserve more info in inode
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>
2014-12-09 09:59:10 +01:00
Lucas Stach 26793cc2cc fs: efivar: move variable discovery into probe
So we can manipulate things easier.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:10 +01:00
Lucas Stach 6c240dd469 fs: efivar: switch to standard list implementation
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>
2014-12-09 09:59:10 +01:00
Lucas Stach 2d51f24660 fs: efivars: cosmetic changes
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:09 +01:00
Sascha Hauer b01bc4c810 Merge branch 'for-next/randconfig-1' 2014-12-08 14:54:11 +01:00
Sascha Hauer a1a7620dfd fs: bpkfs: select CRC32
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-28 15:21:26 +01:00
Sascha Hauer eafab21883 fs: uImagefs: select crc32
It needs it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-27 17:14:49 +01:00
Sascha Hauer a3993a38da fs: implement fstat
fstat is useful to get information about an already opened file. Add
it to barebox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 16:11:06 +02:00
Sascha Hauer 4f7a18cdb5 fs: Store the path in struct filep
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 16:09:17 +02:00
Sascha Hauer 59f91ec6c0 fs: do not lookup global FILE * when the file is already available
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 16:08:03 +02:00
Sascha Hauer bfef6cd5f2 fs: store pointer to fsdev instead of dev in struct filep
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>
2014-10-08 16:06:21 +02:00
Sascha Hauer 5b7b7ee5d9 Merge branch 'for-next/metadata'
Conflicts:
	arch/arm/dts/Makefile
	common/Makefile
	lib/Makefile
2014-08-07 06:15:16 +02:00
Sascha Hauer 8a11a59b37 Merge branch 'for-next/efi'
Conflicts:
	.gitignore
	Makefile
	drivers/serial/Makefile
2014-08-07 06:14:56 +02:00
Sascha Hauer 3cfa4bc00c move file helper functions to separate file
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>
2014-08-07 06:13:51 +02:00
Sascha Hauer 772cc850ae fs: ext4: le32_to_cpu() used on a 16-bit field
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>
2014-07-25 10:38:47 +02:00
Sascha Hauer 07f0462a45 fs: ext4: use EXT2_BLOCK_SIZE instead of fs->blksz
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>
2014-07-25 10:38:39 +02:00
Sascha Hauer 400b4e2bb3 fs: ext4: fix "invalid extent block" error
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>
2014-07-25 10:38:27 +02:00
Sascha Hauer ef4f9d77b7 fs: implement EFI variable filesystem driver
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>
2014-07-16 10:46:18 +02:00
Sascha Hauer d6e62b225b fs: implement EFI filesystem driver
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>
2014-07-16 10:46:18 +02:00
Sascha Hauer b5b926750f fat: Use correct format specifier
Use %zd to print size_t arguments.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-11 08:14:48 +02:00
Sascha Hauer 621266d3a4 automount: check for recursive automount
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>
2014-07-03 08:16:42 +02:00
Sascha Hauer 9f8aab600d drop CONFIG_PARTITION_NEED_MTD
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>
2014-05-13 09:19:46 +02:00
Christoph Fritz 5dafef6aaf tftp: add timeframe when remote server is retransmitting
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>
2014-05-05 09:18:45 +02:00
Alexander Shiyan 6b5a16f193 ubifs: Remove unused variable
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-23 14:00:25 +02:00
Sascha Hauer e6410cd9c4 devfs-core: return new cdev also for mtd partitions
__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>
2014-04-09 22:27:21 +02:00
Sascha Hauer cf1b29a850 Merge branch 'for-next/ubi'
Conflicts:
	drivers/mtd/ubi/cdev.c
2014-03-07 09:26:35 +01:00
Sascha Hauer 74213ed9a7 Merge branch 'for-next/partitionhelper'
Conflicts:
	fs/devfs-core.c
2014-03-07 09:25:53 +01:00
Sascha Hauer 144358e0aa Merge branch 'for-next/nfs'
Conflicts:
	defaultenv/defaultenv-2-base/bin/ifup
2014-03-07 09:25:44 +01:00
Sascha Hauer e358922a74 Merge branch 'for-next/mtd'
Conflicts:
	drivers/mtd/core.c
	net/eth.c
2014-03-07 09:25:18 +01:00
Sascha Hauer a8a08f88cc Merge branch 'for-next/misc'
Conflicts:
	common/environment.c
2014-03-07 09:25:09 +01:00
Sascha Hauer 93578fb233 run_command: remove unused flag parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-07 07:41:26 +01:00
Sascha Hauer 6dac289d0c fs: ubifs: rework logging
By default UBIFS is very verbose. Decrease the verbosity, turn
printf messages into ubifs_ messages and add device parameters
for the values which are not printed anymore.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:24:05 +01:00
Sascha Hauer 15d559e191 fs: ubifs: Fix unused function warning
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:23:01 +01:00
Uwe Kleine-König 2a644bed63 devfs: partitioning: add new helper devfs_create_partitions
Compared to devfs_add_partition which adds a single partition
devfs_create_partitions creates several partitions at once. One nice
benefit is that this simplifies appending partitions because the start
of the latter partition doesn't need to be specified explicitly.
Also dev_add_bb_dev() is called by the new helper if the bbname is
specified for a partition.

Note that adding partitions is also more flexible now (also via
devfs_add_partition) because negative values for offset and size now
have a proper meaning instead of creating broken partitions.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:19:07 +01:00
Uwe Kleine-König a7f78e7273 devfs_add_partition: make flags parameter unsigned
The value is only used to assign to a (*struct cdev)->flags which is an
unsigned int and it is passed as fourth parameter of mtd_add_partition which
is an unsigned long.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:20:26 +01:00
Uwe Kleine-König 835bb02e26 devfs: partitioning: add missing free in error path
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:20:26 +01:00
Sascha Hauer 0b1d85af18 fs: tftp: Fix writing files to tftp
Copying files to tftp is broken since:

| commit d4f5bb1e01
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date:   Sat Sep 28 13:12:50 2013 +0200
|
|     copy_file: Add missing O_TRUNC
|
|     Without it, when copying a smaller file over a larger file the
|     resulting file still has the remaining space from the larger file.
|
|     Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Since this commit copy_file passes O_TRUNC to open(). This results in the
fs layer calling fsdrv->truncate. tftp returns -ENOSYS here and open returns
with an error. To fix this return 0 for the truncate callback in tftp. Also
enforce the O_TRUNC flag when opening a file for writing on tftp as the files
are always truncated on tftp anyway.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: andreas.willig@rafi.de
2014-02-26 09:36:18 +01:00
Sascha Hauer 0c76b7e377 mtd: register mtd partitions as real mtd devices
So far mtd partitions were mtd devices, but these were not registered.
This patch changes this. mtd partitions are now registered like real
mtd devices. This makes them part of the device hierarchy.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-26 08:33:18 +01:00
Sascha Hauer 403fbbbc34 read_file: Use read_full
At least NFS does not fulfill read requests > 1024 bytes at once.
Use read_full in read_file as read doesn't guarantee that the
whole request can be read at once.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-13 11:18:55 +01:00
Alexander Aring a6f19bc782 bpkfs: fix compiler warning
Correct formatstring of size_t is %zu otherwise we get:

fs/bpkfs.c: In function ‘bpkfs_probe’:
fs/bpkfs.c:440:3: warning: format ‘%d’ expects argument of type ‘int’,
but argument 5 has type ‘size_t’ [-Wformat=]
   dev_dbg(dev, "%d: offset = %d\n", i, d->offset);

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:34:35 +01:00