Conversation
Right now, the DB logic was written to support only sqlite3. As we're aiming to add support for other databases, use a more generic way to describe DB fields. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Convert sqlite3-specific bindings into a generic one inside ras-record, to allow adding support later for other databases. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
In preparation for adding support to other databases, don't keep any sqlite3 stuff outside ras-record. For now, we'll keep HAVE_SQLITE3 as an intermediate step, as right now the only SQL supported database is sqlite3. In the future, this will be broken on two separate fields, and the checks inside each rasdaemon file will disapear, as the SQL backend core will take care of it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Those should be 644, not 755. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Right now, rasdaemon is only partially modular: at build time, each individual feature can be selected and added, but the code requires lots of ifdefs. This worked fine at the beginning when there weren't much options, but now the code has lots of optional features. Use a more modular design by adding a module register logic. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As the project grew, there are now too much files at the core directory, making harder to maintain. Move them to subdirs. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Make it more generic, aiming to allow automatic module load via __attribute__((constructor)). Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As we're aiming to let module registration to happen in any order, make the logic deterministic by inserting modules in alphabetic order. This makes insert being O(n) instead of O(1), but performance here is not a problem. While here, fix a bug when checking if allocation succeded. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
While the code compiles, it fails at the test cases. Fix the issues. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Add unit tests to check if modules logic works. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Allow modules to optionally set a private data and ensure that cleanup will receive enough context. This is needed to check modules functionality via unit tests, and could help to ensure that cleanup will do the right thing. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Ensure that init and cleanup logic will work as expected. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Instead of relying on manual conference, check programaticly if module cleanups will happen at the expected way. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
When doing unit tests, it doesn't make any sense to write at
syslog. Also, on success, the normal behavior is to just mask
the error output.
Implement support for it and modify tests/test-modules to
use such feature.
After such change, a successful run will be cleaner:
Testing modules functionality:
01/06: Running NULL entry
02/06: Running single module
03/06: Running modules in order
04/06: Running modules out of order
05/06: Running multiple levels
06/06: Running init/cleanup
All module registration tests passed.
And if the logs are always shown, there will be a tab on
each new line, which will produce a better visual output
as well:
Testing modules functionality:
01/06: Running NULL entry
module entry is missing!
02/06: Running single module
03/06: Running modules in order
04/06: Running modules out of order
05/06: Running multiple levels
06/06: Running init/cleanup
module alpha enabled
module charlie enabled
module foxtrot enabled
module delta enabled
module echo enabled
module beta enabled
All module registration tests passed.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Move all sqlite3-specific logit to db/ras-db, preparing the code to support other databases in the future. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
change the namespace for all database-related ops. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Use kernel-doc style markups to document the database generic interface. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
The code there contains only sqlite3 specifics. Rename it to better reflect its content. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
In preparation to support other database types, add an abstraction layer. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As the idea is to make the logic more modular to give more flexibility and remove ifdef code from rasdaemon, move the DB backend initialization to be done via module register. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Forgot to add ras-db code on a previous commit. While here, update .gitignore. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This is useful for unit tests. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
mchehab
force-pushed
the
next
branch
2 times, most recently
from
August 11, 2026 12:01
45e9484 to
38bf93a
Compare
Add a way to check if db-sqlite3 implementation is working. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
The logic inside ras-db to pick the next backend is moving the pointer twice, producing sigfaults. While here, do a couple of cleanups. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
mchehab
force-pushed
the
next
branch
9 times, most recently
from
August 18, 2026 08:08
b15e0ba to
110ef8b
Compare
Ensure that the build and SRPMS/ directories will be removed. While here, also remove m4/ directory. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Use a more canonical identation format, as given by yamlfmt. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Now that we have a generic interface, add PostgreSQL support. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
let CI do unit tests for PostgreSQL as well. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Database setup is somewhat complex. Add a set of instructions about it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
There are some code there which should be compiled only if a database backend is selected. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As there are now multiple database backends, use the generic HAVE_DB to ensure that the code will work with any backend. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Until this change, rasdaemon had an env file stored under: /etc/sysconfig/rasdaemon.env However, the content of this file was never read. Also, it doesn't follow the way other files are stored there: without a .env suffix. Change the logic to make rasdaemon to automatically load its configuration if the file is present. If there's no /etc/sysconfig/rasdaemon, a warning will be issued but the logic will proceed. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Add support to configure a database via env parameters. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Allow rasdaemon to select the right SQL backend. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Allow overriding the default using a --config (-c) option to optionally select a different config file. This can be very helpful when testing rasdaemon with different DB backends. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Make the empty stub static inline, as otherwise some setups may end declaring it multiple times. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Remove some logs that were useful while changing rasdaemon architecture. While here, replace the meaningless error message: rasdaemon: Failed to open directory to one that actually makes sense: rasdaemon: Failed to open /sys/fs/pstore/erst directory Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Rasdaemon produces lots of logs. Make it clearer to identify potential problems by adding colors to the messages. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This reverts commit 4b29f86.
We want to allow installing inside a directory with: meson build --reconfigure -Dprefix=`pwd`/instal but, at the same time, we need to support "make mock" target. The first one works, but `make mock` is adding /usr twice: ./BUILDROOT/usr/usr/lib/systemd/system/ras-mc-ctl.service ./BUILDROOT/usr/usr/lib/systemd/system/rasdaemon.service Add an extra check to prevent that. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In preparation for rasdaemon version 1.0.0, improve its internal architecture.
Goals:
Updates:
I appreciate feedbacks and PRs against the
nextbranch to help with the redesign.