summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/misc'Sascha Hauer2020-05-1410-30/+0
|\
| * treewide: remove references to CREDITSUwe Kleine-König2020-04-2710-30/+0
| | | | | | | | | | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Fix inode size setting in ftruncateSascha Hauer2020-05-051-0/+1
|/ | | | | | | When changing a file size the size of the corresponding inode has to be changed as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nfs: Do not allow to abortSascha Hauer2020-03-301-3/+0
| | | | | | | | | | | | | | When ctrl-c is pressed then ctrlc() will return true until ctrlc_handled() is called. This means that once ctrl-c is pressed every NFS operation will fail until the upper layer calls ctrlc_handled(). When for example we are doing a 'ls -l' on an NFS directory then after a ctrl-c press not the 'ls -l' aborts, but instead the retrieving of the directory entries which is not what we want. Simply do not call ctrlc() in the fs layer. the NFS timeout is 2 seconds which we have to wait until we have a chance to abort. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: nfs: don't maintain nfs dentries in dcacheSascha Hauer2020-03-301-0/+1
| | | | | | | nfs dentries may change underneath barebox, so do not maintain them in the dcache. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nfs: queue received packetsSascha Hauer2020-03-301-23/+29
| | | | | | | | | It may happen that we receive more than one RPC packet before we come along to check the result. Instead of handling just a single received packet and possibly overwriting the last one queue the received RPC packets. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nfs: Fix polling for packetsSascha Hauer2020-03-301-2/+5
| | | | | | | | | It can happen that the first packet we receive is not the desired one. In this case we have to poll for further packets. set nfs_state back to STATE_START before polling for more packets, otherwise we check the same packet again and again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nfs: Fix rpc_check_reply() return value for stale packetsSascha Hauer2020-03-301-7/+2
| | | | | | | | | | | When we receive a packet with the previous rpc_id then we have the comment "stale packet, wait a bit longer", but that's not what the code does. rpc_check_reply() returns 0 in this case and the caller then interprets the packet as valid. Always return -EAGAIN for invalid rpc_ids. This lets the caller ignore the packets as intented. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nfs: remove unnecessary checkSascha Hauer2020-03-301-3/+0
| | | | | | In rpc_check_reply() pkt is never NULL, drop the unnecessary patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nfs: Add missing freeSascha Hauer2020-03-301-0/+1
| | | | | | Add forgotten packet free in error path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nfs: Add function to free packetsSascha Hauer2020-03-301-11/+16
| | | | | | | | Add to function to free packets rather than freeing them directly. We will introduce received packet qeueuing with one of the next patches, this patch is meant to make it better readable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/block'Sascha Hauer2020-03-182-0/+46
|\
| * cdev: Add discard_range hookSascha Hauer2020-02-141-0/+21
| | | | | | | | | | | | | | To pass though discard_range() to the underlying drivers add a discard_range hook to struct cdev_operations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: Introduce discard_range()Sascha Hauer2020-02-141-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | discard_range() is a way to tell the lower layers that we are no longer interested in a data range of a file, so that the lower layers can discard the underlying data if desired. This is mainly designed to bypass the deficiencies of our block layer. We cache the block data in chunks of multiple KiB (16 currently) if we fall into the block layer with write requests smaller than that we have to read/modify/write a chunk. With the help of discard_range() code writing files to a raw block device can now discard the range the file will be written to. The block layer then no longer has to read the chunks first that are inside the discard range. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: jffs2: add initial support for reading jffs2Steffen Trumtrar2020-02-1028-0/+8459
|/ | | | | | | | | | | | | | | | | | | | | Import the jffs2 filesystem code from Linux v5.5-rc1 and convert it to work with barebox. Writing is *not* supported. Testing was done with a n25q256a-compatible QuadSPI chip on a SoCFPGA-based Socrates board. Testing was done with a combination of: user@somelinuxhost: mkfs.jffs2 --eraseblock=4 -d fs/jffs2/ -o jffs2.img root@target:~ flash_erase -j /dev/mtd5 0 0 root@target:~ dd if=jffs2.img of=/dev/mtd5 barebox@EBV SOCrates:/ mount /dev/mtd0.data (...) mounted /dev/mtd0.data on /mnt/mtd0.data Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pstore: ramoops: use correct format specifier for size_t variablesLucas Stach2019-12-021-4/+4
| | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pstore: don't try to grab non-existent logbufLucas Stach2019-12-021-0/+3
| | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pstore: remove unused goto labelAhmad Fatoum2019-11-271-1/+0
| | | | | | | Previous refactoring removed jumps to fail_clear. Remove it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pstore: fix build by re-resolving botched merge conflictAhmad Fatoum2019-11-271-29/+0
| | | | | | | | | | | | | | | 297ac7288 ("pstore: Only capture log messages") removed the pstore console. v3 of the eventually merged 75a74b5c ("console: fix out-of-bounds read in dputc(/dev/*, ...)") reinstated part of this code, which broke the pstore build because the now removed bufsize member had a user reintroduced in the patch. Fix this by reverting the offending patch's changes to the pstore code. It wasn't applicable to begin with. Fixes: 75a74b5c ("console: fix out-of-bounds read in dputc(/dev/*, ...)") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-11-072-2/+2
|\
| * fs: ubootvarfs: use correct format specifier for pointer diffLucas Stach2019-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The difference between two pointers is represented as a ptrdiff_t, use the correct format specifier when printing to get rid of the following warning in a 64bit build: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long int' [-Wformat=] Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: devfs-core: do a case-insensitive compare of partuuidsAhmad Fatoum2019-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | partuuids are represented as hexadecimal strings, where case doesn't matter. barebox formats them as lower case internally, forcing the partuuid device tree property to be lower case too. Use strcasecmp to be case-insensitive. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/ext4'Sascha Hauer2019-11-072-70/+23
|\ \
| * | fs: ext4: return NULL instead of 0Sascha Hauer2019-10-291-2/+2
| | | | | | | | | | | | | | | | | | | | | ext4fs_get_extent_block() returns a pointer, so return NULL instead of integer 0. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: ext4: Fix handling of sparse filesSascha Hauer2019-10-291-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adoption of U-Boot commit: | commit f81db56f2fd6dc16efeaec2961121244765a1f11 | Author: Stefan Brüns <stefan.bruens@rwth-aachen.de> | Date: Sat Nov 5 22:17:14 2016 +0100 | | ext4: Fix handling of sparse files | | A sparse file may have regions not mapped by any extents, at the start | or at the end of the file, or anywhere between, thus not finding a | matching extent region is never an error. | | Found by python filesystem tests. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: ext4: remove unnecessarily clever file readSascha Hauer2019-10-291-53/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | ext4fs_read_file() tries to tries to bundle contiguous block reads into longer reads from the device. In barebox we cache in the block layer already, so this is unnecessary. Simplify the code by removing the bundled reads. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: ext4: Fix out of bounds memsetSascha Hauer2019-10-291-1/+1
| |/ | | | | | | | | | | | | | | | | When a block we read is a sparse block, we memset the corresponding output buffer to zero. If that block is the last block we read, we may not memset the whole block, but only up to the length of the output buffer, which may be shorter than a full block. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / efi: use efi_guidcmp helper where appropriateAhmad Fatoum2019-10-181-1/+1
|/ | | | | | | We have a helper for it. Let's use it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs-core: have device_find_partition search symlinksAhmad Fatoum2019-10-151-0/+21
| | | | | | | | | | | | | | | | | The barebox,environment binding documentation notes following for the device-path property's second string: > <partname> can be the label for MTD partitions, the number for DOS > partitions (beginning with 0) or the name for GPT partitions. This doesn't work currently because the named partitions are realized as symlinks and those aren't searched by device_find_partition. Fix this by having symlinks feature an appropriate partname if the cdev they link at has one and then have device_find_partition search those as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* chdir(): add LOOKUP_DIRECTORY flag to filename_lookup()Robert Karszniewicz2019-10-141-1/+1
| | | | | | | | This makes sure that automount points get handled even if the path doesn't end with a '/'. Signed-off-by: Robert Karszniewicz <r.karszniewicz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* trivial: fix typo lenght -> lengthUwe Kleine-König2019-10-141-1/+1
| | | | | | | | | | | | Generated by perl -p -i -e 's/lenghte?/length/' arch/arm/boards/chumby_falconwing/falconwing.c arch/arm/mach-samsung/mem-s3c64xx.c fs/ext4/ext_common.h lib/gui/lodepng.c include/jtag.h There is another instance in dts/Bindings/usb/s3c2410-usb.txt, this is fixed in Linux v5.3-rc1 so supposed to be fixed soon in barebox, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/tftp'Sascha Hauer2019-09-122-1/+10
|\
| * fs: tftp: don't maintain tftp dentries in dcacheAhmad Fatoum2019-08-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Currently a negative dentry is cached whenever a non-existing file was looked up over TFTP. Short of a barebox reset, there is no way to invalidate that dentry, so barebox retries the look up. Fix this by always reporting TFTP dentries as invalid in the d_revalidate callback. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: provide no_revalidate_d_ops for network file systemsAhmad Fatoum2019-08-231-0/+9
| | | | | | | | | | | | | | | | | | Networked file systems may wish to forego dentry caching altogether, so every lookup goes over the network and stale data is avoided. Provide a no_revalidate_d_ops helper object that does this. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: tftp: remove duplicate headerAhmad Fatoum2019-08-231-1/+0
| | | | | | | | | | | | | | <fs.h> is included again a few lines prior. Delete it here. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-09-123-42/+30
|\ \
| * | console: fix out-of-bounds read in dputc(/dev/*, ...)Ahmad Fatoum2019-09-021-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to output a single character via echo -a /dev/serial0-1 currently results in garbage output after the newline, because console.c's fops_write discards the buffer length and passes the buffer to (struct cdev)::puts which only handles NUL-terminated strings. Fix this by amending (struct cdev)::puts with a new nbytes parameter, which is correctly propagated. All this functions now return at most the nbytes parameter they were passed in. This fixes __console_puts, which used to count new lines twice in its return value. Fixes: b4f55fcf35 ("console: expose consoles in devfs") Cc: Bastian Krause <bst@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: omap4_usbbootfs: remove commented out codeAhmad Fatoum2019-08-301-41/+0
| | | | | | | | | | | | | | | | | | | | | | | | The code has been sitting commented out in version control for close to 7 years now, drop it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: fat: fix use of wrong enumeration typeAhmad Fatoum2019-08-301-1/+1
| |/ | | | | | | | | | | | | | | disk_read returns a DRESULT, not enum filetype. Change the return value appropriately. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / fs: nfs: Fix possible buffer overflowSascha Hauer2019-09-021-0/+4
|/ | | | | | | | nfs_readlink_req() interprets a 32bit value directly received from the network as length argument to memcpy() without any boundary checking. Clamp the copy size at the end of the incoming packet. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pstore'Sascha Hauer2019-07-122-86/+24
|\
| * pstore: remove unused codeSascha Hauer2019-07-092-27/+0
| | | | | | | | | | | | pstore_info->write() is unused, remove the code implementing it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * pstore: Only capture log messagesSascha Hauer2019-07-091-60/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | With this pstore only captures barebox log messages printed with pr_* and dev_*, but no longer anything printed with printf and friends. When capturing the barebox output with pstore only the log messages are of interest, but not the ones printed with printf and certainly not the things typed interactively on the command line. These are logged currently because we register pstore as a barebox console. Instead, hook into pr_puts which only outputs the barebox log messages. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Add a driver to access U-Boot environment variablesAndrey Smirnov2019-06-073-0/+508
|/ | | | | | | | | Add a driver working on top of ubootvar device and exposing U-Boot environment variable data as files. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Cory Tusar <cory.tusar@zii.aero> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubifs'Sascha Hauer2019-05-1012-75/+580
|\
| * fs: ubifs: Add authentication supportSascha Hauer2019-04-2412-75/+580
| | | | | | | | | | | | | | | | | | | | | | | | This adds UBIFS authentication support. For now, we do not do any authentication even on authenticated UBIFS images. Since this behaviour is not what the user normally expects when mounting authenticated images we only do this when the user explicitly allows it in "global.ubifs.allow_authenticated_unauthenticated". If the flag is false then we refuse mounting such an image and return -EPERM instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: nfs: ensure rpc_req message is sendMarco Felsch2019-04-291-0/+11
|/ | | | | | | | | | | | | | Currently we send a rpc message without checking if the send was succesful and poll for a answer from the server. If the server didn't answer within the NFS_TIMEOUT window we send the package again. In case the package send wasn't successful we always run in that timeout. This gets even worse if the package send fails more than one time. Check if the package send was successful and resend the package if it wasn't to fix this behaviour. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/warnings'Sascha Hauer2019-04-093-110/+2
|\
| * fs: squashfs: Remove unused functionSascha Hauer2019-03-181-108/+0
| | | | | | | | | | | | squashfs_lookup_next() isn't used in the tree. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: Make locally used functions staticSascha Hauer2019-03-182-2/+2
| | | | | | | | | | | | | | Many functions are only used locally but still are globally visible. Make these function static. Avoids warnings generated with -Wmissing-prototypes Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>