1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright 2015 Lennart Poettering
12 typedef enum RemoveFlags {
13 REMOVE_ONLY_DIRECTORIES = 1 << 0,
15 REMOVE_PHYSICAL = 1 << 2, /* if not set, only removes files on tmpfs, never physical file systems */
16 REMOVE_SUBVOLUME = 1 << 3,
19 int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev);
20 int rm_rf(const char *path, RemoveFlags flags);
22 /* Useful for usage with _cleanup_(), destroys a directory and frees the pointer */
23 static inline void rm_rf_physical_and_free(char *p) {
25 (void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
28 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, rm_rf_physical_and_free);