diff options
author | David S. Miller <davem@davemloft.net> | 2010-01-23 03:31:06 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-23 03:31:06 -0500 |
commit | 51c24aaacaea90c8e87f1dec75a2ac7622b593f8 (patch) | |
tree | 9f54936c87764bef75e97395cb56b7d1e0df24c6 /net/dccp | |
parent | 4276e47e2d1c85a2477caf0d22b91c4f2377fba8 (diff) | |
parent | 6be325719b3e54624397e413efd4b33a997e55a3 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ccid.c | 18 | ||||
-rw-r--r-- | net/dccp/ccid.h | 2 | ||||
-rw-r--r-- | net/dccp/probe.c | 3 |
3 files changed, 9 insertions, 14 deletions
diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c index f3e9ba1cfd01..57dfb9c8c4f2 100644 --- a/net/dccp/ccid.c +++ b/net/dccp/ccid.c | |||
@@ -77,34 +77,24 @@ int ccid_getsockopt_builtin_ccids(struct sock *sk, int len, | |||
77 | return err; | 77 | return err; |
78 | } | 78 | } |
79 | 79 | ||
80 | static struct kmem_cache *ccid_kmem_cache_create(int obj_size, const char *fmt,...) | 80 | static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_fmt, const char *fmt,...) |
81 | { | 81 | { |
82 | struct kmem_cache *slab; | 82 | struct kmem_cache *slab; |
83 | char slab_name_fmt[32], *slab_name; | ||
84 | va_list args; | 83 | va_list args; |
85 | 84 | ||
86 | va_start(args, fmt); | 85 | va_start(args, fmt); |
87 | vsnprintf(slab_name_fmt, sizeof(slab_name_fmt), fmt, args); | 86 | vsnprintf(slab_name_fmt, sizeof(slab_name_fmt), fmt, args); |
88 | va_end(args); | 87 | va_end(args); |
89 | 88 | ||
90 | slab_name = kstrdup(slab_name_fmt, GFP_KERNEL); | 89 | slab = kmem_cache_create(slab_name_fmt, sizeof(struct ccid) + obj_size, 0, |
91 | if (slab_name == NULL) | ||
92 | return NULL; | ||
93 | slab = kmem_cache_create(slab_name, sizeof(struct ccid) + obj_size, 0, | ||
94 | SLAB_HWCACHE_ALIGN, NULL); | 90 | SLAB_HWCACHE_ALIGN, NULL); |
95 | if (slab == NULL) | ||
96 | kfree(slab_name); | ||
97 | return slab; | 91 | return slab; |
98 | } | 92 | } |
99 | 93 | ||
100 | static void ccid_kmem_cache_destroy(struct kmem_cache *slab) | 94 | static void ccid_kmem_cache_destroy(struct kmem_cache *slab) |
101 | { | 95 | { |
102 | if (slab != NULL) { | 96 | if (slab != NULL) |
103 | const char *name = kmem_cache_name(slab); | ||
104 | |||
105 | kmem_cache_destroy(slab); | 97 | kmem_cache_destroy(slab); |
106 | kfree(name); | ||
107 | } | ||
108 | } | 98 | } |
109 | 99 | ||
110 | static int ccid_activate(struct ccid_operations *ccid_ops) | 100 | static int ccid_activate(struct ccid_operations *ccid_ops) |
@@ -113,6 +103,7 @@ static int ccid_activate(struct ccid_operations *ccid_ops) | |||
113 | 103 | ||
114 | ccid_ops->ccid_hc_rx_slab = | 104 | ccid_ops->ccid_hc_rx_slab = |
115 | ccid_kmem_cache_create(ccid_ops->ccid_hc_rx_obj_size, | 105 | ccid_kmem_cache_create(ccid_ops->ccid_hc_rx_obj_size, |
106 | ccid_ops->ccid_hc_rx_slab_name, | ||
116 | "ccid%u_hc_rx_sock", | 107 | "ccid%u_hc_rx_sock", |
117 | ccid_ops->ccid_id); | 108 | ccid_ops->ccid_id); |
118 | if (ccid_ops->ccid_hc_rx_slab == NULL) | 109 | if (ccid_ops->ccid_hc_rx_slab == NULL) |
@@ -120,6 +111,7 @@ static int ccid_activate(struct ccid_operations *ccid_ops) | |||
120 | 111 | ||
121 | ccid_ops->ccid_hc_tx_slab = | 112 | ccid_ops->ccid_hc_tx_slab = |
122 | ccid_kmem_cache_create(ccid_ops->ccid_hc_tx_obj_size, | 113 | ccid_kmem_cache_create(ccid_ops->ccid_hc_tx_obj_size, |
114 | ccid_ops->ccid_hc_tx_slab_name, | ||
123 | "ccid%u_hc_tx_sock", | 115 | "ccid%u_hc_tx_sock", |
124 | ccid_ops->ccid_id); | 116 | ccid_ops->ccid_id); |
125 | if (ccid_ops->ccid_hc_tx_slab == NULL) | 117 | if (ccid_ops->ccid_hc_tx_slab == NULL) |
diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h index facedd20b531..269958bf7fe9 100644 --- a/net/dccp/ccid.h +++ b/net/dccp/ccid.h | |||
@@ -49,6 +49,8 @@ struct ccid_operations { | |||
49 | const char *ccid_name; | 49 | const char *ccid_name; |
50 | struct kmem_cache *ccid_hc_rx_slab, | 50 | struct kmem_cache *ccid_hc_rx_slab, |
51 | *ccid_hc_tx_slab; | 51 | *ccid_hc_tx_slab; |
52 | char ccid_hc_rx_slab_name[32]; | ||
53 | char ccid_hc_tx_slab_name[32]; | ||
52 | __u32 ccid_hc_rx_obj_size, | 54 | __u32 ccid_hc_rx_obj_size, |
53 | ccid_hc_tx_obj_size; | 55 | ccid_hc_tx_obj_size; |
54 | /* Interface Routines */ | 56 | /* Interface Routines */ |
diff --git a/net/dccp/probe.c b/net/dccp/probe.c index a1362dc8abb0..bace1d8cbcfd 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c | |||
@@ -161,7 +161,8 @@ static __init int dccpprobe_init(void) | |||
161 | if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops)) | 161 | if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops)) |
162 | goto err0; | 162 | goto err0; |
163 | 163 | ||
164 | ret = register_jprobe(&dccp_send_probe); | 164 | ret = try_then_request_module((register_jprobe(&dccp_send_probe) == 0), |
165 | "dccp"); | ||
165 | if (ret) | 166 | if (ret) |
166 | goto err1; | 167 | goto err1; |
167 | 168 | ||