1/*
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 2000
5 * Poul-Henning Kamp. All rights reserved.
6 *
7 * This code is derived from software donated to Berkeley by
8 * Jan-Simon Pendry.
--- 17 unchanged lines hidden (view full) ---
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)kernfs_vnops.c 8.15 (Berkeley) 5/21/95
32 * From: FreeBSD: src/sys/miscfs/kernfs/kernfs_vnops.c 1.43
33 *
34 * $FreeBSD: head/sys/fs/devfs/devfs_vnops.c 130640 2004-06-17 17:16:53Z phk $
35 */
36
37/*
38 * TODO:
39 * remove empty directories
40 * mknod: hunt down DE_DELETED, compare name, reinstantiate.
41 * mkdir: want it ?
42 */
--- 92 unchanged lines hidden (view full) ---
135 *vpp = vp;
136 return (0);
137 }
138 if (de->de_dirent->d_type == DT_CHR) {
139 dev = *devfs_itod(de->de_inode);
140 if (dev == NULL)
141 return (ENOENT);
142 } else {
143 dev = NULL;
144 }
145 error = getnewvnode("devfs", mp, devfs_vnodeop_p, &vp);
146 if (error != 0) {
147 printf("devfs_allocv: failed to allocate new vnode\n");
148 return (error);
149 }
150
151 if (de->de_dirent->d_type == DT_CHR) {
--- 225 unchanged lines hidden (view full) ---
377 /*
378 * OK, we didn't have an entry for the name we were asked for
379 * so we try to see if anybody can create it on demand.
380 */
381 pname = devfs_fqpn(specname, dvp, cnp);
382 if (pname == NULL)
383 goto notfound;
384
385 cdev = NULL;
386 EVENTHANDLER_INVOKE(dev_clone, pname, strlen(pname), &cdev);
387 if (cdev == NULL)
388 goto notfound;
389
390 devfs_populate(dmp);
391
392 dde = devfs_itode(dmp, cdev->si_inode);
393
394 if (dde == NULL || *dde == NULL || *dde == DE_DELETED)
395 goto notfound;
--- 259 unchanged lines hidden (view full) ---
655 struct vnode *vp = ap->a_vp;
656 struct devfs_dirent *de;
657 int i;
658
659 de = vp->v_data;
660 if (de != NULL)
661 de->de_vnode = NULL;
662 vp->v_data = NULL;
663 if (vp->v_rdev != NULL && vp->v_rdev != NULL) {
664 i = vcount(vp);
665 if ((vp->v_rdev->si_flags & SI_CHEAPCLONE) && i == 0 &&
666 (vp->v_rdev->si_flags & SI_NAMED))
667 destroy_dev(vp->v_rdev);
668 }
669 return (0);
670}
671
--- 249 unchanged lines hidden ---
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 2000
5 * Poul-Henning Kamp. All rights reserved.
6 *
7 * This code is derived from software donated to Berkeley by
8 * Jan-Simon Pendry.
--- 17 unchanged lines hidden (view full) ---
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)kernfs_vnops.c 8.15 (Berkeley) 5/21/95
32 * From: FreeBSD: src/sys/miscfs/kernfs/kernfs_vnops.c 1.43
33 *
34 * $FreeBSD: head/sys/fs/devfs/devfs_vnops.c 130640 2004-06-17 17:16:53Z phk $
35 */
36
37/*
38 * TODO:
39 * remove empty directories
40 * mknod: hunt down DE_DELETED, compare name, reinstantiate.
41 * mkdir: want it ?
42 */
--- 92 unchanged lines hidden (view full) ---
135 *vpp = vp;
136 return (0);
137 }
138 if (de->de_dirent->d_type == DT_CHR) {
139 dev = *devfs_itod(de->de_inode);
140 if (dev == NULL)
141 return (ENOENT);
142 } else {
143 dev = NULL;
144 }
145 error = getnewvnode("devfs", mp, devfs_vnodeop_p, &vp);
146 if (error != 0) {
147 printf("devfs_allocv: failed to allocate new vnode\n");
148 return (error);
149 }
150
151 if (de->de_dirent->d_type == DT_CHR) {
--- 225 unchanged lines hidden (view full) ---
377 /*
378 * OK, we didn't have an entry for the name we were asked for
379 * so we try to see if anybody can create it on demand.
380 */
381 pname = devfs_fqpn(specname, dvp, cnp);
382 if (pname == NULL)
383 goto notfound;
384
385 cdev = NULL;
386 EVENTHANDLER_INVOKE(dev_clone, pname, strlen(pname), &cdev);
387 if (cdev == NULL)
388 goto notfound;
389
390 devfs_populate(dmp);
391
392 dde = devfs_itode(dmp, cdev->si_inode);
393
394 if (dde == NULL || *dde == NULL || *dde == DE_DELETED)
395 goto notfound;
--- 259 unchanged lines hidden (view full) ---
655 struct vnode *vp = ap->a_vp;
656 struct devfs_dirent *de;
657 int i;
658
659 de = vp->v_data;
660 if (de != NULL)
661 de->de_vnode = NULL;
662 vp->v_data = NULL;
663 if (vp->v_rdev != NULL && vp->v_rdev != NULL) {
664 i = vcount(vp);
665 if ((vp->v_rdev->si_flags & SI_CHEAPCLONE) && i == 0 &&
666 (vp->v_rdev->si_flags & SI_NAMED))
667 destroy_dev(vp->v_rdev);
668 }
669 return (0);
670}
671
--- 249 unchanged lines hidden ---