[KEY]: Clean up proc files creation a bit.

Mainly this removes ifdef-s from inside the ipsec_pfkey_init.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Pavel Emelyanov and committed by
David S. Miller
61145aa1 0efeaa33

+27 -8
+27 -8
net/key/af_key.c
··· 3782 3782 3783 3783 return len; 3784 3784 } 3785 + 3786 + static int pfkey_init_proc(void) 3787 + { 3788 + if (create_proc_read_entry("pfkey", 0, init_net.proc_net, 3789 + pfkey_read_proc, NULL) == NULL) 3790 + return -ENOMEM; 3791 + else 3792 + return 0; 3793 + } 3794 + 3795 + static void pfkey_exit_proc(void) 3796 + { 3797 + remove_proc_entry("net/pfkey", NULL); 3798 + } 3799 + #else 3800 + static inline int pfkey_init_proc(void) 3801 + { 3802 + return 0; 3803 + } 3804 + 3805 + static inline void pfkey_exit_proc(void) 3806 + { 3807 + } 3785 3808 #endif 3786 3809 3787 3810 static struct xfrm_mgr pfkeyv2_mgr = ··· 3821 3798 static void __exit ipsec_pfkey_exit(void) 3822 3799 { 3823 3800 xfrm_unregister_km(&pfkeyv2_mgr); 3824 - remove_proc_entry("pfkey", init_net.proc_net); 3801 + pfkey_exit_proc(); 3825 3802 sock_unregister(PF_KEY); 3826 3803 proto_unregister(&key_proto); 3827 3804 } ··· 3836 3813 err = sock_register(&pfkey_family_ops); 3837 3814 if (err != 0) 3838 3815 goto out_unregister_key_proto; 3839 - #ifdef CONFIG_PROC_FS 3840 - err = -ENOMEM; 3841 - if (create_proc_read_entry("pfkey", 0, init_net.proc_net, pfkey_read_proc, NULL) == NULL) 3816 + err = pfkey_init_proc(); 3817 + if (err != 0) 3842 3818 goto out_sock_unregister; 3843 - #endif 3844 3819 err = xfrm_register_km(&pfkeyv2_mgr); 3845 3820 if (err != 0) 3846 3821 goto out_remove_proc_entry; 3847 3822 out: 3848 3823 return err; 3849 3824 out_remove_proc_entry: 3850 - #ifdef CONFIG_PROC_FS 3851 - remove_proc_entry("net/pfkey", NULL); 3825 + pfkey_exit_proc(); 3852 3826 out_sock_unregister: 3853 - #endif 3854 3827 sock_unregister(PF_KEY); 3855 3828 out_unregister_key_proto: 3856 3829 proto_unregister(&key_proto);