[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] cdi: Hack fuer allgemeine cdrom-Ressource



+ cdi/storage: Fuer das erste gefundene CD-ROM-Laufwerk wird gleich noch
  ein Alias cdrom angelegt, damit man nicht wissen muss, an welchem
  Kanal es genau haengt.
* grub_cdrom.cfg: ata:/cdrom statt ata:/atapi10 benutzen

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 build/config/grub_cdrom.cfg   |    4 ++--
 src/modules/cdi/lib/storage.c |    9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/build/config/grub_cdrom.cfg b/build/config/grub_cdrom.cfg
index e0de5e3..263f9f4 100644
--- a/build/config/grub_cdrom.cfg
+++ b/build/config/grub_cdrom.cfg
@@ -7,7 +7,7 @@ module /iso9660
 module /ramoverlay
 module /ext2
 module /console servmgr:/term servmgr:/term
-module /servmgr ata:/atapi10|iso9660:/hd.img|ramoverlay:/cached|ext2:/ vterm:/vterm8/out ata iso9660 console ramoverlay ext2 pci
+module /servmgr ata:/cdrom|iso9660:/hd.img|ramoverlay:/cached|ext2:/ vterm:/vterm8/out ata iso9660 console ramoverlay ext2 pci
 boot
 
 title tyndur (English)
@@ -19,5 +19,5 @@ module /iso9660
 module /ramoverlay
 module /ext2
 module /console servmgr:/term servmgr:/term
-module /servmgr ata:/atapi10|iso9660:/hd.img|ramoverlay:/cached|ext2:/ vterm:/vterm8/out ata iso9660 console ramoverlay ext2 pci
+module /servmgr ata:/cdrom|iso9660:/hd.img|ramoverlay:/cached|ext2:/ vterm:/vterm8/out ata iso9660 console ramoverlay ext2 pci
 boot
diff --git a/src/modules/cdi/lib/storage.c b/src/modules/cdi/lib/storage.c
index 992ae00..5cf16ea 100644
--- a/src/modules/cdi/lib/storage.c
+++ b/src/modules/cdi/lib/storage.c
@@ -212,6 +212,8 @@ static void lostio_mst_if_init()
  */
 int lostio_mst_if_newdev(struct cdi_storage_device* device)
 {
+    static int has_cdrom = 0;
+
     // Slash vor Pfad angaengen
     char path[strlen(device->dev.name) + 2];
     strcpy(path + 1, device->dev.name);
@@ -222,6 +224,13 @@ int lostio_mst_if_newdev(struct cdi_storage_device* device)
     {
         return -1;
     }
+
+    if (!has_cdrom && !strncmp(device->dev.name, "atapi", strlen("atapi"))) {
+        has_cdrom = 1;
+        vfstree_create_node("/cdrom", CDI_LOSTIO_TYPE_MST, device->block_size *
+            device->block_count, (void*) device, 0);
+    }
+
     return 0;
 }
 
-- 
1.6.0.2