lkml.org 
[lkml]   [2005]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectBdev->bd_disk is NULL @ initrd time
Hi,

I have a problem running the following code snippet from a kernel module.

struct block_device *bdev=bdget(MKDEV(3,10));

if(!bdev){
printk(KERN_ALERT "NULL bdev.!!!\n");
return -1;
}

if(!bdev->bd_disk){
printk(KERN_ALERT "NULL bdev bd_disk.!!!\n");
return -1;
}
printk(KERN_ALERT "Diskname is %s.\n",bdev->bd_disk->disk_name);

When this module is inserted from initrd's init script ( after block
drivers are loaded ) bdev->bd_disk is always NULL. But when its
inserted after the system has booted it
works fine. Can someone please explain this behaviour ?.

I checked that the block devices are up by spawning a shell just after
this module is inserted from the init script. When I cat /proc/devices
the ide device shows up.

Thanks
-BD
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-12-15 14:56    [W:0.027 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site