1817bf377SKonstantin Belousov.\" Copyright (c) 2008 Konstantin Belousov 2817bf377SKonstantin Belousov.\" All rights reserved. 3817bf377SKonstantin Belousov.\" 4817bf377SKonstantin Belousov.\" Redistribution and use in source and binary forms, with or without 5817bf377SKonstantin Belousov.\" modification, are permitted provided that the following conditions 6817bf377SKonstantin Belousov.\" are met: 7817bf377SKonstantin Belousov.\" 1. Redistributions of source code must retain the above copyright 8817bf377SKonstantin Belousov.\" notice, this list of conditions and the following disclaimer. 9817bf377SKonstantin Belousov.\" 2. Redistributions in binary form must reproduce the above copyright 10817bf377SKonstantin Belousov.\" notice, this list of conditions and the following disclaimer in the 11817bf377SKonstantin Belousov.\" documentation and/or other materials provided with the distribution. 12817bf377SKonstantin Belousov.\" 13817bf377SKonstantin Belousov.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14817bf377SKonstantin Belousov.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15817bf377SKonstantin Belousov.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16817bf377SKonstantin Belousov.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17817bf377SKonstantin Belousov.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18817bf377SKonstantin Belousov.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19817bf377SKonstantin Belousov.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20817bf377SKonstantin Belousov.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21817bf377SKonstantin Belousov.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22817bf377SKonstantin Belousov.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23817bf377SKonstantin Belousov.\" SUCH DAMAGE. 24817bf377SKonstantin Belousov.\" 259d721de3SChristian Brueffer.Dd January 3, 2009 269d721de3SChristian Brueffer.Dt DEV_CLONE 9 279d721de3SChristian Brueffer.Os 28817bf377SKonstantin Belousov.Sh NAME 29817bf377SKonstantin Belousov.Nm dev_clone , 30817bf377SKonstantin Belousov.Nm drain_dev_clone_events 31817bf377SKonstantin Belousov.Nd eventhandler for name-based device cloning in devfs 32817bf377SKonstantin Belousov.Sh SYNOPSIS 33817bf377SKonstantin Belousov.In sys/param.h 34817bf377SKonstantin Belousov.In sys/conf.h 35817bf377SKonstantin Belousov.Ft void 36817bf377SKonstantin Belousov.Fn clone_handler "void *arg" "struct ucred *cr" "char *name" "int namelen" "struct cdev **dev" 37817bf377SKonstantin Belousov.Bd -literal 38817bf377SKonstantin BelousovEVENTHANDLER_REGISTER(dev_clone, clone_handler, arg, priority); 39817bf377SKonstantin Belousov.Ed 40817bf377SKonstantin Belousov.Ft void 41817bf377SKonstantin Belousov.Fn drain_dev_clone_events 42817bf377SKonstantin Belousov.Sh DESCRIPTION 439d721de3SChristian BruefferA device driver may register a listener that will be notified each time 449d721de3SChristian Brueffera name lookup on the 45*1a720cbeSAlexander Ziaee.Xr devfs 4 46817bf377SKonstantin Belousovmount point fails to find the vnode. 479d721de3SChristian BruefferA listener shall be registered for the 48817bf377SKonstantin Belousov.Va dev_clone 49817bf377SKonstantin Belousovevent. 50817bf377SKonstantin BelousovWhen called, it is supplied with the first argument 51817bf377SKonstantin Belousov.Va arg 52817bf377SKonstantin Belousovthat was specified at handler registration time, 53817bf377SKonstantin Belousovappropriate credentials 54817bf377SKonstantin Belousov.Va cr , 559d721de3SChristian Bruefferand a name 56817bf377SKonstantin Belousov.Va name 579d721de3SChristian Bruefferof length 58817bf377SKonstantin Belousov.Va namelen 599d721de3SChristian Bruefferthat we look for. 609d721de3SChristian BruefferIf the handler decides that the name is appropriate and wants to create the device 619d721de3SChristian Bruefferthat will be associated with the name, it should return it to devfs 62817bf377SKonstantin Belousovin the 639d721de3SChristian Brueffer.Va dev 649d721de3SChristian Bruefferargument. 65817bf377SKonstantin Belousov.Pp 66817bf377SKonstantin BelousovThe 67817bf377SKonstantin Belousov.Fn drain_dev_clone_events 68817bf377SKonstantin Belousovfunction is a barrier. 699d721de3SChristian BruefferIt is guaranteed that all calls to eventhandlers for 709d721de3SChristian Brueffer.Nm dev_clone 719d721de3SChristian Bruefferthat were started before 72817bf377SKonstantin Belousov.Fn drain_dev_clone_events 73817bf377SKonstantin Belousovcall, are finished before it returns control. 74817bf377SKonstantin Belousov.Sh SEE ALSO 75*1a720cbeSAlexander Ziaee.Xr devfs 4 , 76817bf377SKonstantin Belousov.Xr namei 9 77