smb_share_kdoor_client.c revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
/*
* 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 2007 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>
int lmshrd_init = 0;
char *lmshrd_desc[] = {
"",
"LmshrkOpenIter",
"LmshrkCloseIter",
"LmshrkIterate",
"LmshrkNumShares",
"",
"",
"LmshrkGetinfo",
"",
"",
"LmshrkExists",
"LmshrkIsSpecial",
"LmshrkIsRestricted",
"LmshrkIsAdmin",
"LmshrkIsValid",
"LmshrkIsDir",
"LmshrkList",
"LmshrkListTrans",
"LmshrkNumTrans",
"SmbGetKConfig",
0
};
static int
{
int err = 0;
if (lmshrd_init == 0) {
else
lmshrd_init = 1;
}
return (err);
}
static void
{
if (lmshrd_init) {
lmshrd_init = 0;
}
}
/*
* lmshrd_kclient_start
*
* The SMB kernel module should invoke this function upon startup.
*/
int
{
int rc;
rc = lmshrd_kclient_open();
return (rc);
}
/*
* lmshrd_kclient_stop
*
* The SMB kernel module should invoke this function upon unload.
*/
void
{
}
/*
* Return 0 upon success. Otherwise, -1.
*/
static int
{
int err;
int rc = -1;
switch (status) {
case LMSHR_DOOR_SRV_SUCCESS:
rc = 0;
break;
case LMSHR_DOOR_SRV_ERROR:
break;
default:
}
if (rc != 0) {
}
return (rc);
}
lmshrd_open_iterator(int mode)
{
char *buf;
unsigned int used;
unsigned int status = 0;
uint64_t lmshr_iter = 0;
int opcode = LMSHR_DOOR_OPEN_ITERATOR;
if (!lmshrd_init && lmshrd_kclient_open() != 0)
return (lmshr_iter);
if (!buf)
return (lmshr_iter);
return (lmshr_iter);
}
return (lmshr_iter);
}
return (lmshr_iter);
}
return (lmshr_iter);
}
return (lmshr_iter);
}
{
char *buf;
unsigned int used;
unsigned int status = 0;
int opcode = LMSHR_DOOR_CLOSE_ITERATOR;
if (!lmshrd_init && lmshrd_kclient_open() != 0)
return (NERR_InternalError);
if (!buf)
return (NERR_InternalError);
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_Success);
}
{
char *buf;
unsigned int used;
unsigned int status = 0;
int opcode = LMSHR_DOOR_ITERATE;
if (!lmshrd_init && lmshrd_kclient_open() != 0)
return (NERR_InternalError);
if (!buf)
return (NERR_InternalError);
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_Success);
}
int
lmshrd_num_shares(void)
{
char *buf;
unsigned int used;
unsigned int status = 0;
int opcode = LMSHR_DOOR_NUM_SHARES;
if (!lmshrd_init && lmshrd_kclient_open() != 0)
return (-1);
if (!buf)
return (-1);
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (num_shares);
}
{
char *buf;
unsigned int used;
int status;
int opcode = LMSHR_DOOR_GETINFO;
if (!lmshrd_init && lmshrd_kclient_open() != 0)
return (NERR_InternalError);
if (!buf)
return (NERR_InternalError);
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (rc);
}
int
{
char *buf;
unsigned int used;
if (!lmshrd_init && lmshrd_kclient_open() != 0)
return (NERR_InternalError);
if (!buf)
return (NERR_InternalError);
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (NERR_InternalError);
}
return (rc);
}
int
lmshrd_exists(char *share_name)
{
}
int
lmshrd_is_special(char *share_name)
{
}
int
lmshrd_is_restricted(char *share_name)
{
}
int
lmshrd_is_admin(char *share_name)
{
}
int
lmshrd_is_valid(char *share_name)
{
}
int
lmshrd_is_dir(char *path)
{
}
int
{
char *buf;
unsigned int used;
int status;
int opcode = SMB_GET_KCONFIG;
if (!lmshrd_init && lmshrd_kclient_start() != 0)
return (-1);
if (!buf)
return (-1);
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (0);
}
/*
* 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;
/* Return error if server isn't up and running */
if (!lmshrd_init)
return (NERR_ServerNotStarted);
if (lmshrd_kclient_open())
return (NERR_InternalError);
switch (opcode) {
case LMSHR_DOOR_ADD:
sizeof (lmshare_info_t));
return (error);
}
break;
case LMSHR_DOOR_DELETE:
return (error);
}
break;
}
if (lmshare)
return (NERR_InternalError);
}
if (lmshare)
return (error);
}
if (lmshare)
return (NERR_InternalError);
}
if (opcode == LMSHR_DOOR_ADD)
if (smb_dr_decode_finish(dec_ctx)) {
if (lmshare)
return (NERR_InternalError);
}
if (lmshare)
}