summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2020-06-12 18:03:11 +0000
committerPascal Terjan <pterjan@mageia.org>2020-06-12 18:03:11 +0000
commita1c3d8f29fc3cf1b03d8e07d58c6ed902355775f (patch)
tree5da8cd24186caa20391d3cde46d3806f107df356 /mdk-stage1
parent8a58fe8a571bda32f1d3db475922c9c9b15d66ae (diff)
downloaddrakx-a1c3d8f29fc3cf1b03d8e07d58c6ed902355775f.tar
drakx-a1c3d8f29fc3cf1b03d8e07d58c6ed902355775f.tar.gz
drakx-a1c3d8f29fc3cf1b03d8e07d58c6ed902355775f.tar.bz2
drakx-a1c3d8f29fc3cf1b03d8e07d58c6ed902355775f.tar.xz
drakx-a1c3d8f29fc3cf1b03d8e07d58c6ed902355775f.zip
Make the NVME code more generic
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/probing.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c
index c140d2604..d97ecce69 100644
--- a/mdk-stage1/probing.c
+++ b/mdk-stage1/probing.c
@@ -905,13 +905,11 @@ void find_media(enum media_bus bus)
}
}
/* ----------------------------------------------- */
- /* TODO: This code is generic for any block device, we should switch to only use it
- * and add some support to check capabilities and type.
- * The glob can not be changed before removing the rest of the code or disks would be listed twice.
- * */
- log_message("looking for NVME");
+ log_message("looking for other disks");
{
glob_t globbuf;
+ // TODO: We should switch everything to here, and later switch to ignoring
+ // some types of disks (ram, loop, ...) rather than a list to accept.
glob("/sys/block/nvme*", 0, NULL, &globbuf);
for (int i = 0; i < globbuf.gl_pathc; i++) {
@@ -924,7 +922,20 @@ void find_media(enum media_bus bus)
name = strdup(path + 11);
pathend = path + strlen(path);
- strcpy(model, "Unknown NVME Disk");
+ // Check if this device had been handled by other code
+ int exists = 0;
+ for (int j = 0; j < count; j++) {
+ if (!strcmp(name, tmp[j].name)) {
+ exists = 1;
+ break;
+ }
+ }
+ if (exists) {
+ free(name);
+ continue;
+ }
+
+ strcpy(model, "Unknown Disk");
strcpy(pathend, "/device/vendor");
vendor_length = read_attribute(path, model);