Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jul 2000 14:12:03 -0600
From:      Warner Losh <imp@village.org>
To:        "Isaac Waldron" <waldroni@lr.net>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Writing device drivers (ioctl issue) 
Message-ID:  <200007262012.OAA31863@harmony.village.org>
In-Reply-To: Your message of "Wed, 26 Jul 2000 15:57:36 EDT." <005301bff73b$bf8a3460$0100000a@waldron.house> 
References:  <005301bff73b$bf8a3460$0100000a@waldron.house>  

next in thread | previous in thread | raw e-mail | index | archive | help
In message <005301bff73b$bf8a3460$0100000a@waldron.house> "Isaac Waldron" writes:
: The issue I'm running into is with the function I'm writing to handle the
: ioctls for the device.  For one of the ioctls, the code needs to get some
: data from the file descriptor that was passed to the original call to
: ioctl(2).  This is easily accomplished in linux, because the file descriptor
: is passed as the second argument to the device_ioctl function.

What data does it need to get from the file descriptor?

: Is there an easy way to get at the same data (the file descriptor passed to
: ioctl(2) by the calling program, in a kernel-style "struct file *", not the
: standard "struct FILE *") in FreeBSD?  Or will it be neccesary to change the
: ioctl structure slightly and therefore need to change some of the higher
: level functions in plex?

Since you don't say what data you need, it is hard to answer this
question.  Generally, however, each device has its state in a per unit
or per minor softc structure.  This "softc" structure usually contains
all the information you'll need to cause the device to do the right
thing, or to modify the softc state for the given file descriptor.
Keep in mind that you get a dev_t with the ioctl which will tell you
exactly which device minor you are dealing with.

Warner


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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