summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | Merge branch 'for-next/pstore'Sascha Hauer2019-04-096-131/+447
|\ \
| * | pstore: ramoops: allow zapping invalid buffers in read-only modePhilipp Zabel2019-03-182-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FS_PSTORE_RAMOOPS_RO configuration option keeps barebox from zapping (clearing and fixing header ecc) all ramoops buffers on initialization. It also stops barebox from zapping invalid buffers. This causes issues when the console writing code tries to use the uninitialized, invalid console buffer. Therefore, allow barebox to zap invalid buffers, the kernel will do so anyway if it finds broken buffers during its initialization. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore: pass ramoops configuration to kernel via device treePhilipp Zabel2019-03-181-18/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of setting ramoops module parameters on the kernel command line, add a /reserved-memory/ramoops node to the device tree via of_fixup. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Documentation-added-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore: Replace arguments for write() APIKees Cook2019-03-181-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the pstore_info read() callback, there were too many arguments. This switches to the new struct pstore_record pointer instead. This adds "reason" and "part" to the record structure as well. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore: Replace arguments for read() APIKees Cook2019-03-182-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | The argument list for the pstore_read() interface is unwieldy. This changes passes the new struct pstore_record instead. The erst backend was already doing something similar internally. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore: Switch pstore_mkfile to pass recordKees Cook2019-03-183-29/+26
| | | | | | | | | | | | | | | | | | | | | Instead of the long list of arguments, just pass the new record struct. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore: add console supportPhilipp Zabel2019-03-182-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | Add support for writing console messages to pstore. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Documentation-added-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore: Extract common arguments into structureKees Cook2019-03-181-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The read/mkfile pair pass the same arguments and should be cleared between calls. Move to a structure and wipe it after every loop. Signed-off-by: Kees Cook <keescook@chromium.org> [p.zabel@pengutronix.de: ported to Barebox from Linux commit 9abdcccc3d5f] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore/ram: Clarify resource reservation labelsKees Cook2019-03-182-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ramoops reserved a memory region in the kernel, it had an unhelpful label of "persistent ram". When reading iomem, it would be repeated many times, did not hint that it was ramoops in particular, and didn't clarify very much about what each was used for: 0x4fdd4000 - 0x4fdf3fff (size 0x00020000) persistent ram 0x4fdf4000 - 0x4fe13fff (size 0x00020000) persistent ram ... 0x4ff74000 - 0x4ff93fff (size 0x00020000) persistent ram 0x4ff94000 - 0x4ffb3fff (size 0x00020000) persistent ram 0x4ffb4000 - 0x4ffd3fff (size 0x00020000) persistent ram Instead, this adds meaningful labels for how the various regions are being used: 0x4fdd4000 - 0x4fdf3fff (size 0x00020000) ramoops:dump(0/12) 0x4fdf4000 - 0x4fe13fff (size 0x00020000) ramoops:dump(1/12) ... 0x4ff74000 - 0x4ff93fff (size 0x00020000) ramoops:console 0x4ff94000 - 0x4ffb3fff (size 0x00020000) ramoops:ftrace 0x4ffb4000 - 0x4ffd3fff (size 0x00020000) ramoops:pmsg Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> [p.zabel@pengutronix.de: ported to Barebox from Linux commit 1227daa43bce] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore: improve error report for failed setupKees Cook2019-03-181-17/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When setting ramoops record sizes, sometimes it's not clear which parameters contributed to the allocation failure. This adds a per-zone name and expands the failure reports. Signed-off-by: Kees Cook <keescook@chromium.org> [p.zabel@pengutronix.de: ported to Barebox from Linux commit c443a5f3f1f1] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore/ram: Do not use stack VLA for parity workspaceKees Cook2019-03-181-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using a stack VLA for the parity workspace, preallocate a memory region. The preallocation is done to keep from needing to perform allocations during crash dump writing, etc. This also fixes a missed release of librs on free. Signed-off-by: Kees Cook <keescook@chromium.org> [p.zabel@pengutronix.de: ported to Barebox from Linux commit f2531f1976d9] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore: Make ramoops_init_przs generic for other prz arraysKees Cook2019-03-181-28/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently ramoops_init_przs() is hard wired only for panic dump zone array. In preparation for the ftrace zone array (one zone per-cpu) and pmsg zone array, make the function more generic to be able to handle this case. Heavily based on similar work from Joel Fernandes. Signed-off-by: Kees Cook <keescook@chromium.org> [p.zabel@pengutronix.de: ported to Barebox from Linux commit de83209249d6] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ramoops: use DT reserved-memory bindingsKees Cook2019-03-181-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of a ramoops-specific node, use a child node of /reserved-memory. This requires that of_platform_device_create() be explicitly called for the node, though, since "/reserved-memory" does not have its own "compatible" property. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Rob Herring <robh@kernel.org> [p.zabel@pengutronix.de: ported to Barebox from Linux commit 529182e204db] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pstore/ram: add Device Tree bindingsGreg Hackmann2019-03-181-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ramoops is one of the remaining places where ARM vendors still rely on board-specific shims. Device Tree lets us replace those shims with generic code. These bindings mirror the ramoops module parameters, with two small differences: (1) dump_oops becomes an optional "no-dump-oops" property, since ramoops sets dump_oops=1 by default. (2) mem_type=1 becomes the more self-explanatory "unbuffered" property. Signed-off-by: Greg Hackmann <ghackmann@google.com> [fixed platform_get_drvdata() crash, thanks to Brian Norris] [switched from u64 to u32 to simplify code, various whitespace fixes] [use dev_of_node() to gain code-elimination for CONFIG_OF=n] Signed-off-by: Kees Cook <keescook@chromium.org> [p.zabel@pengutronix.de: ported to Barebox from Linux commit 35da60941e44] Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ramoops: probe from device tree if OFTREE is enabledPhilipp Zabel2019-03-181-4/+32
| |/ | | | | | | | | | | | | | | | | | | Switch to a device driver probed from device tree if CONFIG_OFTREE is enabled. Also switch from postcore_initcall to device_initcall, to make sure that memory banks have been initialized before request_sdram_region is called. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-04-092-15/+7
|\ \
| * | treewide: surround Kconfig file paths with double quotesMasahiro Yamada2019-03-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Based on Linux commit 8636a1f9677db4f883f29a072f401303acfc2edd This will be needed when you sync Kconfig with Linux 5.0 or later. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: ramfs: Drop unnecessary check in ramfs_mknod()Andrey Smirnov2019-03-131-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | There's already an early exit statement triggered by "inode" being NULL. Drop an extra check that will always be true. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: ramfs: Drop unused 'chunks' conterAndrey Smirnov2019-03-131-4/+0
| | | | | | | | | | | | | | | | | | | | | This variable doesn't appear to be used anywhere in the code. Drop it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: ramfs: Drop unused 'handle' filed from struct ramfs_inodeAndrey Smirnov2019-03-131-2/+0
| |/ | | | | | | | | | | | | There are no users of this field in the code. Drop it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / bpkfs: Fix lseek error check in bpkfs_probe()Andrey Smirnov2019-03-111-2/+2
|/ | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-03-074-91/+1
|\
| * fs: ubifs: Remove unused crc16 functionsSascha Hauer2019-03-044-91/+1
| | | | | | | | | | | | | | | | The crc16 functions in ubifs are unused, so remove them. (They were only used in the LPT functions which are completely removed for the barebox readonly implementation) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/fs'Sascha Hauer2019-03-073-69/+32
|\ \
| * | fs: Simplify fd to FILE lookup codeAndrey Smirnov2019-02-271-53/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid a bit of repeating code by merging checking fd for correctness and fd to FILE lookup into a single routine and converting the rest of the code to use it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: Drop unused code in fstat()Andrey Smirnov2019-02-271-3/+0
| | | | | | | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: Make use of cdev_flush()Andrey Smirnov2019-02-271-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | Drop extra checks and explicit indirect call in devfs_flush() in favour of using cdev_flush(), since it already does all of the above. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: Make use of cdev_erase()Andrey Smirnov2019-02-271-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | Drop extra checks and explicit indirect call in devfs_erase() in favour of using cdev_erase(), since it already does all of the above. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: ramfs: Drop needless OOM checkAndrey Smirnov2019-02-271-2/+0
| | | | | | | | | | | | | | | | | | | | | Drop needless OOM check since xzalloc() will never return NULL. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: Drop needless OOM checkAndrey Smirnov2019-02-271-3/+0
| |/ | | | | | | | | | | | | Drop needless OOM check since xzalloc() will never return NULL. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / efi: cleanupsOleksij Rempel2019-02-182-2/+2
|/ | | | | | | make local functions static and remove unused code Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>