mirror of https://gitee.com/openkylin/linux.git
nfsd: fix /proc/net/rpc/nfsd.export/content display
Note with "first" always 0, and "lastflags" initially 0, we always dump a spurious set of 0 flags at the start, among other problems. Fix. And attempt to make the code a little more obvious. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
049ef27b22
commit
74ec1e1269
|
@ -1470,25 +1470,43 @@ static void show_secinfo_flags(struct seq_file *m, int flags)
|
||||||
show_expflags(m, flags, NFSEXP_SECINFO_FLAGS);
|
show_expflags(m, flags, NFSEXP_SECINFO_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool secinfo_flags_equal(int f, int g)
|
||||||
|
{
|
||||||
|
f &= NFSEXP_SECINFO_FLAGS;
|
||||||
|
g &= NFSEXP_SECINFO_FLAGS;
|
||||||
|
return f == g;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int show_secinfo_run(struct seq_file *m, struct exp_flavor_info **fp, struct exp_flavor_info *end)
|
||||||
|
{
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
flags = (*fp)->flags;
|
||||||
|
seq_printf(m, ",sec=%d", (*fp)->pseudoflavor);
|
||||||
|
(*fp)++;
|
||||||
|
while (*fp != end && secinfo_flags_equal(flags, (*fp)->flags)) {
|
||||||
|
seq_printf(m, ":%d", (*fp)->pseudoflavor);
|
||||||
|
(*fp)++;
|
||||||
|
}
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
static void show_secinfo(struct seq_file *m, struct svc_export *exp)
|
static void show_secinfo(struct seq_file *m, struct svc_export *exp)
|
||||||
{
|
{
|
||||||
struct exp_flavor_info *f;
|
struct exp_flavor_info *f;
|
||||||
struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;
|
struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;
|
||||||
int lastflags = 0, first = 0;
|
int flags;
|
||||||
|
|
||||||
if (exp->ex_nflavors == 0)
|
if (exp->ex_nflavors == 0)
|
||||||
return;
|
return;
|
||||||
for (f = exp->ex_flavors; f < end; f++) {
|
f = exp->ex_flavors;
|
||||||
if (first || f->flags != lastflags) {
|
flags = show_secinfo_run(m, &f, end);
|
||||||
if (!first)
|
if (!secinfo_flags_equal(flags, exp->ex_flags))
|
||||||
show_secinfo_flags(m, lastflags);
|
show_secinfo_flags(m, flags);
|
||||||
seq_printf(m, ",sec=%d", f->pseudoflavor);
|
while (f != end) {
|
||||||
lastflags = f->flags;
|
flags = show_secinfo_run(m, &f, end);
|
||||||
} else {
|
show_secinfo_flags(m, flags);
|
||||||
seq_printf(m, ":%d", f->pseudoflavor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
show_secinfo_flags(m, lastflags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exp_flags(struct seq_file *m, int flag, int fsid,
|
static void exp_flags(struct seq_file *m, int flag, int fsid,
|
||||||
|
|
Loading…
Reference in New Issue