From: Maxim Storchak <[email protected]>

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 <[email protected]>
---
 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


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to