[PATCH] Add SWAP_FLAG_DISCARD symbol for older distros.

Vinson Lee <[email protected]>
Newsgroups org.kernel.vger.trinity
Message-ID <[email protected]>
From: Vinson Lee <[email protected]>

This patch fixes this build error on CentOS 6.

  CC	syscalls/swap.o
syscalls/swap.c:16: error: ‘SWAP_FLAG_DISCARD’ undeclared here (not in a function)

Signed-off-by: Vinson Lee <[email protected]>
---
 include/compat.h |    5 +++++
 syscalls/swap.c  |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/compat.h b/include/compat.h
index 9d3be59..f392258 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -862,3 +862,8 @@ struct kvm_get_htab_fd {
 #ifndef SCHED_DEADLINE
 #define SCHED_DEADLINE 6
 #endif
+
+/* sys/swap.h */
+#ifndef SWAP_FLAG_DISCARD
+#define SWAP_FLAG_DISCARD 0x10000
+#endif
diff --git a/syscalls/swap.c b/syscalls/swap.c
index 7eb9d79..c28a54a 100644
--- a/syscalls/swap.c
+++ b/syscalls/swap.c
@@ -3,6 +3,7 @@
  */
 #include <sys/swap.h>
 #include "sanitise.h"
+#include "compat.h"
 
 struct syscallentry syscall_swapon = {
 	.name = "swapon",
-- 
1.7.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.