Deleted Added
full compact
devfs_devs.c (206698) devfs_devs.c (207729)
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 *
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 206698 2010-04-16 07:02:28Z jh $
28 * $FreeBSD: head/sys/fs/devfs/devfs_devs.c 207729 2010-05-06 19:22:50Z 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>

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

110
111SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev, CTLFLAG_RD,
112 0, sizeof(struct cdev), "sizeof(struct cdev)");
113
114SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev_priv, CTLFLAG_RD,
115 0, sizeof(struct cdev_priv), "sizeof(struct cdev_priv)");
116
117struct cdev *
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>

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

110
111SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev, CTLFLAG_RD,
112 0, sizeof(struct cdev), "sizeof(struct cdev)");
113
114SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev_priv, CTLFLAG_RD,
115 0, sizeof(struct cdev_priv), "sizeof(struct cdev_priv)");
116
117struct cdev *
118devfs_alloc(void)
118devfs_alloc(int flags)
119{
120 struct cdev_priv *cdp;
121 struct cdev *cdev;
122 struct timespec ts;
123
119{
120 struct cdev_priv *cdp;
121 struct cdev *cdev;
122 struct timespec ts;
123
124 cdp = malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO | M_WAITOK);
124 cdp = malloc(sizeof *cdp, M_CDEVP, M_USE_RESERVE | M_ZERO |
125 ((flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK));
126 if (cdp == NULL)
127 return (NULL);
125
126 cdp->cdp_dirents = &cdp->cdp_dirent0;
127 cdp->cdp_dirent0 = NULL;
128 cdp->cdp_maxdirent = 0;
128
129 cdp->cdp_dirents = &cdp->cdp_dirent0;
130 cdp->cdp_dirent0 = NULL;
131 cdp->cdp_maxdirent = 0;
132 cdp->cdp_inode = 0;
129
130 cdev = &cdp->cdp_c;
131
132 cdev->si_name = cdev->__si_namebuf;
133 LIST_INIT(&cdev->si_children);
134 vfs_timestamp(&ts);
135 cdev->si_atime = cdev->si_mtime = cdev->si_ctime = ts;
133
134 cdev = &cdp->cdp_c;
135
136 cdev->si_name = cdev->__si_namebuf;
137 LIST_INIT(&cdev->si_children);
138 vfs_timestamp(&ts);
139 cdev->si_atime = cdev->si_mtime = cdev->si_ctime = ts;
140 cdev->si_cred = NULL;
136
137 return (cdev);
138}
139
140void
141devfs_free(struct cdev *cdev)
142{
143 struct cdev_priv *cdp;

--- 401 unchanged lines hidden ---
141
142 return (cdev);
143}
144
145void
146devfs_free(struct cdev *cdev)
147{
148 struct cdev_priv *cdp;

--- 401 unchanged lines hidden ---