svn commit: r277179 - in head/sys: dev/usb kern sys

Andrey V. Elsukov ae at FreeBSD.org
Wed Jan 14 17:58:38 UTC 2015


On 14.01.2015 17:04, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Wed Jan 14 14:04:29 2015
> New Revision: 277179
> URL: https://svnweb.freebsd.org/changeset/base/277179
> 
> Log:
>   Add a kernel function to delist our kernel character devices, so that
>   the device name can be re-used right away in case we are destroying
>   the character devices in the background.
>   
>   MFC after:	4 days
>   Reported by:	dchagin@
> 
> Modified:
>   head/sys/dev/usb/usb_device.c
>   head/sys/kern/kern_conf.c
>   head/sys/sys/conf.h
> 
> Modified: head/sys/dev/usb/usb_device.c
> ==============================================================================
> --- head/sys/dev/usb/usb_device.c	Wed Jan 14 13:03:03 2015	(r277178)
> +++ head/sys/dev/usb/usb_device.c	Wed Jan 14 14:04:29 2015	(r277179)
> @@ -2019,7 +2019,10 @@ usb_destroy_dev(struct usb_fs_privdata *
>  		usb_destroy_dev_sync(pd);
>  		return;
>  	}
> -	
> +
> +	/* make sure we can re-use the device name */
> +	delist_dev(pd->cdev);
> +
>  	USB_BUS_LOCK(bus);
>  	LIST_INSERT_HEAD(&bus->pd_cleanup_list, pd, pd_next);
>  	/* get cleanup going */
> 
> Modified: head/sys/kern/kern_conf.c
> ==============================================================================
> --- head/sys/kern/kern_conf.c	Wed Jan 14 13:03:03 2015	(r277178)
> +++ head/sys/kern/kern_conf.c	Wed Jan 14 14:04:29 2015	(r277179)
> @@ -1114,6 +1114,23 @@ destroy_devl(struct cdev *dev)
>  	}
>  }
>  
> +static void
> +delist_dev_locked(struct cdev *dev)
> +{
> +	struct cdev *child;
> +	devfs_destroy(dev);
> +	LIST_FOREACH(child, &dev->si_children, si_siblings)
> +		delist_dev_locked(child);
> +}

It looks a bit strange. First you call destroy(dev), then you are trying
enumerate its children. It is ok?

-- 
WBR, Andrey V. Elsukov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 538 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20150114/d4edc269/attachment.sig>


More information about the svn-src-head mailing list