From owner-freebsd-hackers Wed Jul 26 13:12:10 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id 1281337BE1D for ; Wed, 26 Jul 2000 13:12:07 -0700 (PDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.9.3/8.9.3) with ESMTP id OAA32881; Wed, 26 Jul 2000 14:12:05 -0600 (MDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id OAA31863; Wed, 26 Jul 2000 14:12:03 -0600 (MDT) Message-Id: <200007262012.OAA31863@harmony.village.org> To: "Isaac Waldron" Subject: Re: Writing device drivers (ioctl issue) Cc: freebsd-hackers@FreeBSD.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> Date: Wed, 26 Jul 2000 14:12:03 -0600 From: Warner Losh Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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