1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
32*7c478bd9Sstevel@tonic-gate  * The Regents of the University of California
33*7c478bd9Sstevel@tonic-gate  * All Rights Reserved
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
36*7c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
37*7c478bd9Sstevel@tonic-gate  * contributors.
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /*
43*7c478bd9Sstevel@tonic-gate  * Kernel TLI-like function to read a datagram off of a
44*7c478bd9Sstevel@tonic-gate  * transport endpoints stream head.
45*7c478bd9Sstevel@tonic-gate  *
46*7c478bd9Sstevel@tonic-gate  * Returns:
47*7c478bd9Sstevel@tonic-gate  * 	0	On success or positive error code.
48*7c478bd9Sstevel@tonic-gate  * 		On sucess, type is set to:
49*7c478bd9Sstevel@tonic-gate  * 	T_DATA		If normal data has been received
50*7c478bd9Sstevel@tonic-gate  * 	T_UDERR		If an error indication has been received,
51*7c478bd9Sstevel@tonic-gate  * 			in which case uderr contains the unitdata
52*7c478bd9Sstevel@tonic-gate  * 			error number.
53*7c478bd9Sstevel@tonic-gate  * 	T_ERROR
54*7c478bd9Sstevel@tonic-gate  */
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
57*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
58*7c478bd9Sstevel@tonic-gate #include <sys/user.h>
59*7c478bd9Sstevel@tonic-gate #include <sys/file.h>
60*7c478bd9Sstevel@tonic-gate #include <sys/errno.h>
61*7c478bd9Sstevel@tonic-gate #include <sys/stream.h>
62*7c478bd9Sstevel@tonic-gate #include <sys/strsubr.h>
63*7c478bd9Sstevel@tonic-gate #include <sys/vnode.h>
64*7c478bd9Sstevel@tonic-gate #include <sys/ioctl.h>
65*7c478bd9Sstevel@tonic-gate #include <sys/stropts.h>
66*7c478bd9Sstevel@tonic-gate #include <sys/tihdr.h>
67*7c478bd9Sstevel@tonic-gate #include <sys/timod.h>
68*7c478bd9Sstevel@tonic-gate #include <sys/tiuser.h>
69*7c478bd9Sstevel@tonic-gate #include <sys/t_kuser.h>
70*7c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate int
74*7c478bd9Sstevel@tonic-gate t_krcvudata(TIUSER *tiptr, struct t_kunitdata *unitdata, int *type, int *uderr)
75*7c478bd9Sstevel@tonic-gate {
76*7c478bd9Sstevel@tonic-gate 	int			len;
77*7c478bd9Sstevel@tonic-gate 	size_t			hdrsz;
78*7c478bd9Sstevel@tonic-gate 	union T_primitives	*pptr;
79*7c478bd9Sstevel@tonic-gate 	struct file		*fp;
80*7c478bd9Sstevel@tonic-gate 	mblk_t			*bp;
81*7c478bd9Sstevel@tonic-gate 	mblk_t			*nbp;
82*7c478bd9Sstevel@tonic-gate 	mblk_t			*mp;
83*7c478bd9Sstevel@tonic-gate 	mblk_t			*tmp;
84*7c478bd9Sstevel@tonic-gate 	int			error;
85*7c478bd9Sstevel@tonic-gate 	int			flag;
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate 	fp = tiptr->fp;
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate 	if (type == NULL || uderr == NULL)
90*7c478bd9Sstevel@tonic-gate 		return (EINVAL);
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate 	error = 0;
93*7c478bd9Sstevel@tonic-gate 	unitdata->udata.buf = NULL;
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate 	if (unitdata->udata.udata_mp) {
96*7c478bd9Sstevel@tonic-gate 		KTLILOG(2, "t_krcvudata: freeing existing message block\n", 0);
97*7c478bd9Sstevel@tonic-gate 		freemsg(unitdata->udata.udata_mp);
98*7c478bd9Sstevel@tonic-gate 		unitdata->udata.udata_mp = NULL;
99*7c478bd9Sstevel@tonic-gate 	}
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate 	/*
102*7c478bd9Sstevel@tonic-gate 	 * XXX	Grabbing a mutex to do an atomic operation seems pointless
103*7c478bd9Sstevel@tonic-gate 	 */
104*7c478bd9Sstevel@tonic-gate 	mutex_enter(&fp->f_tlock);
105*7c478bd9Sstevel@tonic-gate 	flag = fp->f_flag;
106*7c478bd9Sstevel@tonic-gate 	mutex_exit(&fp->f_tlock);
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate 	if ((error = tli_recv(tiptr, &bp, flag)) != 0)
109*7c478bd9Sstevel@tonic-gate 		return (error);
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate 	/*
112*7c478bd9Sstevel@tonic-gate 	 * Got something
113*7c478bd9Sstevel@tonic-gate 	 */
114*7c478bd9Sstevel@tonic-gate 	switch (bp->b_datap->db_type) {
115*7c478bd9Sstevel@tonic-gate 	case M_PROTO:
116*7c478bd9Sstevel@tonic-gate 		/* LINTED pointer alignment */
117*7c478bd9Sstevel@tonic-gate 		pptr = (union T_primitives *)bp->b_rptr;
118*7c478bd9Sstevel@tonic-gate 		switch (pptr->type) {
119*7c478bd9Sstevel@tonic-gate 		case T_UNITDATA_IND:
120*7c478bd9Sstevel@tonic-gate 			KTLILOG(2, "t_krcvudata: Got T_UNITDATA_IND\n", 0);
121*7c478bd9Sstevel@tonic-gate 			hdrsz = bp->b_wptr - bp->b_rptr;
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate 			/*
124*7c478bd9Sstevel@tonic-gate 			 * check everything for consistency
125*7c478bd9Sstevel@tonic-gate 			 */
126*7c478bd9Sstevel@tonic-gate 			if (hdrsz < TUNITDATAINDSZ ||
127*7c478bd9Sstevel@tonic-gate 			    hdrsz < (pptr->unitdata_ind.OPT_length +
128*7c478bd9Sstevel@tonic-gate 			    pptr->unitdata_ind.OPT_offset) ||
129*7c478bd9Sstevel@tonic-gate 			    hdrsz < (pptr->unitdata_ind.SRC_length +
130*7c478bd9Sstevel@tonic-gate 			    pptr->unitdata_ind.SRC_offset)) {
131*7c478bd9Sstevel@tonic-gate 				error = EPROTO;
132*7c478bd9Sstevel@tonic-gate 				freemsg(bp);
133*7c478bd9Sstevel@tonic-gate 				break;
134*7c478bd9Sstevel@tonic-gate 			}
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate 			/*
137*7c478bd9Sstevel@tonic-gate 			 * okay, so now we copy them
138*7c478bd9Sstevel@tonic-gate 			 */
139*7c478bd9Sstevel@tonic-gate 			len = MIN(pptr->unitdata_ind.SRC_length,
140*7c478bd9Sstevel@tonic-gate 			    unitdata->addr.maxlen);
141*7c478bd9Sstevel@tonic-gate 			bcopy(bp->b_rptr + pptr->unitdata_ind.SRC_offset,
142*7c478bd9Sstevel@tonic-gate 			    unitdata->addr.buf, len);
143*7c478bd9Sstevel@tonic-gate 			unitdata->addr.len = len;
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate 			len = MIN(pptr->unitdata_ind.OPT_length,
146*7c478bd9Sstevel@tonic-gate 			    unitdata->opt.maxlen);
147*7c478bd9Sstevel@tonic-gate 			bcopy(bp->b_rptr + pptr->unitdata_ind.OPT_offset,
148*7c478bd9Sstevel@tonic-gate 			    unitdata->opt.buf, len);
149*7c478bd9Sstevel@tonic-gate 			unitdata->opt.len = len;
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate 			bp->b_rptr += hdrsz;
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate 			/*
154*7c478bd9Sstevel@tonic-gate 			 * we assume that the client knows how to deal
155*7c478bd9Sstevel@tonic-gate 			 * with a set of linked mblks, so all we do is
156*7c478bd9Sstevel@tonic-gate 			 * make a pass and remove any that are zero
157*7c478bd9Sstevel@tonic-gate 			 * length.
158*7c478bd9Sstevel@tonic-gate 			 */
159*7c478bd9Sstevel@tonic-gate 			nbp = NULL;
160*7c478bd9Sstevel@tonic-gate 			mp = bp;
161*7c478bd9Sstevel@tonic-gate 			while (mp) {
162*7c478bd9Sstevel@tonic-gate 				if (!(bp->b_wptr-bp->b_rptr)) {
163*7c478bd9Sstevel@tonic-gate 					KTLILOG(2,
164*7c478bd9Sstevel@tonic-gate 					    "t_krcvudata: zero length block\n",
165*7c478bd9Sstevel@tonic-gate 					    0);
166*7c478bd9Sstevel@tonic-gate 					tmp = mp->b_cont;
167*7c478bd9Sstevel@tonic-gate 					if (nbp)
168*7c478bd9Sstevel@tonic-gate 						nbp->b_cont = tmp;
169*7c478bd9Sstevel@tonic-gate 					else
170*7c478bd9Sstevel@tonic-gate 						bp = tmp;
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate 					freeb(mp);
173*7c478bd9Sstevel@tonic-gate 					mp = tmp;
174*7c478bd9Sstevel@tonic-gate 				} else {
175*7c478bd9Sstevel@tonic-gate 					nbp = mp;
176*7c478bd9Sstevel@tonic-gate 					mp = mp->b_cont;
177*7c478bd9Sstevel@tonic-gate 				}
178*7c478bd9Sstevel@tonic-gate 			}
179*7c478bd9Sstevel@tonic-gate #ifdef KTLIDEBUG
180*7c478bd9Sstevel@tonic-gate {
181*7c478bd9Sstevel@tonic-gate 	mblk_t *tp;
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate 	tp = bp;
184*7c478bd9Sstevel@tonic-gate 	while (tp) {
185*7c478bd9Sstevel@tonic-gate 		struct datab *dbp = tp->b_datap;
186*7c478bd9Sstevel@tonic-gate 		frtn_t *frp = dbp->db_frtnp;
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate 		KTLILOG(2, "t_krcvudata: bp %x, ", tp);
189*7c478bd9Sstevel@tonic-gate 		KTLILOG(2, "db_size %x, ", dbp->db_lim - dbp->db_base);
190*7c478bd9Sstevel@tonic-gate 		KTLILOG(2, "db_ref %x", dbp->db_ref);
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate 		if (frp != NULL)
193*7c478bd9Sstevel@tonic-gate 			KTLILOG(2, ", func: %x", frp->free_func);
194*7c478bd9Sstevel@tonic-gate 			KTLILOG(2, ", arg %x\n", frp->free_arg);
195*7c478bd9Sstevel@tonic-gate 		} else
196*7c478bd9Sstevel@tonic-gate 			KTLILOG(2, "\n", 0);
197*7c478bd9Sstevel@tonic-gate 		tp = tp->b_cont;
198*7c478bd9Sstevel@tonic-gate 	}
199*7c478bd9Sstevel@tonic-gate }
200*7c478bd9Sstevel@tonic-gate #endif /* KTLIDEBUG */
201*7c478bd9Sstevel@tonic-gate 			/*
202*7c478bd9Sstevel@tonic-gate 			 * now just point the users mblk
203*7c478bd9Sstevel@tonic-gate 			 * pointer to what we received.
204*7c478bd9Sstevel@tonic-gate 			 */
205*7c478bd9Sstevel@tonic-gate 			if (bp == NULL) {
206*7c478bd9Sstevel@tonic-gate 				KTLILOG(2, "t_krcvudata: No data\n", 0);
207*7c478bd9Sstevel@tonic-gate 				error = EPROTO;
208*7c478bd9Sstevel@tonic-gate 				break;
209*7c478bd9Sstevel@tonic-gate 			}
210*7c478bd9Sstevel@tonic-gate 			if (bp->b_wptr != bp->b_rptr) {
211*7c478bd9Sstevel@tonic-gate 			    if (!IS_P2ALIGNED(bp->b_rptr, sizeof (uint32_t)))
212*7c478bd9Sstevel@tonic-gate 					if (!pullupmsg(bp,
213*7c478bd9Sstevel@tonic-gate 					    bp->b_wptr - bp->b_rptr)) {
214*7c478bd9Sstevel@tonic-gate 						KTLILOG(1,
215*7c478bd9Sstevel@tonic-gate 					"t_krcvudata:  pullupmsg failed\n", 0);
216*7c478bd9Sstevel@tonic-gate 						error = EIO;
217*7c478bd9Sstevel@tonic-gate 						freemsg(bp);
218*7c478bd9Sstevel@tonic-gate 						break;
219*7c478bd9Sstevel@tonic-gate 					}
220*7c478bd9Sstevel@tonic-gate 				unitdata->udata.buf = (char *)bp->b_rptr;
221*7c478bd9Sstevel@tonic-gate 				unitdata->udata.len = (uint)(bp->b_wptr -
222*7c478bd9Sstevel@tonic-gate 				    bp->b_rptr);
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate 				KTLILOG(2, "t_krcvudata: got %d bytes\n",
225*7c478bd9Sstevel@tonic-gate 				    unitdata->udata.len);
226*7c478bd9Sstevel@tonic-gate 				unitdata->udata.udata_mp = bp;
227*7c478bd9Sstevel@tonic-gate 			} else {
228*7c478bd9Sstevel@tonic-gate 				KTLILOG(2,
229*7c478bd9Sstevel@tonic-gate 				    "t_krcvudata: 0 length data message\n", 0);
230*7c478bd9Sstevel@tonic-gate 				freemsg(bp);
231*7c478bd9Sstevel@tonic-gate 				unitdata->udata.len = 0;
232*7c478bd9Sstevel@tonic-gate 			}
233*7c478bd9Sstevel@tonic-gate 			*type = T_DATA;
234*7c478bd9Sstevel@tonic-gate 			break;
235*7c478bd9Sstevel@tonic-gate 
236*7c478bd9Sstevel@tonic-gate 		case T_UDERROR_IND:
237*7c478bd9Sstevel@tonic-gate 			KTLILOG(2, "t_krcvudata: Got T_UDERROR_IND\n", 0);
238*7c478bd9Sstevel@tonic-gate 			hdrsz = bp->b_wptr - bp->b_rptr;
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate 			/*
241*7c478bd9Sstevel@tonic-gate 			 * check everything for consistency
242*7c478bd9Sstevel@tonic-gate 			 */
243*7c478bd9Sstevel@tonic-gate 			if (hdrsz < TUDERRORINDSZ ||
244*7c478bd9Sstevel@tonic-gate 			    hdrsz < (pptr->uderror_ind.OPT_length +
245*7c478bd9Sstevel@tonic-gate 			    pptr->uderror_ind.OPT_offset) ||
246*7c478bd9Sstevel@tonic-gate 			    hdrsz < (pptr->uderror_ind.DEST_length +
247*7c478bd9Sstevel@tonic-gate 			    pptr->uderror_ind.DEST_offset)) {
248*7c478bd9Sstevel@tonic-gate 				error = EPROTO;
249*7c478bd9Sstevel@tonic-gate 				freemsg(bp);
250*7c478bd9Sstevel@tonic-gate 				break;
251*7c478bd9Sstevel@tonic-gate 			}
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate 			if (pptr->uderror_ind.DEST_length >
254*7c478bd9Sstevel@tonic-gate 			    (int)unitdata->addr.maxlen ||
255*7c478bd9Sstevel@tonic-gate 			    pptr->uderror_ind.OPT_length >
256*7c478bd9Sstevel@tonic-gate 			    (int)unitdata->opt.maxlen) {
257*7c478bd9Sstevel@tonic-gate 				error = EMSGSIZE;
258*7c478bd9Sstevel@tonic-gate 				freemsg(bp);
259*7c478bd9Sstevel@tonic-gate 				break;
260*7c478bd9Sstevel@tonic-gate 			}
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate 			/*
263*7c478bd9Sstevel@tonic-gate 			 * okay, so now we copy them
264*7c478bd9Sstevel@tonic-gate 			 */
265*7c478bd9Sstevel@tonic-gate 			bcopy(bp->b_rptr + pptr->uderror_ind.DEST_offset,
266*7c478bd9Sstevel@tonic-gate 			    unitdata->addr.buf,
267*7c478bd9Sstevel@tonic-gate 			    (size_t)pptr->uderror_ind.DEST_length);
268*7c478bd9Sstevel@tonic-gate 			unitdata->addr.len = pptr->uderror_ind.DEST_length;
269*7c478bd9Sstevel@tonic-gate 
270*7c478bd9Sstevel@tonic-gate 			bcopy(bp->b_rptr + pptr->uderror_ind.OPT_offset,
271*7c478bd9Sstevel@tonic-gate 			    unitdata->opt.buf,
272*7c478bd9Sstevel@tonic-gate 			    (size_t)pptr->uderror_ind.OPT_length);
273*7c478bd9Sstevel@tonic-gate 			unitdata->opt.len = pptr->uderror_ind.OPT_length;
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate 			*uderr = pptr->uderror_ind.ERROR_type;
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate 			unitdata->udata.buf = NULL;
278*7c478bd9Sstevel@tonic-gate 			unitdata->udata.udata_mp = NULL;
279*7c478bd9Sstevel@tonic-gate 			unitdata->udata.len = 0;
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate 			freemsg(bp);
282*7c478bd9Sstevel@tonic-gate 
283*7c478bd9Sstevel@tonic-gate 			*type = T_UDERR;
284*7c478bd9Sstevel@tonic-gate 			break;
285*7c478bd9Sstevel@tonic-gate 
286*7c478bd9Sstevel@tonic-gate 		default:
287*7c478bd9Sstevel@tonic-gate 			KTLILOG(1,
288*7c478bd9Sstevel@tonic-gate 			    "t_krcvudata: Unknown transport primitive %d\n",
289*7c478bd9Sstevel@tonic-gate 			    pptr->type);
290*7c478bd9Sstevel@tonic-gate 			error = EPROTO;
291*7c478bd9Sstevel@tonic-gate 			freemsg(bp);
292*7c478bd9Sstevel@tonic-gate 			break;
293*7c478bd9Sstevel@tonic-gate 		}
294*7c478bd9Sstevel@tonic-gate 		break;
295*7c478bd9Sstevel@tonic-gate 
296*7c478bd9Sstevel@tonic-gate 	case M_FLUSH:
297*7c478bd9Sstevel@tonic-gate 		KTLILOG(1, "t_krcvudata: tli_recv returned M_FLUSH\n", 0);
298*7c478bd9Sstevel@tonic-gate 		freemsg(bp);
299*7c478bd9Sstevel@tonic-gate 		*type = T_ERROR;
300*7c478bd9Sstevel@tonic-gate 		break;
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate 	default:
303*7c478bd9Sstevel@tonic-gate 		KTLILOG(1, "t_krcvudata: unknown message type %x\n",
304*7c478bd9Sstevel@tonic-gate 		    bp->b_datap->db_type);
305*7c478bd9Sstevel@tonic-gate 		freemsg(bp);
306*7c478bd9Sstevel@tonic-gate 		*type = T_ERROR;
307*7c478bd9Sstevel@tonic-gate 		break;
308*7c478bd9Sstevel@tonic-gate 	}
309*7c478bd9Sstevel@tonic-gate 
310*7c478bd9Sstevel@tonic-gate 	return (error);
311*7c478bd9Sstevel@tonic-gate }
312