|
|
ac32bf |
From 016802f4093e80971a52c590c661a04924cb9aa3 Mon Sep 17 00:00:00 2001
|
|
|
ac32bf |
From: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
|
ac32bf |
Date: Fri, 31 May 2013 13:10:16 -0300
|
|
|
ac32bf |
Subject: [PATCH 03/32] ras-record: rename stmt to stmt_mc_event
|
|
|
ac32bf |
|
|
|
ac32bf |
This stmt is used only for mc_event. So, rename it, as we'll be
|
|
|
ac32bf |
adding other stmts for the other tables.
|
|
|
ac32bf |
|
|
|
ac32bf |
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
|
ac32bf |
---
|
|
|
ac32bf |
ras-record.c | 46 ++++++++++++++++++++++++----------------------
|
|
|
ac32bf |
ras-record.h | 2 +-
|
|
|
ac32bf |
2 files changed, 25 insertions(+), 23 deletions(-)
|
|
|
ac32bf |
|
|
|
ac32bf |
diff --git a/ras-record.c b/ras-record.c
|
|
|
ac32bf |
index 3af0791..efcd78f 100644
|
|
|
ac32bf |
--- a/ras-record.c
|
|
|
ac32bf |
+++ b/ras-record.c
|
|
|
ac32bf |
@@ -194,7 +194,7 @@ int ras_mc_event_opendb(unsigned cpu, struct ras_events *ras)
|
|
|
ac32bf |
return -1;
|
|
|
ac32bf |
}
|
|
|
ac32bf |
|
|
|
ac32bf |
- rc = ras_mc_prepare_stmt(priv, &priv->stmt, &mc_event_tab);
|
|
|
ac32bf |
+ rc = ras_mc_prepare_stmt(priv, &priv->stmt_mc_event, &mc_event_tab);
|
|
|
ac32bf |
if (rc == SQLITE_OK) {
|
|
|
ac32bf |
log(TERM, LOG_INFO,
|
|
|
ac32bf |
"cpu %u: Recording events at %s\n",
|
|
|
ac32bf |
@@ -214,30 +214,32 @@ int ras_store_mc_event(struct ras_events *ras, struct ras_mc_event *ev)
|
|
|
ac32bf |
int rc;
|
|
|
ac32bf |
struct sqlite3_priv *priv = ras->db_priv;
|
|
|
ac32bf |
|
|
|
ac32bf |
- if (!priv || !priv->stmt)
|
|
|
ac32bf |
+ if (!priv || !priv->stmt_mc_event)
|
|
|
ac32bf |
return 0;
|
|
|
ac32bf |
- log(TERM, LOG_INFO, "mc_event store: %p\n", priv->stmt);
|
|
|
ac32bf |
-
|
|
|
ac32bf |
- sqlite3_bind_text(priv->stmt, 1, ev->timestamp, -1, NULL);
|
|
|
ac32bf |
- sqlite3_bind_int (priv->stmt, 2, ev->error_count);
|
|
|
ac32bf |
- sqlite3_bind_text(priv->stmt, 3, ev->error_type, -1, NULL);
|
|
|
ac32bf |
- sqlite3_bind_text(priv->stmt, 4, ev->msg, -1, NULL);
|
|
|
ac32bf |
- sqlite3_bind_text(priv->stmt, 5, ev->label, -1, NULL);
|
|
|
ac32bf |
- sqlite3_bind_int (priv->stmt, 6, ev->mc_index);
|
|
|
ac32bf |
- sqlite3_bind_int (priv->stmt, 7, ev->top_layer);
|
|
|
ac32bf |
- sqlite3_bind_int (priv->stmt, 8, ev->middle_layer);
|
|
|
ac32bf |
- sqlite3_bind_int (priv->stmt, 9, ev->lower_layer);
|
|
|
ac32bf |
- sqlite3_bind_int (priv->stmt, 10, ev->address);
|
|
|
ac32bf |
- sqlite3_bind_int (priv->stmt, 11, ev->grain);
|
|
|
ac32bf |
- sqlite3_bind_int (priv->stmt, 12, ev->syndrome);
|
|
|
ac32bf |
- sqlite3_bind_text(priv->stmt, 13, ev->driver_detail, -1, NULL);
|
|
|
ac32bf |
- rc = sqlite3_step(priv->stmt);
|
|
|
ac32bf |
+ log(TERM, LOG_INFO, "mc_event store: %p\n", priv->stmt_mc_event);
|
|
|
ac32bf |
+
|
|
|
ac32bf |
+ sqlite3_bind_text(priv->stmt_mc_event, 1, ev->timestamp, -1, NULL);
|
|
|
ac32bf |
+ sqlite3_bind_int (priv->stmt_mc_event, 2, ev->error_count);
|
|
|
ac32bf |
+ sqlite3_bind_text(priv->stmt_mc_event, 3, ev->error_type, -1, NULL);
|
|
|
ac32bf |
+ sqlite3_bind_text(priv->stmt_mc_event, 4, ev->msg, -1, NULL);
|
|
|
ac32bf |
+ sqlite3_bind_text(priv->stmt_mc_event, 5, ev->label, -1, NULL);
|
|
|
ac32bf |
+ sqlite3_bind_int (priv->stmt_mc_event, 6, ev->mc_index);
|
|
|
ac32bf |
+ sqlite3_bind_int (priv->stmt_mc_event, 7, ev->top_layer);
|
|
|
ac32bf |
+ sqlite3_bind_int (priv->stmt_mc_event, 8, ev->middle_layer);
|
|
|
ac32bf |
+ sqlite3_bind_int (priv->stmt_mc_event, 9, ev->lower_layer);
|
|
|
ac32bf |
+ sqlite3_bind_int (priv->stmt_mc_event, 10, ev->address);
|
|
|
ac32bf |
+ sqlite3_bind_int (priv->stmt_mc_event, 11, ev->grain);
|
|
|
ac32bf |
+ sqlite3_bind_int (priv->stmt_mc_event, 12, ev->syndrome);
|
|
|
ac32bf |
+ sqlite3_bind_text(priv->stmt_mc_event, 13, ev->driver_detail, -1, NULL);
|
|
|
ac32bf |
+ rc = sqlite3_step(priv->stmt_mc_event);
|
|
|
ac32bf |
if (rc != SQLITE_OK && rc != SQLITE_DONE)
|
|
|
ac32bf |
- log(TERM, LOG_ERR, "Failed to do mc_event step on sqlite: error = %d\n", rc);
|
|
|
ac32bf |
- rc = sqlite3_reset(priv->stmt);
|
|
|
ac32bf |
+ log(TERM, LOG_ERR,
|
|
|
ac32bf |
+ "Failed to do mc_event step on sqlite: error = %d\n", rc);
|
|
|
ac32bf |
+ rc = sqlite3_reset(priv->stmt_mc_event);
|
|
|
ac32bf |
if (rc != SQLITE_OK && rc != SQLITE_DONE)
|
|
|
ac32bf |
- log(TERM, LOG_ERR, "Failed reset mc_event on sqlite: error = %d\n",
|
|
|
ac32bf |
- rc);
|
|
|
ac32bf |
+ log(TERM, LOG_ERR,
|
|
|
ac32bf |
+ "Failed reset mc_event on sqlite: error = %d\n",
|
|
|
ac32bf |
+ rc);
|
|
|
ac32bf |
log(TERM, LOG_INFO, "register inserted at db\n");
|
|
|
ac32bf |
|
|
|
ac32bf |
return rc;
|
|
|
ac32bf |
diff --git a/ras-record.h b/ras-record.h
|
|
|
ac32bf |
index 20c327f..9791185 100644
|
|
|
ac32bf |
--- a/ras-record.h
|
|
|
ac32bf |
+++ b/ras-record.h
|
|
|
ac32bf |
@@ -46,7 +46,7 @@ struct ras_aer_event {
|
|
|
ac32bf |
|
|
|
ac32bf |
struct sqlite3_priv {
|
|
|
ac32bf |
sqlite3 *db;
|
|
|
ac32bf |
- sqlite3_stmt *stmt;
|
|
|
ac32bf |
+ sqlite3_stmt *stmt_mc_event;
|
|
|
ac32bf |
};
|
|
|
ac32bf |
|
|
|
ac32bf |
int ras_mc_event_opendb(unsigned cpu, struct ras_events *ras);
|
|
|
ac32bf |
--
|
|
|
ac32bf |
1.7.1
|
|
|
ac32bf |
|