aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2007-10-17 02:26:26 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:48 -0400
commit93d44cb275f3eba720617a8c5b00d51a8e0e9049 (patch)
treed6379a03a4f1176990ed8207f8f93b2adeeccbd6 /fs
parente57aa839cea13852e07ecb495692b602b11136c9 (diff)
ext2: show all mount options
Using mtab is problematic for various reasons, one of them is that unprivileged mounts won't turn up in there. So we want to get rid of it, and use /proc/mounts instead. But most filesystems are lazy, and are not showing all mount options. Which means, that without mtab, the user won't be able to see some or all of the options. It would be nice if the generic code could remember the mount options, and show them without the need to add extra code to filesystems. But this is not easy, because different filesystems handle mount options given options, and not tough the rest. This is not taken into account by mount(8) either, so /etc/mtab will be broken in this case. This series fixes up ->show_options() in ext[234]. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/super.c61
1 files changed, 59 insertions, 2 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 04bc96caa7b2..3e78af2ae7d8 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -203,10 +203,66 @@ static void ext2_clear_inode(struct inode *inode)
203 203
204static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs) 204static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs)
205{ 205{
206 struct ext2_sb_info *sbi = EXT2_SB(vfs->mnt_sb); 206 struct super_block *sb = vfs->mnt_sb;
207 struct ext2_sb_info *sbi = EXT2_SB(sb);
208 struct ext2_super_block *es = sbi->s_es;
209 unsigned long def_mount_opts;
210
211 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
207 212
208 if (sbi->s_mount_opt & EXT2_MOUNT_GRPID) 213 if (sbi->s_sb_block != 1)
214 seq_printf(seq, ",sb=%lu", sbi->s_sb_block);
215 if (test_opt(sb, MINIX_DF))
216 seq_puts(seq, ",minixdf");
217 if (test_opt(sb, GRPID))
209 seq_puts(seq, ",grpid"); 218 seq_puts(seq, ",grpid");
219 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT2_DEFM_BSDGROUPS))
220 seq_puts(seq, ",nogrpid");
221 if (sbi->s_resuid != EXT2_DEF_RESUID ||
222 le16_to_cpu(es->s_def_resuid) != EXT2_DEF_RESUID) {
223 seq_printf(seq, ",resuid=%u", sbi->s_resuid);
224 }
225 if (sbi->s_resgid != EXT2_DEF_RESGID ||
226 le16_to_cpu(es->s_def_resgid) != EXT2_DEF_RESGID) {
227 seq_printf(seq, ",resgid=%u", sbi->s_resgid);
228 }
229 if (test_opt(sb, ERRORS_CONT)) {
230 int def_errors = le16_to_cpu(es->s_errors);
231
232 if (def_errors == EXT2_ERRORS_PANIC ||
233 def_errors == EXT2_ERRORS_RO) {
234 seq_puts(seq, ",errors=continue");
235 }
236 }
237 if (test_opt(sb, ERRORS_RO))
238 seq_puts(seq, ",errors=remount-ro");
239 if (test_opt(sb, ERRORS_PANIC))
240 seq_puts(seq, ",errors=panic");
241 if (test_opt(sb, NO_UID32))
242 seq_puts(seq, ",nouid32");
243 if (test_opt(sb, DEBUG))
244 seq_puts(seq, ",debug");
245 if (test_opt(sb, OLDALLOC))
246 seq_puts(seq, ",oldalloc");
247
248#ifdef CONFIG_EXT2_FS_XATTR
249 if (test_opt(sb, XATTR_USER))
250 seq_puts(seq, ",user_xattr");
251 if (!test_opt(sb, XATTR_USER) &&
252 (def_mount_opts & EXT2_DEFM_XATTR_USER)) {
253 seq_puts(seq, ",nouser_xattr");
254 }
255#endif
256
257#ifdef CONFIG_EXT2_FS_POSIX_ACL
258 if (test_opt(sb, POSIX_ACL))
259 seq_puts(seq, ",acl");
260 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT2_DEFM_ACL))
261 seq_puts(seq, ",noacl");
262#endif
263
264 if (test_opt(sb, NOBH))
265 seq_puts(seq, ",nobh");
210 266
211#if defined(CONFIG_QUOTA) 267#if defined(CONFIG_QUOTA)
212 if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) 268 if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA)
@@ -659,6 +715,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
659 if (!sbi) 715 if (!sbi)
660 return -ENOMEM; 716 return -ENOMEM;
661 sb->s_fs_info = sbi; 717 sb->s_fs_info = sbi;
718 sbi->s_sb_block = sb_block;
662 719
663 /* 720 /*
664 * See what the current blocksize for the device is, and 721 * See what the current blocksize for the device is, and