safestore_ram.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.
*/
/*
* RAM Safe Store Module
*/
#include <sys/nsc_thread.h>
#include "sd_cache.h"
#include "sd_trace.h"
#include "safestore.h"
#include "safestore_impl.h"
#include "safestore_ram.h"
static int ss_ram_deconfigure(int);
static int ss_ram_getvol(ss_voldata_t *);
static int ss_ram_setvol(const ss_voldata_t *);
static int ss_ram_allocresource(int, int *, ss_resourcelist_t **);
static void ss_ram_deallocresource(ss_resource_t *);
static int ss_ram_getcentry(ss_centry_info_t *);
static int ss_ram_setcentry(const ss_centry_info_t *);
static int ss_ram_cblock_read(const ss_resource_t *, void *, int, int);
static int ss_ram_cblock_write(const ss_resource_t *, const void *, int, int);
"safestore_ram",
0,
};
static void ss_ram_vol_deconfigure();
static int ss_ram_vol_configure(int);
static int ss_ram_wctl_configure();
static void ss_ram_wctl_deconfigure(void);
static int ss_ram_deconfigure_locked();
static kmutex_t ss_ram_config_lock;
static ss_ram_config_t ss_ram_config;
static char default_cblock [8192];
void
{
}
void
{
}
/* ARGSUSED */
static int
{
return (EINVAL);
/* read in the parameters */
/* set the page size */
/* initialize client page size if not set */
if (ss_ramcommon_config.ssc_client_psize == 0)
/* setup volume directory */
(void) ss_ram_deconfigure_locked();
return (SDBC_ENONETMEM);
}
/* setup write q */
if (ss_ram_wctl_configure()) {
(void) ss_ram_deconfigure_locked();
return (SDBC_ENONETMEM);
}
(void) _sd_fill_pattern(default_cblock,
sizeof (default_cblock));
}
/* update client */
return (SS_OK);
}
/* acquires the ss_ram_config_lock and calls ss_ram_deconfigure_locked() */
/* ARGSUSED */
static int
ss_ram_deconfigure(int dirty)
{
int rc;
return (SS_ERR);
return (rc);
}
/*
* internal use only
* caller should acquire config lock before calling this function
*/
static int
{
return (SS_OK);
}
static int
{
return (SS_ERR);
case VDIR_ALL:
break;
case VDIR_VOL:
case VDIR_NODE:
default:
break;
}
return (rc);
}
static int
{
return (SS_ERR);
return (SS_ERR);
case VDIR_ALL:
} else {
/* stuff client copy with token */
/* get the volume data */
}
break;
case VDIR_VOL:
case VDIR_NODE:
default:
break;
}
return (rc);
}
static int
{
return (SS_ERR);
/* get the pointer to the volume entry */
if (ramvoldata == NULL)
return (SS_ERR);
/* stuff the client structure from the ram entry */
sizeof (voldata->sv_volname));
return (SS_OK);
}
static int
{
return (SS_ERR);
/* get the pointer to the volume entry */
if (ramvoldata == NULL)
return (SS_ERR);
/* load the volume entry from the client structure */
sizeof (ramvoldata->svi_volname));
sizeof (ramvoldata->svi_devid));
return (SS_OK);
}
static int
{
int rc = 0;
return (SS_ERR);
case CDIR_ALL:
{ int blocks;
}
break;
case CDIR_VOL:
case CDIR_NODE:
default:
break;
}
return (rc);
}
static int
{
return (SS_ERR);
return (SS_ERR);
case CDIR_ALL:
} else {
/* stuff client copy with token */
/* get the centry data */
}
break;
case CDIR_VOL:
case CDIR_NODE:
default:
break;
}
return (rc);
}
static int
{
return (SS_ERR);
&(ss_ram_config.sn_wr_queue)));
return (SS_ERR);
return (SS_OK);
}
static void
{
}
static int
{
return (SS_ERR);
}
return (SS_EOF);
*reslist = (ss_resourcelist_t *)
return (SS_OK);
}
static int
{
return (SS_ERR);
else
return (SS_ERR);
if (wctl->wc_gl_info)
sizeof (ss_centry_info_impl_t));
else
return (SS_ERR);
return (SS_OK);
}
static int
{
return (SS_ERR);
else
return (SS_ERR);
if (wctl->wc_gl_info)
sizeof (ss_centry_info_impl_t));
else
return (SS_ERR);
return (SS_OK);
}
static int
{
return (SS_ERR);
if ((srcoffset < 0) ||
return (SS_ERR);
return (SS_OK);
}
static int
{
return (SS_ERR);
if ((destoffset < 0) ||
return (SS_ERR);
return (SS_OK);
}
static int
{
switch (cmd) {
case SSIOC_STATS:
break;
default:
cmd);
break;
}
return (rc);
}
static int
{
return (-1);
return (0);
}
static void
{
if (ss_ram_config.sn_volumes)
maxvols * sizeof (ss_voldata_impl_t));
}
static int
{
int blocks;
static ss_centry_info_impl_t *gl;
int i;
== NULL) {
return (-1);
}
KM_NOSLEEP)) == NULL) {
return (-1);
}
/*
* (ie forced_wrthru clear)
*/
return (-1);
}
return (0);
}
static void
{
int blocks;
if (ss_ram_config.sn_wr_cctl) {
blocks * sizeof (ss_wr_cctl_t));
}
if (ss_ram_config.sn_gl_centry_info) {
blocks * sizeof (ss_centry_info_impl_t));
}
}