Bdev->bd_disk is NULL @ initrd time

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

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux