summaryrefslogtreecommitdiffstats
path: root/src/coredump/coredump-vacuum.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-16 13:51:58 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-16 14:27:59 +0100
commit450918d1111d03732141a2a41a8f95ad1b73e742 (patch)
treeb3865fb325df6db2c04634116d22571f73845140 /src/coredump/coredump-vacuum.c
parentbasic/capability-util: add missing initialization (diff)
downloadsystemd-450918d1111d03732141a2a41a8f95ad1b73e742.tar.xz
systemd-450918d1111d03732141a2a41a8f95ad1b73e742.zip
coredump: add typedef for struct
Diffstat (limited to 'src/coredump/coredump-vacuum.c')
-rw-r--r--src/coredump/coredump-vacuum.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c
index 30c67ffe7c..2b0a2e5250 100644
--- a/src/coredump/coredump-vacuum.c
+++ b/src/coredump/coredump-vacuum.c
@@ -22,21 +22,20 @@
#define DEFAULT_KEEP_FREE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
#define DEFAULT_KEEP_FREE (uint64_t) (1024ULL*1024ULL) /* 1 MB */
-struct vacuum_candidate {
+typedef struct VacuumCandidate {
unsigned n_files;
char *oldest_file;
usec_t oldest_mtime;
-};
+} VacuumCandidate;
-static void vacuum_candidate_free(struct vacuum_candidate *c) {
+static void vacuum_candidate_free(VacuumCandidate *c) {
if (!c)
return;
free(c->oldest_file);
free(c);
}
-
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct vacuum_candidate*, vacuum_candidate_free);
+DEFINE_TRIVIAL_CLEANUP_FUNC(VacuumCandidate*, vacuum_candidate_free);
static void vacuum_candidate_hashmap_free(Hashmap *h) {
hashmap_free_with_destructor(h, vacuum_candidate_free);
@@ -142,14 +141,14 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
for (;;) {
_cleanup_(vacuum_candidate_hashmap_freep) Hashmap *h = NULL;
- struct vacuum_candidate *worst = NULL;
+ VacuumCandidate *worst = NULL;
struct dirent *de;
uint64_t sum = 0;
rewinddir(d);
FOREACH_DIRENT(de, d, goto fail) {
- struct vacuum_candidate *c;
+ VacuumCandidate *c;
struct stat st;
uid_t uid;
usec_t t;
@@ -196,9 +195,9 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
}
} else {
- _cleanup_(vacuum_candidate_freep) struct vacuum_candidate *n = NULL;
+ _cleanup_(vacuum_candidate_freep) VacuumCandidate *n = NULL;
- n = new0(struct vacuum_candidate, 1);
+ n = new0(VacuumCandidate, 1);
if (!n)
return log_oom();