[fstools, 1/4] fstools: block: define swap flags for block and swapon
m.storchak at gmail.com
m.storchak at gmail.com
Wed Jul 23 06:19:16 PDT 2025
From: Maxim Storchak <m.storchak at gmail.com>
Define swap flags according to the kernel definitions:
musl and glibc provide SWAP_FLAG_DISCARD, but not discard policies.
Based on busybox's swaponoff.c
Signed-off-by: Maxim Storchak <m.storchak at gmail.com>
---
block.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/block.c b/block.c
index 37f5bfb..4553ee2 100644
--- a/block.c
+++ b/block.c
@@ -52,6 +52,16 @@
#include "libubi/libubi.h"
#endif
+#ifndef SWAP_FLAG_DISCARD
+#define SWAP_FLAG_DISCARD 0x10000
+#endif
+#ifndef SWAP_FLAG_DISCARD_ONCE
+#define SWAP_FLAG_DISCARD_ONCE 0x20000
+#endif
+#ifndef SWAP_FLAG_DISCARD_PAGES
+#define SWAP_FLAG_DISCARD_PAGES 0x40000
+#endif
+
enum {
TYPE_MOUNT,
TYPE_SWAP,
--
2.50.0
More information about the openwrt-devel
mailing list