Re: [PATCH] Add cdroms and other non-partition based devices to blkid database (#485060)

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

 



Ack.

On 11/09/2009 03:07 PM, Martin Sivak wrote:
---
  loader2/driverdisk.c |   23 +++++++++++++++++++++++
  1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c
index eca8605..3a0a13c 100644
--- a/loader2/driverdisk.c
+++ b/loader2/driverdisk.c
@@ -23,6 +23,8 @@
  #include<string.h>
  #include<sys/stat.h>
  #include<unistd.h>
+#include<sys/types.h>
+#include<dirent.h>

  #include<blkid/blkid.h>

@@ -591,6 +593,8 @@ struct ddlist* findDriverDiskByLabel(void)
      char *ddLabel = "OEMDRV";
      struct ddlist *ddDevice = NULL;
      blkid_cache bCache;
+    struct dirent *direntry;
+    DIR *sysblock;

      int res;
      blkid_dev_iterate bIter;
@@ -600,6 +604,25 @@ struct ddlist* findDriverDiskByLabel(void)
  	logMessage(ERROR, _("Cannot initialize cache instance for blkid"));
  	return NULL;
      }
+
+    /* List all block devices from /sys/block and add them to blkid db
+     * libblkid should be doing that, so lets consider this as a workaround */
+    sysblock = opendir("/sys/block");
+    if(sysblock){
+      while((direntry = readdir(sysblock))!=NULL){
+	/* add only h(d?), s(d?) and s(cd?) devices */
+	if(direntry->d_name[0]!='h'&&
+	   direntry->d_name[0]!='s') continue;
+
+	char *devname;
+	if(asprintf(&devname, "/dev/%s", direntry->d_name)!=-1){
+	  blkid_get_dev(bCache, devname, BLKID_DEV_NORMAL);
+	  free(devname);
+	}
+      }
+      closedir(sysblock);
+    }
+
      if((res = blkid_probe_all(bCache))<0){
  	logMessage(ERROR, _("Cannot probe devices in blkid: %d"), res);
  	return NULL;

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux