On 4/4/22 10:01 PM, Kinga Tanska wrote:
To unify all containers checks in code, is_container() function is
added and propagated.
Signed-off-by: Kinga Tanska <kinga.tanska@xxxxxxxxx>
---
Assemble.c | 5 ++---
Create.c | 6 +++---
Grow.c | 6 +++---
Incremental.c | 4 ++--
mdadm.h | 14 ++++++++++++++
super-ddf.c | 6 +++---
super-intel.c | 4 ++--
super0.c | 2 +-
super1.c | 2 +-
sysfs.c | 2 +-
10 files changed, 32 insertions(+), 19 deletions(-)
snipped.
diff --git a/Incremental.c b/Incremental.c
index a57fc323..077d4eea 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -244,7 +244,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
c->autof = ci->autof;
name_to_use = info.name;
- if (name_to_use[0] == 0 && info.array.level == LEVEL_CONTAINER) {
+ if (name_to_use && is_container(info.array.level)) {
name_to_use = info.text_version;
trustworthy = METADATA;
}
I am not sure whether the above change is correct, name_to_use[0] is
different from name_to_use.
The rested part of this patch is fine to me.
@@ -472,7 +472,7 @@ int Incremental(struct mddev_dev *devlist, struct context *c,
/* 7/ Is there enough devices to possibly start the array? */
/* 7a/ if not, finish with success. */
- if (info.array.level == LEVEL_CONTAINER) {
+ if (is_container(info.array.level)) {
char devnm[32];
/* Try to assemble within the container */
sysfs_uevent(sra, "change");
snipped.
Coly Li