]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] add show_options to fat (4/5)
authorHirofumi Ogawa <hirofumi@mail.parknet.co.jp>
Sat, 12 Oct 2002 10:30:57 +0000 (03:30 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sat, 12 Oct 2002 10:30:57 +0000 (03:30 -0700)
This adds fat_show_options() to fat. And instead, this doesn't output
the charset name in fat_fill_super().

fs/fat/inode.c

index 13ed1f870b930272a954e1f563cd1930800f4d47..85a20e83de87289aec05a2881f3fb02ae3fbd104 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/time.h>
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
+#include <linux/seq_file.h>
 #include <linux/msdos_fs.h>
 #include <linux/fat_cvf.h>
 #include <linux/pagemap.h>
@@ -215,6 +216,69 @@ static int simple_getbool(char *s, int *setval)
        return 1;
 }
 
+static int fat_show_options(struct seq_file *m, struct vfsmount *mnt)
+{
+       struct msdos_sb_info *sbi = MSDOS_SB(mnt->mnt_sb);
+       struct fat_mount_options *opts = &sbi->options;
+       int isvfat = opts->isvfat;
+
+       if (opts->fs_uid != 0)
+               seq_printf(m, ",uid=%d", opts->fs_uid);
+       if (opts->fs_gid != 0)
+               seq_printf(m, ",gid=%d", opts->fs_gid);
+       seq_printf(m, ",umask=%04o", opts->fs_umask);
+       if (sbi->nls_disk)
+               seq_printf(m, ",codepage=%s", sbi->nls_disk->charset);
+       if (isvfat) {
+               if (sbi->nls_io
+                   && strcmp(sbi->nls_io->charset, CONFIG_NLS_DEFAULT))
+                       seq_printf(m, ",iocharset=%s", sbi->nls_io->charset);
+
+               switch (opts->shortname) {
+               case VFAT_SFN_DISPLAY_WIN95 | VFAT_SFN_CREATE_WIN95:
+                       seq_puts(m, ",shortname=win95");
+                       break;
+               case VFAT_SFN_DISPLAY_WINNT | VFAT_SFN_CREATE_WINNT:
+                       seq_puts(m, ",shortname=winnt");
+                       break;
+               case VFAT_SFN_DISPLAY_WINNT | VFAT_SFN_CREATE_WIN95:
+                       seq_puts(m, ",shortname=mixed");
+                       break;
+               case VFAT_SFN_DISPLAY_LOWER | VFAT_SFN_CREATE_WIN95:
+                       /* seq_puts(m, ",shortname=lower"); */
+                       break;
+               default:
+                       seq_puts(m, ",shortname=unknown");
+                       break;
+               }
+       }
+       if (opts->name_check != 'n')
+               seq_printf(m, ",check=%c", opts->name_check);
+       if (opts->conversion != 'b')
+               seq_printf(m, ",conv=%c", opts->conversion);
+       if (opts->quiet)
+               seq_puts(m, ",quiet");
+       if (opts->showexec)
+               seq_puts(m, ",showexec");
+       if (opts->sys_immutable)
+               seq_puts(m, ",sys_immutable");
+       if (!isvfat) {
+               if (opts->dotsOK)
+                       seq_puts(m, ",dotsOK=yes");
+               if (opts->nocase)
+                       seq_puts(m, ",nocase");
+       } else {
+               if (opts->utf8)
+                       seq_puts(m, ",utf8");
+               if (opts->unicode_xlate)
+                       seq_puts(m, ",uni_xlate");
+               if (!opts->numtail)
+                       seq_puts(m, ",nonumtail");
+       }
+
+       return 0;
+}
+
 static int parse_options(char *options, int is_vfat, int *debug,
                         struct fat_mount_options *opts,
                         char *cvf_format, char *cvf_options)
@@ -682,6 +746,8 @@ static struct super_operations fat_sops = {
        clear_inode:    fat_clear_inode,
 
        read_inode:     make_bad_inode,
+
+       show_options:   fat_show_options,
 };
 
 static struct export_operations fat_export_ops = {
@@ -936,8 +1002,6 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
                sbi->options.codepage = 0; /* already 0?? */
                sbi->nls_disk = load_nls_default();
        }
-       if (!silent)
-               printk("FAT: Using codepage %s\n", sbi->nls_disk->charset);
 
        /* FIXME: utf8 is using iocharset for upper/lower conversion */
        if (sbi->options.isvfat) {
@@ -950,9 +1014,6 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
                        }
                } else
                        sbi->nls_io = load_nls_default();
-               if (!silent)
-                       printk("FAT: Using IO charset %s\n",
-                              sbi->nls_io->charset);
        }
 
        error = -ENOMEM;