| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The VFS layer already increase the mount reference count for the mount
point. This means e.g. following sequence is well-behaving:
mkdir -p /mnt/disk0.0/media
mount -o loop backing.squashfs /mnt/disk0.0/media
umount /mnt/disk0.0
barebox will do the right thing and report
umount: Device or resource busy
However the reference count of the file where backing.squashfs comes
from is not incremented on mount with the effect that following sequence
crashes:
mkdir -p /media
mount -o loop /mnt/disk0.0/backing.squashfs /media
umount /mnt/disk0.0 # should've returned EBUSY
umount /media
Fix this by touching the backing store's mount reference count when
loop mounting and unmounting.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
ext4 redefines directory ACL to hold the most-significant 32-bit of the
inode size for regular files. For directories, it can either be ACL or,
when using largedir, the most-significant 32-bit of the directory size.
Adapt the code take these upper 32-bit into consideration for
determining regular file size. For directories, behavior remains
unchanged as we neither support ACLs nor >= 4G directories
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
While the block API now supports 64-bit LBAs, file systems like ext4
still use 31- and 32-bit integers at a couple of places. Fix them up.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
struct ext_filesystem is for in-memory bookkeeping but most of it is
unused by barebox and just takes up space. Drop the unused members.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| |
| |
| |
| |
| | |
part_offset is a left-over from the U-Boot port and unused anywhere.
Drop it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
| |
print_hex_dump in barebox always prints a hex dump. Most users use
it for debugging though, so import Linux helpers to do so to cut
down on the #ifdef DEBUG.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, we treat setenv(var, "") and setenv(var, NULL) the same
and delete var, which is surprising and leads to subtle quirks:
- setenv(var, "") is specified by POSIX to set var to an empty string,
but barebox uses it to delete variables
- nv.user= calls nv_set with NULL parameter, but nv user="" doesn't
Make the API more POSIX-like by providing unsetenv with the expected
semantics. Most user code can then use unsetenv without worrying about
whether "" or NULL is the magic deletion value.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
| |
In barebox copy_znode() doesn't make a copy of the znode, We are limited
to readonly support, so copy_znode() returns the original node.
tnc_delete() expects a znode to be dirty and has an assertion for this.
In a normal r/w implementation this is correct, but not in barebox, so
drop the assertion. Instead of removing it just comment it out to make
sure it won't be added again with the next ubifs kernel synchronisation.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Check more carefully for failing requests. This improves the error
message when trying to mount a non-exported nfs directory from:
nfs_mount_req: file handle too big: 44831
to
ERROR: NFS: Mounting failed: Permission denied
. This also fixes an out-of-bounds access as the filehandle size (44831
above) is read from just after the network packet in the error case.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
strerrorp() is only used along with printf. We now have a format
specifier for printing error pointers directly, so use that and
remove strerrorp.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| | |
BAREBOX_MAGICVAR now generates a unique identifier automatically,
so we can convert users of BAREBOX_MAGICVAR_NAMED to the simpler
BAREBOX_MAGICVAR macro.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
| |
barebox doesn't do extended attributes in SquashFS. Remove the left-over
xattr_id that's never read.
Reported-by: clang-analyzer-10
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Filesystem operations possibly call into arbitrary devices, so shouldn't
be used from a poller. This patch sprinkles some WARN_ONCE() when this
happens. One exception is when the file which is accessed is on ramfs
which doesn't have any dependencies to devices.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In case of the fs mounted to '/' the root dentry of the mounted
filesystem is the place where it's mounted itself, so sb->s_root
is the same as fsdev->vfsmount.mountpoint. In that case make
sure we only access it before it has been killed in
dentry_delete_subtree().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| | |
Calling dput() on the root dentry during unmount time is unnecessary,
the dentry will be removed later in dentry_delete_subtree() anyway.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The probe doesn't allocate the device, so remove shouldn't free it
either. This fixes a use-after-free on barebox shutdown:
Iterating over the list of devices requires that remove callbacks
don't remove the devices. This happened to work so far, because
apparently not much new allocations are going on during barebox
shutdown, but let's do it right.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use iget_locked() to let the core allocate the inode. This properly
initializes all fields in the new inode, especially it adds the new
inode to the list of all inodes for the filesystem. This prevents a NULL
pointer derefence when iput() removes the inode from that list.
This fixes squashfs support which is broken since 43902e5763 ("fs: free
inodes we no longer need")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| | |
With inode reference counting in place the core will free the root
inode, so do not free it in the squashfs code.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
| |
When calling squashfs_mount() s_op needs to be set already, otherwise
calling alloc_inode() yields in a NULL pointer derefence.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
When an inode only has a single chunk then we can support memmap for
it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changes the way ramfs stores its data. So far we used equally sized
chunks, this patch changes it to use chunks in a size that fits our
needs. The chunks are always allocated in the size they are needed for
the current truncation. Only if we fail to allocate all desired memory
at once we fall back to allocating smaller chunks. Together with using
the generic list implementation this results in smaller code and has
the advantage that many image files end up being contiguously in memory
and thus we can provide a memmap for them. Files will end up
contiguously in memory when they are first created, then truncated to
the final size and then filled up with data. This is something which
is normally easily achievable when desired.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| | |
When ramfs fails to allocate more memory then returning -ENOSPC is
more appropriate then -ENOMEM.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
So far we freed the no longer needed inodes only at unmount time.
Let's trust our reference counting a bit more and free them once
the reference counter hits zero.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| | |
Let iput() accept NULL pointers so that users do not have to test for
it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Several filesystems rely on the default function which frees
the struct inode * rather than the filesystem specific inode
which the inode is embedded in. This works because the inode
is the first element in the filesystem specific inode. Let's
not depend on this behaviour and for clarity add the destroy_inode
callbacks to all filesystems.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
| |
The AT91 BootROM loads a boot.bin file from the first FAT partition
into SRAM, when booting from MMC. To avoid the need for two barebox
configurations for each of the bootloader stages, add PBL support
for reading from FAT. This way each stage need only have a different
PBL entry point.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
nfs dentries may change underneath barebox, so do not maintain them in
the dcache.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
In rpc_check_reply() pkt is never NULL, drop the unnecessary patch.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
Add forgotten packet free in error path.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
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>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|