Fix dlogutil -t in zero-copy backend 96/282796/1
authorMateusz Majewski <m.majewski2@samsung.com>
Tue, 11 Oct 2022 13:16:50 +0000 (15:16 +0200)
committerMateusz Majewski <m.majewski2@samsung.com>
Tue, 11 Oct 2022 13:18:03 +0000 (15:18 +0200)
The removed code block looks sensible. However, this is actually done
somewhere else (compare the Android Logger backend, which works in a
similar way and doesn't really handle the dump value).

Change-Id: I68161e26bda09833f2a1c20870fa8f4f72c9acaa

src/libdlogutil/fdi_zero_copy.c
src/libdlogutil/fdi_zero_copy.h

index e9d7f84..c0a8020 100644 (file)
@@ -125,7 +125,7 @@ static int zero_copy_prepare_print(struct fd_info *fdi, int dump, bool monitor,
         * so at least reading requires no preparatory steps. */
 
        struct zero_copy_priv_data *const zpd = (struct zero_copy_priv_data *)fdi->priv_data;
-       zpd->dump = monitor ? 0 : dump;
+       zpd->dump = !monitor && dump;
        zpd->monitor = monitor;
        zpd->prev_read_ts = monitor ? get_zlog_clock() : 0;
        zpd->this_read_ts = zpd->prev_read_ts;
@@ -352,12 +352,6 @@ static dlogutil_entry_s *zero_copy_extract_entry(struct fd_info *fdi)
        dlogutil_entry_s *const entry = item->entry;
        free(item);
 
-       if (zpd->dump) {
-               -- zpd->dump;
-               if (!zpd->dump)
-                       free_entry_list(&zpd->items);
-       }
-
        return entry;
 }
 
index fad75d6..849696c 100644 (file)
@@ -37,7 +37,7 @@ struct zero_copy_priv_data {
        uint64_t prev_read_ts;
        uint64_t this_read_ts;
        struct zlog_entry_list *items;
-       int dump;
+       bool dump;
        bool monitor;
        bool eof;
 };