| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
That function never modifies these strings so it can/should use consts.
It makes it a bit more flexible as now callers can also pass consts.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
(cherry picked from commit 3782b59e8f6391134cf146033ebe3baa1fbc0f5a)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit cc63723d886fd ("overlay: use lstat rather than stat and make sure
there are no trailing spaces") changed behavior of foreachdir() breaking
some callbacks. Before that modification all callbacks were getting
directory with a trailing slash. Above commit started removing them.
This broke handle_whiteout() which doesn't work at all since then. It
constructs file paths incorrectly: slash is missing between directory
and a file name. It seems noone noticed it for years because this issue
got hidden by switch2jffs() which also handles whiteouts with its system
command "cp -a" call.
Fix that regression by setting trailing slash back - right after calling
lstat(). Also to keep code simple just skip all entries that aren't
directories. This keeps conditions for removing/setting trailing slash
trivial. A side effect is not calling callbacks for files which is a
free bonus optimization.
Fixes: cc63723d886fd ("overlay: use lstat rather than stat and make sure there are no trailing spaces")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
(cherry picked from commit 79721f0376974859f39699a2237dbfa691233523)
|
|
|
|
|
|
|
|
| |
Alloc globdir buffer dynamically and simply use realloc when needed.
This fixes e.g. segmentation fault in jffs2reset due to an infinite
recurrency when dealing with longs paths.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
|
|
|
|
|
|
| |
compare strlen()+1 characters to make sure we match the trailing \0 as
well. Otherwise things get fishy when using lvm2, see this example:
/dev/mapper/data: UUID="xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx" MOUNT="/mnt" TYPE="LVM2_member"
/dev/mapper/data-fs: UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" LABEL="xxxxxxxx" VERSION="1.0" MOUNT="/mnt" TYPE="ext4"
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
Fixes build error with older gcc
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes e.g. factory-flashed startup issue with jffs2 on ubi overlay
Commit ba019965 ("libfstools: accept volume as argument in most calls")
broke startup for factory-flashed jffs2 on ubi systems, causing substantial
slowdown in factory environments.
When starting up with a factory-flashed jffs2 on ubi system, the "rootfs_data"
volume contains a deadcode marker. In the start phase, mount_root then mounts a
tmpfs overlay, and postpones remounting of the jffs2 overlay until the done
phase of the startup.
The refactoring in ba019965 eliminated an unneeded call to volume_find() when
done() called jffs2_switch(). Unfortunately the refactoring did not take into
account that volume_identify() does not function correctly when called twice in
a row on the same struct volume when using an mtd driver.
mtd_volume_identify() uses mtd_volume_load() to open an fd to the mtd device
and reads a potential deadcode marker from the fd. The first time this works,
and FS_DEADCODE is returned.
When volume_identify() is called a second time however, mtd_volume_load()
notices that we already have an open fd, does nothing further and returns 0
without resetting the file offset to 0. mtd_volume_identify() now reads past
the deadcode marker and now returns FS_JFFS2 if the mtd device is a UBIVOLUME.
jffs2_switch() then handles the wrong case, either pulling the root out from
under user-space in Chaos Calmer, or indefinitely sticking to a tmpfs overlay
in later OpenWRT builds.
Signed-off-by: Pieter Smith <pieter.smith@philips.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
|
|
|
| |
Reduce noise during firstboot when creating overlay fs on block
rootdisk devices.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
| |
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
|
| |
On glibc 2.25, sys/sysmacros.h needs to be included for makedev, major
and minor.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libfstools/rootdisk.c: In function 'rootdisk_volume_identify':
libfstools/rootdisk.c:172:7: error: ignoring return value of 'fread', declared with attribute warn_unused_result [-Werror=unused-result]
fread(&magic, sizeof(magic), 1, f);
^
libfstools/rootdisk.c:179:7: error: ignoring return value of 'fread', declared with attribute warn_unused_result [-Werror=unused-result]
fread(&magic, sizeof(magic), 1, f);
^
libfstools/rootdisk.c: In function 'rootdisk_volume_init':
libfstools/rootdisk.c:268:9: error: ignoring return value of 'system', declared with attribute warn_unused_result [-Werror=unused-result]
system(str);
^
cc1: all warnings being treated as errors
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
|
|
|
|
|
|
| |
added code to block so it can recognize and operate the filesystem checker of f2fs
added f2fs to the filesystem whitelist of block so it can mount it on
/overlay at boot.
Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it>
|
|
|
|
|
|
|
|
|
|
| |
If the mount(2) syscall fails with ENOENT, attempt to mount the filesystem
using an external "/sbin/mount.$fstype" command.
This allows filesystems which do not have direct kernel support, like fuse-
or network filesystems.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
|
|
| |
The current block code wrongly reported the return value of the mount() and
umount2() syscalls, which is always -1 in case the call failed.
Use errno and strerror(errno) instead to propagate the correct error code to
the user.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
| |
The "name" member of struct blkid_struct_probe is not used anywhere anymore
so remove it from the definition to save some stack and heap space.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
|
| |
In the full liblkid there is no tag called "NAME" and the name value reported
by libblkid-tiny was just the kind of uuid passed to blkid_probe_set_uuid_as().
Strip any handling of this property to allow removing it from libblkid-tiny.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
|
|
|
| |
There is no concept of a "NAME" property within libblkid, the value previously
used was the name parameter of blkid_probe_set_uuid_as() which does not denote
the file system name, but the kind of UUID to store.
Since the value never makes sense, stop using it when reporting block
information.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
|
|
|
| |
When blkid_probe_set_uuid_as() is invoked with a non-NULL name parameter
then the name parameter denotes the kind of UUID (like "EXT_JOURNAL") not
the name of the file system.
Only copy the UUID value to the probe uuid member if the given name is
either NULL or "UUID".
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
| |
Attempt to dlopen() libblkid.so at runtime and use it for proping
filesystems if available.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
| |
Add an abstraction layer which separates block.c from libblkid-tiny implementation
details in order to prepare support for optionally using the full libblkid.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
| |
This allows identifying /dev/root by its major:minor number which
are part of /proc/self/mountinfo but aren't contained in /proc/mounts.
Also fix jffs2reset when using an ext4 overlay by adding it to the
list of filesystems allowed if the root_only parameter of
find_mount_point is set.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
Uses either ext4 or f2fs, depending on the overlay volume size
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
| |
Signed-off-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
|
|
| |
Hi all!
In fopivot in libfstools variable name "lowerdir" is confusing and
doesn't make any sense.
There is a patch renaming that var to "mount_options".
|
|
|
|
| |
Signed-off-by: John Crispin <john@phrozen.org>
|
|
|
|
|
|
| |
Don't immediatly fail if block device cannot be stat'ed.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of using two different implementations reading /proc/mounts
and /proc/self/mountinfo, gather all information on mountpoints from
/proc/self/mountinfo.
While at it, tokenize mountinfo inline instead of using strtok_r
because it's hard to tell whether strtok_r allocated new memory or
merely returns a pointer to the (last) token. This might later on be
relevant once we want to free that memory...
Tokenizing mountinfo using strchr inline works without allocating any
new memory by scanning and re-writing the string returned by gets().
As a result, the returned string needs to be duplicated to be safe for
use even after the fclose().
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
| |
Matching only the device name doesn't always work, e.g. in case of
/dev/root. Thus also check the device(minor,major) which can be scraped
from /proc/self/mountinfo.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
| |
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
Allow querying /dev/ubi?_? devices though they are not block devices.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
| |
Skip ubi?_? device if ubiblock?_? is present.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
| |
The glob pattern intended for ubi?_? devices was matching
ubiblock?_? devices as well. Change the glob to actually return only
ubi devices.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
| |
block uses libblob_msgjson which requires us to link against libjson-c.
Some external toolchains would be failing to find that library unless
specified explicitly.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
|
|
|
|
|
|
| |
Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for
libubox/ulog.h. Some external toolchains which do not include standard
locations would fail to find the header otherwise.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Some users will want to use OpenWrt/LEDE devices as NAS
devices and have full POSIX ACL and user_xattr support
(along with other possible use cases), therefore add
support to mount with POSIX ACLs and/or user XATTR
support.
Signed-off-by: Daniel Dickinson <lede@daniel.thecshore.com>
|
|
|
|
|
|
|
| |
Let's use the cannonical source of mount flags instead of
defining the flags ourselves.
Signed-off-by: Daniel Dickinson <lede@daniel.thecshore.com>
|
|
|
|
|
|
|
|
| |
vfat is a common filesystem which users may want to mount on an
OpenWrt/LEDE device, so support peforming filesystem checks
before mount for vfat.
Signed-off-by: Daniel Dickinson <lede@daniel.thecshore.com>
|
|
|
|
|
|
|
|
| |
There is no reason for e2fsck string to be altered, and the
only places where is used take const char * as parameters
so make e2fsck a const char *.
Signed-off-by: Daniel Dickinson <lede@daniel.thecshore.com>
|
|
|
|
| |
Signed-off-by: John Crispin <john@phrozen.org>
|