Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Aug 2006 23:29:29 -0700
From:      John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To:        Jonathan Herriott <herriojr@gmail.com>
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: Newbie Question to Device driver writing
Message-ID:  <20060817062929.GV99774@funkthat.com>
In-Reply-To: <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com>
References:  <6a56d69c0608162129h9e3e085i4ad1f4034833724f@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jonathan Herriott wrote this message on Thu, Aug 17, 2006 at 00:29 -0400:
> I've been interested in learning how to write device drivers for quite
> some time, but I had never had the time to devote to it until now.
> 
> I was reading through the FreeBSD architecture handbook and came
> across the example echo character driver.  To make sure I understand
> all that's going on, I'm searching though all the header files to
> understand what each thing is such as the cdevsw structure and cdev
> structure.
> 
> I've come to the conclusion that the cdev structure is what is used to
> store the information about the actual device I open with make_dev.  I
> was wondering if there is a place in which I can find a good
> explanation of the different attributes of the structure.  The header
> files don't provide much insight for a newbie, so I was wondering if
> there might be some other location.

Well, the cdevsw doesn't contain much more than the standard operations
you can do on a character device...  The Design and Implementation of
the FreeBSD Operating System doesn't have much more info on cdevsw than
you can get from the header file...

d_open, d_fdopen, d_close, d_read, d_write, d_ioctl are each called
in response to their respective call (if d_fdopen is defined, it is
used instead of d_open for open calls, though apparently no one is
using this yet)...

d_poll, d_mmap and d_kqfilter can be called multiple times or not at
all for their respective syscalls...  FreeBSD implements select as a
wrapper around poll...

> On a side note, is there a good irc channel for FreeBSD driver writing
> discussion?

Not that I know of...  Though the -drivers mailing list has been more
active of late...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060817062929.GV99774>