fem.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FEM_H
#define _SYS_FEM_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/pathname.h>
#ifdef __cplusplus
extern "C" {
#endif
struct fs_operation_def; /* from vfs.h */
/*
* overview:
*
* fem - file event monitoring
*
* File Event Monitoring is a formalized mechanism to monitor events on a
* the consumer to request event notifications for specified files and
* directories. The consumers, which intercepts the events, are responsible for
* delivering the event to the next interceptor or the terminal destination.
*
*/
/*
* protocol:
*
* vnode -> fem_head.
* There can only be one fem_head for a vnode.
* Once attached, the fem_head persists until explicitly detached
* or the vnode expires.
*
* fem_head -> fem_list.
* There can be many lists for a head, as each reconfiguration of
* the list causes a new one to be created and initialized from the
* old one. For this reason, modules cannot assume that they can
* reach thier list by vnode->fem_head->fem_list->list[n] == mod;
*
* fem_arg -> vnode, &vnode.
* This relationship is established at the head of the call (ie. in
* femhead_open()) where the fem_arg is allocated. Intermediate nodes
* have direct access to this.
*
* fem_arg -> fem_node
* This relationship is established at the head of the call (ie. in
* femhead_open()) where the fem_arg is allocated. The fem_arg is
* updated as intermediate nodes are invoked, however not as they
* return. For this reason, nodes which are interested in maintaining
* context following a "next" should store a copy of the fem_available
* field before invoking the 'next'.
*/
typedef int femop_t();
typedef int vop_t();
/*
* The following enumerations specify the conditions
* should be installed. These are used when calling
* fem_install() and fsem_install()
*/
typedef enum femhow {
FORCE = 0, /* Force the installation of this monitor */
} femhow_t;
struct fem_node {
void *fn_available;
union {
void *anon; /* anonymous, for updates */
} fn_op;
void (*fn_av_hold)(void *); /* Hold for "fn_available" */
void (*fn_av_rele)(void *); /* Release for "fn_available" */
};
struct fem_arg {
union {
**vpp;
void *anon;
} fa_vnode;
};
struct fem_list {
int feml_tos; /* top of stack pointer(index) */
int feml_ssize; /* stack size */
int feml_pad; /* alignment */
};
struct fem_head {
};
struct fem {
const char *name;
const struct fs_operation_def *templ;
struct caller_context *ct);
int flag);
int *eofp);
};
struct fsem {
const char *name;
const struct fs_operation_def *templ;
};
struct caller_context *ct);
struct caller_context *ct);
int flag);
extern void fem_init(void); /* called once, by startup */
/* fem api */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FEM_H */