17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5aa59c4cbSrsb * Common Development and Distribution License (the "License"). 6aa59c4cbSrsb * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_FEM_H 277c478bd9Sstevel@tonic-gate #define _SYS_FEM_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #include <sys/types.h> 307c478bd9Sstevel@tonic-gate #include <sys/mutex.h> 317c478bd9Sstevel@tonic-gate #include <sys/pathname.h> 327c478bd9Sstevel@tonic-gate #include <sys/uio.h> 337c478bd9Sstevel@tonic-gate #include <sys/file.h> 347c478bd9Sstevel@tonic-gate #include <sys/cred.h> 357c478bd9Sstevel@tonic-gate #include <sys/vfs.h> 367c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 407c478bd9Sstevel@tonic-gate extern "C" { 417c478bd9Sstevel@tonic-gate #endif 427c478bd9Sstevel@tonic-gate 43aa59c4cbSrsb #ifdef _KERNEL 44aa59c4cbSrsb 457c478bd9Sstevel@tonic-gate struct fs_operation_def; /* from vfs.h */ 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * overview: 497c478bd9Sstevel@tonic-gate * 507c478bd9Sstevel@tonic-gate * fem - file event monitoring 517c478bd9Sstevel@tonic-gate * 527c478bd9Sstevel@tonic-gate * File Event Monitoring is a formalized mechanism to monitor events on a 53c3ac4cfbSpetede * vnode or vfs by intercepting the vnode/vfs operations. The framework enables 547c478bd9Sstevel@tonic-gate * the consumer to request event notifications for specified files and 55c3ac4cfbSpetede * directories. The consumers, which intercept the events, are responsible for 567c478bd9Sstevel@tonic-gate * delivering the event to the next interceptor or the terminal destination. 577c478bd9Sstevel@tonic-gate * 587c478bd9Sstevel@tonic-gate */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* 617c478bd9Sstevel@tonic-gate * protocol: 627c478bd9Sstevel@tonic-gate * 637c478bd9Sstevel@tonic-gate * vnode -> fem_head. 647c478bd9Sstevel@tonic-gate * There can only be one fem_head for a vnode. 657c478bd9Sstevel@tonic-gate * Once attached, the fem_head persists until explicitly detached 667c478bd9Sstevel@tonic-gate * or the vnode expires. 677c478bd9Sstevel@tonic-gate * 687c478bd9Sstevel@tonic-gate * fem_head -> fem_list. 697c478bd9Sstevel@tonic-gate * There can be many lists for a head, as each reconfiguration of 707c478bd9Sstevel@tonic-gate * the list causes a new one to be created and initialized from the 717c478bd9Sstevel@tonic-gate * old one. For this reason, modules cannot assume that they can 727c478bd9Sstevel@tonic-gate * reach thier list by vnode->fem_head->fem_list->list[n] == mod; 737c478bd9Sstevel@tonic-gate * 747c478bd9Sstevel@tonic-gate * fem_arg -> vnode, &vnode. 757c478bd9Sstevel@tonic-gate * This relationship is established at the head of the call (ie. in 767c478bd9Sstevel@tonic-gate * femhead_open()) where the fem_arg is allocated. Intermediate nodes 777c478bd9Sstevel@tonic-gate * have direct access to this. 787c478bd9Sstevel@tonic-gate * 797c478bd9Sstevel@tonic-gate * fem_arg -> fem_node 807c478bd9Sstevel@tonic-gate * This relationship is established at the head of the call (ie. in 817c478bd9Sstevel@tonic-gate * femhead_open()) where the fem_arg is allocated. The fem_arg is 827c478bd9Sstevel@tonic-gate * updated as intermediate nodes are invoked, however not as they 837c478bd9Sstevel@tonic-gate * return. For this reason, nodes which are interested in maintaining 847c478bd9Sstevel@tonic-gate * context following a "next" should store a copy of the fem_available 857c478bd9Sstevel@tonic-gate * field before invoking the 'next'. 867c478bd9Sstevel@tonic-gate */ 877c478bd9Sstevel@tonic-gate typedef struct fem_arg femarg_t, fsemarg_t; 887c478bd9Sstevel@tonic-gate typedef struct fem fem_t; 897c478bd9Sstevel@tonic-gate typedef struct fsem fsem_t; 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate typedef int femop_t(); 927c478bd9Sstevel@tonic-gate 93da6c28aaSamw typedef void (*fem_func_t)(void *); 94da6c28aaSamw 957c478bd9Sstevel@tonic-gate /* 967c478bd9Sstevel@tonic-gate * The following enumerations specify the conditions 977c478bd9Sstevel@tonic-gate * under which a monitor (operation/argument combination) 987c478bd9Sstevel@tonic-gate * should be installed. These are used when calling 997c478bd9Sstevel@tonic-gate * fem_install() and fsem_install() 1007c478bd9Sstevel@tonic-gate */ 1017c478bd9Sstevel@tonic-gate typedef enum femhow { 1027c478bd9Sstevel@tonic-gate FORCE = 0, /* Force the installation of this monitor */ 1037c478bd9Sstevel@tonic-gate OPUNIQ = 1, /* Install if operation set is unique */ 1047c478bd9Sstevel@tonic-gate OPARGUNIQ = 2 /* Install if op/arg combination is unique */ 1057c478bd9Sstevel@tonic-gate } femhow_t; 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate struct fem_node { 1087c478bd9Sstevel@tonic-gate void *fn_available; 1097c478bd9Sstevel@tonic-gate union { 1107c478bd9Sstevel@tonic-gate fem_t *fem; 1117c478bd9Sstevel@tonic-gate vnodeops_t *vnode; 1127c478bd9Sstevel@tonic-gate fsem_t *fsem; 1137c478bd9Sstevel@tonic-gate vfsops_t *vfs; 1147c478bd9Sstevel@tonic-gate void *anon; /* anonymous, for updates */ 1157c478bd9Sstevel@tonic-gate } fn_op; 1167c478bd9Sstevel@tonic-gate void (*fn_av_hold)(void *); /* Hold for "fn_available" */ 1177c478bd9Sstevel@tonic-gate void (*fn_av_rele)(void *); /* Release for "fn_available" */ 1187c478bd9Sstevel@tonic-gate }; 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate struct fem_arg { 1217c478bd9Sstevel@tonic-gate union { 1227c478bd9Sstevel@tonic-gate vnode_t *vp, 1237c478bd9Sstevel@tonic-gate **vpp; 1247c478bd9Sstevel@tonic-gate vfs_t *vfsp; 1257c478bd9Sstevel@tonic-gate void *anon; 1267c478bd9Sstevel@tonic-gate } fa_vnode; 1277c478bd9Sstevel@tonic-gate struct fem_node *fa_fnode; 1287c478bd9Sstevel@tonic-gate }; 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate struct fem_list { 1327c478bd9Sstevel@tonic-gate uint_t feml_refc; /* reference count */ 1337c478bd9Sstevel@tonic-gate int feml_tos; /* top of stack pointer(index) */ 1347c478bd9Sstevel@tonic-gate int feml_ssize; /* stack size */ 1357c478bd9Sstevel@tonic-gate int feml_pad; /* alignment */ 1367c478bd9Sstevel@tonic-gate struct fem_node feml_nodes[1]; /* variable bounds */ 1377c478bd9Sstevel@tonic-gate }; 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate struct fem_head { 1407c478bd9Sstevel@tonic-gate kmutex_t femh_lock; 1417c478bd9Sstevel@tonic-gate struct fem_list *femh_list; 1427c478bd9Sstevel@tonic-gate }; 1437c478bd9Sstevel@tonic-gate 144aa59c4cbSrsb /* 145aa59c4cbSrsb * FEM_OPS defines all the FEM operations. It is used to define 146aa59c4cbSrsb * the fem structure (below) and the fs_func_p union (vfs_opreg.h). 147aa59c4cbSrsb */ 148aa59c4cbSrsb #define FEM_OPS \ 149da6c28aaSamw int (*femop_open)(femarg_t *vf, int mode, cred_t *cr, \ 150da6c28aaSamw caller_context_t *ct); \ 151aa59c4cbSrsb int (*femop_close)(femarg_t *vf, int flag, int count, \ 152da6c28aaSamw offset_t offset, cred_t *cr, \ 153da6c28aaSamw caller_context_t *ct); \ 154aa59c4cbSrsb int (*femop_read)(femarg_t *vf, uio_t *uiop, int ioflag, \ 155da6c28aaSamw cred_t *cr, caller_context_t *ct); \ 156aa59c4cbSrsb int (*femop_write)(femarg_t *vf, uio_t *uiop, int ioflag, \ 157da6c28aaSamw cred_t *cr, caller_context_t *ct); \ 158aa59c4cbSrsb int (*femop_ioctl)(femarg_t *vf, int cmd, intptr_t arg, \ 159da6c28aaSamw int flag, cred_t *cr, int *rvalp, \ 160da6c28aaSamw caller_context_t *ct); \ 161aa59c4cbSrsb int (*femop_setfl)(femarg_t *vf, int oflags, int nflags, \ 162da6c28aaSamw cred_t *cr, caller_context_t *ct); \ 163aa59c4cbSrsb int (*femop_getattr)(femarg_t *vf, vattr_t *vap, int flags, \ 164da6c28aaSamw cred_t *cr, caller_context_t *ct); \ 165aa59c4cbSrsb int (*femop_setattr)(femarg_t *vf, vattr_t *vap, int flags, \ 166aa59c4cbSrsb cred_t *cr, caller_context_t *ct); \ 167aa59c4cbSrsb int (*femop_access)(femarg_t *vf, int mode, int flags, \ 168da6c28aaSamw cred_t *cr, caller_context_t *ct); \ 169aa59c4cbSrsb int (*femop_lookup)(femarg_t *vf, char *nm, vnode_t **vpp, \ 170aa59c4cbSrsb pathname_t *pnp, int flags, vnode_t *rdir, \ 171da6c28aaSamw cred_t *cr, caller_context_t *ct, \ 172da6c28aaSamw int *direntflags, pathname_t *realpnp); \ 173aa59c4cbSrsb int (*femop_create)(femarg_t *vf, char *name, vattr_t *vap, \ 174aa59c4cbSrsb vcexcl_t excl, int mode, vnode_t **vpp, \ 175da6c28aaSamw cred_t *cr, int flag, caller_context_t *ct, \ 176da6c28aaSamw vsecattr_t *vsecp); \ 177da6c28aaSamw int (*femop_remove)(femarg_t *vf, char *nm, cred_t *cr, \ 178da6c28aaSamw caller_context_t *ct, int flags); \ 179aa59c4cbSrsb int (*femop_link)(femarg_t *vf, vnode_t *svp, char *tnm, \ 180da6c28aaSamw cred_t *cr, caller_context_t *ct, int flags); \ 181aa59c4cbSrsb int (*femop_rename)(femarg_t *vf, char *snm, vnode_t *tdvp, \ 182da6c28aaSamw char *tnm, cred_t *cr, caller_context_t *ct, \ 183da6c28aaSamw int flags); \ 184aa59c4cbSrsb int (*femop_mkdir)(femarg_t *vf, char *dirname, vattr_t *vap, \ 185da6c28aaSamw vnode_t **vpp, cred_t *cr, \ 186da6c28aaSamw caller_context_t *ct, int flags, \ 187da6c28aaSamw vsecattr_t *vsecp); \ 188aa59c4cbSrsb int (*femop_rmdir)(femarg_t *vf, char *nm, vnode_t *cdir, \ 189da6c28aaSamw cred_t *cr, caller_context_t *ct, int flags); \ 190aa59c4cbSrsb int (*femop_readdir)(femarg_t *vf, uio_t *uiop, cred_t *cr, \ 191da6c28aaSamw int *eofp, caller_context_t *ct, int flags); \ 192aa59c4cbSrsb int (*femop_symlink)(femarg_t *vf, char *linkname, \ 193da6c28aaSamw vattr_t *vap, char *target, cred_t *cr, \ 194da6c28aaSamw caller_context_t *ct, int flags); \ 195da6c28aaSamw int (*femop_readlink)(femarg_t *vf, uio_t *uiop, cred_t *cr, \ 196da6c28aaSamw caller_context_t *ct); \ 197da6c28aaSamw int (*femop_fsync)(femarg_t *vf, int syncflag, cred_t *cr, \ 198da6c28aaSamw caller_context_t *ct); \ 199da6c28aaSamw void (*femop_inactive)(femarg_t *vf, cred_t *cr, \ 200da6c28aaSamw caller_context_t *ct); \ 201da6c28aaSamw int (*femop_fid)(femarg_t *vf, fid_t *fidp, \ 202da6c28aaSamw caller_context_t *ct); \ 203aa59c4cbSrsb int (*femop_rwlock)(femarg_t *vf, int write_lock, \ 204aa59c4cbSrsb caller_context_t *ct); \ 205aa59c4cbSrsb void (*femop_rwunlock)(femarg_t *vf, int write_lock, \ 206aa59c4cbSrsb caller_context_t *ct); \ 207aa59c4cbSrsb int (*femop_seek)(femarg_t *vf, offset_t ooff, \ 208da6c28aaSamw offset_t *noffp, caller_context_t *ct); \ 209da6c28aaSamw int (*femop_cmp)(femarg_t *vf, vnode_t *vp2, \ 210da6c28aaSamw caller_context_t *ct); \ 211aa59c4cbSrsb int (*femop_frlock)(femarg_t *vf, int cmd, struct flock64 *bfp, \ 212aa59c4cbSrsb int flag, offset_t offset, \ 213da6c28aaSamw struct flk_callback *flk_cbp, cred_t *cr, \ 214da6c28aaSamw caller_context_t *ct); \ 215aa59c4cbSrsb int (*femop_space)(femarg_t *vf, int cmd, struct flock64 *bfp, \ 216aa59c4cbSrsb int flag, offset_t offset, cred_t *cr, \ 217aa59c4cbSrsb caller_context_t *ct); \ 218da6c28aaSamw int (*femop_realvp)(femarg_t *vf, vnode_t **vpp, \ 219da6c28aaSamw caller_context_t *ct); \ 220aa59c4cbSrsb int (*femop_getpage)(femarg_t *vf, offset_t off, size_t len, \ 221aa59c4cbSrsb uint_t *protp, struct page **plarr, \ 222aa59c4cbSrsb size_t plsz, struct seg *seg, caddr_t addr, \ 223da6c28aaSamw enum seg_rw rw, cred_t *cr, \ 224da6c28aaSamw caller_context_t *ct); \ 225aa59c4cbSrsb int (*femop_putpage)(femarg_t *vf, offset_t off, size_t len, \ 226da6c28aaSamw int flags, cred_t *cr, caller_context_t *ct); \ 227aa59c4cbSrsb int (*femop_map)(femarg_t *vf, offset_t off, struct as *as, \ 228aa59c4cbSrsb caddr_t *addrp, size_t len, uchar_t prot, \ 229da6c28aaSamw uchar_t maxprot, uint_t flags, cred_t *cr, \ 230da6c28aaSamw caller_context_t *ct); \ 231aa59c4cbSrsb int (*femop_addmap)(femarg_t *vf, offset_t off, struct as *as, \ 232aa59c4cbSrsb caddr_t addr, size_t len, uchar_t prot, \ 233da6c28aaSamw uchar_t maxprot, uint_t flags, cred_t *cr, \ 234da6c28aaSamw caller_context_t *ct); \ 235aa59c4cbSrsb int (*femop_delmap)(femarg_t *vf, offset_t off, struct as *as, \ 236aa59c4cbSrsb caddr_t addr, size_t len, uint_t prot, \ 237da6c28aaSamw uint_t maxprot, uint_t flags, cred_t *cr, \ 238da6c28aaSamw caller_context_t *ct); \ 239aa59c4cbSrsb int (*femop_poll)(femarg_t *vf, short events, int anyyet, \ 240da6c28aaSamw short *reventsp, struct pollhead **phpp, \ 241da6c28aaSamw caller_context_t *ct); \ 242d7334e51Srm int (*femop_dump)(femarg_t *vf, caddr_t addr, offset_t lbdn, \ 243d7334e51Srm offset_t dblks, caller_context_t *ct); \ 244aa59c4cbSrsb int (*femop_pathconf)(femarg_t *vf, int cmd, ulong_t *valp, \ 245da6c28aaSamw cred_t *cr, caller_context_t *ct); \ 246aa59c4cbSrsb int (*femop_pageio)(femarg_t *vf, struct page *pp, \ 247aa59c4cbSrsb u_offset_t io_off, size_t io_len, int flags, \ 248da6c28aaSamw cred_t *cr, caller_context_t *ct); \ 249d7334e51Srm int (*femop_dumpctl)(femarg_t *vf, int action, offset_t *blkp, \ 250da6c28aaSamw caller_context_t *ct); \ 251aa59c4cbSrsb void (*femop_dispose)(femarg_t *vf, struct page *pp, int flag, \ 252da6c28aaSamw int dn, cred_t *cr, caller_context_t *ct); \ 253aa59c4cbSrsb int (*femop_setsecattr)(femarg_t *vf, vsecattr_t *vsap, \ 254da6c28aaSamw int flag, cred_t *cr, caller_context_t *ct); \ 255aa59c4cbSrsb int (*femop_getsecattr)(femarg_t *vf, vsecattr_t *vsap, \ 256da6c28aaSamw int flag, cred_t *cr, caller_context_t *ct); \ 257aa59c4cbSrsb int (*femop_shrlock)(femarg_t *vf, int cmd, \ 258da6c28aaSamw struct shrlock *shr, int flag, cred_t *cr, \ 259da6c28aaSamw caller_context_t *ct); \ 260df2381bfSpraks int (*femop_vnevent)(femarg_t *vf, vnevent_t vnevent, \ 261*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States vnode_t *dvp, char *cname, \ 262*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States caller_context_t *ct); \ 263*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int (*femop_reqzcbuf)(femarg_t *vf, enum uio_rw ioflag, \ 264*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States xuio_t *xuio, cred_t *cr, \ 265*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States caller_context_t *ct); \ 266*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States int (*femop_retzcbuf)(femarg_t *vf, xuio_t *xuio, cred_t *cr, \ 267*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States caller_context_t *ct) 268df2381bfSpraks /* NB: No ";" */ 269aa59c4cbSrsb 2707c478bd9Sstevel@tonic-gate struct fem { 2717c478bd9Sstevel@tonic-gate const char *name; 2727c478bd9Sstevel@tonic-gate const struct fs_operation_def *templ; 273aa59c4cbSrsb FEM_OPS; /* Signatures of all FEM operations (femops) */ 2747c478bd9Sstevel@tonic-gate }; 2757c478bd9Sstevel@tonic-gate 276aa59c4cbSrsb /* 277aa59c4cbSrsb * FSEM_OPS defines all the FSEM operations. It is used to define 278aa59c4cbSrsb * the fsem structure (below) and the fs_func_p union (vfs_opreg.h). 279aa59c4cbSrsb */ 280aa59c4cbSrsb #define FSEM_OPS \ 281aa59c4cbSrsb int (*fsemop_mount)(fsemarg_t *vf, vnode_t *mvp, \ 282aa59c4cbSrsb struct mounta *uap, cred_t *cr); \ 283aa59c4cbSrsb int (*fsemop_unmount)(fsemarg_t *vf, int flag, cred_t *cr); \ 284aa59c4cbSrsb int (*fsemop_root)(fsemarg_t *vf, vnode_t **vpp); \ 285aa59c4cbSrsb int (*fsemop_statvfs)(fsemarg_t *vf, statvfs64_t *sp); \ 286aa59c4cbSrsb int (*fsemop_sync)(fsemarg_t *vf, short flag, cred_t *cr); \ 287aa59c4cbSrsb int (*fsemop_vget)(fsemarg_t *vf, vnode_t **vpp, fid_t *fidp); \ 288aa59c4cbSrsb int (*fsemop_mountroot)(fsemarg_t *vf, \ 289aa59c4cbSrsb enum whymountroot reason); \ 290aa59c4cbSrsb void (*fsemop_freevfs)(fsemarg_t *vf); \ 291aa59c4cbSrsb int (*fsemop_vnstate)(fsemarg_t *vf, vnode_t *vp, \ 292aa59c4cbSrsb vntrans_t nstate) /* NB: No ";" */ 293aa59c4cbSrsb 2947c478bd9Sstevel@tonic-gate struct fsem { 2957c478bd9Sstevel@tonic-gate const char *name; 2967c478bd9Sstevel@tonic-gate const struct fs_operation_def *templ; 297aa59c4cbSrsb FSEM_OPS; /* Signatures of all FSEM operations (fsemops) */ 2987c478bd9Sstevel@tonic-gate }; 2997c478bd9Sstevel@tonic-gate 300da6c28aaSamw extern int vnext_open(femarg_t *vf, int mode, cred_t *cr, 301da6c28aaSamw caller_context_t *ct); 3027c478bd9Sstevel@tonic-gate extern int vnext_close(femarg_t *vf, int flag, int count, offset_t offset, 303da6c28aaSamw cred_t *cr, caller_context_t *ct); 3047c478bd9Sstevel@tonic-gate extern int vnext_read(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr, 305da6c28aaSamw caller_context_t *ct); 3067c478bd9Sstevel@tonic-gate extern int vnext_write(femarg_t *vf, uio_t *uiop, int ioflag, cred_t *cr, 307da6c28aaSamw caller_context_t *ct); 3087c478bd9Sstevel@tonic-gate extern int vnext_ioctl(femarg_t *vf, int cmd, intptr_t arg, int flag, 309da6c28aaSamw cred_t *cr, int *rvalp, caller_context_t *ct); 310da6c28aaSamw extern int vnext_setfl(femarg_t *vf, int oflags, int nflags, cred_t *cr, 311da6c28aaSamw caller_context_t *ct); 312da6c28aaSamw extern int vnext_getattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr, 313da6c28aaSamw caller_context_t *ct); 3147c478bd9Sstevel@tonic-gate extern int vnext_setattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr, 3157c478bd9Sstevel@tonic-gate caller_context_t *ct); 316da6c28aaSamw extern int vnext_access(femarg_t *vf, int mode, int flags, cred_t *cr, 317da6c28aaSamw caller_context_t *ct); 3187c478bd9Sstevel@tonic-gate extern int vnext_lookup(femarg_t *vf, char *nm, vnode_t **vpp, 3197c478bd9Sstevel@tonic-gate pathname_t *pnp, int flags, vnode_t *rdir, 320da6c28aaSamw cred_t *cr, caller_context_t *ct, 321da6c28aaSamw int *direntflags, pathname_t *realpnp); 3227c478bd9Sstevel@tonic-gate extern int vnext_create(femarg_t *vf, char *name, vattr_t *vap, 3237c478bd9Sstevel@tonic-gate vcexcl_t excl, int mode, vnode_t **vpp, cred_t *cr, 324da6c28aaSamw int flag, caller_context_t *ct, vsecattr_t *vsecp); 325da6c28aaSamw extern int vnext_remove(femarg_t *vf, char *nm, cred_t *cr, 326da6c28aaSamw caller_context_t *ct, int flags); 327da6c28aaSamw extern int vnext_link(femarg_t *vf, vnode_t *svp, char *tnm, cred_t *cr, 328da6c28aaSamw caller_context_t *ct, int flags); 3297c478bd9Sstevel@tonic-gate extern int vnext_rename(femarg_t *vf, char *snm, vnode_t *tdvp, char *tnm, 330da6c28aaSamw cred_t *cr, caller_context_t *ct, int flags); 3317c478bd9Sstevel@tonic-gate extern int vnext_mkdir(femarg_t *vf, char *dirname, vattr_t *vap, 332da6c28aaSamw vnode_t **vpp, cred_t *cr, caller_context_t *ct, 333da6c28aaSamw int flags, vsecattr_t *vsecp); 334da6c28aaSamw extern int vnext_rmdir(femarg_t *vf, char *nm, vnode_t *cdir, cred_t *cr, 335da6c28aaSamw caller_context_t *ct, int flags); 336da6c28aaSamw extern int vnext_readdir(femarg_t *vf, uio_t *uiop, cred_t *cr, int *eofp, 337da6c28aaSamw caller_context_t *ct, int flags); 3387c478bd9Sstevel@tonic-gate extern int vnext_symlink(femarg_t *vf, char *linkname, vattr_t *vap, 339da6c28aaSamw char *target, cred_t *cr, caller_context_t *ct, 340da6c28aaSamw int flags); 341da6c28aaSamw extern int vnext_readlink(femarg_t *vf, uio_t *uiop, cred_t *cr, 342da6c28aaSamw caller_context_t *ct); 343da6c28aaSamw extern int vnext_fsync(femarg_t *vf, int syncflag, cred_t *cr, 344da6c28aaSamw caller_context_t *ct); 345da6c28aaSamw extern void vnext_inactive(femarg_t *vf, cred_t *cr, caller_context_t *ct); 346da6c28aaSamw extern int vnext_fid(femarg_t *vf, fid_t *fidp, caller_context_t *ct); 3477c478bd9Sstevel@tonic-gate extern int vnext_rwlock(femarg_t *vf, int write_lock, caller_context_t *ct); 3487c478bd9Sstevel@tonic-gate extern void vnext_rwunlock(femarg_t *vf, int write_lock, caller_context_t *ct); 349da6c28aaSamw extern int vnext_seek(femarg_t *vf, offset_t ooff, offset_t *noffp, 350da6c28aaSamw caller_context_t *ct); 351da6c28aaSamw extern int vnext_cmp(femarg_t *vf, vnode_t *vp2, caller_context_t *ct); 3527c478bd9Sstevel@tonic-gate extern int vnext_frlock(femarg_t *vf, int cmd, struct flock64 *bfp, 3537c478bd9Sstevel@tonic-gate int flag, offset_t offset, 354da6c28aaSamw struct flk_callback *flk_cbp, cred_t *cr, 355da6c28aaSamw caller_context_t *ct); 3567c478bd9Sstevel@tonic-gate extern int vnext_space(femarg_t *vf, int cmd, struct flock64 *bfp, 3577c478bd9Sstevel@tonic-gate int flag, offset_t offset, cred_t *cr, 3587c478bd9Sstevel@tonic-gate caller_context_t *ct); 359da6c28aaSamw extern int vnext_realvp(femarg_t *vf, vnode_t **vpp, caller_context_t *ct); 3607c478bd9Sstevel@tonic-gate extern int vnext_getpage(femarg_t *vf, offset_t off, size_t len, 3617c478bd9Sstevel@tonic-gate uint_t *protp, struct page **plarr, size_t plsz, 3627c478bd9Sstevel@tonic-gate struct seg *seg, caddr_t addr, enum seg_rw rw, 363da6c28aaSamw cred_t *cr, caller_context_t *ct); 3647c478bd9Sstevel@tonic-gate extern int vnext_putpage(femarg_t *vf, offset_t off, size_t len, int flags, 365da6c28aaSamw cred_t *cr, caller_context_t *ct); 3667c478bd9Sstevel@tonic-gate extern int vnext_map(femarg_t *vf, offset_t off, struct as *as, 3677c478bd9Sstevel@tonic-gate caddr_t *addrp, size_t len, uchar_t prot, uchar_t maxprot, 368da6c28aaSamw uint_t flags, cred_t *cr, caller_context_t *ct); 3697c478bd9Sstevel@tonic-gate extern int vnext_addmap(femarg_t *vf, offset_t off, struct as *as, 3707c478bd9Sstevel@tonic-gate caddr_t addr, size_t len, uchar_t prot, 371da6c28aaSamw uchar_t maxprot, uint_t flags, cred_t *cr, 372da6c28aaSamw caller_context_t *ct); 3737c478bd9Sstevel@tonic-gate extern int vnext_delmap(femarg_t *vf, offset_t off, struct as *as, 3747c478bd9Sstevel@tonic-gate caddr_t addr, size_t len, uint_t prot, 375da6c28aaSamw uint_t maxprot, uint_t flags, cred_t *cr, 376da6c28aaSamw caller_context_t *ct); 3777c478bd9Sstevel@tonic-gate extern int vnext_poll(femarg_t *vf, short events, int anyyet, 378da6c28aaSamw short *reventsp, struct pollhead **phpp, 379da6c28aaSamw caller_context_t *ct); 380d7334e51Srm extern int vnext_dump(femarg_t *vf, caddr_t addr, offset_t lbdn, 381d7334e51Srm offset_t dblks, caller_context_t *ct); 382da6c28aaSamw extern int vnext_pathconf(femarg_t *vf, int cmd, ulong_t *valp, cred_t *cr, 383da6c28aaSamw caller_context_t *ct); 3847c478bd9Sstevel@tonic-gate extern int vnext_pageio(femarg_t *vf, struct page *pp, u_offset_t io_off, 385da6c28aaSamw size_t io_len, int flags, cred_t *cr, 386da6c28aaSamw caller_context_t *ct); 387d7334e51Srm extern int vnext_dumpctl(femarg_t *vf, int action, offset_t *blkp, 388da6c28aaSamw caller_context_t *ct); 3897c478bd9Sstevel@tonic-gate extern void vnext_dispose(femarg_t *vf, struct page *pp, int flag, int dn, 390da6c28aaSamw cred_t *cr, caller_context_t *ct); 3917c478bd9Sstevel@tonic-gate extern int vnext_setsecattr(femarg_t *vf, vsecattr_t *vsap, int flag, 392da6c28aaSamw cred_t *cr, caller_context_t *ct); 3937c478bd9Sstevel@tonic-gate extern int vnext_getsecattr(femarg_t *vf, vsecattr_t *vsap, int flag, 394da6c28aaSamw cred_t *cr, caller_context_t *ct); 3957c478bd9Sstevel@tonic-gate extern int vnext_shrlock(femarg_t *vf, int cmd, struct shrlock *shr, 396da6c28aaSamw int flag, cred_t *cr, caller_context_t *ct); 397df2381bfSpraks extern int vnext_vnevent(femarg_t *vf, vnevent_t vevent, vnode_t *dvp, 398da6c28aaSamw char *cname, caller_context_t *ct); 399*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States extern int vnext_reqzcbuf(femarg_t *vf, enum uio_rw ioflag, xuio_t *xuiop, 400*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States cred_t *cr, caller_context_t *ct); 401*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States extern int vnext_retzcbuf(femarg_t *vf, xuio_t *xuiop, cred_t *cr, 402*c242f9a0Schunli zhang - Sun Microsystems - Irvine United States caller_context_t *ct); 4037c478bd9Sstevel@tonic-gate 4047c478bd9Sstevel@tonic-gate extern int vfsnext_mount(fsemarg_t *vf, vnode_t *mvp, struct mounta *uap, 4057c478bd9Sstevel@tonic-gate cred_t *cr); 4067c478bd9Sstevel@tonic-gate extern int vfsnext_unmount(fsemarg_t *vf, int flag, cred_t *cr); 4077c478bd9Sstevel@tonic-gate extern int vfsnext_root(fsemarg_t *vf, vnode_t **vpp); 4087c478bd9Sstevel@tonic-gate extern int vfsnext_statvfs(fsemarg_t *vf, statvfs64_t *sp); 4097c478bd9Sstevel@tonic-gate extern int vfsnext_sync(fsemarg_t *vf, short flag, cred_t *cr); 4107c478bd9Sstevel@tonic-gate extern int vfsnext_vget(fsemarg_t *vf, vnode_t **vpp, fid_t *fidp); 4117c478bd9Sstevel@tonic-gate extern int vfsnext_mountroot(fsemarg_t *vf, enum whymountroot reason); 4127c478bd9Sstevel@tonic-gate extern void vfsnext_freevfs(fsemarg_t *vf); 4137c478bd9Sstevel@tonic-gate extern int vfsnext_vnstate(fsemarg_t *vf, vnode_t *vp, vntrans_t nstate); 4147c478bd9Sstevel@tonic-gate 4157c478bd9Sstevel@tonic-gate 4167c478bd9Sstevel@tonic-gate extern void fem_init(void); /* called once, by startup */ 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate /* fem api */ 4197c478bd9Sstevel@tonic-gate extern int fem_create(char *name, const struct fs_operation_def *templ, 4207c478bd9Sstevel@tonic-gate fem_t **actual); 4217c478bd9Sstevel@tonic-gate extern void fem_free(fem_t *fem); 4227c478bd9Sstevel@tonic-gate extern int fem_install(struct vnode *v, fem_t *mon, void *arg, femhow_t how, 4237c478bd9Sstevel@tonic-gate void (*arg_hold)(void *), void (*arg_rele)(void *)); 4247c478bd9Sstevel@tonic-gate extern int fem_is_installed(struct vnode *v, fem_t *mon, void *arg); 4257c478bd9Sstevel@tonic-gate extern int fem_uninstall(struct vnode *v, fem_t *mon, void *arg); 4267c478bd9Sstevel@tonic-gate extern vnodeops_t *fem_getvnops(struct vnode *v); 4277c478bd9Sstevel@tonic-gate extern void fem_setvnops(struct vnode *v, struct vnodeops *nops); 4287c478bd9Sstevel@tonic-gate 4297c478bd9Sstevel@tonic-gate 4307c478bd9Sstevel@tonic-gate extern int fsem_create(char *name, const struct fs_operation_def *templ, 4317c478bd9Sstevel@tonic-gate fsem_t **actual); 4327c478bd9Sstevel@tonic-gate extern void fsem_free(fsem_t *fsem); 4337c478bd9Sstevel@tonic-gate extern int fsem_is_installed(struct vfs *v, fsem_t *mon, void *arg); 4347c478bd9Sstevel@tonic-gate extern int fsem_install(struct vfs *v, fsem_t *mon, void *arg, femhow_t how, 4357c478bd9Sstevel@tonic-gate void (*arg_hold)(void *), void (*arg_rele)(void *)); 4367c478bd9Sstevel@tonic-gate extern int fsem_uninstall(struct vfs *v, fsem_t *mon, void *arg); 4377c478bd9Sstevel@tonic-gate extern vfsops_t *fsem_getvfsops(struct vfs *v); 4387c478bd9Sstevel@tonic-gate extern void fsem_setvfsops(struct vfs *v, struct vfsops *nops); 4397c478bd9Sstevel@tonic-gate 440aa59c4cbSrsb #endif /* _KERNEL */ 4417c478bd9Sstevel@tonic-gate 4427c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4437c478bd9Sstevel@tonic-gate } 4447c478bd9Sstevel@tonic-gate #endif 4457c478bd9Sstevel@tonic-gate 4467c478bd9Sstevel@tonic-gate #endif /* _SYS_FEM_H */ 447