pstore: Implement show_options
authorDavid Howells <dhowells@redhat.com>
Wed, 5 Jul 2017 15:24:34 +0000 (16:24 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 6 Jul 2017 07:31:46 +0000 (03:31 -0400)
Implement the show_options superblock op for pstore as part of a bid to get
rid of s_options and generic_show_options() to make it easier to implement
a context-based mount where the mount options can be passed individually
over a file descriptor.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Kees Cook <keescook@chromium.org>
cc: Anton Vorontsov <anton@enomsg.org>
cc: Colin Cross <ccross@android.com>
cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/pstore/inode.c
fs/pstore/internal.h
fs/pstore/platform.c

index 792a4e5f9226d16fefa0b6fd47061a76c79416ba..913e839ac1f5b7972c718ee2a034840bfba6cd24 100644 (file)
@@ -283,6 +283,16 @@ static void parse_options(char *options)
        }
 }
 
+/*
+ * Display the mount options in /proc/mounts.
+ */
+static int pstore_show_options(struct seq_file *m, struct dentry *root)
+{
+       if (kmsg_bytes != PSTORE_DEFAULT_KMSG_BYTES)
+               seq_printf(m, ",kmsg_bytes=%lu", kmsg_bytes);
+       return 0;
+}
+
 static int pstore_remount(struct super_block *sb, int *flags, char *data)
 {
        sync_filesystem(sb);
@@ -296,7 +306,7 @@ static const struct super_operations pstore_ops = {
        .drop_inode     = generic_delete_inode,
        .evict_inode    = pstore_evict_inode,
        .remount_fs     = pstore_remount,
-       .show_options   = generic_show_options,
+       .show_options   = pstore_show_options,
 };
 
 static struct super_block *pstore_sb;
@@ -448,8 +458,6 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent)
 {
        struct inode *inode;
 
-       save_mount_options(sb, data);
-
        pstore_sb = sb;
 
        sb->s_maxbytes          = MAX_LFS_FILESIZE;
index c416e653dc4f59d34a261ee2a617d82850067587..4d5913130580eaa1275f027caf9278dec1f073c1 100644 (file)
@@ -5,6 +5,9 @@
 #include <linux/time.h>
 #include <linux/pstore.h>
 
+#define PSTORE_DEFAULT_KMSG_BYTES 10240
+extern unsigned long kmsg_bytes;
+
 #ifdef CONFIG_PSTORE_FTRACE
 extern void pstore_register_ftrace(void);
 extern void pstore_unregister_ftrace(void);
index d468eec9b8a6ba9aa574055c0e76c615e2ede9d0..6640df40908d4c91fba9b1e53dd654877800f64f 100644 (file)
@@ -99,7 +99,7 @@ static char *big_oops_buf;
 static size_t big_oops_buf_sz;
 
 /* How much of the console log to snapshot */
-static unsigned long kmsg_bytes = 10240;
+unsigned long kmsg_bytes = PSTORE_DEFAULT_KMSG_BYTES;
 
 void pstore_set_kmsg_bytes(int bytes)
 {