richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
1abbee
From 1b84db099fc619719026679236a9db0199fd129a Mon Sep 17 00:00:00 2001
1abbee
From: Lennart Poettering <lennart@poettering.net>
1abbee
Date: Tue, 19 May 2015 00:24:27 +0200
1abbee
Subject: [PATCH] journalctl: rename boot_id_t to BootId
1abbee
1abbee
So far we tried to reserve the _t suffix to types we use like a value in
1abbee
contrast to types we use as objects, hence let's do this in journalctl
1abbee
too.
1abbee
1abbee
Cherry-picked from: 45bc27b621c51b9d0e0229835deb6d188bcd417b
1abbee
Related: #1318994
1abbee
---
1abbee
 src/journal/journalctl.c | 42 +++++++++++++++++++++++-------------------
1abbee
 1 file changed, 23 insertions(+), 19 deletions(-)
1abbee
1abbee
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
181b3f
index 92ee3fb27..e84dd4c9d 100644
1abbee
--- a/src/journal/journalctl.c
1abbee
+++ b/src/journal/journalctl.c
1abbee
@@ -128,12 +128,12 @@ static enum {
1abbee
         ACTION_VACUUM,
1abbee
 } arg_action = ACTION_SHOW;
1abbee
 
1abbee
-typedef struct boot_id_t {
1abbee
+typedef struct BootId {
1abbee
         sd_id128_t id;
1abbee
         uint64_t first;
1abbee
         uint64_t last;
1abbee
-        LIST_FIELDS(struct boot_id_t, boot_list);
1abbee
-} boot_id_t;
1abbee
+        LIST_FIELDS(struct BootId, boot_list);
1abbee
+} BootId;
1abbee
 
1abbee
 static int add_matches_for_device(sd_journal *j, const char *devpath) {
1abbee
         int r;
1abbee
@@ -934,13 +934,15 @@ static int add_matches(sd_journal *j, char **args) {
1abbee
         return 0;
1abbee
 }
1abbee
 
1abbee
-static int discover_next_boot(sd_journal *j,
1abbee
-                              boot_id_t **boot,
1abbee
-                              bool advance_older,
1abbee
-                              bool read_realtime) {
1abbee
+static int discover_next_boot(
1abbee
+                sd_journal *j,
1abbee
+                BootId **boot,
1abbee
+                bool advance_older,
1abbee
+                bool read_realtime) {
1abbee
+
1abbee
         int r;
1abbee
         char match[9+32+1] = "_BOOT_ID=";
1abbee
-        _cleanup_free_ boot_id_t *next_boot = NULL;
1abbee
+        _cleanup_free_ BootId *next_boot = NULL;
1abbee
 
1abbee
         assert(j);
1abbee
         assert(boot);
1abbee
@@ -965,7 +967,7 @@ static int discover_next_boot(sd_journal *j,
1abbee
         else if (r == 0)
1abbee
                 return 0; /* End of journal, yay. */
1abbee
 
1abbee
-        next_boot = new0(boot_id_t, 1);
1abbee
+        next_boot = new0(BootId, 1);
1abbee
         if (!next_boot)
1abbee
                 return log_oom();
1abbee
 
1abbee
@@ -1012,13 +1014,15 @@ static int discover_next_boot(sd_journal *j,
1abbee
         return 0;
1abbee
 }
1abbee
 
1abbee
-static int get_boots(sd_journal *j,
1abbee
-                     boot_id_t **boots,
1abbee
-                     boot_id_t *query_ref_boot,
1abbee
-                     int ref_boot_offset) {
1abbee
+static int get_boots(
1abbee
+                sd_journal *j,
1abbee
+                BootId **boots,
1abbee
+                BootId *query_ref_boot,
1abbee
+                int ref_boot_offset) {
1abbee
+
1abbee
         bool skip_once;
1abbee
         int r, count = 0;
1abbee
-        boot_id_t *head = NULL, *tail = NULL;
1abbee
+        BootId *head = NULL, *tail = NULL;
1abbee
         const bool advance_older = query_ref_boot && ref_boot_offset <= 0;
1abbee
 
1abbee
         assert(j);
1abbee
@@ -1073,12 +1077,12 @@ static int get_boots(sd_journal *j,
1abbee
                 /* No sd_journal_next/previous here. */
1abbee
         }
1abbee
 
1abbee
-        while (true) {
1abbee
-                _cleanup_free_ boot_id_t *current = NULL;
1abbee
+        for (;;) {
1abbee
+                _cleanup_free_ BootId *current = NULL;
1abbee
 
1abbee
                 r = discover_next_boot(j, &current, advance_older, !query_ref_boot);
1abbee
                 if (r < 0) {
1abbee
-                        boot_id_t *id, *id_next;
1abbee
+                        BootId *id, *id_next;
1abbee
                         LIST_FOREACH_SAFE(boot_list, id, id_next, head)
1abbee
                                 free(id);
1abbee
                         return r;
1abbee
@@ -1116,7 +1120,7 @@ finish:
1abbee
 
1abbee
 static int list_boots(sd_journal *j) {
1abbee
         int w, i, count;
1abbee
-        boot_id_t *id, *id_next, *all_ids;
1abbee
+        BootId *id, *id_next, *all_ids;
1abbee
 
1abbee
         assert(j);
1abbee
 
1abbee
@@ -1148,7 +1152,7 @@ static int list_boots(sd_journal *j) {
1abbee
 static int add_boot(sd_journal *j) {
1abbee
         char match[9+32+1] = "_BOOT_ID=";
1abbee
         int r;
1abbee
-        boot_id_t ref_boot_id = {};
1abbee
+        BootId ref_boot_id = {};
1abbee
 
1abbee
         assert(j);
1abbee