diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-12-13 05:50:40 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-12-13 05:50:40 +0000 |
commit | b88e889a8d3601a66829eb3785990c7e914ebd5c (patch) | |
tree | 709f4812997ae4eb6521c5c898d27cb00106a17b /loader2/modules.c | |
parent | 130528dc6fd28be1d1fb266e9b1d945c8478d697 (diff) | |
download | anaconda-b88e889a8d3601a66829eb3785990c7e914ebd5c.tar.gz anaconda-b88e889a8d3601a66829eb3785990c7e914ebd5c.tar.xz anaconda-b88e889a8d3601a66829eb3785990c7e914ebd5c.zip |
write out /tmp/scsidisks after we're done loading modules with the
correspondence between sds and scsi adapters so that the second stage
has a way to filter out things like usb or firewire drives
Diffstat (limited to 'loader2/modules.c')
-rw-r--r-- | loader2/modules.c | 38 |
1 files changed, 38 insertions, 0 deletions
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, |