summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.am1
-rw-r--r--src/lib/kernel-tainted.c143
-rw-r--r--src/lib/make_descr.c1
-rw-r--r--src/lib/problem_data.c8
4 files changed, 145 insertions, 8 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 14220c99..86210d4e 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -11,6 +11,7 @@ lib_LTLIBRARIES = \
# xconnect.cpp
libreport_la_SOURCES = \
+ kernel-tainted.c \
xfuncs.c \
is_in_string_list.c \
encbase64.c \
diff --git a/src/lib/kernel-tainted.c b/src/lib/kernel-tainted.c
new file mode 100644
index 00000000..115e44e0
--- /dev/null
+++ b/src/lib/kernel-tainted.c
@@ -0,0 +1,143 @@
+/*
+ Copyright (C) 2011 ABRT team
+ Copyright (C) 2011 RedHat Inc
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include "abrtlib.h"
+
+/* From RHEL6 kernel/panic.c: */
+static const int tnts_short[] = {
+ 'P' ,
+ 'F' ,
+ 'S' ,
+ 'R' ,
+ 'M' ,
+ 'B' ,
+ 'U' ,
+ 'D' ,
+ 'A' ,
+ 'W' ,
+ 'C' ,
+ 'I' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ '-' ,
+ 'H' ,
+ 'T' ,
+};
+
+/**
+ * print_tainted - return a string to represent the kernel taint state.
+ *
+ * 'P' - Proprietary module has been loaded.
+ * 'F' - Module has been forcibly loaded.
+ * 'S' - SMP with CPUs not designed for SMP.
+ * 'R' - User forced a module unload.
+ * 'M' - System experienced a machine check exception.
+ * 'B' - System has hit bad_page.
+ * 'U' - Userspace-defined naughtiness.
+ * 'D' - Kernel has oopsed before
+ * 'A' - ACPI table overridden.
+ * 'W' - Taint on warning.
+ * 'C' - modules from drivers/staging are loaded.
+ * 'I' - Working around severe firmware bug.
+ * 'H' - Hardware is unsupported.
+ * T - Tech_preview
+ */
+
+
+static const char *const tnts_long[] = {
+ "Proprietary module has been loaded.",
+ "Module has been forcibly loaded.",
+ "SMP with CPUs not designed for SMP.",
+ "User forced a module unload.",
+ "System experienced a machine check exception.",
+ "System has hit bad_page.",
+ "Userspace-defined naughtiness.",
+ "Kernel has oopsed before.",
+ "ACPI table overridden.",
+ "Taint on warning.",
+ "Modules from drivers/staging are loaded.",
+ "Working around severe firmware bug.",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "Hardware is unsupported.",
+ "Tech_preview",
+};
+
+char *kernel_tainted_short(unsigned tainted)
+{
+ char *tnt = xzalloc(ARRAY_SIZE(tnts_short) + 1);
+ int i = 0;
+ while (tainted)
+ {
+ if (0x1 & tainted)
+ tnt[i] = tnts_short[i];
+ else
+ tnt[i] = '-';
+
+ ++i;
+ tainted >>= 1;
+ }
+
+ return tnt;
+}
+
+GList *kernel_tainted_long(unsigned tainted)
+{
+ int i = 0;
+ GList *tnt = NULL;
+
+ while (tainted)
+ {
+ if (0x1 & tainted && tnts_long[i])
+ tnt = g_list_append(tnt, xstrdup(tnts_long[i]));
+
+ ++i;
+ tainted >>= 1;
+ }
+
+ return tnt;
+}
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index fe629d2b..036d7770 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -237,6 +237,7 @@ static const char *const blacklisted_items[] = {
FILENAME_DUPHASH ,
FILENAME_UUID ,
FILENAME_COUNT ,
+ FILENAME_TAINTED_SHORT,
NULL
};
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
index 657044bb..b4be1562 100644
--- a/src/lib/problem_data.c
+++ b/src/lib/problem_data.c
@@ -129,14 +129,6 @@ const char *get_problem_item_content_or_NULL(problem_data_t *problem_data, const
}
-/* problem_data_vector[i] = { "name" = { "content", CD_FLAG_foo_bits } } */
-
-vector_of_problem_data_t *new_vector_of_problem_data(void)
-{
- return g_ptr_array_new_with_free_func((void (*)(void*)) &free_problem_data);
-}
-
-
/* Miscellaneous helpers */
static const char *const editable_files[] = {