summaryrefslogtreecommitdiff
path: root/src/shared/machine-image.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-11 17:24:08 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:33 +0200
commitd94c2b06f9800d635f3cb05b4a6c67145aa1ba09 (patch)
tree35bbd746d0e8ec646c66e39b63d9a15d9824412b /src/shared/machine-image.h
parentd5bd92bbbe578d96b3905832cd3ccdb9249e620c (diff)
machinectl: add new "machinectl clean" command
This new command removes all, or all hidden container images that have been downloaded.
Diffstat (limited to 'src/shared/machine-image.h')
-rw-r--r--src/shared/machine-image.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/shared/machine-image.h b/src/shared/machine-image.h
index 31b720d50c..7410168c4f 100644
--- a/src/shared/machine-image.h
+++ b/src/shared/machine-image.h
@@ -25,6 +25,8 @@
#include "hashmap.h"
#include "lockfile-util.h"
#include "macro.h"
+#include "path-util.h"
+#include "string-util.h"
#include "time-util.h"
typedef enum ImageType {
@@ -75,3 +77,27 @@ int image_path_lock(const char *path, int operation, LockFile *global, LockFile
int image_name_lock(const char *name, int operation, LockFile *ret);
int image_set_limit(Image *i, uint64_t referenced_max);
+
+static inline bool IMAGE_IS_HIDDEN(const struct Image *i) {
+ assert(i);
+
+ return i->name && i->name[0] == '.';
+}
+
+static inline bool IMAGE_IS_VENDOR(const struct Image *i) {
+ assert(i);
+
+ return i->path && path_startswith(i->path, "/usr");
+}
+
+static inline bool IMAGE_IS_HOST(const struct Image *i) {
+ assert(i);
+
+ if (i->name && streq(i->name, ".host"))
+ return true;
+
+ if (i->path && path_equal(i->path, "/"))
+ return true;
+
+ return false;
+}