drop net-snmp dep
[unleashed.git] / kernel / fs / sockfs / sockvfsops.c
blob05956010d05dac6fd7efe8cfb6d8678fb2dd04a9
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
25 #include <sys/types.h>
26 #include <sys/t_lock.h>
27 #include <sys/param.h>
28 #include <sys/systm.h>
29 #include <sys/buf.h>
30 #include <sys/cmn_err.h>
31 #include <sys/debug.h>
32 #include <sys/errno.h>
33 #include <sys/vfs.h>
34 #include <sys/swap.h>
35 #include <sys/vnode.h>
36 #include <sys/cred.h>
37 #include <sys/thread.h>
38 #include <sys/zone.h>
40 #include <sys/fs_subr.h>
42 #include <sys/stream.h>
43 #include <sys/socket.h>
44 #include <sys/stropts.h>
45 #include <sys/socketvar.h>
48 * This is the loadable module wrapper.
50 #include <sys/modctl.h>
52 static zone_key_t sockfs_zone_key;
54 static vfsdef_t vfw = {
55 VFSDEF_VERSION,
56 "sockfs",
57 sockinit,
58 VSW_ZMOUNT,
59 NULL
62 extern struct mod_ops mod_fsops;
65 * Module linkage information for the kernel.
67 static struct modlfs modlfs = {
68 &mod_fsops, "filesystem for sockfs", &vfw
71 static struct modlinkage modlinkage = {
72 MODREV_1, (void *)&modlfs, NULL
75 int
76 _init(void)
78 int ret;
81 * We want to be informed each time a zone is created or
82 * destroyed in the kernel, so we can maintain per-zone
83 * kstat. sock_kstat_init() will also be called for the
84 * global zone, without us having to special case it here.
86 zone_key_create(&sockfs_zone_key,
87 sock_kstat_init, NULL, sock_kstat_fini);
89 if ((ret = mod_install(&modlinkage)) != 0) {
90 (void) zone_key_delete(sockfs_zone_key);
93 return (ret);
96 int
97 _info(struct modinfo *modinfop)
99 return (mod_info(&modlinkage, modinfop));
103 _fini(void)
105 /* zone_key_delete(sockfs_zone_key); - if we were ever to be unloaded */
107 return (EBUSY);
111 * N.B.
112 * No _fini routine. This module cannot be unloaded once loaded.
113 * The NO_UNLOAD_STUB in modstub.s must change if this module ever
114 * is modified to become unloadable.