From 92e204969e72a6650e8657cfaf2be6ad0fba5e44 Mon Sep 17 00:00:00 2001
From: Masahide NAKAMURA <nakam@linux-ipv6.org>
Date: Mon, 28 Aug 2006 11:31:47 +0900
Subject: [PATCH] [XFRM]: Introduce proc interface.

This is a proc interface platform.
New directory /proc/net/xfrm is added as transformation proc
interface holder.

Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
---
 include/net/xfrm.h     |    1 +
 net/xfrm/Makefile      |    2 +-
 net/xfrm/xfrm_policy.c |    1 +
 net/xfrm/xfrm_proc.c   |   39 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 42 insertions(+), 1 deletions(-)
 create mode 100644 net/xfrm/xfrm_proc.c

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 8d05ace..b0d39e9 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -910,6 +910,7 @@ extern void xfrm_state_init(void);
 extern void xfrm4_state_init(void);
 extern void xfrm6_state_init(void);
 extern void xfrm6_state_fini(void);
+extern int xfrm_proc_init(void);
 
 extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *);
 extern struct xfrm_state *xfrm_state_alloc(void);
diff --git a/net/xfrm/Makefile b/net/xfrm/Makefile
index de3c1a6..2d97a18 100644
--- a/net/xfrm/Makefile
+++ b/net/xfrm/Makefile
@@ -3,6 +3,6 @@
 #
 
 obj-$(CONFIG_XFRM) := xfrm_policy.o xfrm_state.o xfrm_hash.o \
-		      xfrm_input.o xfrm_algo.o
+		      xfrm_input.o xfrm_algo.o xfrm_proc.o
 obj-$(CONFIG_XFRM_USER) += xfrm_user.o
 
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 1897753..f5da7f4 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2279,6 +2279,7 @@ void __init xfrm_init(void)
 	xfrm_state_init();
 	xfrm_policy_init();
 	xfrm_input_init();
+	xfrm_proc_init();
 }
 
 #ifdef CONFIG_XFRM_MIGRATE
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c
new file mode 100644
index 0000000..7b55334
--- /dev/null
+++ b/net/xfrm/xfrm_proc.c
@@ -0,0 +1,39 @@
+/*
+ * Author:	Masahide NAKAMURA <nakam@linux-ipv6.org>
+ *
+ *		This program is free software; you can redistribute it and/or
+ *		modify it under the terms of the GNU General Public License
+ *		as published by the Free Software Foundation; either version
+ *		2 of the License, or (at your option) any later version.
+ */
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+
+#ifdef CONFIG_PROC_FS
+
+static struct proc_dir_entry *proc_net_xfrm;
+
+int __init xfrm_proc_init(void)
+{
+	int rc = 0;
+
+	proc_net_xfrm = proc_mkdir("xfrm", proc_net);
+	if (!proc_net_xfrm)
+		goto proc_net_xfrm_fail;
+
+ out:
+	return rc;
+
+ proc_net_xfrm_fail:
+	rc = -ENOMEM;
+	goto out;
+}
+
+#if 0
+void xfrm_proc_exit(void)
+{
+	remove_proc_entry("xfrm", proc_net);
+}
+#endif
+
+#endif	/* CONFIG_PROC_FS */
-- 
1.5.0.3

