21 #ifndef LIBREPORT_DUMP_DIR_H_
22 #define LIBREPORT_DUMP_DIR_H_
25 #include <sys/types.h>
36 int create_symlink_lockfile(
const char *filename,
const char *pid_str);
39 DD_FAIL_QUIETLY_ENOENT = (1 << 0),
40 DD_FAIL_QUIETLY_EACCES = (1 << 1),
42 DD_OPEN_FOLLOW = (1 << 2),
43 DD_OPEN_READONLY = (1 << 3),
44 DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (1 << 4),
45 DD_DONT_WAIT_FOR_LOCK = (1 << 5),
62 struct dump_dir *dd_opendir(
const char *dir,
int flags);
66 struct dump_dir *dd_create(
const char *dir, uid_t uid, mode_t mode);
68 void dd_create_basic_files(
struct dump_dir *dd, uid_t uid,
const char *chroot_dir);
69 int dd_exist(
const struct dump_dir *dd,
const char *path);
70 void dd_sanitize_mode_and_owner(
struct dump_dir *dd);
72 DIR *dd_init_next_file(
struct dump_dir *dd);
73 int dd_get_next_file(
struct dump_dir *dd,
char **short_name,
char **full_name);
75 char* dd_load_text_ext(
const struct dump_dir *dd,
const char *name,
unsigned flags);
76 char* dd_load_text(
const struct dump_dir *dd,
const char *name);
77 void dd_save_text(
struct dump_dir *dd,
const char *name,
const char *data);
78 void dd_save_binary(
struct dump_dir *dd,
const char *name,
const char *data,
unsigned size);
83 long dd_get_item_size(
struct dump_dir *dd,
const char *name);
88 int dd_delete_item(
struct dump_dir *dd,
const char *name);
91 int dd_rename(
struct dump_dir *dd,
const char *new_path);
100 int dd_chown(
struct dump_dir *dd, uid_t new_uid);
104 #define add_reported_to_data libreport_add_reported_to_data
105 int add_reported_to_data(
char **reported_to,
const char *line);
106 #define add_reported_to libreport_add_reported_to
107 void add_reported_to(
struct dump_dir *dd,
const char *line);
118 #define free_report_result libreport_free_report_result
120 #define find_in_reported_to_data libreport_find_in_reported_to_data
121 report_result_t *find_in_reported_to_data(
const char *reported_to,
const char *report_label);
122 #define find_in_reported_to libreport_find_in_reported_to
124 #define read_entire_reported_to_data libreport_read_entire_reported_to_data
125 GList *read_entire_reported_to_data(
const char* reported_to);
126 #define read_entire_reported_to libreport_read_entire_reported_to
127 GList *read_entire_reported_to(
struct dump_dir *dd);
130 void delete_dump_dir(
const char *dirname);
138 int dump_dir_accessible_by_uid(
const char *dirname, uid_t uid);
141 DD_STAT_ACCESSIBLE_BY_UID = 1,
142 DD_STAT_OWNED_BY_UID = DD_STAT_ACCESSIBLE_BY_UID << 1,
152 int dump_dir_stat_for_uid(
const char *dirname, uid_t uid);
160 int dd_mark_as_notreportable(
struct dump_dir *dd,
const char *reason);