From owner-freebsd-scsi Sat Mar 4 3: 7:18 2000 Delivered-To: freebsd-scsi@freebsd.org Received: from procsys.com (PPP-190-101.bng.vsnl.net.in [203.197.190.101]) by hub.freebsd.org (Postfix) with SMTP id 0920637B7DD; Sat, 4 Mar 2000 03:06:52 -0800 (PST) (envelope-from nanda@procsys.com) Received: from nanda ([192.168.1.70]) by procsys.com with SMTP; Sat, 04 Mar 2000 14:59:55 +0800 Message-ID: <38C0D83D.5A21@procsys.com> Date: Sat, 04 Mar 2000 15:02:45 +0530 From: Nanda Kumar Reply-To: nanda@procsys.com X-Mailer: Mozilla 3.01Gold (Win95; I) MIME-Version: 1.0 To: Mike Smith Cc: freebsd-scsi@FreeBSD.ORG Subject: Re: IOCTL support in SCSI block driver References: <200003032231.OAA01856@mass.cdrom.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, I didn't find the make_dev() function in FreeBSD 3.4 version. Is there any equivalent function to mak_edev () in 3.4 ? Does the make_dev () creates an inode also for the device ? Regards, Nandan >Mike Smith wrote: > > > I am just resending the mail. After going through the code i am almost > > lost. > > > > I went through the mylex code to find how they implement the control > > interface. But i have some doubts regarding this. Mainly these doubts > > come since i am still quiete new to the FreeBSD world and don't have > > good text books regarding how to write device drivers etc. > > > > 1). In the user space how do i specify a controller to communicate with > > that ? For eg. if i want to open the device and a send an IOCTL how do > > i specify that ? In our case actual disks will be seen as part of target > > discovery done through the CAM SCSI interface. > > The controller code instantiates a device for each controller. The Mylex > driver is still doing this the "old" way: > > /* > * Register the control device on first attach. > */ > if (cdev_registered++ == 0) > cdevsw_add(&mlx_cdevsw); > > It would be more correct for it to use: > > sc->mlx_dev_t = make_dev(&mlx_cdevsw, device_get_unit(sc->mlx_dev), > 0, 0, S_IRUSR|S_IRUSRW, > "mlx%d", device_get_unit(sc->mlx_dev)); > > and then use > > destroy_dev(sc->mlx_dev_t); > > in the corresponding detach method. > > (makes note to self to fix Mylex driver thusly). > > > 2). I found that the while registering the character device the "softc" > > structure does not come to picture at all. But later while opening the > > device the "softc" structure is obtained using "devclass_get_softc". > > How is it obtained ? If there are some documents regarding these you can > > tell me and i will go through it. > > The bus code is responsible for tracking the softc structure; the minor > number for the device maps directly to the controller instance number, so > /dev/mlx0 has minor number 0, and thus you ask for the softc pointer for > instance 0 of mlx_devclass. > > -- > \\ Give a man a fish, and you feed him for a day. \\ Mike Smith > \\ Tell him he should learn how to fish himself, \\ msmith@freebsd.org > \\ and he'll hate you for a lifetime. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message