From a22c570ddba7a71f717eb2209674f4301f5ba8d7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 26 Nov 2010 17:51:54 +0100 Subject: preparatory patch for future factoring out of headers for reportlib Some files and functions are renamed, no logic changes. Signed-off-by: Denys Vlasenko --- src/include/Makefile.am | 2 +- src/include/abrt_crash_dump.h | 128 ++++++++++++++++++++++++++++++++++++++++++ src/include/abrtlib.h | 2 +- src/include/crash_types.h | 128 ------------------------------------------ src/include/dbus_common.h | 2 +- src/include/dump_dir.h | 9 ++- src/include/plugin.h | 2 +- 7 files changed, 136 insertions(+), 137 deletions(-) create mode 100644 src/include/abrt_crash_dump.h delete mode 100644 src/include/crash_types.h (limited to 'src/include') diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 11f3e461..3716d19e 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -3,7 +3,7 @@ HEADER_FILES = \ abrtlib.h \ abrt_types.h \ comm_layer_inner.h \ - crash_types.h \ + abrt_crash_dump.h \ dbus_common.h \ dump_dir.h \ observer.h \ diff --git a/src/include/abrt_crash_dump.h b/src/include/abrt_crash_dump.h new file mode 100644 index 00000000..ed7ffe95 --- /dev/null +++ b/src/include/abrt_crash_dump.h @@ -0,0 +1,128 @@ +/* + Copyright (C) 2009 Abrt team. + Copyright (C) 2009 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. +*/ +#ifndef ABRT_CRASH_DUMP_H_ +#define ABRT_CRASH_DUMP_H_ + +#include "abrt_types.h" + +// Keep in sync with CCDump.py: + +// Filenames in dump directory: +// filled by a hook: +#define FILENAME_ANALYZER "analyzer" +#define FILENAME_EXECUTABLE "executable" +#define FILENAME_BINARY "binary" +#define FILENAME_CMDLINE "cmdline" +#define FILENAME_REASON "reason" +#define FILENAME_COREDUMP "coredump" +#define FILENAME_BACKTRACE "backtrace" +#define FILENAME_MEMORYMAP "memorymap" +#define FILENAME_DUPHASH "global_uuid" /* name is compat, to be renamed to "duphash" */ +// Name of the function where the application crashed. +// Optional. +#define FILENAME_CRASH_FUNCTION "crash_function" +// filled by CDebugDump::Create() (which also fills FILENAME_UID): +#define FILENAME_ARCHITECTURE "architecture" +#define FILENAME_KERNEL "kernel" +#define FILENAME_TIME "time" +#define FILENAME_RELEASE "release" /* from /etc/redhat-release */ +// filled by +#define FILENAME_PACKAGE "package" +#define FILENAME_COMPONENT "component" +#define FILENAME_DESCRIPTION "description" /* package descr (not crash descr) */ +#define FILENAME_COMMENT "comment" +#define FILENAME_REPRODUCE "reproduce" +#define FILENAME_RATING "rating" +#define FILENAME_HOSTNAME "hostname" +// Optional. Set to "1" by abrt-handle-upload for every unpacked crashdump +#define FILENAME_REMOTE "remote" +#define FILENAME_TAINTED "kernel_tainted" +// TODO: TicketUploader also has open-coded "TICKET", "CUSTOMER" files + +#define FILENAME_UID "uid" +#define FILENAME_UUID "uuid" +#define FILENAME_INFORMALL "inform_all_users" +#define FILENAME_COUNT "count" +#define FILENAME_MESSAGE "message" +// Not stored as files, added "on the fly": +#define CD_DUMPDIR "DumpDir" +// "Which events are possible (make sense) on this crash dump?" +// (a string with "\n" terminated event names) +#define CD_EVENTS "Events" + + +// Crash data is a map of 3-element vectors of strings: type, editable, content +#define CD_TYPE 0 +#define CD_EDITABLE 1 +#define CD_CONTENT 2 + +// SYS - system value, should not be displayed +// BIN - binary data +// TXT - text data, can be displayed +#define CD_SYS "s" +#define CD_BIN "b" +#define CD_TXT "t" +// Text bigger than this usually is attached, not added inline +#define CD_TEXT_ATT_SIZE (2*1024) + +#define CD_ISEDITABLE "y" +#define CD_ISNOTEDITABLE "n" + + +#ifdef __cplusplus +extern "C" { +#endif + +extern const char *const must_have_files[]; + +bool is_editable_file(const char *file_name); + +#ifdef __cplusplus +} +#endif + + +#ifdef __cplusplus + +// +typedef map_vector_string_t map_crash_data_t; +typedef std::vector vector_map_crash_data_t; + +void add_to_crash_data_ext(map_crash_data_t& pCrashData, + const char *pItem, + const char *pType, + const char *pEditable, + const char *pContent); +// Uses type:CD_TXT, editable:CD_ISNOTEDITABLE +void add_to_crash_data(map_crash_data_t& pCrashData, + const char *pItem, + const char *pContent); + +void load_crash_data_from_crash_dump_dir(struct dump_dir *dd, map_crash_data_t& data); + +const char *get_crash_data_item_content_or_NULL(const map_crash_data_t& crash_data, const char *key); +// Aborts if key is not found: +const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key); + +void log_map_crash_data(const map_crash_data_t& data, const char *name); + +#endif /* __cplusplus */ + + +#endif diff --git a/src/include/abrtlib.h b/src/include/abrtlib.h index cbaafc60..8cd0664a 100644 --- a/src/include/abrtlib.h +++ b/src/include/abrtlib.h @@ -77,7 +77,7 @@ int vdprintf(int d, const char *format, va_list ap); #include "hash_sha1.h" #include "hash_md5.h" -#include "crash_types.h" +#include "abrt_crash_dump.h" #include "dump_dir.h" #include "abrt_types.h" diff --git a/src/include/crash_types.h b/src/include/crash_types.h deleted file mode 100644 index 28b2eb09..00000000 --- a/src/include/crash_types.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - Copyright (C) 2009 Abrt team. - Copyright (C) 2009 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. -*/ -#ifndef CRASHTYPES_H_ -#define CRASHTYPES_H_ - -#include "abrt_types.h" - -// Keep in sync with CCDump.py: - -// Filenames in dump directory: -// filled by a hook: -#define FILENAME_ANALYZER "analyzer" -#define FILENAME_EXECUTABLE "executable" -#define FILENAME_BINARY "binary" -#define FILENAME_CMDLINE "cmdline" -#define FILENAME_REASON "reason" -#define FILENAME_COREDUMP "coredump" -#define FILENAME_BACKTRACE "backtrace" -#define FILENAME_MEMORYMAP "memorymap" -#define FILENAME_DUPHASH "global_uuid" /* name is compat, to be renamed to "duphash" */ -// Name of the function where the application crashed. -// Optional. -#define FILENAME_CRASH_FUNCTION "crash_function" -// filled by CDebugDump::Create() (which also fills FILENAME_UID): -#define FILENAME_ARCHITECTURE "architecture" -#define FILENAME_KERNEL "kernel" -#define FILENAME_TIME "time" -#define FILENAME_RELEASE "release" /* from /etc/redhat-release */ -// filled by -#define FILENAME_PACKAGE "package" -#define FILENAME_COMPONENT "component" -#define FILENAME_DESCRIPTION "description" /* package descr (not crash descr) */ -#define FILENAME_COMMENT "comment" -#define FILENAME_REPRODUCE "reproduce" -#define FILENAME_RATING "rating" -#define FILENAME_HOSTNAME "hostname" -// Optional. Set to "1" by abrt-handle-upload for every unpacked crashdump -#define FILENAME_REMOTE "remote" -#define FILENAME_TAINTED "kernel_tainted" -// TODO: TicketUploader also has open-coded "TICKET", "CUSTOMER" files - -#define FILENAME_UID "uid" -#define FILENAME_UUID "uuid" -#define FILENAME_INFORMALL "inform_all_users" -#define FILENAME_COUNT "count" -#define FILENAME_MESSAGE "message" -// Not stored as files, added "on the fly": -#define CD_DUMPDIR "DumpDir" -// "Which events are possible (make sense) on this crash dump?" -// (a string with "\n" terminated event names) -#define CD_EVENTS "Events" - - -// Crash data is a map of 3-element vectors of strings: type, editable, content -#define CD_TYPE 0 -#define CD_EDITABLE 1 -#define CD_CONTENT 2 - -// SYS - system value, should not be displayed -// BIN - binary data -// TXT - text data, can be displayed -#define CD_SYS "s" -#define CD_BIN "b" -#define CD_TXT "t" -// Text bigger than this usually is attached, not added inline -#define CD_TEXT_ATT_SIZE (2*1024) - -#define CD_ISEDITABLE "y" -#define CD_ISNOTEDITABLE "n" - - -#ifdef __cplusplus -extern "C" { -#endif - -extern const char *const must_have_files[]; - -bool is_editable_file(const char *file_name); - -#ifdef __cplusplus -} -#endif - - -#ifdef __cplusplus - -// -typedef map_vector_string_t map_crash_data_t; -typedef std::vector vector_map_crash_data_t; - -void add_to_crash_data_ext(map_crash_data_t& pCrashData, - const char *pItem, - const char *pType, - const char *pEditable, - const char *pContent); -// Uses type:CD_TXT, editable:CD_ISNOTEDITABLE -void add_to_crash_data(map_crash_data_t& pCrashData, - const char *pItem, - const char *pContent); - -void load_crash_data_from_debug_dump(struct dump_dir *dd, map_crash_data_t& data); - -const char *get_crash_data_item_content_or_NULL(const map_crash_data_t& crash_data, const char *key); -// Aborts if key is not found: -const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key); - -void log_map_crash_data(const map_crash_data_t& data, const char *name); - -#endif /* __cplusplus */ - - -#endif diff --git a/src/include/dbus_common.h b/src/include/dbus_common.h index 63053cc9..6c739169 100644 --- a/src/include/dbus_common.h +++ b/src/include/dbus_common.h @@ -19,7 +19,7 @@ #ifndef DBUSCOMMON_H_ #define DBUSCOMMON_H_ -#include "crash_types.h" +#include "abrt_crash_dump.h" #define ABRTD_DBUS_NAME "com.redhat.abrt" #define ABRTD_DBUS_PATH "/com/redhat/abrt" diff --git a/src/include/dump_dir.h b/src/include/dump_dir.h index fc882185..7a38f1e4 100644 --- a/src/include/dump_dir.h +++ b/src/include/dump_dir.h @@ -1,6 +1,5 @@ /* - DebugDump.h - header file for the library caring of writing new reports - to the specific directory + On-disk storage of crash dumps Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) Copyright (C) 2009 RedHat inc. @@ -19,8 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef DEBUGDUMP_H_ -#define DEBUGDUMP_H_ +#ifndef DUMP_DIR_H_ +#define DUMP_DIR_H_ #ifdef __cplusplus extern "C" { @@ -56,7 +55,7 @@ void dd_save_text(struct dump_dir *dd, const char *name, const char *data); void dd_save_binary(struct dump_dir *dd, const char *name, const char *data, unsigned size); void dd_delete(struct dump_dir *dd); -void delete_debug_dump_dir(const char *dd_dir); +void delete_crash_dump_dir(const char *dd_dir); #ifdef __cplusplus } diff --git a/src/include/plugin.h b/src/include/plugin.h index 0ab85617..3f652e65 100644 --- a/src/include/plugin.h +++ b/src/include/plugin.h @@ -23,7 +23,7 @@ #define PLUGIN_H_ #include "abrt_types.h" -#include "crash_types.h" +#include "abrt_crash_dump.h" #define PLUGINS_MAGIC_NUMBER 6 -- cgit