summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsfd-counter.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:30:35 +0000
commit378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch)
tree44dfb6ca500d32cabd450649b322a42e70a30683 /misc-utils/lsfd-counter.h
parentInitial commit. (diff)
downloadutil-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.tar.xz
util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.zip
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'misc-utils/lsfd-counter.h')
-rw-r--r--misc-utils/lsfd-counter.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/misc-utils/lsfd-counter.h b/misc-utils/lsfd-counter.h
new file mode 100644
index 0000000..bac11a9
--- /dev/null
+++ b/misc-utils/lsfd-counter.h
@@ -0,0 +1,30 @@
+/*
+ * lsfd-counter.h - counter implementation used in --summary option
+ *
+ * Copyright (C) 2021 Red Hat, Inc.
+ * Copyright (C) 2021 Masatake YAMATO <yamato@redhat.com>
+ *
+ * This file may be redistributed under the terms of the
+ * GNU Lesser General Public License.
+ */
+#ifndef UTIL_LINUX_LSFD_COUNTER_H
+#define UTIL_LINUX_LSFD_COUNTER_H
+
+#include "libsmartcols.h"
+#include "lsfd-filter.h"
+#include <stdbool.h>
+
+struct lsfd_counter;
+
+/* The created counter takes the ownership of the filter; the filter is
+ * freed in lsfd_counter_free().
+ */
+struct lsfd_counter *lsfd_counter_new(const char *const name, struct lsfd_filter *filter);
+void lsfd_counter_free(struct lsfd_counter *counter);
+
+bool lsfd_counter_accumulate(struct lsfd_counter *counter, struct libscols_line *ln);
+
+const char *lsfd_counter_name(struct lsfd_counter *counter);
+size_t lsfd_counter_value(struct lsfd_counter *counter);
+
+#endif /* UTIL_LINUX_LSFD_COUNTER_H */