ctfs_event.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"
#include <sys/vfs_opreg.h>
#include <sys/sysmacros.h>
#include <sys/contract.h>
#include <sys/contract_impl.h>
#include <sys/ctfs_impl.h>
/*
*/
/*
* ctfs_endpoint_open
*
* Called by the VOP_OPEN entry points to perform some common checks
* and set up the endpoint listener, if not already done.
*/
static int
{
return (EINVAL);
}
return (0);
}
/*
* ctfs_endpoint inactive
*
* Called by the VOP_INACTIVE entry points to perform common listener
* cleanup.
*/
static void
{
endpt->ctfs_endpt_flags = 0;
}
}
/*
* ctfs_endpoint_ioctl
*
* Implements the common VOP_IOCTL handling for the event endpoints.
* rprivchk, if true, indicates that event receive requests should
* check the provided credentials. This distinction exists because
* contract endpoints perform their privilege checks at open-time, and
* process bundle queue listeners by definition may view all events
* their queues contain.
*/
static int
{
switch (cmd) {
case CT_ERESET:
break;
case CT_ERECV:
/*
* We pass in NULL for the cred when reading from
* process bundle queues and contract queues because
* the privilege check was performed at open time.
*/
case CT_ECRECV:
case CT_ENEXT:
return (EFAULT);
case CT_ERELIABLE:
default:
return (EINVAL);
}
return (0);
}
/*
* ctfs_endpoint_poll
*
* Called by the VOP_POLL entry points.
*/
static int
{
} else {
*reventsp = 0;
if (!anyyet)
}
return (0);
}
/*
* ctfs_create_evnode
*
* Creates and returns a new evnode.
*/
vnode_t *
{
/*
* We transitively have a hold on the contract through our
* parent directory.
*/
return (vp);
}
/*
* ctfs_ev_access - VOP_ACCESS entry point
*
* You only get to access event files for contracts you or your
* effective user id owns, unless you have a privilege.
*/
/*ARGSUSED*/
static int
int mode,
int flags,
{
int error;
return (EACCES);
return (error);
return (0);
}
/*
* ctfs_ev_open - VOP_OPEN entry point
*
* Performs the same privilege checks as ctfs_ev_access, and then calls
* ctfs_endpoint_open to perform the common endpoint initialization.
*/
/* ARGSUSED */
static int
{
int error;
return (error);
/*
* See comment in ctfs_bu_open.
*/
}
/*
* ctfs_ev_inactive - VOP_INACTIVE entry point
*/
/* ARGSUSED */
static void
{
/*
* We must destroy the endpoint before releasing the parent; otherwise
* we will try to destroy a contract with active listeners. To prevent
* this, we grab an extra hold on the parent.
*/
}
}
/*
* ctfs_ev_getattr - VOP_GETATTR entry point
*/
/* ARGSUSED */
static int
int flags,
{
return (0);
}
/*
* ctfs_ev_ioctl - VOP_IOCTL entry point
*/
/* ARGSUSED */
static int
int cmd,
int flag,
int *rvalp,
{
}
/*
* ctfs_ev_poll - VOP_POLL entry point
*/
/*ARGSUSED*/
static int
short events,
int anyyet,
short *reventsp,
pollhead_t **php,
{
}
const fs_operation_def_t ctfs_tops_event[] = {
};
/*
* ctfs_create_pbundle
*
* file.
*/
vnode_t *
{
return (vp);
}
/*
* ctfs_create_bundle
*
* file.
*/
vnode_t *
{
return (vp);
}
/*
* ctfs_bu_open - VOP_OPEN entry point
*/
/* ARGSUSED */
static int
{
/*
* This assumes we are only ever called immediately after a
* VOP_LOOKUP. We could clone ourselves here, but doing so
*/
}
/*
* ctfs_bu_inactive - VOP_INACTIVE entry point
*/
/* ARGSUSED */
static void
{
/*
* See comments in ctfs_ev_inactive() above.
*/
}
}
/*
* ctfs_bu_getattr - VOP_GETATTR entry point
*/
/* ARGSUSED */
static int
int flags,
{
return (0);
}
/*
* ctfs_bu_ioctl - VOP_IOCTL entry point
*/
/* ARGSUSED */
static int
int cmd,
int flag,
int *rvalp,
{
}
/*
* ctfs_bu_poll - VOP_POLL entry point
*/
/*ARGSUSED*/
static int
short events,
int anyyet,
short *reventsp,
pollhead_t **php,
{
}
const fs_operation_def_t ctfs_tops_bundle[] = {
};