1 /*
2 * lsfd-counter.h - counter implementation used in --summary option
3 *
4 * Copyright (C) 2021 Red Hat, Inc.
5 * Copyright (C) 2021 Masatake YAMATO <yamato@redhat.com>
6 *
7 * This file may be redistributed under the terms of the
8 * GNU Lesser General Public License.
9 */
10 #ifndef UTIL_LINUX_LSFD_COUNTER_H
11 #define UTIL_LINUX_LSFD_COUNTER_H
12
13 #include "libsmartcols.h"
14 #include "lsfd-filter.h"
15 #include <stdbool.h>
16
17 struct lsfd_counter;
18
19 /* The created counter takes the ownership of the filter; the filter is
20 * freed in lsfd_counter_free().
21 */
22 struct lsfd_counter *lsfd_counter_new(const char *const name, struct lsfd_filter *filter);
23 void lsfd_counter_free(struct lsfd_counter *counter);
24
25 bool lsfd_counter_accumulate(struct lsfd_counter *counter, struct libscols_line *ln);
26
27 const char *lsfd_counter_name(struct lsfd_counter *counter);
28 size_t lsfd_counter_value(struct lsfd_counter *counter);
29
30 #endif /* UTIL_LINUX_LSFD_COUNTER_H */