* [PATCH] envfs-core: write to log where appropriate
@ 2021-11-29 7:17 Ahmad Fatoum
2021-11-30 10:24 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-11-29 7:17 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Allow retrieving warning and status messages about the environment via log.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
common/envfs-core.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/common/envfs-core.c b/common/envfs-core.c
index 1898c1c8cb28..0984d538734f 100644
--- a/common/envfs-core.c
+++ b/common/envfs-core.c
@@ -12,6 +12,8 @@
* the default environment when building the barebox binary. So
* do not add any new barebox related functions here!
*/
+#define pr_fmt(fmt) "envfs: " fmt
+
#ifdef __BAREBOX__
#include <common.h>
#include <fs.h>
@@ -23,6 +25,8 @@
#include <libfile.h>
#else
# define errno_str(x) ("void")
+#define pr_info(fmt, ...) printf(pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_warn(fmt, ...) printf(pr_fmt(fmt), ##__VA_ARGS__)
#endif
static int dir_remove_action(const char *filename, struct stat *statbuf,
@@ -39,17 +43,17 @@ static int dir_remove_action(const char *filename, struct stat *statbuf,
int envfs_check_super(struct envfs_super *super, size_t *size)
{
if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
- printf("envfs: no envfs (magic mismatch) - envfs never written?\n");
+ pr_info("no envfs (magic mismatch) - envfs never written?\n");
return -EIO;
}
if (crc32(0, super, sizeof(*super) - 4) != ENVFS_32(super->sb_crc)) {
- printf("wrong crc on env superblock\n");
+ pr_warn("wrong crc on env superblock\n");
return -EIO;
}
if (super->major < ENVFS_MAJOR)
- printf("envfs version %d.%d loaded into %d.%d\n",
+ pr_info("version %d.%d loaded into %d.%d\n",
super->major, super->minor,
ENVFS_MAJOR, ENVFS_MINOR);
@@ -64,7 +68,7 @@ int envfs_check_data(struct envfs_super *super, const void *buf, size_t size)
crc = crc32(0, buf, size);
if (crc != ENVFS_32(super->crc)) {
- printf("wrong crc on env\n");
+ pr_warn("wrong crc on env\n");
return -EIO;
}
@@ -93,7 +97,7 @@ int envfs_load_data(struct envfs_super *super, void *buf, size_t size,
buf += sizeof(struct envfs_inode);
if (ENVFS_32(inode->magic) != ENVFS_INODE_MAGIC) {
- printf("envfs: wrong magic\n");
+ pr_warn("wrong magic\n");
ret = -EIO;
goto out;
}
--
2.33.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] envfs-core: write to log where appropriate
2021-11-29 7:17 [PATCH] envfs-core: write to log where appropriate Ahmad Fatoum
@ 2021-11-30 10:24 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-11-30 10:24 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Nov 29, 2021 at 08:17:56AM +0100, Ahmad Fatoum wrote:
> Allow retrieving warning and status messages about the environment via log.
>
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> common/envfs-core.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-30 10:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 7:17 [PATCH] envfs-core: write to log where appropriate Ahmad Fatoum
2021-11-30 10:24 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox