Hello Erik, I really appreciate what you replied to me. :) On Mon, May 21, 2007 at 12:04:49PM +0200, Erik Mouw wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Mon, May 21, 2007 at 07:46:39AM +0900, Seongsu Lee wrote: > > I am playing with block devices but I need help. > > > > [1] > > I want to override the do_hd_requrst() of a user-specified > > hard disk. For the work, I want to iterate in 'gendisk's > > without modifying the current source. (ex: hd.c) > > 'struct gendisk' is static variables and I have no idea > > to access it. > > So you want to change something without having to change something. > Sounds a bit impossible to me. > > > How can I override the request function of a gendisk? > > Why do you want to override it in the first place? What is the goal? > Maybe there are much better ways to achieve what you try to do. What I want to do is to use my own do_request function which redirect I/O request into physically another device under the condition. I found that I can get reference pointer of IDE device driver, struct ide_disk_obj by a function, bdget() and a macro containter_of. struct block_device *b = bdget(dev); idkp = container_of(g->private_data, struct ide_disk_obj, driver): And I overrided the do_request() function by: do_request_oldp = idkp->driver->do_request; idkp->driver->do_request = ide_do_rw_disk_my_own; I hope this may help somebody. > > [2] > > Is it right that the Linux use only one request queue for > > all the IDE/ATA-based block devices? > > I looked hd_init() in drivers/ide/lagacy/hd.c and found > > that a single request queue, hd_queue is used for all the > > devices. Am I right? > > For the legacy devices maybe, yeah. Note that the legacy driver is > almost never used unless you have a very old 386 system with MFM drives > or so. Anything slightly more modern uses the non-legacy IDE drivers or > the libata SATA/PATA drivers which use a request queue per device. You are right. hd.c in drivers/ide/lagacy directory is a code for very old device. I didn't know it. Modern disks such as IDE/ATA or S-ATA based use per-drive rqeust queue. Thank you very much. -- Seongsu's personal blog - http://www.senux.com/ But what can you do with it? -- ubiquitous cry from Linux-user partner. (Submitted by Andy Pearce, ajp@xxxxxxxxxxxxxxxx) -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ