pstore: use mount option instead sysfs to tweak kmsg_bytes

/sys/fs is a somewhat strange way to tweak what could more
obviously be tuned with a mount option.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Luck, Tony
2011-03-18 15:33:43 -07:00
committed by Linus Torvalds
parent 10effcb548
commit 366f7e7a79
5 changed files with 59 additions and 47 deletions

View File

@@ -37,24 +37,14 @@
static DEFINE_SPINLOCK(pstore_lock);
static struct pstore_info *psinfo;
/* How much of the console log to snapshot. /sys/fs/pstore/kmsg_bytes */
/* How much of the console log to snapshot */
static unsigned long kmsg_bytes = 10240;
static ssize_t b_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
void pstore_set_kmsg_bytes(int bytes)
{
return snprintf(buf, PAGE_SIZE, "%lu\n", kmsg_bytes);
kmsg_bytes = bytes;
}
static ssize_t b_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count)
{
return (sscanf(buf, "%lu", &kmsg_bytes) > 0) ? count : 0;
}
struct kobj_attribute pstore_kmsg_bytes_attr =
__ATTR(kmsg_bytes, S_IRUGO | S_IWUSR, b_show, b_store);
/* Tag each group of saved records with a sequence number */
static int oopscount;