summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* fs: tftp: Use pr_debug for errorsSascha Hauer2018-09-101-1/+1
| | | | | | | This has been debug output before for good reasons. The users will usually print the error messages when they want to. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: improve file size handlingSascha Hauer2018-08-301-2/+8
| | | | | | | | Previously we used FILE_SIZE_STREAM unconditionally. Instead, fill the inode size with a valid filesize if we have one and only if not fall back to FILE_SIZE_STREAM. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: hide files which are actually not present on the serverSascha Hauer2018-08-301-8/+25
| | | | | | | | | | In tftp_lookup we claimed that every desired file is there. This leads to problems when a user only tests if a file is present and makes decisions upon this information. Rather than claiming that all files are present do a tftp_do_open() on the files and see if it is really there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: fix return valueSascha Hauer2018-08-301-1/+1
| | | | | | | | When tftp_get_inode() fails it is a sign for a out of memory situtation rather than an indicator for no space left on the filesystem, so return -ENOMEM. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: fix memory holeSascha Hauer2018-08-301-10/+7
| | | | | | | dpath() returns a pointer to an allocated string, so we have to free it. Put the pointer into our file private data and free it on close time. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: tftp: overhaul debuggingSascha Hauer2018-08-301-10/+25
| | | | | | | | | - use pr_* instead of debug() - use pr_vdebug for the less interesting messages - use pr_err for error messages - print state as clear text and not as number Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/memcmds'Sascha Hauer2018-08-131-1/+1
|\
| * fs: ramfs: get chunks zero initializedSascha Hauer2018-08-101-1/+1
| | | | | | | | | | | | | | Initialize new chunks to zero, otherwise a ->truncate call may result in uninitialized data in files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: squashfs: Switch to dentry cache implementationSascha Hauer2018-07-139-177/+365
| | | | | | | | | | | | While at it implement symlink support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: cramfs: Switch to dentry cache implementationSascha Hauer2018-07-132-251/+273
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: tftp: Switch to dentry cache implementationSascha Hauer2018-07-132-43/+55
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: nfs: Switch to dentry cache implementationSascha Hauer2018-07-132-309/+234
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: ubifs: Switch to dentry cache implementationSascha Hauer2018-07-136-484/+313
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: ext4: Switch to dentry cache implementationSascha Hauer2018-07-113-123/+160
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: devfs: Switch to dentry cache implementationSascha Hauer2018-07-112-66/+85
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: ramfs: Switch to dentry cache implementationSascha Hauer2018-07-112-303/+99
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: dentry cache implementationSascha Hauer2018-07-1111-1005/+2635
|/ | | | | | | | | | | | | | | | | | | | | | | This adds the Linux dentry cache implementation to barebox. Until now every filesystem driver resolves the full path to a file for itself. This leads to code duplication and is error prone since resolving paths is a complicated task. Also it can narrow down the lookup performance since barebox only knows ASCII paths and has no way of caching lookups. With this patch we get the Linux dcache implementation. The path resolving code from fs/namei.c is nearly taken as-is, minus the RCU and locking code. Dcaching is made simple as of now: We simply cache everything and never release any dentries. Although we do reference counting for inodes and dentries it is effectively not used yet. We never free anything until a fs is unmounted in which case we free everything no matter if references are taken or not. This patch also contains a wrapper in fs/legacy.c to support filesystems with the old API. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs-core: Make use of devpath_to_name()Andrey Smirnov2018-06-251-4/+2
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: fix memory access via /dev/mem for MIPS64Peter Mamonov2018-06-141-2/+2
| | | | | | | | lseek checks for non-negative in-memory offsets (addresses), failing otherwise. However negative address 0xffffffffXXXXXXXX is a valid MIPS64 virtual address. Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Fix finding correct directory for mkdir/rmdirSascha Hauer2018-04-061-2/+2
| | | | | | | When there are links in the path mkdir/rmdir are called with then canonicalize_path is needed which resolves the links. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Cleanup whitespace damageSascha Hauer2018-04-061-13/+13
| | | | | | fs.c has some whitespaces where there should be tabs. Fix it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Move mem_write/mem_read to devfs-coreSascha Hauer2018-04-062-66/+68
| | | | | | | fs.c is already heavily filled with code. Move mem_write/mem_read to devfs-core where it fits better. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Add super_operationsSascha Hauer2018-04-062-39/+0
| | | | | | | | Add a struct super_operations we can use later when we get a fs implementation closer to Linux. Only add the functions we'll likely need though. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubifs: remove dead codeSascha Hauer2018-04-061-475/+0
| | | | | | | Remove code that was added to UBIFS for U-Boot but that is not needed for barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubifs: Remove Linux struct definitions we already haveSascha Hauer2018-04-061-317/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubifs: remove dead codeSascha Hauer2018-04-061-187/+0
| | | | | | | Remove stuff that was added to UBIFS for U-Boot which we do not need because we already have it in the Linux header files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename file_operations -> cdev_operationsSascha Hauer2018-04-061-1/+1
| | | | | | | | Linux also has struct file_operations which are something different. Rename our file_operations to cdev_operations which better matches what we have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: check pointer returned by get_fsdevice_by_path before dereferencingGaël PORTAY2018-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In __canonicalize_path() we dereference the pointer returned by get_fsdevice_by_path() without checking if the pointer is NULL or not. When the pointer is NULL it leads to an Ooops. Ooops, address error on load or ifetch! $ 0 : 00000000 00000001 a0000026 a0811c10 $ 4 : a0402e60 a0402e48 a0811c00 a0402e58 $ 8 : 00000001 00000000 0000005a 00000023 $12 : 00000000 00000002 00601021 00000000 $16 : a0402e60 a0402e50 a0402e39 a0810000 $20 : a0402e38 a0811420 a0811424 00000000 $24 : 00000000 a080de10 $28 : 87f87d40 a03ffa68 a0810000 a080ce30 Hi : 00000002 Lo : 00000000 epc : a080ce34 ra : a080ce30 Status: 00000006 Cause : 40008010 Config: 80040483 ### ERROR ### Please RESET the board ### Fixes: d79a81736 fs: Don't bother filesystems without link support with additional stat() calls Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ratp: allow building without full console supportAleksander Morgado2018-03-011-1/+1
| | | | | | | | | | | | | Make CONFIG_RATP a selectable config option, so that the user can enable RATP support without explicitly needing to enable the full console support over RATP (e.g. only for RATP FS or built-in command support). The full console can still be explicitly enabled with CONFIG_CONSOLE_RATP. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/zstd'Sascha Hauer2018-02-086-0/+169
|\
| * squashfs: Add zstd supportPhilipp Zabel2018-02-056-0/+169
| | | | | | | | | | | | | | | | | | | | Based on kernel commit 87bf54bb43dd ("squashfs: Add zstd support"). Creating zstd compressed squashfs images is supported by squashfs-tools newer than commit e38956b92f73 ("squashfs-tools: Add zstd support"). Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/tftp-workaround'Sascha Hauer2018-02-082-24/+35
|\ \
| * | fs/uimagefs: Use is_tftp_fs() and cache_file() to ease TFTP workaroundSascha Hauer2018-01-251-24/+13
| | | | | | | | | | | | | | | | | | | | | We have helper functions now to ease file caching when a file is on TFTP. Use them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: implement is_tftp_fs()Sascha Hauer2018-01-251-0/+22
| |/ | | | | | | | | | | | | | | | | | | Some commands need files in which they can lseek backwards which is particularly not possible on TFTP. Instead of hiding this behind can_lseek_backward() create a function for it which tests if the file is on TFTP directly rather than using different lseek operations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | pstore: lower message prioritySascha Hauer2018-02-061-1/+1
| | | | | | | | | | | | | | | | Having no valid data in pstore after a coldstart is pretty much expected, so do not print a scary error message, but a debug message instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: add support loop mount offsetPhilipp Zabel2018-02-052-7/+13
| | | | | | | | | | | | | | | | When loop mounting, allow to specify an offset into the file, similarly to the losetup offset option. Multiplicative suffixes are supported. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: Fix memory leak in mount()Sascha Hauer2018-01-261-0/+2
|/ | | | | | | | "path" is allocated by normalise_path() and thus must be freed. This was done in the error path, but not in the success path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-01-225-67/+3
|\
| * move parseopt to lib/Antony Pavlov2018-01-175-67/+3
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fs: implement ftruncateSascha Hauer2018-01-101-0/+22
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: fix: add can_lseek_backward and use in uimage_openMichael Grzeschik2017-11-101-2/+2
| | | | | | | | | | Since commit ce0cc7fe we support forward seek on tftpfs. This feature breaks the condition to check rather we open an uimage over tftp. Since backward seeking is the problem here, we add the function can_lseek_backward and check for it instead of the simple lseek. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove checks for xzalloc() returning NULLUwe Kleine-König2017-09-262-4/+0
| | | | | | | xzalloc() either returns memory or panics, so checking for NULL is useless. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* efi: make sure efi-fs is started in the right orderMichael Olbrich2017-09-081-1/+1
| | | | | | | | | with this parch, EFI System partition will be mounted to /boot instead of /mnt/diskXX. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: Don't bother filesystems without link support with additional stat() callsSascha Hauer2017-09-061-0/+10
| | | | | | | | | | | | | In __canonicalize_path() we only call stat() to know if the path is a link or not. When the filesystem doesn't support links we already know that it's not a link, so we do not need to call stat(). This helps the tftp filesystem since the parent directories of a file to be opened won't be stat()ed anymore, something tftp does not support. Fixes: a602bebc fs: Implement links to directories Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: avoid pathes with '//' in __canonicalize_path()Sascha Hauer2017-09-061-2/+7
| | | | | | | | | In __canonicalize_path pathes beginning with '//' can occur. This is normally not a problem since normalize_path() will clean this up, but it means we cannot call get_fsdevice_by_path() on these pathes in this function, as needed in the next patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs-core: add function to find cdev by partuuidSteffen Trumtrar2017-07-101-0/+14
| | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* fs: efi: return with correct error code in efifs_statSteffen Trumtrar2017-07-101-3/+1
| | | | | | | | Instead of erroring out when a file is not present, just return ENOENT if the file does not exist and let the fs-layer handle the situation correctly. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* fs: Make locally used function canonicalize_dir() staticSascha Hauer2017-06-271-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-06-144-4/+151
|\
| * fs: add cdev_create_loop and cdev_remove_loop for loop mount optionPhilipp Zabel2017-06-063-6/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to create a loopback cdev from a file. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Fixed up with: fs: Makefile: Add parseopt to all builds parseopt.h was included to fs.c with commit 9248b, but parseopt.o has a dependency to CONFIG_FS_NFS. Moved parseopt.o to the default build to eliminate build failures. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>