Re: svn commit: r277179 - in head/sys: dev/usb kern sys
On 01/14/15 18:57, Andrey V. Elsukov wrote: 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? Hi, Maybe you misread dev_destroy() with devfs_destroy(). devfs_destroy() only clears a flag bit, so that the devfs system does no longer show the device and the duplicate device check done when you create a new character device is not seeing the yet-to-be destroyed device. It should be OK from what I can see and have tested. --HPS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r277179 - in head/sys: dev/usb kern sys
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 signature.asc Description: OpenPGP digital signature
svn commit: r277179 - in head/sys: dev/usb kern sys
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); +} + +void +delist_dev(struct cdev *dev) +{ + dev_lock(); + delist_dev_locked(dev); + dev_unlock(); +} + void destroy_dev(struct cdev *dev) { Modified: head/sys/sys/conf.h == --- head/sys/sys/conf.h Wed Jan 14 13:03:03 2015(r277178) +++ head/sys/sys/conf.h Wed Jan 14 14:04:29 2015(r277179) @@ -245,6 +245,7 @@ void clone_cleanup(struct clonedevs **); int clone_create(struct clonedevs **, struct cdevsw *, int *unit, struct cdev **dev, int extra); intcount_dev(struct cdev *_dev); +void delist_dev(struct cdev *_dev); void destroy_dev(struct cdev *_dev); intdestroy_dev_sched(struct cdev *dev); intdestroy_dev_sched_cb(struct cdev *dev, void (*cb)(void *), void *arg); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org