An uppercut - do not use the pcounter on struct proto.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
#include <linux/module.h>
#include <linux/lockdep.h>
#include <linux/netdevice.h>
-#include <linux/pcounter.h>
#include <linux/skbuff.h> /* struct sk_buff */
#include <linux/mm.h>
#include <linux/security.h>
/* Keeping track of sockets in use */
#ifdef CONFIG_PROC_FS
unsigned int inuse_idx;
- struct pcounter inuse;
#endif
/* Memory pressure */
#ifdef CONFIG_PROC_FS
-# define DEFINE_PROTO_INUSE(NAME) DEFINE_PCOUNTER(NAME)
-# define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse)
/* Called with local bh disabled */
extern void sock_prot_inuse_add(struct proto *prot, int inc);
extern int sock_prot_inuse_get(struct proto *proto);
#else
-# define DEFINE_PROTO_INUSE(NAME)
-# define REF_PROTO_INUSE(NAME)
static void inline sock_prot_inuse_add(struct proto *prot, int inc)
{
}
.twsk_obj_size = sizeof(struct inet_timewait_sock),
};
-DEFINE_PROTO_INUSE(dccp_v4)
-
static struct proto dccp_v4_prot = {
.name = "DCCP",
.owner = THIS_MODULE,
.compat_setsockopt = compat_dccp_setsockopt,
.compat_getsockopt = compat_dccp_getsockopt,
#endif
- REF_PROTO_INUSE(dccp_v4)
};
static struct net_protocol dccp_v4_protocol = {
.twsk_obj_size = sizeof(struct dccp6_timewait_sock),
};
-DEFINE_PROTO_INUSE(dccp_v6)
-
static struct proto dccp_v6_prot = {
.name = "DCCPv6",
.owner = THIS_MODULE,
.compat_setsockopt = compat_dccp_setsockopt,
.compat_getsockopt = compat_dccp_getsockopt,
#endif
- REF_PROTO_INUSE(dccp_v6)
};
static struct inet6_protocol dccp_v6_protocol = {
}
}
-DEFINE_PROTO_INUSE(raw)
-
struct proto raw_prot = {
.name = "RAW",
.owner = THIS_MODULE,
.compat_setsockopt = compat_raw_setsockopt,
.compat_getsockopt = compat_raw_getsockopt,
#endif
- REF_PROTO_INUSE(raw)
};
#ifdef CONFIG_PROC_FS
}
#endif /* CONFIG_PROC_FS */
-DEFINE_PROTO_INUSE(tcp)
-
struct proto tcp_prot = {
.name = "TCP",
.owner = THIS_MODULE,
.compat_setsockopt = compat_tcp_setsockopt,
.compat_getsockopt = compat_tcp_getsockopt,
#endif
- REF_PROTO_INUSE(tcp)
};
void __init tcp_v4_init(void)
}
-DEFINE_PROTO_INUSE(udp)
-
struct proto udp_prot = {
.name = "UDP",
.owner = THIS_MODULE,
.compat_setsockopt = compat_udp_setsockopt,
.compat_getsockopt = compat_udp_getsockopt,
#endif
- REF_PROTO_INUSE(udp)
};
/* ------------------------------------------------------------------------ */
.netns_ok = 1,
};
-DEFINE_PROTO_INUSE(udplite)
-
struct proto udplite_prot = {
.name = "UDP-Lite",
.owner = THIS_MODULE,
.compat_setsockopt = compat_udp_setsockopt,
.compat_getsockopt = compat_udp_getsockopt,
#endif
- REF_PROTO_INUSE(udplite)
};
static struct inet_protosw udplite4_protosw = {
return(0);
}
-DEFINE_PROTO_INUSE(rawv6)
-
struct proto rawv6_prot = {
.name = "RAWv6",
.owner = THIS_MODULE,
.compat_setsockopt = compat_rawv6_setsockopt,
.compat_getsockopt = compat_rawv6_getsockopt,
#endif
- REF_PROTO_INUSE(rawv6)
};
#ifdef CONFIG_PROC_FS
}
#endif
-DEFINE_PROTO_INUSE(tcpv6)
-
struct proto tcpv6_prot = {
.name = "TCPv6",
.owner = THIS_MODULE,
.compat_setsockopt = compat_tcp_setsockopt,
.compat_getsockopt = compat_tcp_getsockopt,
#endif
- REF_PROTO_INUSE(tcpv6)
};
static struct inet6_protocol tcpv6_protocol = {
/* ------------------------------------------------------------------------ */
-DEFINE_PROTO_INUSE(udpv6)
-
struct proto udpv6_prot = {
.name = "UDPv6",
.owner = THIS_MODULE,
.compat_setsockopt = compat_udpv6_setsockopt,
.compat_getsockopt = compat_udpv6_getsockopt,
#endif
- REF_PROTO_INUSE(udpv6)
};
static struct inet_protosw udpv6_protosw = {
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
};
-DEFINE_PROTO_INUSE(udplitev6)
-
struct proto udplitev6_prot = {
.name = "UDPLITEv6",
.owner = THIS_MODULE,
.compat_setsockopt = compat_udpv6_setsockopt,
.compat_getsockopt = compat_udpv6_getsockopt,
#endif
- REF_PROTO_INUSE(udplitev6)
};
static struct inet_protosw udplite6_protosw = {
}
-DEFINE_PROTO_INUSE(sctp)
-
/* This proto struct describes the ULP interface for SCTP. */
struct proto sctp_prot = {
.name = "SCTP",
.enter_memory_pressure = sctp_enter_memory_pressure,
.memory_allocated = &sctp_memory_allocated,
.sockets_allocated = &sctp_sockets_allocated,
- REF_PROTO_INUSE(sctp)
};
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-DEFINE_PROTO_INUSE(sctpv6)
struct proto sctpv6_prot = {
.name = "SCTPv6",
.enter_memory_pressure = sctp_enter_memory_pressure,
.memory_allocated = &sctp_memory_allocated,
.sockets_allocated = &sctp_sockets_allocated,
- REF_PROTO_INUSE(sctpv6)
};
#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */