Commit 07bdc074 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pstore-v5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull pstore updates from Kees Cook:
 "Use normal block device I/O path for pstore/blk. (Christoph Hellwig,
  Kees Cook, Pu Lehui)"

* tag 'pstore-v5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  pstore/blk: Include zone in pstore_device_info
  pstore/blk: Fix kerndoc and redundancy on blkdev param
  pstore/blk: Use the normal block device I/O path
  pstore/blk: Move verify_size() macro out of function
  pstore/blk: Improve failure reporting
parents 616ea5cc 1d1f6cc5
...@@ -45,15 +45,18 @@ blkdev ...@@ -45,15 +45,18 @@ blkdev
The block device to use. Most of the time, it is a partition of block device. The block device to use. Most of the time, it is a partition of block device.
It's required for pstore/blk. It is also used for MTD device. It's required for pstore/blk. It is also used for MTD device.
It accepts the following variants for block device: When pstore/blk is built as a module, "blkdev" accepts the following variants:
1. <hex_major><hex_minor> device number in hexadecimal represents itself; no 1. /dev/<disk_name> represents the device number of disk
leading 0x, for example b302.
#. /dev/<disk_name> represents the device number of disk
#. /dev/<disk_name><decimal> represents the device number of partition - device #. /dev/<disk_name><decimal> represents the device number of partition - device
number of disk plus the partition number number of disk plus the partition number
#. /dev/<disk_name>p<decimal> - same as the above; this form is used when disk #. /dev/<disk_name>p<decimal> - same as the above; this form is used when disk
name of partitioned disk ends with a digit. name of partitioned disk ends with a digit.
When pstore/blk is built into the kernel, "blkdev" accepts the following variants:
#. <hex_major><hex_minor> device number in hexadecimal representation,
with no leading 0x, for example b302.
#. PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF represents the unique id of #. PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF represents the unique id of
a partition if the partition table provides it. The UUID may be either an a partition if the partition table provides it. The UUID may be either an
EFI/GPT UUID, or refer to an MSDOS partition using the format SSSSSSSS-PP, EFI/GPT UUID, or refer to an MSDOS partition using the format SSSSSSSS-PP,
...@@ -227,8 +230,5 @@ For developer reference, here are all the important structures and APIs: ...@@ -227,8 +230,5 @@ For developer reference, here are all the important structures and APIs:
.. kernel-doc:: include/linux/pstore_zone.h .. kernel-doc:: include/linux/pstore_zone.h
:internal: :internal:
.. kernel-doc:: fs/pstore/blk.c
:internal:
.. kernel-doc:: include/linux/pstore_blk.h .. kernel-doc:: include/linux/pstore_blk.h
:internal: :internal:
...@@ -423,13 +423,13 @@ static void mtdpstore_notify_add(struct mtd_info *mtd) ...@@ -423,13 +423,13 @@ static void mtdpstore_notify_add(struct mtd_info *mtd)
longcnt = BITS_TO_LONGS(div_u64(mtd->size, mtd->erasesize)); longcnt = BITS_TO_LONGS(div_u64(mtd->size, mtd->erasesize));
cxt->badmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL); cxt->badmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
cxt->dev.total_size = mtd->size;
/* just support dmesg right now */ /* just support dmesg right now */
cxt->dev.flags = PSTORE_FLAGS_DMESG; cxt->dev.flags = PSTORE_FLAGS_DMESG;
cxt->dev.read = mtdpstore_read; cxt->dev.zone.read = mtdpstore_read;
cxt->dev.write = mtdpstore_write; cxt->dev.zone.write = mtdpstore_write;
cxt->dev.erase = mtdpstore_erase; cxt->dev.zone.erase = mtdpstore_erase;
cxt->dev.panic_write = mtdpstore_panic_write; cxt->dev.zone.panic_write = mtdpstore_panic_write;
cxt->dev.zone.total_size = mtd->size;
ret = register_pstore_device(&cxt->dev); ret = register_pstore_device(&cxt->dev);
if (ret) { if (ret) {
......
This diff is collapsed.
...@@ -10,36 +10,15 @@ ...@@ -10,36 +10,15 @@
/** /**
* struct pstore_device_info - back-end pstore/blk driver structure. * struct pstore_device_info - back-end pstore/blk driver structure.
* *
* @total_size: The total size in bytes pstore/blk can use. It must be greater
* than 4096 and be multiple of 4096.
* @flags: Refer to macro starting with PSTORE_FLAGS defined in * @flags: Refer to macro starting with PSTORE_FLAGS defined in
* linux/pstore.h. It means what front-ends this device support. * linux/pstore.h. It means what front-ends this device support.
* Zero means all backends for compatible. * Zero means all backends for compatible.
* @read: The general read operation. Both of the function parameters * @zone: The struct pstore_zone_info details.
* @size and @offset are relative value to bock device (not the *
* whole disk).
* On success, the number of bytes should be returned, others
* means error.
* @write: The same as @read, but the following error number:
* -EBUSY means try to write again later.
* -ENOMSG means to try next zone.
* @erase: The general erase operation for device with special removing
* job. Both of the function parameters @size and @offset are
* relative value to storage.
* Return 0 on success and others on failure.
* @panic_write:The write operation only used for panic case. It's optional
* if you do not care panic log. The parameters are relative
* value to storage.
* On success, the number of bytes should be returned, others
* excluding -ENOMSG mean error. -ENOMSG means to try next zone.
*/ */
struct pstore_device_info { struct pstore_device_info {
unsigned long total_size;
unsigned int flags; unsigned int flags;
pstore_zone_read_op read; struct pstore_zone_info zone;
pstore_zone_write_op write;
pstore_zone_erase_op erase;
pstore_zone_write_op panic_write;
}; };
int register_pstore_device(struct pstore_device_info *dev); int register_pstore_device(struct pstore_device_info *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment