summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-01-12 17:31:57 +0000
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-01-12 17:31:57 +0000
commitf2eceb5268f0d26d53db5f9dad318dd45fd900bd (patch)
treef18701f79b88df69d0b8a4791e8bf7472c3e2c68
parenta1a03fa54bfb45315eefaa49ceb38a21aceafde8 (diff)
downloadsystemd-f2eceb5268f0d26d53db5f9dad318dd45fd900bd.tar.gz
journal: Remove unused arguments from journal_file_next_entry_for_data()
-rw-r--r--src/journal/test-journal.c8
-rw-r--r--src/libsystemd/sd-journal/journal-file.c32
-rw-r--r--src/libsystemd/sd-journal/journal-file.h2
-rw-r--r--src/libsystemd/sd-journal/sd-journal.c6
4 files changed, 9 insertions, 39 deletions
diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c
index 11647504e9..3afe66db89 100644
--- a/src/journal/test-journal.c
+++ b/src/journal/test-journal.c
@@ -76,17 +76,17 @@ static void test_non_empty(void) {
assert_se(le64toh(o->entry.seqnum) == 1);
assert_se(journal_file_find_data_object(f->file, test, strlen(test), NULL, &p) == 1);
- assert_se(journal_file_next_entry_for_data(f->file, NULL, 0, p, DIRECTION_DOWN, &o, NULL) == 1);
+ assert_se(journal_file_next_entry_for_data(f->file, p, DIRECTION_DOWN, &o, NULL) == 1);
assert_se(le64toh(o->entry.seqnum) == 1);
- assert_se(journal_file_next_entry_for_data(f->file, NULL, 0, p, DIRECTION_UP, &o, NULL) == 1);
+ assert_se(journal_file_next_entry_for_data(f->file, p, DIRECTION_UP, &o, NULL) == 1);
assert_se(le64toh(o->entry.seqnum) == 3);
assert_se(journal_file_find_data_object(f->file, test2, strlen(test2), NULL, &p) == 1);
- assert_se(journal_file_next_entry_for_data(f->file, NULL, 0, p, DIRECTION_UP, &o, NULL) == 1);
+ assert_se(journal_file_next_entry_for_data(f->file, p, DIRECTION_UP, &o, NULL) == 1);
assert_se(le64toh(o->entry.seqnum) == 2);
- assert_se(journal_file_next_entry_for_data(f->file, NULL, 0, p, DIRECTION_DOWN, &o, NULL) == 1);
+ assert_se(journal_file_next_entry_for_data(f->file, p, DIRECTION_DOWN, &o, NULL) == 1);
assert_se(le64toh(o->entry.seqnum) == 2);
assert_se(journal_file_find_data_object(f->file, "quux", 4, NULL, &p) == 0);
diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c
index 505e4f728d..22b848d2f3 100644
--- a/src/libsystemd/sd-journal/journal-file.c
+++ b/src/libsystemd/sd-journal/journal-file.c
@@ -2810,7 +2810,6 @@ int journal_file_next_entry(
int journal_file_next_entry_for_data(
JournalFile *f,
- Object *o, uint64_t p,
uint64_t data_offset,
direction_t direction,
Object **ret, uint64_t *ret_offset) {
@@ -2820,7 +2819,6 @@ int journal_file_next_entry_for_data(
int r;
assert(f);
- assert(p > 0 || !o);
r = journal_file_move_to_object(f, OBJECT_DATA, data_offset, &d);
if (r < 0)
@@ -2830,29 +2828,7 @@ int journal_file_next_entry_for_data(
if (n <= 0)
return n;
- if (!o)
- i = direction == DIRECTION_DOWN ? 0 : n - 1;
- else {
- if (o->object.type != OBJECT_ENTRY)
- return -EINVAL;
-
- r = generic_array_bisect_plus_one(f,
- le64toh(d->data.entry_offset),
- le64toh(d->data.entry_array_offset),
- le64toh(d->data.n_entries),
- p,
- test_object_offset,
- DIRECTION_DOWN,
- NULL, NULL,
- &i);
-
- if (r <= 0)
- return r;
-
- r = bump_array_index(&i, direction, n);
- if (r <= 0)
- return r;
- }
+ i = direction == DIRECTION_DOWN ? 0 : n - 1;
for (;;) {
r = generic_array_get_plus_one(f,
@@ -2872,12 +2848,6 @@ int journal_file_next_entry_for_data(
return r;
}
- /* Ensure our array is properly ordered. */
- if (p > 0 && check_properly_ordered(ofs, p, direction))
- return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
- "%s data entry array not properly ordered at entry %" PRIu64,
- f->path, i);
-
if (ret_offset)
*ret_offset = ofs;
diff --git a/src/libsystemd/sd-journal/journal-file.h b/src/libsystemd/sd-journal/journal-file.h
index b90e3a608a..39e91d71c4 100644
--- a/src/libsystemd/sd-journal/journal-file.h
+++ b/src/libsystemd/sd-journal/journal-file.h
@@ -214,7 +214,7 @@ void journal_file_save_location(JournalFile *f, Object *o, uint64_t offset);
int journal_file_compare_locations(JournalFile *af, JournalFile *bf);
int journal_file_next_entry(JournalFile *f, uint64_t p, direction_t direction, Object **ret, uint64_t *offset);
-int journal_file_next_entry_for_data(JournalFile *f, Object *o, uint64_t p, uint64_t data_offset, direction_t direction, Object **ret, uint64_t *offset);
+int journal_file_next_entry_for_data(JournalFile *f, uint64_t data_offset, direction_t direction, Object **ret, uint64_t *offset);
int journal_file_move_to_entry_by_seqnum(JournalFile *f, uint64_t seqnum, direction_t direction, Object **ret, uint64_t *offset);
int journal_file_move_to_entry_by_realtime(JournalFile *f, uint64_t realtime, direction_t direction, Object **ret, uint64_t *offset);
diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
index f51ecbfc53..166ea5155f 100644
--- a/src/libsystemd/sd-journal/sd-journal.c
+++ b/src/libsystemd/sd-journal/sd-journal.c
@@ -611,9 +611,9 @@ static int find_location_for_match(
/* FIXME: missing: find by monotonic */
if (j->current_location.type == LOCATION_HEAD)
- return journal_file_next_entry_for_data(f, NULL, 0, dp, DIRECTION_DOWN, ret, offset);
+ return journal_file_next_entry_for_data(f, dp, DIRECTION_DOWN, ret, offset);
if (j->current_location.type == LOCATION_TAIL)
- return journal_file_next_entry_for_data(f, NULL, 0, dp, DIRECTION_UP, ret, offset);
+ return journal_file_next_entry_for_data(f, dp, DIRECTION_UP, ret, offset);
if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
return journal_file_move_to_entry_by_seqnum_for_data(f, dp, j->current_location.seqnum, direction, ret, offset);
if (j->current_location.monotonic_set) {
@@ -624,7 +624,7 @@ static int find_location_for_match(
if (j->current_location.realtime_set)
return journal_file_move_to_entry_by_realtime_for_data(f, dp, j->current_location.realtime, direction, ret, offset);
- return journal_file_next_entry_for_data(f, NULL, 0, dp, direction, ret, offset);
+ return journal_file_next_entry_for_data(f, dp, direction, ret, offset);
} else if (m->type == MATCH_OR_TERM) {
uint64_t np = 0;