⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wrapfs.h

📁 Solaris操作系统下的过滤驱动程序, C源码程序.
💻 H
字号:
/* * Copyright (c) 1997-2003 Erez Zadok * Copyright (c) 2001-2003 Stony Brook University * Copyright (c) 1997-2000 Columbia University * * For specific licensing information, see the COPYING file distributed with * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. * * This Copyright notice must be kept intact and distributed with all * fistgen sources INCLUDING sources generated by fistgen. */#ifndef	__WRAPFS_H_#define	__WRAPFS_H_/* * Copyright (c) 1992, 1993 *      The Regents of the University of California.  All rights reserved. * * This code is derived from software donated to Berkeley by * Jan-Simon Pendry. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *      This product includes software developed by the University of *      California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *      @(#)wrapfs.h    8.3 (Berkeley) 8/20/94 * * $Id: wrapfs.h,v 1.4 2002/12/27 20:18:52 ezk Exp $ */struct wrapfs_args {  char *target;			/* Target of loopback  */};#ifdef FIST_DEBUG/* debugging ioctls */#define FIST_IOCTL_GET_DEBUG_VALUE	_IOR('F', 1,  int)#define FIST_IOCTL_SET_DEBUG_VALUE	_IOW('F', 2,  int)#endif /* FIST_DEBUG */#ifdef KERNEL/* per-vfs private date */struct wrapfs_mount {  struct mount *wrapfsm_vfs;  struct vnode *wrapfsm_rootvp;	/* Reference to root wrapfs_node */  /* additional per-vfs BDTs */  FIST_VFS_FIELDS;};/* * A cache of vnode references * (This is a private structure per vnode->v_data) */struct wrapfs_node {  LIST_ENTRY(wrapfs_node) wrapfs_hash; /* Hash list */  struct vnode *wrapfs_lowervp; /* VREFed once */  struct vnode *wrapfs_vnode;	/* Back pointer */};extern int wrapfs_init __P((struct vfsconf * vfsp));extern int wrapfs_node_create __P((struct mount *mp, struct vnode * target, struct vnode ** vpp));/* * Flags for wrapfs_{en,de}code_filename * DO_DOTS means the special entries . and .. should be encoded (for symlink) * SKIP_DOTS means they should be preserved intact */#define DO_DOTS   0#define SKIP_DOTS 1#define MAXNAMLEN	255	/* as per POSIX */#define	MOUNT_TO_WRAPFS_MOUNT(mp) ((struct wrapfs_mount *)((mp)->mnt_data))#define	VP_TO_WRAPFS(vp) ((struct wrapfs_node *)(vp)->v_data)#define	WRAPFS_TO_VP(xp) ((xp)->wrapfs_vnode)#ifdef WRAPFS_DIAGNOSTICextern struct vnode *wrapfs_checkvp __P((struct vnode * vp, char *fil, int lno));# define WRAPFS_VP_TO_LOWERVP(vp) wrapfs_checkvp((vp), __FILE__, __LINE__)#else# define WRAPFS_VP_TO_LOWERVP(vp) (VP_TO_WRAPFS(vp)->wrapfs_lowervp)#endif /* WRAPFS_DIAGNOSTIC */#define vfs2priv(x)	MOUNT_TO_WRAPFS_MOUNT(x)#define vnode2lower(x)	WRAPFS_VP_TO_LOWERVP(x)#define dir2lower(x)	WRAPFS_VP_TO_LOWERVP(x)#define CRED()	curproc->p_cred->pc_ucred#define printk	printf/* simpler macros for using with file name encoding */#ifdef FIST_FILTER_NAME#define CNP_VARS	cn_t *thiscnp=NULL, *lowercnp=NULL#define CNP_BEFORE(V) \	do { \	  thiscnp = ap->a_cnp; /* save original */ \	  lowercnp = wrapfs_new_cnp((V), thiscnp); \	  ap->a_cnp = lowercnp;		/* prepare for bypass */ \	} while (0)#define CNP_AFTER(V) \	do { \	  if ((thiscnp->cn_flags & PARAMASK) != (lowercnp->cn_flags & PARAMASK)) \	    panic("%s: FLAGS CHANGED this:0x%x lower:0x%x", \		  __FUNCTION__, (int)thiscnp->cn_flags, (int)lowercnp->cn_flags); \	  wrapfs_update_cnp((V), &lowercnp, thiscnp, error); \	  ap->a_cnp = thiscnp;	/* update for caller */ \	} while (0)# define err error#else /* not FIST_FILTER_NAME */#define CNP_VARS#define CNP_BEFORE(x)#define CNP_AFTER(x)#endif /* not FIST_FILTER_NAME */extern int wrapfs_bypass __P((struct vop_generic_args * ap));extern vop_t **wrapfs_vnodeop_p;/* XXX: EZK hacky stuff I have to do rather than change system headers */typedef struct vnode vnode_t;typedef struct vattr vattr_t;typedef struct uio uio_t;typedef struct iovec iovec_t;typedef struct ucred cred_t;typedef struct mount vfs_t;typedef struct componentname cn_t;typedef struct componentname pathname_t;#define	MIN(a,b)		(((a)<(b))?(a):(b))#define	MAX(a,b)		(((a)>(b))?(a):(b))#define VT_WRAPFS		VT_NULL#define MOUNT_WRAPFS		MOUNT_NULL#define kmem_alloc(size)	malloc((size), M_TEMP, M_WAITOK)#define kmem_free(addr)		free((addr), M_TEMP)#ifdef FIST_FILTER_NAMEextern void wrapfs_encode_filename(vfs_t *vfsp, char *name, char **uuencoded_name, int *uuencoded_length, int skip_dots, int use_namei_zone, cred_t *cr);extern int wrapfs_decode_filename(vfs_t *vfsp, char *name, int length, char **decrypted_name, int *decrypted_length, int skip_dots, cred_t *cr);#endif /* FIST_FILTER_NAME */extern int wrapfs_encode_block(char *func, int line, caddr_t base, int len, const vnode_t *vp, cred_t *cr);extern int wrapfs_decode_block(char *func, int line, caddr_t base, int len, const vnode_t *vp, cred_t *cr);extern void *kmem_zalloc(unsigned long size);extern int fist_uiomove(caddr_t cp, int n, enum uio_rw rwflag, struct uio *uio);extern void wrapfs_verify_lower_object(vnode_t *vp, char *fxn);extern cn_t *wrapfs_new_cnp(const vnode_t *thisvp, const cn_t *cnp);extern void wrapfs_update_cnp(const vnode_t *thisvp, cn_t **lowercnpp, cn_t *thiscnp, int error);extern char *fist_cn_flags(u_long flags);struct freelist {  long	spare0;  struct malloc_type *type;  long	spare1;  caddr_t	next;};#define WEIRD_ADDR 0xdeadc0deextern int fist_isdeadcode(void *addr);#ifdef FIST_DEBUGextern void fist_dprint_internal(int level, char *str, ...);extern void fist_print_vnode(char *, vnode_t *);extern void fist_print_vfs(char *, vfs_t *);/* extern void fist_print_uap(char *, struct mounta *); */extern void fist_print_uio(const char *, uio_t *);extern void fist_print_uios(const char *, uio_t *);extern void fist_print_page(const char *fxn_name, vm_page_t pp);extern void fist_print_cn(const char *fxn_name, cn_t *);/* extern void fist_print_pathname(char *fxn_name, struct pathname *pnp); */extern int fist_get_debug_value(void);extern int fist_set_debug_value(int val);# define print_location() \	fist_dprint(2, "%s %s:%d\n", __FUNCTION__, __FILE__, __LINE__)# define fist_dprint(level, str, args...) \	fist_dprint_internal(level, str, ## args)# define ASSERT(e)	((e) ? (void)0 : panic("ASSERTION \"%s\" FAILED at %s:%d", #e, __FILE__, __LINE__))#else /* not FIST_DEBUG */# define fist_dprint(level, format, args...)# define print_location()# define fist_print_vnode(a, b)# define fist_print_vfs(a, b)# define fist_print_uio(a, b)# define fist_print_uios(a, b)# define fist_print_uap(a, b)# define fist_print_page(a, b)# define fist_print_cn(a, b)# define ASSERT(e)#endif /* not FIST_DEBUG */#ifdef FIST_USE_AUX_SRCextern int wrapfs_read_file(const char *filename, void *buf, int len);extern int wrapfs_write_file(const char *filename, void *buf, int len);extern int fist_lookup(vnode_t *dvp, char *name, vnode_t **vpp, pathname_t *pnp, int flags, vnode_t *rdir, cred_t *cr, uid_t uid, gid_t gid);#endif /* FIST_USE_AUX_SRC *//* auto-generated extern definitions */FIST_AUTO_GENERATED_EXTERNS#endif /* KERNEL *//* * Definitions for user and kernel code */#define memset(arg, val, len) bzero(arg, len)/* ioctls */FIST_IOCTL_DEFS#endif /* not __WRAPFS_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -