From 28c588d6a86daa3d2f2bb7cdb4604d79e7dcf08b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 9 Dec 2010 12:29:54 +0100 Subject: create report-libs-devel package; separate out report headers Signed-off-by: Denys Vlasenko --- src/include/Makefile.am | 16 +++---- src/include/crash_dump.h | 100 ---------------------------------------- src/include/dump_dir.h | 68 --------------------------- src/include/report/crash_dump.h | 100 ++++++++++++++++++++++++++++++++++++++++ src/include/report/dump_dir.h | 68 +++++++++++++++++++++++++++ src/include/report/run_event.h | 48 +++++++++++++++++++ src/include/run_event.h | 48 ------------------- 7 files changed, 224 insertions(+), 224 deletions(-) delete mode 100644 src/include/crash_dump.h delete mode 100644 src/include/dump_dir.h create mode 100644 src/include/report/crash_dump.h create mode 100644 src/include/report/dump_dir.h create mode 100644 src/include/report/run_event.h delete mode 100644 src/include/run_event.h (limited to 'src/include') diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 5b61bd82..165c705b 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -1,8 +1,11 @@ -HEADER_FILES = \ - crash_dump.h \ - dump_dir.h \ - run_event.h \ - \ +libreport_includedir = $(includedir)/report +libreport_include_HEADERS = \ + report/crash_dump.h \ + report/dump_dir.h \ + report/run_event.h + +libabrt_includedir = $(includedir)/abrt +libabrt_include_HEADERS = \ abrtlib.h \ abrt_types.h \ comm_layer_inner.h \ @@ -13,6 +16,3 @@ HEADER_FILES = \ action.h \ analyzer.h \ xfuncs.h - -lib_includedir=$(includedir)/abrt/ -lib_include_HEADERS = $(HEADER_FILES) diff --git a/src/include/crash_dump.h b/src/include/crash_dump.h deleted file mode 100644 index 10ddc885..00000000 --- a/src/include/crash_dump.h +++ /dev/null @@ -1,100 +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 CRASH_DUMP_H_ -#define CRASH_DUMP_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct dump_dir; - -enum { - CD_FLAG_SYS = (1 << 0), - CD_FLAG_BIN = (1 << 1), - CD_FLAG_TXT = (1 << 2), - CD_FLAG_ISEDITABLE = (1 << 3), - CD_FLAG_ISNOTEDITABLE = (1 << 4), -}; - -struct crash_item { - char *content; - unsigned flags; -}; -typedef struct crash_item crash_item; - -/* In-memory crash data structure and accessors */ - -typedef GHashTable crash_data_t; - -crash_data_t *new_crash_data(void); - -static inline void free_crash_data(crash_data_t *crash_data) -{ - if (crash_data) - g_hash_table_destroy(crash_data); -} - -void add_to_crash_data_ext(crash_data_t *crash_data, - const char *name, - const char *content, - unsigned flags); -/* Uses CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE flags */ -void add_to_crash_data(crash_data_t *crash_data, - const char *name, - const char *content); - -static inline struct crash_item *get_crash_data_item_or_NULL(crash_data_t *crash_data, const char *key) -{ - return (struct crash_item *)g_hash_table_lookup(crash_data, key); -} -const char *get_crash_item_content_or_NULL(crash_data_t *crash_data, const char *key); -/* Aborts if key is not found: */ -const char *get_crash_item_content_or_die(crash_data_t *crash_data, const char *key); - - -/* Vector of these structures */ - -typedef GPtrArray vector_of_crash_data_t; - -static inline crash_data_t *get_crash_data(vector_of_crash_data_t *vector, unsigned i) -{ - return (crash_data_t *)g_ptr_array_index(vector, i); -} - -vector_of_crash_data_t *new_vector_of_crash_data(void); -static inline void free_vector_of_crash_data(vector_of_crash_data_t *vector) -{ - if (vector) - g_ptr_array_free(vector, TRUE); -} - - -/* Conversions between in-memory and on-disk formats */ - -crash_data_t *load_crash_data_from_crash_dump_dir(struct dump_dir *dd); -struct dump_dir *create_crash_dump_dir(crash_data_t *crash_data); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/include/dump_dir.h b/src/include/dump_dir.h deleted file mode 100644 index 8cec9459..00000000 --- a/src/include/dump_dir.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - On-disk storage of crash dumps - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) - 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 DUMP_DIR_H_ -#define DUMP_DIR_H_ - -/* For DIR */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - DD_FAIL_QUIETLY = (1 << 0), -}; - -struct dump_dir { - char *dd_dir; - DIR *next_dir; - int locked; - uid_t dd_uid; - gid_t dd_gid; -}; - -void dd_close(struct dump_dir *dd); - -struct dump_dir *dd_opendir(const char *dir, int flags); -struct dump_dir *dd_create(const char *dir, uid_t uid); -int dd_exist(struct dump_dir *dd, const char *path); -DIR *dd_init_next_file(struct dump_dir *dd); -int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name); - -enum { - /* DD_FAIL_QUIETLY bit is valid for dd_load_text_ext too, */ - DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (1 << 1), -}; -char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags); -char* dd_load_text(const struct dump_dir *dd, const char *name); -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_crash_dump_dir(const char *dd_dir); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/include/report/crash_dump.h b/src/include/report/crash_dump.h new file mode 100644 index 00000000..10ddc885 --- /dev/null +++ b/src/include/report/crash_dump.h @@ -0,0 +1,100 @@ +/* + 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 CRASH_DUMP_H_ +#define CRASH_DUMP_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct dump_dir; + +enum { + CD_FLAG_SYS = (1 << 0), + CD_FLAG_BIN = (1 << 1), + CD_FLAG_TXT = (1 << 2), + CD_FLAG_ISEDITABLE = (1 << 3), + CD_FLAG_ISNOTEDITABLE = (1 << 4), +}; + +struct crash_item { + char *content; + unsigned flags; +}; +typedef struct crash_item crash_item; + +/* In-memory crash data structure and accessors */ + +typedef GHashTable crash_data_t; + +crash_data_t *new_crash_data(void); + +static inline void free_crash_data(crash_data_t *crash_data) +{ + if (crash_data) + g_hash_table_destroy(crash_data); +} + +void add_to_crash_data_ext(crash_data_t *crash_data, + const char *name, + const char *content, + unsigned flags); +/* Uses CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE flags */ +void add_to_crash_data(crash_data_t *crash_data, + const char *name, + const char *content); + +static inline struct crash_item *get_crash_data_item_or_NULL(crash_data_t *crash_data, const char *key) +{ + return (struct crash_item *)g_hash_table_lookup(crash_data, key); +} +const char *get_crash_item_content_or_NULL(crash_data_t *crash_data, const char *key); +/* Aborts if key is not found: */ +const char *get_crash_item_content_or_die(crash_data_t *crash_data, const char *key); + + +/* Vector of these structures */ + +typedef GPtrArray vector_of_crash_data_t; + +static inline crash_data_t *get_crash_data(vector_of_crash_data_t *vector, unsigned i) +{ + return (crash_data_t *)g_ptr_array_index(vector, i); +} + +vector_of_crash_data_t *new_vector_of_crash_data(void); +static inline void free_vector_of_crash_data(vector_of_crash_data_t *vector) +{ + if (vector) + g_ptr_array_free(vector, TRUE); +} + + +/* Conversions between in-memory and on-disk formats */ + +crash_data_t *load_crash_data_from_crash_dump_dir(struct dump_dir *dd); +struct dump_dir *create_crash_dump_dir(crash_data_t *crash_data); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/report/dump_dir.h b/src/include/report/dump_dir.h new file mode 100644 index 00000000..8cec9459 --- /dev/null +++ b/src/include/report/dump_dir.h @@ -0,0 +1,68 @@ +/* + On-disk storage of crash dumps + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) + 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 DUMP_DIR_H_ +#define DUMP_DIR_H_ + +/* For DIR */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + DD_FAIL_QUIETLY = (1 << 0), +}; + +struct dump_dir { + char *dd_dir; + DIR *next_dir; + int locked; + uid_t dd_uid; + gid_t dd_gid; +}; + +void dd_close(struct dump_dir *dd); + +struct dump_dir *dd_opendir(const char *dir, int flags); +struct dump_dir *dd_create(const char *dir, uid_t uid); +int dd_exist(struct dump_dir *dd, const char *path); +DIR *dd_init_next_file(struct dump_dir *dd); +int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name); + +enum { + /* DD_FAIL_QUIETLY bit is valid for dd_load_text_ext too, */ + DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (1 << 1), +}; +char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags); +char* dd_load_text(const struct dump_dir *dd, const char *name); +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_crash_dump_dir(const char *dd_dir); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/report/run_event.h b/src/include/report/run_event.h new file mode 100644 index 00000000..c2e34650 --- /dev/null +++ b/src/include/report/run_event.h @@ -0,0 +1,48 @@ +/* + 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 RUN_EVENT_H_ +#define RUN_EVENT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct dump_dir; + +struct run_event_state { + int (*post_run_callback)(const char *dump_dir_name, void *param); + void *post_run_param; + char* (*logging_callback)(char *log_line, void *param); + void *logging_param; +}; +struct run_event_state *new_run_event_state(void); +void free_run_event_state(struct run_event_state *state); + +/* Returns exitcode of first failed action, or first nonzero return value + * of post_run_callback. If all actions are successful, returns 0. + * If no actions were run for the event, returns -1. + */ +int run_event(struct run_event_state *state, const char *dump_dir_name, const char *event); +char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/run_event.h b/src/include/run_event.h deleted file mode 100644 index c2e34650..00000000 --- a/src/include/run_event.h +++ /dev/null @@ -1,48 +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 RUN_EVENT_H_ -#define RUN_EVENT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -struct dump_dir; - -struct run_event_state { - int (*post_run_callback)(const char *dump_dir_name, void *param); - void *post_run_param; - char* (*logging_callback)(char *log_line, void *param); - void *logging_param; -}; -struct run_event_state *new_run_event_state(void); -void free_run_event_state(struct run_event_state *state); - -/* Returns exitcode of first failed action, or first nonzero return value - * of post_run_callback. If all actions are successful, returns 0. - * If no actions were run for the event, returns -1. - */ -int run_event(struct run_event_state *state, const char *dump_dir_name, const char *event); -char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx); - -#ifdef __cplusplus -} -#endif - -#endif -- cgit