* [PATCH 1/2] block: parse cmdline partitions first
@ 2021-10-21 22:51 Michał Mirosław
2021-10-21 22:51 ` [PATCH 2/2] block: allow empty cmdline partition set Michał Mirosław
0 siblings, 1 reply; 3+ messages in thread
From: Michał Mirosław @ 2021-10-21 22:51 UTC (permalink / raw)
To: Jens Axboe, Jonathan Corbet; +Cc: linux-block, linux-doc, linux-kernel
Make sure cmdline-provided partitions can override anything that's
on a storage device.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
block/partitions/core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 66ef9bc6d6a1..b4dac3077dce 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -15,6 +15,13 @@
#include "check.h"
static int (*check_part[])(struct parsed_partitions *) = {
+ /*
+ * Let cmdline override whatever there is on disk.
+ */
+#ifdef CONFIG_CMDLINE_PARTITION
+ cmdline_partition,
+#endif
+
/*
* Probe partition formats with tables at disk address 0
* that also have an ADFS boot block at 0xdc0.
@@ -42,9 +49,6 @@ static int (*check_part[])(struct parsed_partitions *) = {
adfspart_check_ADFS,
#endif
-#ifdef CONFIG_CMDLINE_PARTITION
- cmdline_partition,
-#endif
#ifdef CONFIG_EFI_PARTITION
efi_partition, /* this must come before msdos */
#endif
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] block: allow empty cmdline partition set
2021-10-21 22:51 [PATCH 1/2] block: parse cmdline partitions first Michał Mirosław
@ 2021-10-21 22:51 ` Michał Mirosław
0 siblings, 0 replies; 3+ messages in thread
From: Michał Mirosław @ 2021-10-21 22:51 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe; +Cc: linux-doc, linux-kernel, linux-block
Make no-partitions setting valid. This makes it possible to prevent
kernel from trying to read a partition table from a device.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
Documentation/block/cmdline-partition.rst | 2 +-
block/partitions/cmdline.c | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/Documentation/block/cmdline-partition.rst b/Documentation/block/cmdline-partition.rst
index 530bedff548a..a5ccacee982f 100644
--- a/Documentation/block/cmdline-partition.rst
+++ b/Documentation/block/cmdline-partition.rst
@@ -13,7 +13,7 @@ Users can easily change the partition.
The format for the command line is just like mtdparts:
blkdevparts=<blkdev-def>[;<blkdev-def>]
- <blkdev-def> := <blkdev-id>:<partdef>[,<partdef>]
+ <blkdev-def> := <blkdev-id>:[<partdef>[,<partdef>]]
<partdef> := <size>[@<offset>](part-name)
<blkdev-id>
diff --git a/block/partitions/cmdline.c b/block/partitions/cmdline.c
index 1af610f0ba8c..3655e8c8e949 100644
--- a/block/partitions/cmdline.c
+++ b/block/partitions/cmdline.c
@@ -164,11 +164,9 @@ static int parse_parts(struct cmdline_parts **parts, const char *bdevdef)
next_subpart = &(*next_subpart)->next_subpart;
}
- if (!newparts->subpart) {
- pr_warn("cmdline partition has no valid partition.");
- ret = -EINVAL;
- goto fail;
- }
+ if (!newparts->subpart)
+ pr_warn("%s: cmdline partition has no valid partitions.",
+ newparts->name);
*parts = newparts;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] block: allow empty cmdline partition set
2020-01-04 16:24 [PATCH 1/2] block: parse cmdline partitions first Michał Mirosław
@ 2020-01-04 16:24 ` Michał Mirosław
0 siblings, 0 replies; 3+ messages in thread
From: Michał Mirosław @ 2020-01-04 16:24 UTC (permalink / raw)
To: Jonathan Corbet, Jens Axboe; +Cc: linux-doc, linux-kernel, linux-block
Make no-partitions setting valid. This makes it possible to prevent
kernel from trying to read partition table from a device.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
Documentation/block/cmdline-partition.rst | 2 +-
block/cmdline-parser.c | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/Documentation/block/cmdline-partition.rst b/Documentation/block/cmdline-partition.rst
index 530bedff548a..a5ccacee982f 100644
--- a/Documentation/block/cmdline-partition.rst
+++ b/Documentation/block/cmdline-partition.rst
@@ -13,7 +13,7 @@ Users can easily change the partition.
The format for the command line is just like mtdparts:
blkdevparts=<blkdev-def>[;<blkdev-def>]
- <blkdev-def> := <blkdev-id>:<partdef>[,<partdef>]
+ <blkdev-def> := <blkdev-id>:[<partdef>[,<partdef>]]
<partdef> := <size>[@<offset>](part-name)
<blkdev-id>
diff --git a/block/cmdline-parser.c b/block/cmdline-parser.c
index f2a14571882b..bc63e46e7bfc 100644
--- a/block/cmdline-parser.c
+++ b/block/cmdline-parser.c
@@ -133,11 +133,9 @@ static int parse_parts(struct cmdline_parts **parts, const char *bdevdef)
next_subpart = &(*next_subpart)->next_subpart;
}
- if (!newparts->subpart) {
- pr_warn("cmdline partition has no valid partition.");
- ret = -EINVAL;
- goto fail;
- }
+ if (!newparts->subpart)
+ pr_warn("%s: cmdline partition has no valid partitions.",
+ newparts->name);
*parts = newparts;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-21 22:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 22:51 [PATCH 1/2] block: parse cmdline partitions first Michał Mirosław
2021-10-21 22:51 ` [PATCH 2/2] block: allow empty cmdline partition set Michał Mirosław
-- strict thread matches above, loose matches on Subject: below --
2020-01-04 16:24 [PATCH 1/2] block: parse cmdline partitions first Michał Mirosław
2020-01-04 16:24 ` [PATCH 2/2] block: allow empty cmdline partition set Michał Mirosław
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).