Commit 121bed24 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Remove path buffer passed around by cache_show routines

this was need for paths, but now we have seq_path...
parent cde37947
...@@ -195,8 +195,7 @@ int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) ...@@ -195,8 +195,7 @@ int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
static int expkey_show(struct seq_file *m, static int expkey_show(struct seq_file *m,
struct cache_detail *cd, struct cache_detail *cd,
struct cache_head *h, struct cache_head *h)
char *pbuf)
{ {
struct svc_expkey *ek ; struct svc_expkey *ek ;
...@@ -437,8 +436,7 @@ static void exp_flags(struct seq_file *m, int flag, int fsid, uid_t anonu, uid_t ...@@ -437,8 +436,7 @@ static void exp_flags(struct seq_file *m, int flag, int fsid, uid_t anonu, uid_t
static int svc_export_show(struct seq_file *m, static int svc_export_show(struct seq_file *m,
struct cache_detail *cd, struct cache_detail *cd,
struct cache_head *h, struct cache_head *h)
char *pbuf)
{ {
struct svc_export *exp ; struct svc_export *exp ;
...@@ -1045,7 +1043,7 @@ static int e_show(struct seq_file *m, void *p) ...@@ -1045,7 +1043,7 @@ static int e_show(struct seq_file *m, void *p)
if (cache_check(&svc_export_cache, &exp->h, NULL)) if (cache_check(&svc_export_cache, &exp->h, NULL))
return 0; return 0;
if (cache_put(&exp->h, &svc_export_cache)) BUG(); if (cache_put(&exp->h, &svc_export_cache)) BUG();
return svc_export_show(m, &svc_export_cache, cp, NULL); return svc_export_show(m, &svc_export_cache, cp);
} }
struct seq_operations nfs_exports_op = { struct seq_operations nfs_exports_op = {
......
...@@ -80,8 +80,7 @@ struct cache_detail { ...@@ -80,8 +80,7 @@ struct cache_detail {
int (*cache_show)(struct seq_file *m, int (*cache_show)(struct seq_file *m,
struct cache_detail *cd, struct cache_detail *cd,
struct cache_head *h, struct cache_head *h);
char *pbuf);
/* fields below this comment are for internal use /* fields below this comment are for internal use
* and should not be touched by cache owners * and should not be touched by cache owners
......
...@@ -1018,7 +1018,6 @@ int qword_get(char **bpp, char *dest, int bufsize) ...@@ -1018,7 +1018,6 @@ int qword_get(char **bpp, char *dest, int bufsize)
struct handle { struct handle {
struct cache_detail *cd; struct cache_detail *cd;
char *pbuf;
}; };
static void *c_start(struct seq_file *m, loff_t *pos) static void *c_start(struct seq_file *m, loff_t *pos)
...@@ -1087,10 +1086,9 @@ static int c_show(struct seq_file *m, void *p) ...@@ -1087,10 +1086,9 @@ static int c_show(struct seq_file *m, void *p)
{ {
struct cache_head *cp = p; struct cache_head *cp = p;
struct cache_detail *cd = ((struct handle*)m->private)->cd; struct cache_detail *cd = ((struct handle*)m->private)->cd;
char *pbuf = ((struct handle*)m->private)->pbuf;
if (p == (void *)1) if (p == (void *)1)
return cd->cache_show(m, cd, NULL, pbuf); return cd->cache_show(m, cd, NULL);
ifdebug(CACHE) ifdebug(CACHE)
seq_printf(m, "# expiry=%ld refcnt=%d\n", seq_printf(m, "# expiry=%ld refcnt=%d\n",
...@@ -1102,7 +1100,7 @@ static int c_show(struct seq_file *m, void *p) ...@@ -1102,7 +1100,7 @@ static int c_show(struct seq_file *m, void *p)
else else
cache_put(cp, cd); cache_put(cp, cd);
return cd->cache_show(m, cd, cp, pbuf); return cd->cache_show(m, cd, cp);
} }
struct seq_operations cache_content_op = { struct seq_operations cache_content_op = {
...@@ -1115,26 +1113,19 @@ struct seq_operations cache_content_op = { ...@@ -1115,26 +1113,19 @@ struct seq_operations cache_content_op = {
static int content_open(struct inode *inode, struct file *file) static int content_open(struct inode *inode, struct file *file)
{ {
int res; int res;
char *namebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
struct handle *han; struct handle *han;
struct cache_detail *cd = PDE(inode)->data; struct cache_detail *cd = PDE(inode)->data;
if (namebuf == NULL)
return -ENOMEM;
han = kmalloc(sizeof(*han), GFP_KERNEL); han = kmalloc(sizeof(*han), GFP_KERNEL);
if (han == NULL) { if (han == NULL)
kfree(namebuf);
return -ENOMEM; return -ENOMEM;
}
han->pbuf = namebuf;
han->cd = cd; han->cd = cd;
res = seq_open(file, &cache_content_op); res = seq_open(file, &cache_content_op);
if (res) { if (res)
kfree(namebuf);
kfree(han); kfree(han);
} else else
((struct seq_file *)file->private_data)->private = han; ((struct seq_file *)file->private_data)->private = han;
return res; return res;
...@@ -1143,7 +1134,6 @@ static int content_release(struct inode *inode, struct file *file) ...@@ -1143,7 +1134,6 @@ static int content_release(struct inode *inode, struct file *file)
{ {
struct seq_file *m = (struct seq_file *)file->private_data; struct seq_file *m = (struct seq_file *)file->private_data;
struct handle *han = m->private; struct handle *han = m->private;
kfree(han->pbuf);
kfree(han); kfree(han);
m->private = NULL; m->private = NULL;
return seq_release(inode, file); return seq_release(inode, file);
......
...@@ -215,8 +215,7 @@ static int ip_map_parse(struct cache_detail *cd, ...@@ -215,8 +215,7 @@ static int ip_map_parse(struct cache_detail *cd,
static int ip_map_show(struct seq_file *m, static int ip_map_show(struct seq_file *m,
struct cache_detail *cd, struct cache_detail *cd,
struct cache_head *h, struct cache_head *h)
char *pbuf)
{ {
struct ip_map *im; struct ip_map *im;
struct in_addr addr; struct in_addr addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment