Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294419
b: refs/heads/master
c: 0a402d5
h: refs/heads/master
i:
  294417: afccbb7
  294415: e3f9c6a
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Feb 1, 2012
1 parent 8e8f14f commit 1325078
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5ecebb7c7fd737cf387a552994df319c063973db
refs/heads/master: 0a402d5a653ee2b613aaba3092a87b1e964622ce
4 changes: 4 additions & 0 deletions trunk/include/linux/sunrpc/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct cache_detail {
struct cache_detail_procfs procfs;
struct cache_detail_pipefs pipefs;
} u;
struct net *net;
};


Expand Down Expand Up @@ -202,6 +203,9 @@ extern int cache_register_net(struct cache_detail *cd, struct net *net);
extern void cache_unregister(struct cache_detail *cd);
extern void cache_unregister_net(struct cache_detail *cd, struct net *net);

extern struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net);
extern void cache_destroy_net(struct cache_detail *cd, struct net *net);

extern void sunrpc_init_cache_detail(struct cache_detail *cd);
extern void sunrpc_destroy_cache_detail(struct cache_detail *cd);
extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
Expand Down
26 changes: 26 additions & 0 deletions trunk/net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,32 @@ void cache_unregister(struct cache_detail *cd)
}
EXPORT_SYMBOL_GPL(cache_unregister);

struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net)
{
struct cache_detail *cd;

cd = kmemdup(tmpl, sizeof(struct cache_detail), GFP_KERNEL);
if (cd == NULL)
return ERR_PTR(-ENOMEM);

cd->hash_table = kzalloc(cd->hash_size * sizeof(struct cache_head *),
GFP_KERNEL);
if (cd->hash_table == NULL) {
kfree(cd);
return ERR_PTR(-ENOMEM);
}
cd->net = net;
return cd;
}
EXPORT_SYMBOL_GPL(cache_create_net);

void cache_destroy_net(struct cache_detail *cd, struct net *net)
{
kfree(cd->hash_table);
kfree(cd);
}
EXPORT_SYMBOL_GPL(cache_destroy_net);

static ssize_t cache_read_pipefs(struct file *filp, char __user *buf,
size_t count, loff_t *ppos)
{
Expand Down

0 comments on commit 1325078

Please sign in to comment.