| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Insert a helpful size check that is an outcome of the following dt-utils
commits:
| commit a6eb5350be0f7a5673162d20f2dd72569d5a4d0c
| Author: Markus Pargmann <mpa@pengutronix.de>
| Date: Fri May 27 13:53:40 2016 +0200
|
| barebox-state: Import updated state code
|
| Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
| commit 583acea6669550ffa7ffb465301ddb3529206afc
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date: Thu Mar 23 11:29:50 2017 +0100
|
| state: backend-direct: Fix max_size
|
| The max_size in the direct backend includes the meta data, so
| substract its size when determing the max data size we can store.
|
| Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| commit dcf781f1b3d15aff5f5ff0b604bff447dee2040c
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date: Thu Mar 23 12:59:48 2017 +0100
|
| state: backend_bucket_direct: max_size is always given
|
| max_size is always != 0, so if(direct->max_size) can be skipped.
|
| Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Linux userspace with recent glibc versions lets barebox-state suffer from
linux/stat.h redefining 'struct statx' and because of that switched to the
inclusion of sys/stat.h instead, see dt-utils commit 1c80e31872ae ("src: fix
compilation for glibc version 2.27.9000-36.fc29 and newer").
We can follow this switch in barebox without any problems, too, as in barebox
sys/stat.h includes linux/stat.h (and adds some more definitions on top that
don't hurt us here).
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
Linux userspace needs sys/param.h to have the definition of roundup().
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Other than in barebox the offset and size of a state's backend device do not
necessarily equal zero in Linux userspace (EEPROMs & block devices), so barebox'
and dt-utils' state code differ here.
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To harmonize the common codebase this ports the following dt-utils commit:
| commit 5588a6c32d54bc4a1ef0b9f72807c46dd00bc20e
| Author: Ulrich Ölmann <u.oelmann@pengutronix.de>
| Date: Sun Feb 3 22:48:07 2019 +0100
|
| state: fix formatting of "uint32_t" variables
|
| The format specifier "%zd" is for "size_t" typed variables and produces a
| warning with gcc, so use "%u" instead.
|
| Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
| Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To harmonize the common codebase this ports the following dt-utils commit:
| commit 89d033284cb69f834c1f2195c9e99a3d7f585cf1
| Author: Ulrich Ölmann <u.oelmann@pengutronix.de>
| Date: Sun Feb 3 22:48:06 2019 +0100
|
| state: fix formatting of "off_t" variables
|
| Explicitely casting an "off_t" variable to "long long" and formatting it via
| "%lld" or "%llx" respectively makes 32- as well as 64-bit compilers
| happy (tested with gcc-8.2.1 and clang-7.0.1).
|
| Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
| Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To harmonize the common codebase this ports the remaining hunks of the following
dt-utils commit, as the residual hunks have independently already been done
before in barebox commit 1afbf6b5680e ("state: fix compile warnings for dev_err
expansion"):
| commit 9f1db73234b40f4ea071421e8179065df16211ec
| Author: Philipp Rosenberger <p.rosenberger@linutronix.de>
| Date: Thu Oct 18 09:17:23 2018 +0200
|
| Fix compiler warnings about wrong type conversion in messages.
|
| These warning were observed with gcc-6.3 on x86-64.
|
| Signed-off-by: Philipp Rosenberger <p.rosenberger@linutronix.de>
| Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
| |
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
Fixes: 7126dffd0be ("common: state: Add variable_type to state_variable")
Fixes: 6096a0cfa4a ("common: state: fix alignment")
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
Fixes: 7126dffd0be ("common: state: Add variable_type to state_variable")
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
state_find_type() is unused and doesn't have a prototype. Remove it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This has been forgotten in commit 9d6d91931afb ("state: Remove -EUCLEAN check
from userspace tool").
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| | |
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| | |
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| | |
Introduce dev_set_name() in order to hide implementation details of
setting device's name so it'd be easier to change it.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| | |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Commit a66a8d79871c ("state: remove unused arguments from
state_new_from_node()") removed a little bit too much.
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
| |
See commit b6089182316d ("treewide: Use of_property_write_string() where
appropriate").
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
backend_bucket_circular currently assumes writesize is power of 2,
which makes it fail on dataflash devices, where this assumption
is false.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
After an update to a newer barebox version with an enabled state
framework, existing data in storage memories could be overwritten.
Add a new property to check in front of every write task, if the meta
magic field only contains the magic number, zeros or ones.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
| |
When fixing up the kernels state nodes we depended on the full node path
of the input device tree. This does not work when the kernel device tree
has different names. This has happened lately when the i.MX6 device
trees got their leading zeroes removed from the node names.
Use of_find_node_by_reproducible_name() to find the node corresponding
to the storage backend node in the kernel device tree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
state_new_from_node() has arguments describing the backend path. These
are never used in barebox, the backend path is always derived from the
device nodes backend description. Remove these arguments.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
The init_from_defaults parameter allows to detect if a state has been
initialized from default values, i.e. state_load failed.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
| |
The dirty parameter is readonly, so refuse to set it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
This API function allows to receive a copy of a MAC address from
variables in a state.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
The variable_type struct holds a name of its type. Checking the type of
a variable with this string needs much resources.
This patch introduce a enum of the variable type for better type
checking.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
Add a pointer in state_variable to the corresponding variable_type array
element.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Printing 'ret' makes no sense.
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change 119f92b27e131a0cb506fe8d8bffe8010fb14a3d already tried to fix it, but
forgets the 'direct' usecase.
The 'backend-storage-type' node is optional. Its default depends on the
capability of the used backend memory, which means "circular" or NULL.
The latter defaults to 'direct' in the routines.
If it is NULL, the devicetree fixup routine skips exporting a
'backend-storage-type' node to the kernel's devicetree.
But currently if the 'backend-storage-type' node is explicitly given as
'direct', it will be skipped silently and set to NULL instead. In this
case the user of the 'barebox-state' tool then ends up with the warning:
"No backend-storage-type found, using default"
which is annoying, because it was given.
Storing the given value will still use a NULL if the
'backend-storage-type' node isn't defined, but stores everything else if
it is defined. Then the 'backend-storage-type' node is present in the
kernel's devicetree as well.
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
A simple typo makes the state framework fail, but without an error
message the developer is lost in the dark.
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
While working on the state documentation it turns out to be helpful to have
more debug messages while a developer implements a 'state' variable set
and tries to configure it correctly.
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previous 'state' variable set variants do not know and use metadata. The
'direct' storage backend's read function honors this, but not its
counterpart the write function. This makes an update of the 'state'
variable set impossible.
This change makes backward compatibility explicit, else it complains in
the read function as well. With some more debug output it helps the
developer to do things right.
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
This looks like a leftover.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
A report about the changed on-storage state format might be interesting
to the user.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
|
|\ \ |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fix the following warnings:
CC common/state/backend_format_dtb.o
In file included from include/common.h:33:0,
from common/state/backend_format_dtb.c:18:
common/state/backend_format_dtb.c: In function ‘state_backend_format_dtb_verify’:
include/printk.h:52:52: warning: format ‘%d’ expects argument of type ‘int’, but
argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
(level) <= LOGLEVEL ? dev_printf((level), (dev), (format), ##args) : 0; \
^
include/printk.h:63:2: note: in expansion of macro ‘__dev_printf’
__dev_printf(3, (dev) , format , ## arg)
^~~~~~~~~~~~
common/state/backend_format_dtb.c:52:3: note: in expansion of macro ‘dev_err’
dev_err(fdtb->dev, "Error, stored DTB length (%d) longer than read buffer (%d)\n",
^~~~~~~
include/printk.h:52:52: warning: format ‘%d’ expects argument of type ‘int’, but
argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
(level) <= LOGLEVEL ? dev_printf((level), (dev), (format), ##args) : 0; \
^
include/printk.h:63:2: note: in expansion of macro ‘__dev_printf’
__dev_printf(3, (dev) , format , ## arg)
^~~~~~~~~~~~
common/state/backend_format_dtb.c:52:3: note: in expansion of macro ‘dev_err’
dev_err(fdtb->dev, "Error, stored DTB length (%d) longer than read buffer (%d)\n",
^~~~~~~
CC common/state/backend_format_raw.o
In file included from include/common.h:33:0,
from common/state/backend_format_raw.c:18:
common/state/backend_format_raw.c: In function ‘backend_format_raw_verify’:
include/printk.h:52:52: warning: format ‘%d’ expects argument of type ‘int’, but
argument 4 has type ‘ssize_t {aka long int}’ [-Wformat=]
(level) <= LOGLEVEL ? dev_printf((level), (dev), (format), ##args) : 0; \
^
include/printk.h:63:2: note: in expansion of macro ‘__dev_printf’
__dev_printf(3, (dev) , format , ## arg)
^~~~~~~~~~~~
common/state/backend_format_raw.c:111:3: note: in expansion of macro ‘dev_err’
dev_err(backend_raw->dev, "Error, buffer length (%d) is shorter than the minimum required header length\n",
^~~~~~~
CC common/state/backend_storage.o
In file included from common/state/backend_storage.c:24:0:
common/state/backend_storage.c: In function ‘state_storage_mtd_buckets_init’:
include/printk.h:52:52: warning: format ‘%zu’ expects argument of type ‘size_t’,
but argument 5 has type ‘uint32_t {aka unsigned int}’ [-Wformat=]
(level) <= LOGLEVEL ? dev_printf((level), (dev), (format), ##args) : 0; \
^
include/printk.h:63:2: note: in expansion of macro ‘__dev_printf’
__dev_printf(3, (dev) , format , ## arg)
^~~~~~~~~~~~
common/state/backend_storage.c:250:3: note: in expansion of macro ‘dev_err’
dev_err(storage->dev, "Offset within the device is not aligned to eraseblocks. Offset is %ld, erasesize %zu\n",
^~~~~~~
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
When the circular bucket meta magic was not found, it is assumed that
the whole written state is in the old on-storage format. In that case,
the size of the circular bucket meta must not be subtracted from the
read length, or the (complete_len > len) check in the raw backend's
verify function will fail:
state: Error, invalid data_len 16 in header, have data of len 24
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
When the "backend-storage-type" property is unset in the barebox dtb
then barebox will use the default. Instead of leaving the property
unset in the Linux dtb, set it to the value we used as default. By
making the default explicit to Linux we force Linux to the same backend
type, even when the defaults may differ.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
backend-storage-type is irrelevant for mtd devices, so do not
complain about this option missing. The mtd backend will print
messages if necessary.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
| |
There's no need to check for the existence of the backend property as
this is done implicitly later anyway. With this check removed of_path
is only assigned, but never used. Remove the unused code.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
When the kernel device tree is fixed up we assume that it doesn't
have a state node, so we must also assume that it doesn't have
a alias. Create it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|