chiark / gitweb /
machined,machinectl: add calls for changing container/VM quotas
[elogind.git] / src / shared / machine-image.c
index 8d61507e8494c55ed1257de34c07690456085302..c6d2850ad2dcf9d901f3dce0f5ffe4d6b1a1e4f3 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/fs.h>
 #include <fcntl.h>
 
-#include "strv.h"
 #include "utf8.h"
 #include "btrfs-util.h"
 #include "path-util.h"
@@ -614,6 +613,19 @@ int image_path_lock(const char *path, int operation, LockFile *global, LockFile
         return 0;
 }
 
+int image_set_limit(Image *i, uint64_t referred_max) {
+        assert(i);
+
+        if (path_equal(i->path, "/") ||
+            path_startswith(i->path, "/usr"))
+                return -EROFS;
+
+        if (i->type != IMAGE_SUBVOLUME)
+                return -ENOTSUP;
+
+        return btrfs_quota_limit(i->path, referred_max);
+}
+
 int image_name_lock(const char *name, int operation, LockFile *ret) {
         const char *p;