chiark / gitweb /
core: loopback - simplify check_loopback()
[elogind.git] / src / journal / journal-file.c
index 35f3ea92a4c92906c96c61f73f85da4bb3226ea5..48c27ee627a503f169697e2bb4f967eeb6e9de62 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/statvfs.h>
 #include <fcntl.h>
 #include <stddef.h>
-#include <sys/xattr.h>
 
 #include "journal-def.h"
 #include "journal-file.h"
@@ -2003,7 +2002,7 @@ int journal_file_compare_locations(JournalFile *af, JournalFile *bf) {
 
 int journal_file_next_entry(
                 JournalFile *f,
-                Object *o, uint64_t p,
+                uint64_t p,
                 direction_t direction,
                 Object **ret, uint64_t *offset) {
 
@@ -2011,18 +2010,14 @@ int journal_file_next_entry(
         int r;
 
         assert(f);
-        assert(p > 0 || !o);
 
         n = le64toh(f->header->n_entries);
         if (n <= 0)
                 return 0;
 
-        if (!o)
+        if (p == 0)
                 i = direction == DIRECTION_DOWN ? 0 : n - 1;
         else {
-                if (o->object.type != OBJECT_ENTRY)
-                        return -EINVAL;
-
                 r = generic_array_bisect(f,
                                          le64toh(f->header->entry_array_offset),
                                          le64toh(f->header->n_entries),
@@ -2530,8 +2525,6 @@ int journal_file_open(
         }
 
         if (f->last_stat.st_size == 0 && f->writable) {
-                uint64_t crtime;
-
                 /* Let's attach the creation time to the journal file,
                  * so that the vacuuming code knows the age of this
                  * file even if the file might end up corrupted one
@@ -2542,8 +2535,7 @@ int journal_file_open(
                  * attributes are not supported we'll just skip this,
                  * and rely solely on mtime/atime/ctime of the file. */
 
-                crtime = htole64((uint64_t) now(CLOCK_REALTIME));
-                fsetxattr(f->fd, "user.crtime_usec", &crtime, sizeof(crtime), XATTR_CREATE);
+                fd_setcrtime(f->fd, now(CLOCK_REALTIME));
 
 #ifdef HAVE_GCRYPT
                 /* Try to load the FSPRG state, and if we can't, then