| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently we do not support the UBIFS file encryption feature.
Nevertheless we can allow read clear files from UBIFS to be
able to boot an unencrypted kernel. This differs from the Kernel
behaviour, so add a globalvar to make that configurable.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This syncs the UBIFS code with Linux-4.19-rc6.
There are many functions in the Linux UBIFS codebase that we do not need
for a readonly implementation. These are missing here, but all removed
functions are annotated as such so it should be relatively easy to copy
a newer codebase over the current one and to see which functions shall
be removed from the newer version.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch aggressively removes stuff that we do not need in a readonly
implementation:
- write buffering support
- lpt/ltab code
- garbage collector
- everything under #ifndef __BAREBOX__
This decreases the binary size by about 5k on ARM, but the main reason
for doing this is the idea that things that are not there don't need to
be synced with upstream ubifs code.
The __BAREBOX__ ifdeffery makes the code very hard to read and is a
maintenance burden by itself, so it is removed here aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| | |
Implement clear_nlink and set_nlink and remove the private versions
from UBIFS.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| | |
Implement in fs core rather than using a private version in UBIFS.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| | |
To ease code porting from Linux
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| | |
Add mutex_lock_nested, mutex_unlock_nested and mutex_is_locked to
include/linux/mutex.h and remove them from UBIFS.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
We have kmemdup as a UBIFS specific variant, put it into the correct
header files. Instead of reimplementing it just use memdup we already
have.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Move stuff we already have in include/linux/barebox-wrapper.h that
really belongs to include/linux/slab.h to there. Also add kmem_cache_*
functions. UBIFS uses them in there own implementation, so we have to
remove it there.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
During sequential writes into single file, fs layer is consequently
calling ramfs_truncate() function. When file size grows
ramfs_truncate() takes more and more time to complete, due to
interations through all already written data chunks. As an example
loading ~450M image using usb fastboot protocol took over 500s to
complete.
Use ramfs_find_chunk() function to search for last chunk of data in
ramfs_truncate() implementation, which saves a lot of loop
iterations. As a result loading ~450M image using usb fastboot
protocol takes around 25s now.
Tested-by: Maciej Zagrabski <m.zagrabski@grinn-global.com>
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In ramfs_truncate() "newchunks" denotes the number of chunks we
want to have after the call. We decrease that number while iterating
over the existing chunks and decrease it further with every newly
allocated chunk until "newchunks" is zero.
This is a bit hard to read. Instead we drop the decreasing while
iterating over existing chunks and increase "oldchunks" while allocating
until it reaches "newchunks".
This is mainly done to make the next patch easier.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since the switch to dentry cache implementation we no longer allocate
the super block, so we must not free it in the error path.
Fixes: ("4d2b23bcf9 fs: ubifs: Switch to dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
stat() needs to set errno correctly when returning with an error.
Fixes: b3fbfad7ae ("fs: dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
| |
When the initial lookup fails in open we have to go to the error path
which sets errno correctly rather than returning directly.
Fixes: b3fbfad7ae ("fs: dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Since the switch to dentry cache implementation the memory is no
longer freed when a file in ramfs is deleted. Fix this.
Fixes: b283b72639 ("fs: ramfs: Switch to dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
The real r/w flags were lost in the switch to dentry cache
implementation. Restore them.
Fixes: 9137c41915 ("fs: devfs: Switch to dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this files in /dev/ appear as regular files. copy_file()
stumbles upon this as it tries a truncate() on that files which
then fails. Create the files as character devices so that copy_file()
works as expected.
Fixes: 9137c41915 ("fs: devfs: Switch to dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Giorgio Dal Molin <giorgio.nicole@arcor.de>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
- 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>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| | |
While at it implement symlink support.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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.c has some whitespaces where there should be tabs. Fix it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|