Date: Sat, 04 Mar 2000 15:02:45 +0530 From: Nanda Kumar <nanda@procsys.com> To: Mike Smith <msmith@freebsd.org> Cc: freebsd-scsi@FreeBSD.ORG Subject: Re: IOCTL support in SCSI block driver Message-ID: <38C0D83D.5A21@procsys.com> References: <200003032231.OAA01856@mass.cdrom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38C0D83D.5A21>