struct gendisk via request_queue

Submitted by khalil
on October 3, 2008 - 8:26am

Hi, I need to use the struct gendisk, to get the disk capacity "via" struct request_queue. I know

disk = container_of(queue->kobj.parent, struct gendisk, kobj);

with the old kernel, but with 2.6.26?

I finally realized

khalil
on
October 6, 2008 - 1:58am

@param request_queue q

struct device *dev = container_of(q->kobj.parent, struct device, kobj);
struct *disk = container_of(dev, struct gendisk, dev);

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.