unsigned n_matches;
};
+static void reset_location(sd_journal *j) {
+ Iterator i;
+ JournalFile *f;
+
+ assert(j);
+
+ j->current_file = NULL;
+ j->current_field = 0;
+
+ HASHMAP_FOREACH(f, j->files, i)
+ f->current_offset = 0;
+}
+
int sd_journal_add_match(sd_journal *j, const void *data, size_t size) {
Match *m;
LIST_PREPEND(Match, matches, j->matches, m);
j->n_matches ++;
+ reset_location(j);
+
return 0;
}
}
j->n_matches = 0;
+
+ reset_location(j);
}
static int compare_order(JournalFile *af, Object *ao, uint64_t ap,
}
-int sd_journal_get_field(sd_journal *j, const char *field, const void **data, size_t *size) {
+int sd_journal_get_data(sd_journal *j, const char *field, const void **data, size_t *size) {
JournalFile *f;
uint64_t i, n;
size_t field_length;
return 0;
}
-int sd_journal_iterate_fields(sd_journal *j, const void **data, size_t *size) {
+int sd_journal_enumerate_data(sd_journal *j, const void **data, size_t *size) {
JournalFile *f;
uint64_t p, l, n, h;
size_t t;
return 1;
}
+void sd_journal_start_data(sd_journal *j) {
+ assert(j);
+
+ j->current_field = 0;
+}
+
int sd_journal_seek_head(sd_journal *j) {
assert(j);
- return -EINVAL;
+
+ reset_location(j);
+
+ return real_journal_next(j, DIRECTION_DOWN);
}
int sd_journal_seek_tail(sd_journal *j) {
assert(j);
- return -EINVAL;
+
+ reset_location(j);
+
+ return real_journal_next(j, DIRECTION_UP);
}