From 4506916ad328499f14233b30c6e251512af907f4 Mon Sep 17 00:00:00 2001 From: Masahide NAKAMURA Date: Mon, 28 Aug 2006 11:31:47 +0900 Subject: [PATCH] [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 --- 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(-) diff --git a/include/net/xfrm.h b/include/net/xfrm.h index a5f80bf..f7dc2df 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -920,6 +920,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 @@ # Makefile for the XFRM subsystem. # 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 e5a3be0..727622d 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -2411,6 +2411,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 + * + * 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 +#include + +#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.4.3.GIT