smb_kshare.c revision 0dcb3379c7a3a8648f0f7e629824f7201285d006
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Kernel door client for LanMan share management.
*/
#include <smbsrv/smb_common_door.h>
#include <smbsrv/lmshare_door.h>
static int smb_kshare_chk_dsrv_status(int, smb_dr_ctx_t *);
/*
* smb_kshare_init
*
* This function is not MultiThread safe. The caller has to make sure only one
* thread calls this function.
*/
smb_kshare_init(int door_id)
{
return (door_ki_lookup(door_id));
}
/*
* smb_kshare_fini
*
* This function is not MultiThread safe. The caller has to make sure only one
* thread calls this function.
*/
void
{
if (dhdl)
}
{
char *buf;
unsigned int used;
int status;
int opcode = LMSHR_DOOR_GETINFO;
status);
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
status);
}
return (rc);
}
{
char *door_buf;
int door_bufsz;
unsigned int used;
int status;
int opcode = LMSHR_DOOR_ENUM;
+ sizeof (smb_enumshare_info_t);
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
if (rc == NERR_Success) {
(void) smb_dr_get_buf(dec_ctx,
}
}
return (rc);
}
/*
* This is a special interface that will be utilized by ZFS to cause
*
* arg is either a lmshare_info_t or share_name from userspace.
* It will need to be copied into the kernel. It is lmshare_info_t
* for add operations and share_name for delete operations.
*/
int
{
door_arg_t doorarg = { 0 };
int error;
int rc;
unsigned int used;
int opcode;
switch (opcode) {
case LMSHR_DOOR_ADD:
return (error);
}
break;
case LMSHR_DOOR_DELETE:
return (error);
}
break;
}
if (lmshare)
return (NERR_InternalError);
}
if (error) {
if (lmshare)
return (error);
}
if (lmshare)
return (NERR_InternalError);
}
if (opcode == LMSHR_DOOR_ADD)
if (smb_dr_decode_finish(dec_ctx))
if (lmshare)
}
/*
* Return 0 upon success. Otherwise > 0
*/
static int
{
int err;
switch (status) {
case LMSHR_DOOR_SRV_SUCCESS:
return (0);
case LMSHR_DOOR_SRV_ERROR:
(void) smb_dr_decode_finish(dec_ctx);
return (err);
}
ASSERT(0);
return (EINVAL);
}