diff options
-rw-r--r-- | loader2/loader.c | 4 | ||||
-rw-r--r-- | loader2/modules.c | 38 | ||||
-rw-r--r-- | loader2/modules.h | 2 |
3 files changed, 44 insertions, 0 deletions
diff --git a/loader2/loader.c b/loader2/loader.c index 92e42db55..508d9118b 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -1010,6 +1010,10 @@ int main(int argc, char ** argv) { usbInitializeMouse(modLoaded, modDeps, modInfo, flags); + /* we've loaded all the modules we're going to. write out a file + * describing which scsi disks go with which scsi adapters */ + writeScsiDisks(modLoaded); + /* we only want to use RHupdates on nfs installs. otherwise, we'll * use files on the first iso image and not be able to umount it */ if (!strncmp(url, "nfs:", 4)) { diff --git a/loader2/modules.c b/loader2/modules.c index 1c1c7f0c5..f640bacd9 100644 --- a/loader2/modules.c +++ b/loader2/modules.c @@ -611,6 +611,44 @@ static int writeModulesConf(moduleList list, int fd) { return 0; } +/* writes out /tmp/scsidisks with a scsi disk / module correspondence. + * format is sd%c adapter + */ +void writeScsiDisks(moduleList list) { + int i, fd, num; + struct loadedModuleInfo * lm; + char buf[512]; + + if (!list) return; + + if ((fd = open("/tmp/scsidisks", O_WRONLY | O_CREAT, 0666)) == -1) { + logMessage("error opening /tmp/scsidisks: %s", strerror(errno)); + return; + } + + for (i = 0, lm = list->mods; i < list->numModules; i++, lm++) { + if (!lm->weLoaded) continue; + if (lm->major != DRIVER_SCSI) continue; + + for (num = lm->firstDevNum; num <= lm->lastDevNum; num++) { + if (num < 26) + sprintf(buf, "sd%c\t%s\n", 'a' + num, lm->name); + else { + unsigned int one, two; + one = num / 26; + two = num % 26; + + sprintf(buf, "sd%c%c\t%s\n", 'a' + one - 1, + 'a' + two, lm->name); + } + write(fd, buf, strlen(buf)); + } + } + + close(fd); + return; +} + /* JKFIXME: needs a way to know about module locations. also, we should * extract them to a ramfs instead of /tmp */ static struct extractedModule * extractModules (char * const * modNames, diff --git a/loader2/modules.h b/loader2/modules.h index 90cb92bd0..bfb4c0cd3 100644 --- a/loader2/modules.h +++ b/loader2/modules.h @@ -42,5 +42,7 @@ int mlLoadModuleSetLocation(const char * modNames, struct moduleBallLocation * location); int mlModuleInList(const char * modName, moduleList list); +void writeScsiDisks(moduleList list); + #endif |