sdev_vtops.c revision aecfc01d1bad84e66649703f7fc2926ef70b34ba
/*
* 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.
*/
/*
*/
#include <sys/sysmacros.h>
#include <sys/vfs_opreg.h>
/* warlock in this file only cares about variables shared by vt and devfs */
#define DEVVT_UID_DEFAULT SDEV_UID_DEFAULT
#define DEVVT_GID_DEFAULT (0)
#define DEVVT_DEVMODE_DEFAULT (0600)
#define DEVVT_ACTIVE_NAME "active"
/* attributes for VT nodes */
static vattr_t devvt_vattr = {
VCHR, /* va_type */
DEVVT_UID_DEFAULT, /* va_uid */
DEVVT_GID_DEFAULT, /* va_gid */
0 /* 0 hereafter */
};
struct vnodeops *devvt_vnodeops;
struct vnodeops *
devvt_getvnodeops(void)
{
return (devvt_vnodeops);
}
static int
{
long uminor = 0;
return (EINVAL);
*mp = 0;
return (EINVAL);
}
return (0);
}
/*ARGSUSED*/
int
{
/* validate only READY nodes */
sdcmn_err(("dev fs: skipping: node not ready %s(%p)",
return (SDEV_VTOR_SKIP);
}
return (SDEV_VTOR_INVALID);
}
return (SDEV_VTOR_VALID);
return (SDEV_VTOR_INVALID);
}
return (SDEV_VTOR_INVALID);
return (SDEV_VTOR_VALID);
}
/*
* This callback is invoked from devname_lookup_func() to create
* a entry when the node is not found in the cache.
*/
/*ARGSUSED*/
static int
{
return (SDEV_VTOR_INVALID);
return (0);
}
return (-1);
return (-1);
*vap = devvt_vattr;
return (0);
}
/*ARGSUSED3*/
static int
{
type = SDEV_VLINK;
} else {
type = SDEV_VATTR;
}
/* Give warlock a more clear call graph */
#ifndef __lock_lint
#else
devvt_create_rvp(0, 0, 0, 0, 0, 0);
#endif
if (error == 0) {
case VCHR:
break;
case VDIR:
case VLNK:
break;
default:
break;
}
}
return (error);
}
static void
{
int error;
return;
return;
return;
}
if (type & SDEV_VATTR) {
vap = &devvt_vattr;
} else if (type & SDEV_VLINK) {
vap = &sdev_vattr_lnk;
}
}
static void
{
/* skip stale nodes */
continue;
/* validate and prune only ready nodes */
continue;
case SDEV_VTOR_VALID:
case SDEV_VTOR_SKIP:
continue;
case SDEV_VTOR_INVALID:
sdcmn_err7(("destroy invalid "
break;
}
continue;
/* remove the cache node */
}
}
static void
{
int found = 0;
/* We have to fool warlock this way, otherwise it will complain */
#ifndef __lock_lint
}
#else
#endif
/* 1. create missed nodes */
char nm[16];
continue;
found = 0;
/* skip stale nodes */
continue;
/* validate and prune only ready nodes */
continue;
found = 1;
break;
}
}
if (!found) {
}
}
/* 2. create active link node */
found = 0;
/* skip stale nodes */
continue;
/* validate and prune only ready nodes */
continue;
found = 1;
break;
}
}
if (!found)
/* 3. cleanup invalid nodes */
#ifndef __lock_lint
#else
#endif
}
/*ARGSUSED4*/
static int
{
if (uiop->uio_offset == 0) {
}
}
/*
* We allow create to find existing nodes
* - if the node doesn't exist - EROFS
* - creating an existing dir read-only succeeds, otherwise EISDIR
* - exclusive creates fail - EEXIST
*/
/*ARGSUSED2*/
static int
{
int error;
NULL)) != 0) {
return (error);
}
else
if (error) {
} else
return (error);
}
const fs_operation_def_t devvt_vnodeops_tbl[] = {
};