summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* mtd: Add subpagesize to mtd_info_userSascha Hauer2013-12-201-0/+1
| | | | | | | | | ubiformat needs the subpagesize to work correctly. The kernel uses sysfs to pass the subpagesize, but in barebox we have the possibility to extend struct mtd_info_user. Add a corresponding field and use it in ubiformat. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix endless loop in automount codeSascha Hauer2013-11-271-0/+2
| | | | | | | | | | A chdir to a path registered as an automount path followed by a 'ls' results in an endless loop. This happens because the command the automounter executes results in another automount request. Fix this by running the automounter from the chdir code before the cwd is actually changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Add function to get cdev by mountpathSascha Hauer2013-11-051-0/+13
| | | | | | This is useful to know for the bootloader spec implementation. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubifs: Remove redundant assignmentAlexander Shiyan2013-10-222-2/+0
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: ignore O_TRUNC open flag for devicesSascha Hauer2013-10-161-2/+1
| | | | | | | | | | | | | | | | | | The O_TRUNC flag has to be ignored when opening devices. Otherwise cp /somefile /dev/somedev fails. This is broken since: | commit d4f5bb1e011ac653a167031554f0ac9e028e9e36 | 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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mount'Sascha Hauer2013-10-075-52/+126
|\
| * fs: add cdev mount helpersSascha Hauer2013-09-301-0/+80
| | | | | | | | | | | | | | Introduce helpers to iterate over cdevs and mount them to a known path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: use bus_for_each_driverSascha Hauer2013-09-291-4/+1
| | | | | | | | | | | | Instead of using for_each_driver and testing for the bus type. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: cleanup backingstore handlingSascha Hauer2013-09-295-48/+45
| | | | | | | | | | | | | | | | | | | | | | All filesystem drivers which need a backingstore device do the same ignoring of '/dev/' in the backingstore followed by a cdev_open. Add a helper function for it and let the core handle the cdev. As a side effect this makes sure that fsdev->cdev is also set when a device is mounted without the leading '/dev/' which was previously ignored by the mount code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/fs'Sascha Hauer2013-10-073-0/+559
|\ \ | | | | | | | | | | | | | | | Conflicts: fs/Kconfig fs/Makefile
| * | fs: add uimagefsJean-Christophe PLAGNIOL-VILLARD2013-09-273-0/+559
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this will provide the image data and information via file # ls -l /tmp/ -rwxrwxrwx 3 arch -rwxrwxrwx 12 compression -rwxrwxrwx 16 name -rwxrwxrwx 5 os -rwxrwxrwx 24 time -rwxrwxrwx 12 type -rwxrwxrwx 10 load_addr -rwxrwxrwx 10 entry_point -rwxrwxrwx 2199875 data0 -rwxrwxrwx 2199875 data -rwxrwxrwx 10 data.crc if it's multi image # ls -l /tmp-multi/ -rwxrwxrwx 3 arch -rwxrwxrwx 12 compression -rwxrwxrwx 16 name -rwxrwxrwx 5 os -rwxrwxrwx 24 time -rwxrwxrwx 16 type -rwxrwxrwx 10 load_addr -rwxrwxrwx 10 entry_point -rwxrwxrwx 1292 data0 -rwxrwxrwx 983 data1 -rwxrwxrwx 2287 data -rwxrwxrwx 10 data.crc you can get the image header via an ioctl on any file UIMAGEFS_METADATA if you want to check the crc do # crc32 -f /tmp-multi/data -V /tmp-multi/data.crc CRC32 for /tmp-multi/data 0x00000000 ... 0x000008ee ==> 0x88d5a0db Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / fs: add BPKFS supportJean-Christophe PLAGNIOL-VILLARD2013-10-063-0/+530
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simple update file format developed for Somfy, tools and library are available under LGPLv2 (https://www.gitorious.org/libbpk). This format in the v1.0 allow you to store 6 types a binary stream for a unique hardware id: - bootloader - bootloader_version - description.gz - kernel - rootfs - firmware_version and you can easly add more binary stream type. The fs will display you in a directory per hw id and if a binary stream type is unknown will be display as unknown_%08x # mount image.bpk /tmp # ls -l /tmp/hw_id_0/ -rwxrwxrwx 10 firmware_version -rwxrwxrwx 8 firmware_version.crc -rwxrwxrwx 1845968 kernel -rwxrwxrwx 8 kernel.crc -rwxrwxrwx 5062656 rootfs -rwxrwxrwx 8 rootfs.crc -rwxrwxrwx 248 bootloader -rwxrwxrwx 8 bootloader.crc -rwxrwxrwx 248925 description.gz -rwxrwxrwx 8 description.gz.crc -rwxrwxrwx 4 bootloader_version -rwxrwxrwx 8 bootloader_version.crc -rwxrwxrwx 4 unknown_1234567g -rwxrwxrwx 8 unknown_1234567g.crc Why BPK and not CPIO or uImage 1) CPIO cpio does not handle > 4GiB image and does not have any crc checksum 2) uImage uImage only provide one crc32 for the all data part and only a list of binary stream with no information about what is what (in multi-image format) 3) BPK BPK provide a crc32 for the header part and one crc32 per binary stream so if you does not care of some data you are not force to check them And you known exactly the binary stream type and for which hw to use it. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Fargier Sylvain <sylvain.fargier@somfy.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix lseek on fat filesystems.Fargier Sylvain2013-09-181-0/+1
| | | | | | | | FILE object was not updated properly when seeking. Signed-off-by: Fargier Sylvain <sylvain.fargier@somfy.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2013-09-051-1/+1
|\
| * fs: tftp: don't duplicate timeout informationBaruch Siach2013-08-121-1/+1
| | | | | | | | | | Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Add ubifs supportSascha Hauer2013-08-0728-0/+15531
|/ | | | | | | | This adds ubifs support from u-boot-2013.07. This is taken mostly as-is, only the necessary adjustments to attach to the barebox fs layer have been made. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: add device_find_partitionSascha Hauer2013-07-151-0/+27
| | | | | | | device_find_partition allows to find a partition of a device with a particular name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: allow to open a struct cdevSascha Hauer2013-07-151-5/+11
| | | | | | | cdev_open() opens a cdev by name. This introduces cdev_do_open which allows to open a cdev when the cdev is already found by other means. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: introduce partition namesSascha Hauer2013-07-151-0/+3
| | | | | | | | currently most partition cdevs have the name <devname>.<partname> This makes it hard to find a partition by <partname>. This introduces a partname field in struct cdev so that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: let devfs_add_partition return the new partitionSascha Hauer2013-07-151-6/+6
| | | | | | Useful for unregistering later or for adding addional flags. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* read_file: Make it work on tftp servers which do not pass sizeSascha Hauer2013-06-202-1/+22
| | | | | | | | Some tftp servers (for example netkit-tftp) do not pass the filesize. Add a workaround for read_file which reads the file into a temporary file which then is copied to a buffer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pr_print'Sascha Hauer2013-04-041-6/+6
|\
| * ext4: switch debug and printf to dev_xxxJean-Christophe PLAGNIOL-VILLARD2013-03-091-6/+6
| | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: allocate FILE table dynamicallySascha Hauer2013-03-141-4/+7
|/ | | | | | | | | 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>
* fs: add pread and pwrite functionsAlexander Aring2013-02-201-14/+74
| | | | | | | | | | | | | | | 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>
* fs: fix return type of readAlexander Aring2013-02-181-1/+1
| | | | | Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/oftree'Sascha Hauer2013-02-041-0/+19
|\ | | | | | | | | Conflicts: drivers/of/base.c
| * Add write_file functionSascha Hauer2013-01-191-0/+19
| | | | | | | | | | | | | | write_file() will write a buffer to a file. The file is created if necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2013-02-041-10/+11
|\ \
| * | tftp: reset timer on progressSascha Hauer2013-01-201-10/+11
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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>
* / treewide: fix format specifiersSascha Hauer2013-01-271-2/+2
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs & mtd: add MEMERASE ioctl supportWolfram Sang2012-12-191-1/+2
| | | | | | | | 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>
* drivers/base: fix corrupt device treeSascha Hauer2012-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 c2e568d19c5c34a05a1002d25280bf113b72b752 | 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>
* fs: move dev_add_child before device_registerSascha Hauer2012-12-121-5/+5
| | | | | | Biology tells us that the parent is known before the child is born. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'kconfig'Sascha Hauer2012-12-081-1/+1
|\
| * Cleanup Kconfig filesAlexander Shiyan2012-12-081-1/+1
| | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'for-next/mem-commands'Sascha Hauer2012-12-071-1/+1
|\ \
| * | mem: add the swab (swap bytes) option to memory_display()Antony Pavlov2012-11-261-1/+1
| |/ | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / fs: implement initial ext4 support from U-BootSascha Hauer2012-12-0310-0/+1384
|/ | | | | | | | | | | | | | 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>
* omap4: add filesystem support over usb bootVicente2012-11-163-0/+225
| | | | | Signed-off-by: Vicente <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/fs'Sascha Hauer2012-11-161-9/+18
|\
| * fs: improve robustnessVicente2012-10-081-9/+18
| | | | | | | | | | Signed-off-by: Vicente <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs tftp: Fix possible fifo overflowSascha Hauer2012-10-241-1/+5
| | | | | | | | | | | | | | | | | | | | 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>
* | fs tftp: Only request a block onceSascha Hauer2012-10-241-0/+6
| | | | | | | | | | | | | | | | | | 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>
* | devfs-core: add writesize in mtd partition ioctlAlexander Aring2012-10-231-0/+1
|/ | | | | | | 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>
* Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-037-21/+0
|\ | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-177-21/+0
| | | | | | | | | | | | | | 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>
* | Merge branch 'for-next/fat-detection'Sascha Hauer2012-10-031-18/+19
|\ \
| * | fs/fat: Handle MBR on the first sectorFranck Jullien2012-09-201-18/+19
| |/ | | | | | | | | | | | | | | 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>
* | Merge branch 'for-next/driver'Sascha Hauer2012-10-031-0/+6
|\ \ | |/ |/|