Print this page
10687 Service routine cast changes need smatch fixes


   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.
   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
  24  * Copyright 2017 Joyent, Inc.
  25  */
  26 
  27 #include <sys/param.h>
  28 #include <sys/types.h>
  29 #include <sys/stream.h>
  30 #include <sys/strsubr.h>
  31 #include <sys/strsun.h>
  32 #include <sys/stropts.h>
  33 #include <sys/zone.h>
  34 #include <sys/vnode.h>
  35 #include <sys/sysmacros.h>
  36 #define _SUN_TPI_VERSION 2
  37 #include <sys/tihdr.h>
  38 #include <sys/timod.h>
  39 #include <sys/ddi.h>
  40 #include <sys/sunddi.h>
  41 #include <sys/mkdev.h>
  42 #include <sys/debug.h>
  43 #include <sys/kmem.h>
  44 #include <sys/cmn_err.h>


3592 }
3593 
3594 /*
3595  * Write-side service procedure, invoked when we defer processing
3596  * if another message is received while a dump is in progress.
3597  */
3598 int
3599 spdsock_wsrv(queue_t *q)
3600 {
3601         spdsock_t *ss = q->q_ptr;
3602         mblk_t *mp;
3603         ipsec_stack_t *ipss = ss->spdsock_spds->spds_netstack->netstack_ipsec;
3604 
3605         if (ss->spdsock_dump_req != NULL) {
3606                 qenable(OTHERQ(q));
3607                 return (0);
3608         }
3609 
3610         while ((mp = getq(q)) != NULL) {
3611                 if (ipsec_loaded(ipss)) {
3612                         spdsock_wput(q, mp);
3613                         if (ss->spdsock_dump_req != NULL)
3614                                 return (0);
3615                 } else if (!ipsec_failed(ipss)) {
3616                         (void) putq(q, mp);
3617                 } else {
3618                         spdsock_error(q, mp, EPFNOSUPPORT, 0);
3619                 }
3620         }
3621         return (0);
3622 }
3623 
3624 /* ARGSUSED */
3625 static int
3626 spdsock_close(queue_t *q, int flags __unused, cred_t *credp __unused)
3627 {
3628         spdsock_t *ss = q->q_ptr;
3629         spd_stack_t     *spds = ss->spdsock_spds;
3630 
3631         qprocsoff(q);
3632 




   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.
   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
  24  * Copyright 2019, Joyent, Inc.
  25  */
  26 
  27 #include <sys/param.h>
  28 #include <sys/types.h>
  29 #include <sys/stream.h>
  30 #include <sys/strsubr.h>
  31 #include <sys/strsun.h>
  32 #include <sys/stropts.h>
  33 #include <sys/zone.h>
  34 #include <sys/vnode.h>
  35 #include <sys/sysmacros.h>
  36 #define _SUN_TPI_VERSION 2
  37 #include <sys/tihdr.h>
  38 #include <sys/timod.h>
  39 #include <sys/ddi.h>
  40 #include <sys/sunddi.h>
  41 #include <sys/mkdev.h>
  42 #include <sys/debug.h>
  43 #include <sys/kmem.h>
  44 #include <sys/cmn_err.h>


3592 }
3593 
3594 /*
3595  * Write-side service procedure, invoked when we defer processing
3596  * if another message is received while a dump is in progress.
3597  */
3598 int
3599 spdsock_wsrv(queue_t *q)
3600 {
3601         spdsock_t *ss = q->q_ptr;
3602         mblk_t *mp;
3603         ipsec_stack_t *ipss = ss->spdsock_spds->spds_netstack->netstack_ipsec;
3604 
3605         if (ss->spdsock_dump_req != NULL) {
3606                 qenable(OTHERQ(q));
3607                 return (0);
3608         }
3609 
3610         while ((mp = getq(q)) != NULL) {
3611                 if (ipsec_loaded(ipss)) {
3612                         (void) spdsock_wput(q, mp);
3613                         if (ss->spdsock_dump_req != NULL)
3614                                 return (0);
3615                 } else if (!ipsec_failed(ipss)) {
3616                         (void) putq(q, mp);
3617                 } else {
3618                         spdsock_error(q, mp, EPFNOSUPPORT, 0);
3619                 }
3620         }
3621         return (0);
3622 }
3623 
3624 /* ARGSUSED */
3625 static int
3626 spdsock_close(queue_t *q, int flags __unused, cred_t *credp __unused)
3627 {
3628         spdsock_t *ss = q->q_ptr;
3629         spd_stack_t     *spds = ss->spdsock_spds;
3630 
3631         qprocsoff(q);
3632