nsc_cache.c revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
/*
* 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.
*/
#define __NSC_GEN__
#include "nsc_dev.h"
#ifdef DS_DDICT
#include "../contract.h"
#endif
#include "../nsctl.h"
nsc_def_t _nsc_cache_def[] = {
0, 0, 0
};
extern nsc_io_t *_nsc_reserve_io(char *, int);
extern void _nsc_release_io(nsc_io_t *);
extern kmutex_t _nsc_io_lock;
/* ARGSUSED */
void
{
}
{
if (h)
return (h);
}
int
{
return (EINVAL);
}
int
{
nsc_buf_t *h;
int rc;
return (EINVAL);
if (flag & NSC_NODATA)
return (EINVAL);
return (ENOBUFS);
return (ENOBUFS);
}
if (rc <= 0) {
h->sb_flag &= ~NSC_HALLOCATED;
*ptr = h;
}
return (rc);
}
int
{
int (*fn)() = _nsc_alloc_buf_h;
return (EACCES);
(NSC_READ|NSC_NODATA)) {
/*
* NSC_NODATA access checks.
*
* - NSC_READ|NSC_NODATA is illegal since there would
* be no data buffer to immediately read the data into.
* - NSC_WRITE|NSC_NODATA is valid since the client can
* provide the buffer and then call nsc_write() as
* necessary.
* - NSC_NODATA is valid since the client can provide the
* buffer and then call nsc_read() or nsc_write() as
* necessary.
*/
return (EACCES);
}
if (*ptr) {
}
}
/* ARGSUSED */
static int
{
nsc_buf_t *h;
int rc;
return (ENOBUFS);
h->sb_flag &= ~NSC_HALLOCATED;
*ptr = h;
return (rc);
}
(void) nsc_free_handle(h);
return (rc);
}
int
{
return (EIO);
}
int
{
return (EIO);
}
int
{
return (EIO);
}
int
{
return (EIO);
}
return (rc);
}
static int
{
return (EINVAL);
if (!len)
return (0);
/* find starting point in "from" vector */
/* find starting point in "to" vector */
/* copy required data */
while (lenbytes) {
if (!l1)
if (!l2)
}
return (0);
}
int
{
return (EINVAL);
return (EIO);
"nsc_copy_direct: h2 (%p) flags (%x) include NSC_READ",
}
"nsc_copy_direct: h2 (%p) flags (%x) do not "
}
return (rc);
/*
* The slow way ...
*/
if (rc <= 0)
return (rc);
}
int
{
return (EIO);
}
int
{
int abuf;
int rc;
if (h == NULL)
return (0);
}
if (abuf)
else
}
return (rc);
}
int
{
(blind_t)NSC_GET_NODE_HINT, 0));
}
int
{
(blind_t)NSC_SET_NODE_HINT, 0));
}
int
{
}
int
{
}
int
{
}
int
{
}
void
{
if (!iodev)
return;
}
void
{
if (!iodev)
return;
}