Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rasdaemon: Fix for vendor errors are not recorded in the SQLite datab… #157

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ras-non-standard-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ int register_ns_ev_decoder(struct ras_ns_ev_decoder *ns_ev_decoder)
#endif
if (!ras_ns_ev_dec_list) {
ras_ns_ev_dec_list = ns_ev_decoder;
ras_ns_ev_dec_list->ref_count = 0;
} else {
list = ras_ns_ev_dec_list;
while (list->next)
Expand All @@ -86,6 +87,8 @@ int ras_ns_add_vendor_tables(struct ras_events *ras)
return -1;

ns_ev_decoder = ras_ns_ev_dec_list;
if (ras_ns_ev_dec_list)
ras_ns_ev_dec_list->ref_count++;
while (ns_ev_decoder) {
if (ns_ev_decoder->add_table && !ns_ev_decoder->stmt_dec_record) {
error = ns_ev_decoder->add_table(ras, ns_ev_decoder);
Expand Down Expand Up @@ -128,6 +131,16 @@ void ras_ns_finalize_vendor_tables(void)
#ifdef HAVE_SQLITE3
struct ras_ns_ev_decoder *ns_ev_decoder = ras_ns_ev_dec_list;

if (!ras_ns_ev_dec_list)
return;

if (ras_ns_ev_dec_list->ref_count > 0)
ras_ns_ev_dec_list->ref_count--;
else
return;
if (ras_ns_ev_dec_list->ref_count > 0)
return;

while (ns_ev_decoder) {
if (ns_ev_decoder->stmt_dec_record) {
ras_mc_finalize_vendor_table(ns_ev_decoder->stmt_dec_record);
Expand All @@ -141,6 +154,9 @@ void ras_ns_finalize_vendor_tables(void)
static void unregister_ns_ev_decoder(void)
{
#ifdef HAVE_SQLITE3
if (!ras_ns_ev_dec_list)
return;
ras_ns_ev_dec_list->ref_count = 1;
ras_ns_finalize_vendor_tables();
#endif
ras_ns_ev_dec_list = NULL;
Expand Down
1 change: 1 addition & 0 deletions ras-non-standard-handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

struct ras_ns_ev_decoder {
struct ras_ns_ev_decoder *next;
uint16_t ref_count;
const char *sec_type;
int (*add_table)(struct ras_events *ras, struct ras_ns_ev_decoder *ev_decoder);
int (*decode)(struct ras_events *ras, struct ras_ns_ev_decoder *ev_decoder,
Expand Down
Loading