Skip to content

Commit fb0af3f

Browse files
jwboyeraegl
authored andcommitted
pstore: Create a convenient mount point for pstore
Using /dev/pstore as a mount point for the pstore filesystem is slightly awkward. We don't normally mount filesystems in /dev/ and the /dev/pstore file isn't created automatically by anything. While this method will still work, we can create a persistent mount point in sysfs. This will put pstore on par with things like cgroups and efivarfs. Signed-off-by: Josh Boyer <jwboyer@redhat.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Tony Luck <tony.luck@intel.com>
1 parent a93bc0c commit fb0af3f

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎Documentation/ABI/testing/pstore‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Where: /dev/pstore/...
1+
Where: /sys/fs/pstore/... (or /dev/pstore/...)
22
Date: March 2011
33
Kernel Version: 2.6.39
44
Contact: tony.luck@intel.com
@@ -11,9 +11,9 @@ Description: Generic interface to platform dependent persistent storage.
1111
of the console log is captured, but other interesting
1212
data can also be saved.
1313

14-
# mount -t pstore -o kmsg_bytes=8000 - /dev/pstore
14+
# mount -t pstore -o kmsg_bytes=8000 - /sys/fs/pstore
1515

16-
$ ls -l /dev/pstore
16+
$ ls -l /sys/fs/pstore/
1717
total 0
1818
-r--r--r-- 1 root root 7896 Nov 30 15:38 dmesg-erst-1
1919

@@ -27,9 +27,9 @@ Description: Generic interface to platform dependent persistent storage.
2727
the file will signal to the underlying persistent storage
2828
device that it can reclaim the space for later re-use.
2929

30-
$ rm /dev/pstore/dmesg-erst-1
30+
$ rm /sys/fs/pstore/dmesg-erst-1
3131

32-
The expectation is that all files in /dev/pstore
32+
The expectation is that all files in /sys/fs/pstore/
3333
will be saved elsewhere and erased from persistent store
3434
soon after boot to free up space ready for the next
3535
catastrophe.

‎fs/pstore/inode.c‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,25 @@ static struct file_system_type pstore_fs_type = {
418418
.kill_sb = pstore_kill_sb,
419419
};
420420

421+
static struct kobject *pstore_kobj;
422+
421423
static int __init init_pstore_fs(void)
422424
{
423-
return register_filesystem(&pstore_fs_type);
425+
int err = 0;
426+
427+
/* Create a convenient mount point for people to access pstore */
428+
pstore_kobj = kobject_create_and_add("pstore", fs_kobj);
429+
if (!pstore_kobj) {
430+
err = -ENOMEM;
431+
goto out;
432+
}
433+
434+
err = register_filesystem(&pstore_fs_type);
435+
if (err < 0)
436+
kobject_put(pstore_kobj);
437+
438+
out:
439+
return err;
424440
}
425441
module_init(init_pstore_fs)
426442

0 commit comments

Comments
 (0)