Deleted Added
sdiff udiff text old ( 224743 ) new ( 226041 )
full compact
1/*-
2 * Copyright (c) 2000,2004
3 * Poul-Henning Kamp. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * From: FreeBSD: src/sys/miscfs/kernfs/kernfs_vfsops.c 1.36
27 *
28 * $FreeBSD: head/sys/fs/devfs/devfs_devs.c 224743 2011-08-09 20:53:33Z kib $
29 */
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/conf.h>
34#include <sys/dirent.h>
35#include <sys/kernel.h>
36#include <sys/limits.h>

--- 129 unchanged lines hidden (view full) ---

166void
167devfs_free(struct cdev *cdev)
168{
169 struct cdev_priv *cdp;
170
171 cdp = cdev2priv(cdev);
172 if (cdev->si_cred != NULL)
173 crfree(cdev->si_cred);
174 if (cdp->cdp_inode > 0)
175 free_unr(devfs_inos, cdp->cdp_inode);
176 if (cdp->cdp_maxdirent > 0)
177 free(cdp->cdp_dirents, M_DEVFS2);
178 free(cdp, M_CDEVP);
179}
180
181struct devfs_dirent *
182devfs_find(struct devfs_dirent *dd, const char *name, int namelen, int type)
183{

--- 205 unchanged lines hidden (view full) ---

389 if (de->de_symlink) {
390 free(de->de_symlink, M_DEVFS);
391 de->de_symlink = NULL;
392 }
393#ifdef MAC
394 mac_devfs_destroy(de);
395#endif
396 if (de->de_inode > DEVFS_ROOTINO) {
397 free_unr(devfs_inos, de->de_inode);
398 de->de_inode = 0;
399 }
400 if (DEVFS_DE_DROP(de))
401 devfs_dirent_free(de);
402
403 if (dd != NULL) {
404 if (DEVFS_DE_DROP(dd))
405 devfs_dirent_free(dd);

--- 274 unchanged lines hidden (view full) ---

680 struct cdev_priv *cdp;
681
682 mtx_assert(&devmtx, MA_OWNED);
683 cdp = cdev2priv(dev);
684 cdp->cdp_flags &= ~CDP_ACTIVE;
685 devfs_generation++;
686}
687
688static void
689devfs_devs_init(void *junk __unused)
690{
691
692 devfs_inos = new_unrhdr(DEVFS_ROOTINO + 1, INT_MAX, &devmtx);
693}
694
695SYSINIT(devfs_devs, SI_SUB_DEVFS, SI_ORDER_FIRST, devfs_devs_init, NULL);