Commit 6fc11138 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Define cache_show methods for export and filehandle cache in nfsd.

parent d9c6a4e4
...@@ -193,6 +193,31 @@ int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) ...@@ -193,6 +193,31 @@ int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
return err; return err;
} }
static int expkey_show(struct seq_file *m,
struct cache_detail *cd,
struct cache_head *h,
char *pbuf)
{
struct svc_expkey *ek ;
if (h ==NULL) {
seq_puts(m, "#domain fsidtype fsid [path]\n");
return 0;
}
ek = container_of(h, struct svc_expkey, h);
seq_printf(m, "%s %d 0x%08x", ek->ek_client->name,
ek->ek_fsidtype, ek->ek_fsid[0]);
if (ek->ek_fsid == 0)
seq_printf(m, "%08x", ek->ek_fsid[0]);
if (test_bit(CACHE_VALID, &h->flags) &&
!test_bit(CACHE_NEGATIVE, &h->flags)) {
seq_printf(m, " ");
seq_path(m, ek->ek_export->ex_mnt, ek->ek_export->ex_dentry, "\\ \t\n");
}
seq_printf(m, "\n");
return 0;
}
struct cache_detail svc_expkey_cache = { struct cache_detail svc_expkey_cache = {
.hash_size = EXPKEY_HASHMAX, .hash_size = EXPKEY_HASHMAX,
.hash_table = expkey_table, .hash_table = expkey_table,
...@@ -200,6 +225,7 @@ struct cache_detail svc_expkey_cache = { ...@@ -200,6 +225,7 @@ struct cache_detail svc_expkey_cache = {
.cache_put = expkey_put, .cache_put = expkey_put,
.cache_request = expkey_request, .cache_request = expkey_request,
.cache_parse = expkey_parse, .cache_parse = expkey_parse,
.cache_show = expkey_show,
}; };
static inline int svc_expkey_match (struct svc_expkey *a, struct svc_expkey *b) static inline int svc_expkey_match (struct svc_expkey *a, struct svc_expkey *b)
...@@ -407,6 +433,31 @@ int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) ...@@ -407,6 +433,31 @@ int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
return err; return err;
} }
static void exp_flags(struct seq_file *m, int flag, int fsid, uid_t anonu, uid_t anong);
static int svc_export_show(struct seq_file *m,
struct cache_detail *cd,
struct cache_head *h,
char *pbuf)
{
struct svc_export *exp ;
if (h ==NULL) {
seq_puts(m, "#path domain(flags)\n");
return 0;
}
exp = container_of(h, struct svc_export, h);
seq_path(m, exp->ex_mnt, exp->ex_dentry, " \t\n\\");
seq_putc(m, '\t');
seq_escape(m, exp->ex_client->name, " \t\n\\");
seq_putc(m, '(');
if (test_bit(CACHE_VALID, &h->flags) &&
!test_bit(CACHE_NEGATIVE, &h->flags))
exp_flags(m, exp->ex_flags, exp->ex_fsid,
exp->ex_anon_uid, exp->ex_anon_gid);
seq_puts(m, ")\n");
return 0;
}
struct cache_detail svc_export_cache = { struct cache_detail svc_export_cache = {
.hash_size = EXPORT_HASHMAX, .hash_size = EXPORT_HASHMAX,
.hash_table = export_table, .hash_table = export_table,
...@@ -414,6 +465,7 @@ struct cache_detail svc_export_cache = { ...@@ -414,6 +465,7 @@ struct cache_detail svc_export_cache = {
.cache_put = svc_export_put, .cache_put = svc_export_put,
.cache_request = svc_export_request, .cache_request = svc_export_request,
.cache_parse = svc_export_parse, .cache_parse = svc_export_parse,
.cache_show = svc_export_show,
}; };
static inline int svc_export_match(struct svc_export *a, struct svc_export *b) static inline int svc_export_match(struct svc_export *a, struct svc_export *b)
......
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