Robert Watson wrote: > On Fri, 14 Aug 2009, Andrew Gallatin wrote: > >> I've been porting a closed-source driver to FreeBSD 8 from FreeBSD >> 5/6/7. It use the dev_clone() eventhandler to mimic linux-like open >> semantics (for linux binary compat). > > No particular experience with unloading cloning stuff, but have you > noticed that in 8.x we now have per-file descriptor device state? This > is often the semantics people actually want, rather than cloning. See > devfs_set_cdevpriv(9) for details -- there are several synthetic devices > in the tree that use it now (although some of them do too much > error-checking, and should assert rather than return errors, I think). Unfortunately, I think I still need device cloning. The linux semantics are to open /dev/mx0, then call an ioctl to set the device private state. This gets set (in linux) in the "struct file *" ->private_data field. So multiple processes can open /dev/mx0, and they all have different private data. FWIW: >> I'm assuming these files are lingering because clone_cleanup() >> (called at device detach) is not cleaning up these lingering >> device nodes. I've tried writing a dtrace script to trace >> clone_cleanup. But since that happens from device detach, >> dtrace doesn't work (blocks driver unload). I've also tried >> setting a breakpoint in ddb(), but the breakpoint seems to >> be ignored (other breakpoints work fine, which is odd). I think ddb wasn't working because my kernel sources didn't quite match my running kernel. After a kernel & module rebuild, I can watch clone_cleanup(), and I see destroy_devl() get called. It calls devfs_destroy(), as well. The interesting thing is that if I run devd -D -d, and watch the events scroll by, I see the destruction of a device with a null name. Eg: Processing event '!system=DEVFS subsystem=CDEV type=DESTROY cdev=' Pushing table setting system=DEVFS setting subsystem=CDEV setting type=DESTROY setting cdev= Processing notify event <...> If I do the same thing on 7.2, I see: Processing event '!system=DEVFS subsystem=CDEV type=DESTROY cdev=mx_fake.0' Pushing table setting system=DEVFS setting subsystem=CDEV setting type=DESTROY setting cdev=mx_fake.0 Processing notify event So I wonder if the node is not getting removed because its name has gotten mangled somehow... DrewReceived on Fri Aug 14 2009 - 17:24:04 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:53 UTC