introduce two APIs for page attribute
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / net / ipv4 / udplite.c
blob3c807964da96a95eb08f738974abda92b0959f87
1 /*
2 * UDPLITE An implementation of the UDP-Lite protocol (RFC 3828).
4 * Authors: Gerrit Renker <gerrit@erg.abdn.ac.uk>
6 * Changes:
7 * Fixes:
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
13 #include "udp_impl.h"
15 struct hlist_head udplite_hash[UDP_HTABLE_SIZE];
17 static int udplite_rcv(struct sk_buff *skb)
19 return __udp4_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE);
22 static void udplite_err(struct sk_buff *skb, u32 info)
24 __udp4_lib_err(skb, info, udplite_hash);
27 static struct net_protocol udplite_protocol = {
28 .handler = udplite_rcv,
29 .err_handler = udplite_err,
30 .no_policy = 1,
31 .netns_ok = 1,
34 struct proto udplite_prot = {
35 .name = "UDP-Lite",
36 .owner = THIS_MODULE,
37 .close = udp_lib_close,
38 .connect = ip4_datagram_connect,
39 .disconnect = udp_disconnect,
40 .ioctl = udp_ioctl,
41 .init = udplite_sk_init,
42 .destroy = udp_destroy_sock,
43 .setsockopt = udp_setsockopt,
44 .getsockopt = udp_getsockopt,
45 .sendmsg = udp_sendmsg,
46 .recvmsg = udp_recvmsg,
47 .sendpage = udp_sendpage,
48 .backlog_rcv = udp_queue_rcv_skb,
49 .hash = udp_lib_hash,
50 .unhash = udp_lib_unhash,
51 .get_port = udp_v4_get_port,
52 .obj_size = sizeof(struct udp_sock),
53 .h.udp_hash = udplite_hash,
54 #ifdef CONFIG_COMPAT
55 .compat_setsockopt = compat_udp_setsockopt,
56 .compat_getsockopt = compat_udp_getsockopt,
57 #endif
60 static struct inet_protosw udplite4_protosw = {
61 .type = SOCK_DGRAM,
62 .protocol = IPPROTO_UDPLITE,
63 .prot = &udplite_prot,
64 .ops = &inet_dgram_ops,
65 .capability = -1,
66 .no_check = 0, /* must checksum (RFC 3828) */
67 .flags = INET_PROTOSW_PERMANENT,
70 #ifdef CONFIG_PROC_FS
71 static struct udp_seq_afinfo udplite4_seq_afinfo = {
72 .name = "udplite",
73 .family = AF_INET,
74 .hashtable = udplite_hash,
75 .seq_fops = {
76 .owner = THIS_MODULE,
78 .seq_ops = {
79 .show = udp4_seq_show,
83 static int udplite4_proc_init_net(struct net *net)
85 return udp_proc_register(net, &udplite4_seq_afinfo);
88 static void udplite4_proc_exit_net(struct net *net)
90 udp_proc_unregister(net, &udplite4_seq_afinfo);
93 static struct pernet_operations udplite4_net_ops = {
94 .init = udplite4_proc_init_net,
95 .exit = udplite4_proc_exit_net,
98 static __init int udplite4_proc_init(void)
100 return register_pernet_subsys(&udplite4_net_ops);
102 #else
103 static inline int udplite4_proc_init(void)
105 return 0;
107 #endif
109 void __init udplite4_register(void)
111 if (proto_register(&udplite_prot, 1))
112 goto out_register_err;
114 if (inet_add_protocol(&udplite_protocol, IPPROTO_UDPLITE) < 0)
115 goto out_unregister_proto;
117 inet_register_protosw(&udplite4_protosw);
119 if (udplite4_proc_init())
120 printk(KERN_ERR "%s: Cannot register /proc!\n", __func__);
121 return;
123 out_unregister_proto:
124 proto_unregister(&udplite_prot);
125 out_register_err:
126 printk(KERN_CRIT "%s: Cannot add UDP-Lite protocol.\n", __func__);
129 EXPORT_SYMBOL(udplite_hash);
130 EXPORT_SYMBOL(udplite_prot);