summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-authenticate.c2
-rw-r--r--src/journal/journal-def.h2
-rw-r--r--src/journal/journal-file.c10
-rw-r--r--src/journal/journal-verify.c8
-rw-r--r--src/journal/sd-journal.c6
5 files changed, 14 insertions, 14 deletions
diff --git a/src/journal/journal-authenticate.c b/src/journal/journal-authenticate.c
index fd3b82134f..0e31c8dc91 100644
--- a/src/journal/journal-authenticate.c
+++ b/src/journal/journal-authenticate.c
@@ -246,7 +246,7 @@ int journal_file_hmac_put_object(JournalFile *f, int type, Object *o, uint64_t p
if (r < 0)
return r;
} else {
- if (type > 0 && o->object.type != type)
+ if (type > OBJECT_UNUSED && o->object.type != type)
return -EBADMSG;
}
diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h
index e55fa196f2..005e5fa149 100644
--- a/src/journal/journal-def.h
+++ b/src/journal/journal-def.h
@@ -53,7 +53,7 @@ typedef struct FSSHeader FSSHeader;
/* Object types */
enum {
- OBJECT_UNUSED,
+ OBJECT_UNUSED, /* also serves as "any type" or "additional context" */
OBJECT_DATA,
OBJECT_FIELD,
OBJECT_ENTRY,
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 4632326d4f..6ee0fff04c 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -376,7 +376,7 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
static unsigned type_to_context(int type) {
/* One context for each type, plus one catch-all for the rest */
- return type > 0 && type < _OBJECT_TYPE_MAX ? type : 0;
+ return type > OBJECT_UNUSED && type < _OBJECT_TYPE_MAX ? type : 0;
}
static int journal_file_move_to(JournalFile *f, int context, bool keep_always, uint64_t offset, uint64_t size, void **ret) {
@@ -446,7 +446,7 @@ int journal_file_move_to_object(JournalFile *f, int type, uint64_t offset, Objec
if (s < minimum_header_size(o))
return -EBADMSG;
- if (type > 0 && o->object.type != type)
+ if (type > OBJECT_UNUSED && o->object.type != type)
return -EBADMSG;
if (s > sizeof(ObjectHeader)) {
@@ -494,7 +494,7 @@ int journal_file_append_object(JournalFile *f, int type, uint64_t size, Object *
void *t;
assert(f);
- assert(type > 0 && type < _OBJECT_TYPE_MAX);
+ assert(type > OBJECT_UNUSED && type < _OBJECT_TYPE_MAX);
assert(size >= sizeof(ObjectHeader));
assert(offset);
assert(ret);
@@ -507,7 +507,7 @@ int journal_file_append_object(JournalFile *f, int type, uint64_t size, Object *
if (p == 0)
p = le64toh(f->header->header_size);
else {
- r = journal_file_move_to_object(f, -1, p, &tail);
+ r = journal_file_move_to_object(f, OBJECT_UNUSED, p, &tail);
if (r < 0)
return r;
@@ -2294,7 +2294,7 @@ void journal_file_dump(JournalFile *f) {
p = le64toh(f->header->header_size);
while (p != 0) {
- r = journal_file_move_to_object(f, -1, p, &o);
+ r = journal_file_move_to_object(f, OBJECT_UNUSED, p, &o);
if (r < 0)
goto fail;
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index 75792a5a60..b03335ef31 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -865,7 +865,7 @@ int journal_file_verify(
if (show_progress)
draw_progress(0x7FFF * p / le64toh(f->header->tail_object_offset), &last_usec);
- r = journal_file_move_to_object(f, -1, p, &o);
+ r = journal_file_move_to_object(f, OBJECT_UNUSED, p, &o);
if (r < 0) {
error(p, "invalid object");
goto fail;
@@ -1085,11 +1085,11 @@ int journal_file_verify(
q = last_tag;
while (q <= p) {
- r = journal_file_move_to_object(f, -1, q, &o);
+ r = journal_file_move_to_object(f, OBJECT_UNUSED, q, &o);
if (r < 0)
goto fail;
- r = journal_file_hmac_put_object(f, -1, o, q);
+ r = journal_file_hmac_put_object(f, OBJECT_UNUSED, o, q);
if (r < 0)
goto fail;
@@ -1097,7 +1097,7 @@ int journal_file_verify(
}
/* Position might have changed, let's reposition things */
- r = journal_file_move_to_object(f, -1, p, &o);
+ r = journal_file_move_to_object(f, OBJECT_UNUSED, p, &o);
if (r < 0)
goto fail;
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 028060d348..be08a92b76 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -2588,10 +2588,10 @@ _public_ int sd_journal_enumerate_unique(sd_journal *j, const void **data, size_
continue;
}
- /* We do not use the type context here, but 0 instead,
- * so that we can look at this data object at the same
+ /* We do not use OBJECT_DATA context here, but OBJECT_UNUSED
+ * instead, so that we can look at this data object at the same
* time as one on another file */
- r = journal_file_move_to_object(j->unique_file, 0, j->unique_offset, &o);
+ r = journal_file_move_to_object(j->unique_file, OBJECT_UNUSED, j->unique_offset, &o);
if (r < 0)
return r;