Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 179786
b: refs/heads/master
c: de4ef86
h: refs/heads/master
v: v3
  • Loading branch information
Neil Horman authored and David S. Miller committed Jan 19, 2010
1 parent 9247cfd commit 1afc6fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0a931acfd19faf13129a22a46c06f330ecc2a4a3
refs/heads/master: de4ef86cfce60d2250111f34f8a084e769f23b16
18 changes: 5 additions & 13 deletions trunk/net/dccp/ccid.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,24 @@ int ccid_getsockopt_builtin_ccids(struct sock *sk, int len,
return err;
}

static struct kmem_cache *ccid_kmem_cache_create(int obj_size, const char *fmt,...)
static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_fmt, const char *fmt,...)
{
struct kmem_cache *slab;
char slab_name_fmt[32], *slab_name;
va_list args;

va_start(args, fmt);
vsnprintf(slab_name_fmt, sizeof(slab_name_fmt), fmt, args);
va_end(args);

slab_name = kstrdup(slab_name_fmt, GFP_KERNEL);
if (slab_name == NULL)
return NULL;
slab = kmem_cache_create(slab_name, sizeof(struct ccid) + obj_size, 0,
slab = kmem_cache_create(slab_name_fmt, sizeof(struct ccid) + obj_size, 0,
SLAB_HWCACHE_ALIGN, NULL);
if (slab == NULL)
kfree(slab_name);
return slab;
}

static void ccid_kmem_cache_destroy(struct kmem_cache *slab)
{
if (slab != NULL) {
const char *name = kmem_cache_name(slab);

if (slab != NULL)
kmem_cache_destroy(slab);
kfree(name);
}
}

static int ccid_activate(struct ccid_operations *ccid_ops)
Expand All @@ -113,13 +103,15 @@ static int ccid_activate(struct ccid_operations *ccid_ops)

ccid_ops->ccid_hc_rx_slab =
ccid_kmem_cache_create(ccid_ops->ccid_hc_rx_obj_size,
ccid_ops->ccid_hc_rx_slab_name,
"ccid%u_hc_rx_sock",
ccid_ops->ccid_id);
if (ccid_ops->ccid_hc_rx_slab == NULL)
goto out;

ccid_ops->ccid_hc_tx_slab =
ccid_kmem_cache_create(ccid_ops->ccid_hc_tx_obj_size,
ccid_ops->ccid_hc_tx_slab_name,
"ccid%u_hc_tx_sock",
ccid_ops->ccid_id);
if (ccid_ops->ccid_hc_tx_slab == NULL)
Expand Down
2 changes: 2 additions & 0 deletions trunk/net/dccp/ccid.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ struct ccid_operations {
const char *ccid_name;
struct kmem_cache *ccid_hc_rx_slab,
*ccid_hc_tx_slab;
char ccid_hc_rx_slab_name[32];
char ccid_hc_tx_slab_name[32];
__u32 ccid_hc_rx_obj_size,
ccid_hc_tx_obj_size;
/* Interface Routines */
Expand Down

0 comments on commit 1afc6fc

Please sign in to comment.