Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/inet/sockmods/sockmod_sdp.c
+++ new/usr/src/uts/common/inet/sockmods/sockmod_sdp.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 #include <sys/sysmacros.h>
27 27 #include <sys/strsubr.h>
28 28 #include <sys/socket.h>
29 29 #include <sys/socketvar.h>
30 30 #include <sys/modctl.h>
31 31 #include <sys/cmn_err.h>
32 32 #include <sys/vfs.h>
33 33 #include <inet/sdp_itf.h>
34 34 #include <fs/sockfs/sockcommon.h>
35 35 #include "socksdp.h"
36 36
37 37 struct sonode *socksdp_create(struct sockparams *, int, int, int,
38 38 int, int, int *, cred_t *);
39 39 static void socksdp_destroy(struct sonode *);
40 40
41 41 static __smod_priv_t sosdp_priv = {
42 42 socksdp_create,
43 43 socksdp_destroy,
44 44 NULL
45 45 };
46 46
47 47 static smod_reg_t sinfo = {
48 48 SOCKMOD_VERSION,
49 49 "socksdp",
50 50 SOCK_UC_VERSION,
51 51 SOCK_DC_VERSION,
52 52 NULL,
53 53 &sosdp_priv
54 54 };
↓ open down ↓ |
54 lines elided |
↑ open up ↑ |
55 55
56 56 /*
57 57 * Module linkage information for the kernel
58 58 */
59 59 static struct modlsockmod modlsockmod = {
60 60 &mod_sockmodops, "SDP socket module", &sinfo
61 61 };
62 62
63 63 static struct modlinkage modlinkage = {
64 64 MODREV_1,
65 - &modlsockmod,
66 - NULL
65 + { &modlsockmod, NULL }
67 66 };
68 67
69 68 /*
70 69 * Creates a sdp socket data structure.
71 70 */
72 71 /* ARGSUSED */
73 72 struct sonode *
74 73 socksdp_create(struct sockparams *sp, int family, int type, int protocol,
75 74 int version, int sflags, int *errorp, cred_t *cr)
76 75 {
77 76 struct sonode *so;
78 77 int kmflags = (sflags & SOCKET_NOSLEEP) ? KM_NOSLEEP : KM_SLEEP;
79 78
80 79 dprint(4, ("Inside sosdp_create: domain:%d proto:%d type:%d",
81 80 family, protocol, type));
82 81
83 82 *errorp = 0;
84 83 if (is_system_labeled()) {
85 84 *errorp = EOPNOTSUPP;
86 85 return (NULL);
87 86 }
88 87
89 88 if (version == SOV_STREAM) {
90 89 *errorp = EINVAL;
91 90 return (NULL);
92 91 }
93 92
94 93 /*
95 94 * We only support one type of SDP socket. Let sotpi_create()
96 95 * handle all other cases, such as raw socket.
97 96 */
98 97 if (!(family == AF_INET || family == AF_INET6) ||
99 98 !(type == SOCK_STREAM)) {
100 99 *errorp = EINVAL;
101 100 return (NULL);
102 101 }
103 102
104 103 so = kmem_cache_alloc(socket_cache, kmflags);
105 104 if (so == NULL) {
106 105 *errorp = ENOMEM;
107 106 return (NULL);
108 107 }
109 108
110 109 sonode_init(so, sp, family, type, protocol, &sosdp_sonodeops);
111 110 so->so_pollev |= SO_POLLEV_ALWAYS;
112 111
113 112 dprint(2, ("sosdp_create: %p domain %d type %d\n", (void *)so, family,
114 113 type));
115 114
116 115 if (version == SOV_DEFAULT) {
117 116 version = so_default_version;
118 117 }
119 118 so->so_version = (short)version;
120 119
121 120 /*
122 121 * set the default values to be INFPSZ
123 122 * if a protocol desires it can change the value later
124 123 */
125 124 so->so_proto_props.sopp_rxhiwat = SOCKET_RECVHIWATER;
126 125 so->so_proto_props.sopp_rxlowat = SOCKET_RECVLOWATER;
127 126 so->so_proto_props.sopp_maxpsz = INFPSZ;
128 127 so->so_proto_props.sopp_maxblk = INFPSZ;
129 128
130 129 return (so);
131 130 }
132 131
133 132 static void
134 133 socksdp_destroy(struct sonode *so)
135 134 {
136 135 ASSERT(so->so_ops == &sosdp_sonodeops);
137 136
138 137 sosdp_fini(so, CRED());
139 138
140 139 kmem_cache_free(socket_cache, so);
141 140 }
142 141
143 142 int
144 143 _init(void)
145 144 {
146 145 return (mod_install(&modlinkage));
147 146 }
148 147
149 148 int
150 149 _fini(void)
151 150 {
152 151 return (mod_remove(&modlinkage));
153 152 }
154 153
155 154 int
156 155 _info(struct modinfo *modinfop)
157 156 {
158 157 return (mod_info(&modlinkage, modinfop));
159 158 }
↓ open down ↓ |
83 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX