Subject: locking out device attach/detach?
To: None <tech-kern@netbsd.org>
From: Iain Hibbert <plunky@rya-online.net>
List: tech-kern
Date: 12/05/2005 22:06:10
Hi,
How should I lock out device attach/detach routines while for example
walking a device list that I've added to in said routines in order to
protect against the list being modified while I use it? (only short scans)
looking at the master ifnet list in net/if.c for instance:
ifunit() uses TAILQ_FIRST/TAILQ_NEXT with no protection (?)
if_attach() uses TAILQ_INSERT_LAST with no protection
if_detach() uses TAILQ_REMOVE inside splnet()
when device attach/detach functions are called, how are they triggered and
at what priority is the call? (is pcmcia different to usb?)
I'm not using the ifnet code any more (I think bluetooth device is not
exactly an interface), but am doing much the same thing with another list
head..
iain