mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Stupid question re: register_cdrom()
@ 2004-04-05 20:53 Calin A. Culianu
  2004-04-05 23:03 ` Tony Breeds
  0 siblings, 1 reply; 4+ messages in thread
From: Calin A. Culianu @ 2004-04-05 20:53 UTC (permalink / raw)
  To: linux-kernel


Let's say I was coding a cdrom emulator in software for kernel 2.4.  I
am unclear about register_cdrom().  Does register_cdrom() in
cdrom.c take care of telling the kernel that my kdev_t major/minor
combination in fact leads to a real driver?  Or do I need to take care of
that outside of regsiter_cdrom()?

If not.. how do I tell the kernel data structures that my driver's major
number does in fact point to a cdrom driver.  Basically, I want my
driver's major number to show up in /proc/devices..

This might be a stupid question, but I am not a linux kernel expert...

Thanks for your patience!

-Calin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Stupid question re: register_cdrom()
  2004-04-05 20:53 Stupid question re: register_cdrom() Calin A. Culianu
@ 2004-04-05 23:03 ` Tony Breeds
  2004-04-06  3:03   ` Calin A. Culianu
  2004-04-06 18:45   ` Calin A. Culianu
  0 siblings, 2 replies; 4+ messages in thread
From: Tony Breeds @ 2004-04-05 23:03 UTC (permalink / raw)
  To: Calin A. Culianu; +Cc: Linux Kernel ML

On Mon, Apr 05, 2004 at 04:53:16PM -0400, Calin A. Culianu wrote:
> 
> Let's say I was coding a cdrom emulator in software for kernel 2.4.  I
> am unclear about register_cdrom().  Does register_cdrom() in
> cdrom.c take care of telling the kernel that my kdev_t major/minor
> combination in fact leads to a real driver?  Or do I need to take care of
> that outside of regsiter_cdrom()?
> 
> If not.. how do I tell the kernel data structures that my driver's major
> number does in fact point to a cdrom driver.  Basically, I want my
> driver's major number to show up in /proc/devices..
> 
> This might be a stupid question, but I am not a linux kernel expert...

Neither am I, therefore I hope you get a reply from someone else
refuting or acknowledging my claims.


I looks to me that the code that does the actual registration of the
driver is in drivers/ide/ide-cd.c NOT cdrom.c.  Specifically
ide_cdrom_attach().  Said function eventually calls the register_cdrom()
you ask about.

For writing a cdrom emulator  You may want to look more closely at the
non-IDE/SCSI devices as they seem to register their driver data
themselves  I had a quick read of aztcd.c, I think between cdrom.c and
aztcd.c you should be able to piece together what you want.

Also Try reading http://www.xml.com/ldd/chapter/book/ for details on 2.4
drivers

Yours Tony

        linux.conf.au       http://lca2005.linux.org.au/
	Apr 18-23 2005      The Australian Linux Technical Conference!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Stupid question re: register_cdrom()
  2004-04-05 23:03 ` Tony Breeds
@ 2004-04-06  3:03   ` Calin A. Culianu
  2004-04-06 18:45   ` Calin A. Culianu
  1 sibling, 0 replies; 4+ messages in thread
From: Calin A. Culianu @ 2004-04-06  3:03 UTC (permalink / raw)
  To: Tony Breeds; +Cc: Linux Kernel ML

On Tue, 6 Apr 2004, Tony Breeds wrote:

> On Mon, Apr 05, 2004 at 04:53:16PM -0400, Calin A. Culianu wrote:
> >
> > Let's say I was coding a cdrom emulator in software for kernel 2.4.  I
> > am unclear about register_cdrom().  Does register_cdrom() in
> > cdrom.c take care of telling the kernel that my kdev_t major/minor
> > combination in fact leads to a real driver?  Or do I need to take care of
> > that outside of regsiter_cdrom()?
> >
> > If not.. how do I tell the kernel data structures that my driver's major
> > number does in fact point to a cdrom driver.  Basically, I want my
> > driver's major number to show up in /proc/devices..
> >
> > This might be a stupid question, but I am not a linux kernel expert...
>
> Neither am I, therefore I hope you get a reply from someone else
> refuting or acknowledging my claims.
>
>
> I looks to me that the code that does the actual registration of the
> driver is in drivers/ide/ide-cd.c NOT cdrom.c.  Specifically
> ide_cdrom_attach().  Said function eventually calls the register_cdrom()
> you ask about.
>
> For writing a cdrom emulator  You may want to look more closely at the
> non-IDE/SCSI devices as they seem to register their driver data
> themselves  I had a quick read of aztcd.c, I think between cdrom.c and
> aztcd.c you should be able to piece together what you want.
>
> Also Try reading http://www.xml.com/ldd/chapter/book/ for details on 2.4
> drivers
>

This is actually very good advice.  I need to look at sample code to more
quickly bring myself up to speed on the kernel API. Having a good example
in aztcd.c would probably do it.  Thanks! (I have yet to read the code,
but I just wanted to thank you for replying).

-Calin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Stupid question re: register_cdrom()
  2004-04-05 23:03 ` Tony Breeds
  2004-04-06  3:03   ` Calin A. Culianu
@ 2004-04-06 18:45   ` Calin A. Culianu
  1 sibling, 0 replies; 4+ messages in thread
From: Calin A. Culianu @ 2004-04-06 18:45 UTC (permalink / raw)
  To: Tony Breeds; +Cc: Linux Kernel ML

On Tue, 6 Apr 2004, Tony Breeds wrote:

> On Mon, Apr 05, 2004 at 04:53:16PM -0400, Calin A. Culianu wrote:
> >
> > Let's say I was coding a cdrom emulator in software for kernel 2.4.  I
> > am unclear about register_cdrom().  Does register_cdrom() in
> > cdrom.c take care of telling the kernel that my kdev_t major/minor
> > combination in fact leads to a real driver?  Or do I need to take care of
> > that outside of regsiter_cdrom()?
> >
> > If not.. how do I tell the kernel data structures that my driver's major
> > number does in fact point to a cdrom driver.  Basically, I want my
> > driver's major number to show up in /proc/devices..
> >
> > This might be a stupid question, but I am not a linux kernel expert...
>
> Neither am I, therefore I hope you get a reply from someone else
> refuting or acknowledging my claims.
>
>
> I looks to me that the code that does the actual registration of the
> driver is in drivers/ide/ide-cd.c NOT cdrom.c.  Specifically
> ide_cdrom_attach().  Said function eventually calls the register_cdrom()
> you ask about.
>
> For writing a cdrom emulator  You may want to look more closely at the
> non-IDE/SCSI devices as they seem to register their driver data
> themselves  I had a quick read of aztcd.c, I think between cdrom.c and
> aztcd.c you should be able to piece together what you want.
>
> Also Try reading http://www.xml.com/ldd/chapter/book/ for details on 2.4
> drivers

FYI --

It turns out that you need to either call devfs_register_blkdev, or plain
old register_blkdev in the non-devfs codepath.  :)


Thanks a ton for giving me the advice to read other drivers.  That's what
did it! :)

-Calin


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-06 18:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-05 20:53 Stupid question re: register_cdrom() Calin A. Culianu
2004-04-05 23:03 ` Tony Breeds
2004-04-06  3:03   ` Calin A. Culianu
2004-04-06 18:45   ` Calin A. Culianu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®