From 7b431f1054e8a54d65db43ffdec473042ee29f53 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Fri, 12 Jun 2020 18:03:11 +0000 Subject: Move CCISS to generic code --- mdk-stage1/probing.c | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c index c23ab517b..251e3eb45 100644 --- a/mdk-stage1/probing.c +++ b/mdk-stage1/probing.c @@ -807,38 +807,6 @@ void find_media(enum media_bus bus) end_scsi:; } - /* ----------------------------------------------- */ - log_message("looking for Compaq Smart Array media"); - { - char * procfiles[] = { "/proc/driver/cpqarray/ida0", "/proc/driver/cciss/cciss0", // 2.4 style - "/proc/array/ida", "/proc/cciss/cciss", // 2.2 style - NULL }; - static char cpq_descr[] = "Compaq RAID logical disk"; - char ** procfile; - FILE * f; - - for (procfile = procfiles; procfile && *procfile; procfile++) { - if((f = fopen(*procfile, "rb"))) { - while (fgets(buf, sizeof(buf), f)) { - if (ptr_begins_static_str(buf, "ida/") || ptr_begins_static_str(buf, "cciss/")) { - char * end = strchr(buf, ':'); - if (!end) - log_message("Inconsistency in %s, line:\n%s", *procfile, buf); - else { - *end = '\0'; - tmp[count].name = strdup(buf); - tmp[count].type = DISK; - tmp[count].model = cpq_descr; - log_message("CPQ: found %s", tmp[count].name); - count++; - } - } - } - fclose(f); - } - } - } - /* ----------------------------------------------- */ log_message("looking for DAC960"); { @@ -877,6 +845,7 @@ void find_media(enum media_bus bus) // some types of disks (ram, loop, ...) rather than a list to accept. glob("/sys/block/nvme*", 0, NULL, &globbuf); glob("/sys/block/vd*", 0, NULL, &globbuf); + glob("/sys/block/cciss*", 0, NULL, &globbuf); for (int i = 0; i < globbuf.gl_pathc; i++) { char *name, *pathend; @@ -886,6 +855,14 @@ void find_media(enum media_bus bus) strncpy(path, globbuf.gl_pathv[i], sizeof(path)); name = strdup(path + 11); + + // Replace ! with /, for example for cciss!c0d0 devices + char * c = name; + while((c = strchr(c, '!')) != NULL) { + *c = '/'; + c++; + } + pathend = path + strlen(path); // Check if this device had been handled by other code -- cgit v1.2.1