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

📄 dentry.c

📁 Solaris操作系统下的过滤驱动程序, C源码程序.
💻 C
字号:
/* * 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. *//* *  $Id: dentry.c,v 1.9 2002/12/27 20:18:59 ezk Exp $ */#ifdef HAVE_CONFIG_H# include <config.h>#endif /* HAVE_CONFIG_H */#ifdef FISTGEN# include "fist_wrapfs.h"#endif /* FISTGEN */#include "fist.h"#include "wrapfs.h"/* * THIS IS A BOOLEAN FUNCTION: returns 1 if valid, 0 otherwise. */STATIC int#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,8)wrapfs_d_revalidate(dentry_t *dentry, int flags)#else /* kernel before 2.2.8 */wrapfs_d_revalidate(dentry_t *dentry)#endif /* kernel before 2.2.8 */{    int err = 1; // default is valid (1); invalid is 0.    dentry_t *hidden_dentry = wrapfs_hidden_dentry(dentry);    print_entry_location();    if (!hidden_dentry->d_op || !hidden_dentry->d_op->d_revalidate)	goto out;#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,8)    err = hidden_dentry->d_op->d_revalidate(hidden_dentry, flags);#else /* kernel before 2.2.8 */    err = hidden_dentry->d_op->d_revalidate(hidden_dentry);#endif /* kernel before 2.2.8 */ out:    print_exit_status(err);    return err;}STATIC intwrapfs_d_hash(dentry_t *dentry, qstr_t *name){    int err = 0;    dentry_t *hidden_dentry = wrapfs_hidden_dentry(dentry);    print_entry_location();    if (!hidden_dentry->d_op || !hidden_dentry->d_op->d_hash)	goto out;    err = hidden_dentry->d_op->d_hash(hidden_dentry, name); out:    print_exit_status(err);    return err;}STATIC intwrapfs_d_compare(dentry_t *dentry, qstr_t *a, qstr_t *b){    int err;    dentry_t *hidden_dentry = wrapfs_hidden_dentry(dentry);    print_entry_location();    if (hidden_dentry->d_op && hidden_dentry->d_op->d_compare) {	// XXX: WRONG: should encode_filename on a&b strings	err = hidden_dentry->d_op->d_compare(hidden_dentry, a, b);    } else {	err = ((a->len != b->len) || memcmp(a->name, b->name, b->len));    }    print_exit_status(err);    return err;}#ifdef FIST_DEBUG/* * Not needed because the real place where dput() needs to free up * private dentry resources is d_release, called from d_free, * called from dput(). */STATIC voidwrapfs_d_delete(dentry_t *dentry){    print_entry_location();    print_exit_location();}#endif /* FIST_DEBUG */STATIC voidwrapfs_d_release(dentry_t *dentry){    // call dtohd directly because hidden_dentry could be NULL    dentry_t *hidden_dentry;    print_entry_location();    fist_print_dentry("wrapfs_d_release IN dentry", dentry);    /* this could be a negative dentry, so check first */    if (!dtopd(dentry)) {	fist_dprint(6, "wrapfs_d_release: dentry without private data\n");	goto out;    }    hidden_dentry = dtohd(dentry);    fist_print_dentry("wrapfs_d_release IN hidden_dentry", hidden_dentry);    if (hidden_dentry->d_inode)	fist_dprint(6, "wrapfs_d_release: hidden_inode->i_count %d, i_num %lu.\n",		    hidden_dentry->d_inode->i_count,		    hidden_dentry->d_inode->i_ino);    /* XXX: free private data (wrapfs_dentry_info) here, when/if needed */    dtopd(dentry) = NULL;    /* decrement hidden dentry's counter and free its inode */    dput(hidden_dentry); out:    print_exit_location();}#ifdef FIST_DEBUG/* * we don't need wrapfs_iput, because dentry_iput will call iput() if * d_iput is not defined.We left this implemented for ease of * tracing/debugging. */STATIC voidwrapfs_d_iput(dentry_t *dentry, inode_t *inode){    print_entry_location();    iput(inode);    print_exit_location();}#endif /* FIST_DEBUG */struct dentry_operations wrapfs_dops = {    d_revalidate:	wrapfs_d_revalidate,    d_hash:		wrapfs_d_hash,    d_compare:		wrapfs_d_compare,    d_release:		wrapfs_d_release,#ifdef FIST_DEBUG    d_delete:		wrapfs_d_delete,    d_iput:		wrapfs_d_iput,#endif /* FIST_DEBUG */};/* * Local variables: * c-basic-offset: 4 * End: */

⌨️ 快捷键说明

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