Commit cde37947 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Use new svc_export_show to implement e_show for /proc/fs/nfs/exports

Also remove the path_buf that was passed around for
/proc/fs/nfs/exports as the existance of seq_path removes the need
for this.
parent 11092356
......@@ -1028,17 +1028,11 @@ static void exp_flags(struct seq_file *m, int flag, int fsid, uid_t anonu, uid_t
seq_printf(m, "%sanongid=%d", first++?",":"", anong);
}
static inline void mangle(struct seq_file *m, const char *s)
{
seq_escape(m, s, " \t\n\\");
}
static int e_show(struct seq_file *m, void *p)
{
struct cache_head *cp = p;
struct svc_export *exp = container_of(cp, struct svc_export, h);
svc_client *clp;
char *pbuf;
if (p == (void *)1) {
seq_puts(m, "# Version 1.1\n");
......@@ -1051,17 +1045,7 @@ static int e_show(struct seq_file *m, void *p)
if (cache_check(&svc_export_cache, &exp->h, NULL))
return 0;
if (cache_put(&exp->h, &svc_export_cache)) BUG();
pbuf = m->private;
mangle(m, d_path(exp->ex_dentry, exp->ex_mnt,
pbuf, PAGE_SIZE));
seq_putc(m, '\t');
mangle(m, clp->name);
seq_putc(m, '(');
exp_flags(m, exp->ex_flags, exp->ex_fsid,
exp->ex_anon_uid, exp->ex_anon_gid);
seq_puts(m, ")\n");
return 0;
return svc_export_show(m, &svc_export_cache, cp, NULL);
}
struct seq_operations nfs_exports_op = {
......
......@@ -175,32 +175,14 @@ static struct file_operations transaction_ops = {
extern struct seq_operations nfs_exports_op;
static int exports_open(struct inode *inode, struct file *file)
{
int res;
char *namebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (namebuf == NULL)
return -ENOMEM;
res = seq_open(file, &nfs_exports_op);
if (res)
kfree(namebuf);
else
((struct seq_file *)file->private_data)->private = namebuf;
return res;
}
static int exports_release(struct inode *inode, struct file *file)
{
struct seq_file *m = (struct seq_file *)file->private_data;
kfree(m->private);
m->private = NULL;
return seq_release(inode, file);
return seq_open(file, &nfs_exports_op);
}
static struct file_operations exports_operations = {
.open = exports_open,
.read = seq_read,
.llseek = seq_lseek,
.release = exports_release,
.release = seq_release,
};
/*----------------------------------------------------------------------------*/
......
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