cvs commit: src/sys/fs/devfs devfs_vnops.c src/sys/kern kern_conf.c src/sys/sys conf.h

Nate Lawson nate at root.org
Wed Aug 17 17:04:43 GMT 2005


Poul-Henning Kamp wrote:
> phk         2005-08-17 08:19:53 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/fs/devfs         devfs_vnops.c 
>     sys/kern             kern_conf.c 
>     sys/sys              conf.h 
>   Log:
>   Handle device drivers with D_NEEDGIANT in a way which does not
>   penalize the 'good' drivers:  Allocate a shadow cdevsw and populate
>   it with wrapper functions which grab Giant
>   
>   Revision  Changes    Path
>   1.120     +0 -24     src/sys/fs/devfs/devfs_vnops.c
>   1.190     +155 -9    src/sys/kern/kern_conf.c
>   1.226     +1 -0      src/sys/sys/conf.h
> 
>
>  static void
>  prep_cdevsw(struct cdevsw *devsw)
>  {
> +	struct cdevsw *dsw2;
>  
> +	if (devsw->d_flags & D_NEEDGIANT)
> +		dsw2 = malloc(sizeof *dsw2, M_DEVT, M_WAITOK);
> +	else
> +		dsw2 = NULL;
>  	dev_lock();
>  
>  	if (devsw->d_version != D_VERSION_01) {

Is it guaranteed that prep_cdevsw() won't be called twice without a call 
to fini_cdevsw()?  Otherwise, the shadow cdevsw could leak when its 
pointer is set to NULL.  I'm not familiar with this code, just asking.

-- 
Nate


More information about the cvs-src mailing list