richardphibel / rpms / systemd

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