fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/cmn_err.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/ksynch.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/kmem.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/ddi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define __NSC_GEN__
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "nsc_dev.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "../nsctl.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (Un)Freeze Module
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This module provides a means to 'freeze' a device and ensure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that no SP software has an open reference to that device. Later
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the device can be 'unfrozen' and the SP software can resume
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * normal operations.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This module is required because it is possible to place a virtual
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * volume driver (RAID-0, 1 or 5) into a state whereby it needs to be
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * disabled for corrective action. The (un)freeze facility provides a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * method of doing this without downtime.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * A device that is frozen should be frozen on all nodes. It is the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * responsibility of the management software or the user to perform
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the freeze and unfreeze on the required nodes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern nsc_mem_t *_nsc_local_mem;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _nsc_frz_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _nsc_frz_s *next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_path_t *token;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char path[NSC_MAXPATH];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} _nsc_frz_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _nsc_frz_stop(char *, int *); /* forward decl */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic _nsc_frz_t *_nsc_frz_top;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic nsc_def_t _nsc_frz_def[];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic kmutex_t _nsc_frz_sleep;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic nsc_io_t *_nsc_frz_io;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_nsc_init_frz(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_init(&_nsc_frz_sleep, NULL, MUTEX_DRIVER, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _nsc_frz_io = nsc_register_io("frz",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NSC_FREEZE_ID | NSC_FILTER, _nsc_frz_def);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!_nsc_frz_io)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_WARN, "nsctl: _nsc_init_frz: register failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_nsc_deinit_frz(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (_nsc_frz_io)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) nsc_unregister_io(_nsc_frz_io, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _nsc_frz_io = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_destroy(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * int _nsc_frz_start(char *path, int *rvp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Freeze a device
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calling/Exit State:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Must be called from a context that can block.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns 0 for success, or one of the following error codes:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EINVAL - invalid 'path' argument
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ENOMEM - failed to allocate memory
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EALREADY - 'path' is already frozen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Registers 'path' to be accessed through the NSC_FREEZE_ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * io module, and forces any open file descriptors for 'path'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to be re-opened as appropriate.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_nsc_frz_start(path, rvp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint *rvp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _nsc_frz_t *frz, *xfrz;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *rvp = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(path) >= NSC_MAXPATH)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte frz = nsc_kmem_zalloc(sizeof (*frz), KM_SLEEP, _nsc_local_mem);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!frz)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ENOMEM);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(frz->path, path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_enter(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (xfrz = _nsc_frz_top; xfrz; xfrz = xfrz->next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(frz->path, xfrz->path) == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!xfrz) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte frz->next = _nsc_frz_top;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _nsc_frz_top = frz;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xfrz) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_kmem_free(frz, sizeof (*frz));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EALREADY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte frz->token = nsc_register_path(path, NSC_DEVICE, _nsc_frz_io);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!frz->token) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) _nsc_frz_stop(path, &rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * int _nsc_frz_stop(char *path, int *rvp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Unfreeze a device
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calling/Exit State:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Must be called from a context that can block.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns 0 or an error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Removes the path registration for the NSC_FREEZE_ID io module
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and forces any re-opens as appropriate.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_nsc_frz_stop(path, rvp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint *rvp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _nsc_frz_t **xfrz, *frz = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rc = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *rvp = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_enter(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (xfrz = &_nsc_frz_top; *xfrz; xfrz = &(*xfrz)->next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(path, (*xfrz)->path) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte frz = *xfrz;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!frz) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (frz->token)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = nsc_unregister_path(frz->token, NSC_PCATCH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rc) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*xfrz) = frz->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_kmem_free(frz, sizeof (*frz));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * int _nsc_frz_isfrozen(char *path, int *rvp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Tests whether a device is frozen.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calling/Exit State:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns 0 or EINVAL.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Sets *rvp to 1 if the device was not frozen, and 0 otherwise.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This function returns historical information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_nsc_frz_isfrozen(path, rvp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint *rvp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _nsc_frz_t *frz;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *rvp = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (! _nsc_frz_io)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_enter(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (frz = _nsc_frz_top; frz; frz = frz->next)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(frz->path, path) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *rvp = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(&_nsc_frz_sleep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * static int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * _nsc_frz_open(char *path, int flag, blind_t *cdp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dummy open function.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is the "Open" function for the I/O module.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * It is just a dummy.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_nsc_frz_open(path, flag, cdp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteblind_t *cdp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *cdp = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * static int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * _nsc_frz_close()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dummy close function.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is the "Close" function for the I/O module.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * It is just a dummy.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_nsc_frz_close() { return (0); }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * static int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * _nsc_frz_attach()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Attach a device to this i/o module.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calling/Exit State:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns EACCES in all cricumstances.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Description:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This function is called by the nsctl module when it wishes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to attach the device to this I/O module (ie. as part of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * nsc_reserve() processing). This function unconditionally
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returns an error which forces the nsc_reserve() to fail, and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * so no access to possible to the underlying device.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_nsc_frz_attach() { return (EACCES); }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic nsc_def_t _nsc_frz_def[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Open", (uintptr_t)_nsc_frz_open, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Close", (uintptr_t)_nsc_frz_close, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Attach", (uintptr_t)_nsc_frz_attach, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Provide", 0, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, 0, 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};