smb_kdoor.c revision 9fb67ea305c66b6a297583b9b0db6796b0dfe497
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <smbsrv/smb_kproto.h>
#include <smbsrv/smb_door.h>
static int smb_kdoor_send(smb_doorarg_t *);
static int smb_kdoor_receive(smb_doorarg_t *);
static int smb_kdoor_upcall_private(smb_doorarg_t *);
static int smb_kdoor_encode(smb_doorarg_t *);
static int smb_kdoor_decode(smb_doorarg_t *);
static void smb_kdoor_free(door_arg_t *);
static int smb_kdoor_id = -1;
static uint64_t smb_kdoor_ncall = 0;
static kmutex_t smb_kdoor_mutex;
static kcondvar_t smb_kdoor_cv;
void
smb_kdoor_init(void)
{
}
void
smb_kdoor_fini(void)
{
}
/*
* Open the door. If the door is already open, close it first
* because the door-id has probably changed.
*/
int
smb_kdoor_open(int door_id)
{
int rc;
smb_kdoor_ncall = 0;
if (smb_kdoor_hd == NULL) {
}
return (rc);
}
/*
* Close the door.
*/
void
smb_kdoor_close(void)
{
if (smb_kdoor_hd != NULL) {
while (smb_kdoor_ncall > 0)
smb_kdoor_hd = NULL;
}
}
/*
* Wrapper to handle door call reference counting.
*/
int
{
int rc;
return (-1);
}
return (-1);
if (smb_kdoor_hd == NULL) {
if (smb_kdoor_open(smb_kdoor_id) != 0) {
return (-1);
}
}
rc = -1;
else
}
} else {
}
}
if ((--smb_kdoor_ncall) == 0)
return (rc);
}
/*
* Send the request half of the consumer's door call.
*/
static int
{
int rc;
if (smb_kdoor_encode(&da) != 0)
return (-1);
return (rc);
}
/*
* Get the response half for the consumer's door call.
*/
static int
{
int rc;
if (smb_kdoor_encode(&da) != 0)
return (-1);
return (rc);
}
/*
* We use a copy of the door arg because doorfs may change data_ptr
* and we want to detect that when freeing the door buffers. After
* this call, response data must be referenced via rbuf and rsize.
*/
static int
{
int i;
int rc;
for (i = 0; i < SMB_DOOR_CALL_RETRIES; ++i) {
if (smb_server_is_stopping())
return (-1);
break;
return (-1);
}
return (-1);
return (0);
}
static int
{
char *buf;
xdr_destroy(&xdrs);
return (-1);
}
xdr_destroy(&xdrs);
return (-1);
}
}
xdr_destroy(&xdrs);
return (0);
}
/*
* Decode the response in rbuf and rsize.
*/
static int
{
return (-1);
}
xdr_destroy(&xdrs);
return (-1);
}
xdr_destroy(&xdrs);
return (-1);
}
xdr_destroy(&xdrs);
return (-1);
}
}
xdr_destroy(&xdrs);
return (0);
}
static void
{
}
static boolean_t
{
return (B_FALSE);
}
return (B_FALSE);
}
return (B_TRUE);
}
/*
* Free both the argument and result door buffers regardless of the status
* of the up-call. The doorfs allocates a new buffer if the result buffer
* passed by the client is too small.
*/
static void
{
}