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]

 



Sorry, stupid error in here.. But I'm still interested if the general idea looks ok..

----- "Martin Sivak" <msivak@xxxxxxxxxx> wrote:

> ---
>  loader2/driverdisk.c |   24 ++++++++++++++++++++++++
>  1 files changed, 24 insertions(+), 0 deletions(-)
> 
> diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c
> index eca8605..298c896 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,26 @@ 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?), z(fcp) devices */
> +	if(direntry->d_name[0]!='h' &&
> +	   direntry->d_name[0]!='s' &&
> +	   direntry->d_name[0]!='z') continue;
> +
> +	char *devname = asprintf("/dev/%s", direntry->d_name);
> +	if(devname){
> +	  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;
> -- 
> 1.6.4.4

_______________________________________________
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