[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 3783 return len; 3784 } 3785 #endif 3786 3787 static struct xfrm_mgr pfkeyv2_mgr = ··· 3821 static void __exit ipsec_pfkey_exit(void) 3822 { 3823 xfrm_unregister_km(&pfkeyv2_mgr); 3824 - remove_proc_entry("pfkey", init_net.proc_net); 3825 sock_unregister(PF_KEY); 3826 proto_unregister(&key_proto); 3827 } ··· 3836 err = sock_register(&pfkey_family_ops); 3837 if (err != 0) 3838 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) 3842 goto out_sock_unregister; 3843 - #endif 3844 err = xfrm_register_km(&pfkeyv2_mgr); 3845 if (err != 0) 3846 goto out_remove_proc_entry; 3847 out: 3848 return err; 3849 out_remove_proc_entry: 3850 - #ifdef CONFIG_PROC_FS 3851 - remove_proc_entry("net/pfkey", NULL); 3852 out_sock_unregister: 3853 - #endif 3854 sock_unregister(PF_KEY); 3855 out_unregister_key_proto: 3856 proto_unregister(&key_proto);
··· 3782 3783 return len; 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 + } 3808 #endif 3809 3810 static struct xfrm_mgr pfkeyv2_mgr = ··· 3798 static void __exit ipsec_pfkey_exit(void) 3799 { 3800 xfrm_unregister_km(&pfkeyv2_mgr); 3801 + pfkey_exit_proc(); 3802 sock_unregister(PF_KEY); 3803 proto_unregister(&key_proto); 3804 } ··· 3813 err = sock_register(&pfkey_family_ops); 3814 if (err != 0) 3815 goto out_unregister_key_proto; 3816 + err = pfkey_init_proc(); 3817 + if (err != 0) 3818 goto out_sock_unregister; 3819 err = xfrm_register_km(&pfkeyv2_mgr); 3820 if (err != 0) 3821 goto out_remove_proc_entry; 3822 out: 3823 return err; 3824 out_remove_proc_entry: 3825 + pfkey_exit_proc(); 3826 out_sock_unregister: 3827 sock_unregister(PF_KEY); 3828 out_unregister_key_proto: 3829 proto_unregister(&key_proto);