diff mbox series

[v1,1/2] diskpart: format partition anyway

Message ID 20210728140238.8708-2-roland.gaudig-oss@weidmueller.com
State Changes Requested
Headers show
Series handlers: diskpart: Add check for existing filesystem | expand

Commit Message

Roland Gaudig July 28, 2021, 2:02 p.m. UTC
From: Roland Gaudig <roland.gaudig@gaudig.com>

In cases where there exists an unused and unformatted spare partion which
shall be activated by a later update, it is necessary to format such a
partition even if the partition table has not been altered.

Therefore, this commit introduces a new configuration option
CONFIG_DISKFORMAT_IGNORE_PT_CHANGE. If this option is activated a partition
will be formatted anyway if requested by the sw-description. No matter if
the partition table has been changed or not.

Signed-off-by: Roland Gaudig <roland.gaudig@gaudig.com>
Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
---

 handlers/Config.in          | 10 ++++++++++
 handlers/diskpart_handler.c |  4 ++++
 2 files changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/handlers/Config.in b/handlers/Config.in
index a0cc5a3..bfc8d19 100644
--- a/handlers/Config.in
+++ b/handlers/Config.in
@@ -116,6 +116,16 @@  menuconfig DISKFORMAT
 	  This extension of the diskpart handler allows creating filesystems
 	  on empty partitions.
 
+config DISKFORMAT_IGNORE_PT_CHANGE
+	bool "Disable check whether partition table changed"
+	depends on DISKFORMAT
+	default n
+	help
+	  Activating this option disables the check whether the partition table
+	  has changed. In cases where there exists an unused unformatted spare
+	  partition activating this option allows creating a filesystem even
+	  when the partition table remains unchaned.
+
 if DISKFORMAT
 
 source fs/Config.in
diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c
index b5c9a42..85dfb10 100644
--- a/handlers/diskpart_handler.c
+++ b/handlers/diskpart_handler.c
@@ -940,7 +940,11 @@  handler_release:
 
 #ifdef CONFIG_DISKFORMAT
 	/* Create filesystems */
+#ifdef CONFIG_DISKFORMAT_IGNORE_PT_CHANGE
+	if (!ret) {
+#else
 	if (!ret && createtable->parent) {
+#endif
 		LIST_FOREACH(part, &priv.listparts, next) {
 			int index;
 			/*