aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2010-09-24 17:43:59 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-09-26 14:48:25 -0400
commit74ec1e1269eba65b5f8e810cf0363ddb7aa64de5 (patch)
tree11b0ab0612f275b0ddff4077be3ba8ee46f78f6c /fs/nfsd
parent049ef27b224ecc33958465fef83d5e4e8a056115 (diff)
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>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/export.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index a3c7d0ceb24..067e2e612e2 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1470,25 +1470,43 @@ static void show_secinfo_flags(struct seq_file *m, int flags)
1470 show_expflags(m, flags, NFSEXP_SECINFO_FLAGS); 1470 show_expflags(m, flags, NFSEXP_SECINFO_FLAGS);
1471} 1471}
1472 1472
1473static bool secinfo_flags_equal(int f, int g)
1474{
1475 f &= NFSEXP_SECINFO_FLAGS;
1476 g &= NFSEXP_SECINFO_FLAGS;
1477 return f == g;
1478}
1479
1480static int show_secinfo_run(struct seq_file *m, struct exp_flavor_info **fp, struct exp_flavor_info *end)
1481{
1482 int flags;
1483
1484 flags = (*fp)->flags;
1485 seq_printf(m, ",sec=%d", (*fp)->pseudoflavor);
1486 (*fp)++;
1487 while (*fp != end && secinfo_flags_equal(flags, (*fp)->flags)) {
1488 seq_printf(m, ":%d", (*fp)->pseudoflavor);
1489 (*fp)++;
1490 }
1491 return flags;
1492}
1493
1473static void show_secinfo(struct seq_file *m, struct svc_export *exp) 1494static void show_secinfo(struct seq_file *m, struct svc_export *exp)
1474{ 1495{
1475 struct exp_flavor_info *f; 1496 struct exp_flavor_info *f;
1476 struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors; 1497 struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;
1477 int lastflags = 0, first = 0; 1498 int flags;
1478 1499
1479 if (exp->ex_nflavors == 0) 1500 if (exp->ex_nflavors == 0)
1480 return; 1501 return;
1481 for (f = exp->ex_flavors; f < end; f++) { 1502 f = exp->ex_flavors;
1482 if (first || f->flags != lastflags) { 1503 flags = show_secinfo_run(m, &f, end);
1483 if (!first) 1504 if (!secinfo_flags_equal(flags, exp->ex_flags))
1484 show_secinfo_flags(m, lastflags); 1505 show_secinfo_flags(m, flags);
1485 seq_printf(m, ",sec=%d", f->pseudoflavor); 1506 while (f != end) {
1486 lastflags = f->flags; 1507 flags = show_secinfo_run(m, &f, end);
1487 } else { 1508 show_secinfo_flags(m, flags);
1488 seq_printf(m, ":%d", f->pseudoflavor);
1489 }
1490 } 1509 }
1491 show_secinfo_flags(m, lastflags);
1492} 1510}
1493 1511
1494static void exp_flags(struct seq_file *m, int flag, int fsid, 1512static void exp_flags(struct seq_file *m, int flag, int fsid,