aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/export.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-07-17 07:04:49 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:08 -0400
commitac34cdb03dfdb8cdc824f41f577434c5c2521155 (patch)
tree7ba12b944282a401911fd0d7d61fc116317e1789 /fs/nfsd/export.c
parent0ec757df9743025f14190d6034d8bd2bf37c2dd1 (diff)
knfsd: nfsd: factor out code from show_expflags
Factor out some code to be shared by secinfo display code. Remove some unnecessary conditional printing of commas where we know the condition is true. Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r--fs/nfsd/export.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 323cbdcc9bfd..06d5cd4a52c4 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1453,28 +1453,35 @@ static struct flags {
1453 { 0, {"", ""}} 1453 { 0, {"", ""}}
1454}; 1454};
1455 1455
1456static void exp_flags(struct seq_file *m, int flag, int fsid, 1456static void show_expflags(struct seq_file *m, int flags, int mask)
1457 uid_t anonu, uid_t anong, struct nfsd4_fs_locations *fsloc)
1458{ 1457{
1459 int first = 0;
1460 struct flags *flg; 1458 struct flags *flg;
1459 int state, first = 0;
1461 1460
1462 for (flg = expflags; flg->flag; flg++) { 1461 for (flg = expflags; flg->flag; flg++) {
1463 int state = (flg->flag & flag)?0:1; 1462 if (flg->flag & ~mask)
1463 continue;
1464 state = (flg->flag & flags) ? 0 : 1;
1464 if (*flg->name[state]) 1465 if (*flg->name[state])
1465 seq_printf(m, "%s%s", first++?",":"", flg->name[state]); 1466 seq_printf(m, "%s%s", first++?",":"", flg->name[state]);
1466 } 1467 }
1468}
1469
1470static void exp_flags(struct seq_file *m, int flag, int fsid,
1471 uid_t anonu, uid_t anong, struct nfsd4_fs_locations *fsloc)
1472{
1473 show_expflags(m, flag, NFSEXP_ALLFLAGS);
1467 if (flag & NFSEXP_FSID) 1474 if (flag & NFSEXP_FSID)
1468 seq_printf(m, "%sfsid=%d", first++?",":"", fsid); 1475 seq_printf(m, ",fsid=%d", fsid);
1469 if (anonu != (uid_t)-2 && anonu != (0x10000-2)) 1476 if (anonu != (uid_t)-2 && anonu != (0x10000-2))
1470 seq_printf(m, "%sanonuid=%d", first++?",":"", anonu); 1477 seq_printf(m, ",sanonuid=%d", anonu);
1471 if (anong != (gid_t)-2 && anong != (0x10000-2)) 1478 if (anong != (gid_t)-2 && anong != (0x10000-2))
1472 seq_printf(m, "%sanongid=%d", first++?",":"", anong); 1479 seq_printf(m, ",sanongid=%d", anong);
1473 if (fsloc && fsloc->locations_count > 0) { 1480 if (fsloc && fsloc->locations_count > 0) {
1474 char *loctype = (fsloc->migrated) ? "refer" : "replicas"; 1481 char *loctype = (fsloc->migrated) ? "refer" : "replicas";
1475 int i; 1482 int i;
1476 1483
1477 seq_printf(m, "%s%s=", first++?",":"", loctype); 1484 seq_printf(m, ",%s=", loctype);
1478 seq_escape(m, fsloc->locations[0].path, ",;@ \t\n\\"); 1485 seq_escape(m, fsloc->locations[0].path, ",;@ \t\n\\");
1479 seq_putc(m, '@'); 1486 seq_putc(m, '@');
1480 seq_escape(m, fsloc->locations[0].hosts, ",;@ \t\n\\"); 1487 seq_escape(m, fsloc->locations[0].hosts, ",;@ \t\n\\");