9
0
Fork 0
Commit Graph

268 Commits

Author SHA1 Message Date
Sascha Hauer 2143dfda8b Merge branch 'for-next/pr_print' 2013-04-04 14:20:33 +02:00
Sascha Hauer 32f8f583c9 fs: allocate FILE table dynamically
Some systems are runnignfrom a very limited SRAM, but have a huge
malloc space in SDRAM. The bss normally is in SRAM, so we should
avoid having big structures there. The FILE table is 5120 bytes
big, so allocate it dynamically instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 08:42:28 +01:00
Jean-Christophe PLAGNIOL-VILLARD c44eabb109 ext4: switch debug and printf to dev_xxx
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-09 11:18:08 +01:00
Alexander Aring 9d8a20592f fs: add pread and pwrite functions
Add pread and pwrite functions.

Split read and write functions to save some space.
The functions pread and pwrite saves and sets the file
position to a given offset and restore them afterwards.

This also makes the nandtest command use these function
which is necessary to not break compilation for the nandtest
command.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-20 08:22:42 +01:00
Alexander Aring e48b144071 fs: fix return type of read
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-18 11:09:46 +01:00
Sascha Hauer 0b12784089 Merge branch 'for-next/oftree'
Conflicts:
	drivers/of/base.c
2013-02-04 15:49:04 +01:00
Sascha Hauer da5fe0ba47 Merge branch 'for-next/misc' 2013-02-04 15:49:00 +01:00
Sascha Hauer a01e54d201 treewide: fix format specifiers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-27 14:24:10 +01:00
Sascha Hauer 12ef4d0df9 tftp: reset timer on progress
When during tftp receive operation a ACK packet can't successfully be sent
the timer was resetted directly after send resulting in a deadlock.

This patch changes the timer reset operation in a way that it is only resetted
when the actually is progress, namely in the TFTP_ACK/TFTP_DATA pathes in the
tftp handler.

Reported-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Antony Pavlov <antonynpavlov@gmail.com>
2013-01-20 17:00:10 +01:00
Sascha Hauer a886dac94e Add write_file function
write_file() will write a buffer to a file. The file is created
if necessary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-19 11:48:17 +01:00
Wolfram Sang 8c98a5dfb7 devfs & mtd: add MEMERASE ioctl support
To make that, we need to shift mtd_erase before mtd_ioctl.
ubi-utils need that, especially ubiformat.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-19 10:31:23 +01:00
Sascha Hauer 1a9e93cc81 drivers/base: fix corrupt device tree
dev_add_child is a very unsafe function. If called multiple times
it allows setting the same device to different parents thus corrupting
the siblings list. This happens regularly since:

| commit c2e568d19c
| Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| Date:   Sat Nov 3 16:11:05 2012 +0100
|
|    bus: add bus device
|
|    automatically add it as parent of any bus device if none already specified
|
|    we have now a nice output per bus

If for example a FATfs is mounted this nice output per bus often ends with:

>     `---- fat0
>     `---- 0
>          `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL>
>          `---- sram00
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               unable to handle NULL pointer dereference at address 0x0000000c
> pc : [<87f08a20>]    lr : [<87f08a04>]
> sp : 86eff8c0  ip : 87f3fbde  fp : ffffffff
> r10: ffffffff  r9 : 00000000  r8 : 00000003
> r7 : 86f075b8  r6 : 00000002  r5 : ffffffec  r4 : 86f07544
> r3 : 00000000  r2 : 43f900b4  r1 : 00000020  r0 : 00000005
> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
> [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130)
>
> [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c)
> [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14)
> [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38)
> [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60)

This patch fixes this by adding a device to its parents children list in
register_device so that dev_add_child is no longer needed. This function
is removed from the tree. Now callers of register_device have to clearly
set the parent *before* registering a device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Jan Lübbe <jlu@pengutronix.de>
2012-12-12 15:04:27 +01:00
Sascha Hauer c7c9c88cc2 fs: move dev_add_child before device_register
Biology tells us that the parent is known before the child is born.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-12 14:49:05 +01:00
Sascha Hauer 8030ab24fa Merge branch 'kconfig' 2012-12-08 12:22:21 +01:00
Alexander Shiyan 4c20f9af97 Cleanup Kconfig files
This patch provides a global cleanup barebox Kconfig files. This includes
replacing spaces to tabs, formatting in accordance format, removing
extraneous lines and spaces. No functional changes.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-08 12:22:12 +01:00
Sascha Hauer 116c24e99e Merge branch 'for-next/mem-commands' 2012-12-07 16:43:15 +01:00
Sascha Hauer ac6e464cb2 fs: implement initial ext4 support from U-Boot
The ext4 implementation has been taken from U-Boot with some
changes:

- No global variables to allow for multiple filesystems to
  be mounted and multiple files to be open.
- remove fs internal link following and use the barebox link
  implementation.
- remove write support. This is incomplete in U-Boot, so I decided
  to skip this for now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-03 11:23:25 +01:00
Antony Pavlov f23198905c mem: add the swab (swap bytes) option to memory_display()
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-26 11:14:40 +01:00
Vicente 64254636af omap4: add filesystem support over usb boot
Signed-off-by: Vicente <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-16 15:32:31 +01:00
Sascha Hauer a2f3fde144 Merge branch 'for-next/fs' 2012-11-16 14:00:45 +01:00
Sascha Hauer 975d6a0130 fs tftp: Fix possible fifo overflow
In tftp_read we send a request for a new packet without checking if we
have enough space in the FIFO. This can lead to a FIFO overflow and a
corrupt file. Add a check for it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2012-10-24 09:57:51 +02:00
Sascha Hauer d2606de353 fs tftp: Only request a block once
tftp_send is called often. Each time, when in STATE_RDATA, a packet
is requested from the tftp server, even if we requested the same packet
already.
Stop this by tracking which packet we requested.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-24 09:57:44 +02:00
Alexander Aring 346b16ba0a devfs-core: add writesize in mtd partition ioctl
Add writesize in mtd partition MEMGETINFO ioctl.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-23 08:25:31 +02:00
Vicente 7c16deba8c fs: improve robustness
Signed-off-by: Vicente <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-08 21:57:13 +02:00
Sascha Hauer d1e65d2a7b Merge branch 'for-next/remove-fsf-address'
Conflicts:
	drivers/net/miidev.c
	include/miidev.h
2012-10-03 21:12:48 +02:00
Sascha Hauer 3b02a1ac3a Merge branch 'for-next/fat-detection' 2012-10-03 21:10:37 +02:00
Sascha Hauer d4541ee94f Merge branch 'for-next/driver' 2012-10-03 21:09:34 +02:00
Jean-Christophe PLAGNIOL-VILLARD 72b0a6503f driver: register bus
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-23 21:15:13 +02:00
Franck Jullien 466e505fd9 fs/fat: Handle MBR on the first sector
Use filetype to detect FAT boot sector.
Add support for disk with MBR on the first sector.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-20 08:58:00 +02:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Alexander Aring 05a68cca1f fs: fs.c fix cast
Fix casting on min argument, to avoid warnings on 64bit build.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-11 09:19:47 +02:00
Jean-Christophe PLAGNIOL-VILLARD 361d5bd773 fs/nfs: fix read when size < 1024
Currently we always request 1024.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-07 10:27:15 +02:00
Sascha Hauer e5a927883e Merge branch 'for-next/link' 2012-09-05 12:59:29 +02:00
Jean-Christophe PLAGNIOL-VILLARD 0e22047a99 nfs: add readlink support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD ad6c28ac41 ramfs: add symlink and readlink support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD 1483f45879 fs: introduce get_mounted_path to get the path where a file is mounted
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD c3defd0504 fs: open: add symlink support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD 2d7ac4aa33 fs: implement stat
stat() stats the file pointed to by path and fills in buf.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD 65d4f485eb fs: add symlink support
Limit it's support to existing file only

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD 99684498ec fs: rename stat to lstat as we implement lstat
For compatibility put a inline on lstat for stat until we have the symlink
support.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD f4d850eb76 fs: fix rmdir with symlink
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD 2f17f1a22f fs: add readlink support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-05 03:22:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD 173fa8fe4c fs/fat: add filetype
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-04 09:08:39 +02:00
Jean-Christophe PLAGNIOL-VILLARD a1b1aec6af fs/mount: add autodetection type support
if NULL is pass as type mount will try to autodetect the filesystem type

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-04 09:08:39 +02:00
Sascha Hauer 11632d1eb3 fs nfs: depend on net
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-25 09:27:27 +02:00
Sascha Hauer 8d064097eb fs: fix standard zero, full devices
The standard devices are currently broken since they have
the size ~0. As now files use loff_t as file size which is a signed
type the read implementation gets confused and now returns -1.

The current implementation also has the (somewhat theorical) problem
that we do not have real streaming devices, so /dev/zero went out
of zeroes after reading 4GB (or now LLONG_MAX).

This patch introduces a new cdev flag DEVFS_IS_CHARACTER_DEV and a new
file size flag FILE_SIZE_STREAM which makes it possible to create
real stream devices instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-04 08:38:22 +02:00
Sascha Hauer 1510c57e93 Merge branch 'for-next/resource-size'
Conflicts:
	drivers/base/resource.c
	fs/fs.c
2012-07-02 11:05:57 +02:00
Sascha Hauer c9fc3209ac Merge branch 'for-next/fs' 2012-07-02 11:00:41 +02:00
Sascha Hauer f22d4e2778 Merge branch 'for-next/sparse' 2012-07-02 10:59:37 +02:00
Sascha Hauer 6e4b15537b Merge branch 'for-next/misc' 2012-07-02 10:59:30 +02:00