summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-12-13 05:50:40 +0000
committerJeremy Katz <katzj@redhat.com>2002-12-13 05:50:40 +0000
commitb88e889a8d3601a66829eb3785990c7e914ebd5c (patch)
tree709f4812997ae4eb6521c5c898d27cb00106a17b
parent130528dc6fd28be1d1fb266e9b1d945c8478d697 (diff)
downloadanaconda-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
-rw-r--r--loader2/loader.c4
-rw-r--r--loader2/modules.c38
-rw-r--r--loader2/modules.h2
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