listxattr(dentry, buffer, size):由VFS调用来列出给定文件的所有的扩展属性。这个方法由系统调用listxattr(2)调用。
removexattr(dentry, name):由VFS调用来从一个文件移除(remove)一个扩展属性。这个方法由系统调用removexattr(2)调用。
truncate_range:一个由底层文件系统提供来截断块的范围的方法,比如在一个文件的某些地方打洞。

上面的方法对所有可能的索引节点和文件系统类型都是可用的。不过,只有其中的一个子集应用到某一个特定单位文件系统的索引节点和文件系统;为实现的方法对应的字段应被设置为NULL。
inode_operations中对inode操作的方法和super_operations中队inode操作的方法相比则要更高级一些,而后者则更靠近底层,即更接近对磁盘硬件设备的操作。
2.5目录项对象
对于进程查找的路径名中的每个分量,内核都为其创建一个目录项对象;目录项对象将每个分量与其对应的索引节点相联系。目录项对象在磁盘上没有对应的映像,它们存放在目录项缓存中。它们是一些根据目录文件的内容,填充的一些内存中的结构。单循环链表其定义如下:
---------------------------------------------------------------------
include/linux/dcache.h
struct dentry {
atomic_t d_count;
/* 目录项高速缓存标志 */
unsigned int d_flags; /* protected by d_lock */
spinlock_t d_lock; /* per dentry lock */
/* 对于目录而言,用于记录安装该目录项的文件系统的计数器*/
int d_mounted;
struct inode *d_inode; /* Where the name belongs to - NULL is
* negative */
/*
* The next three fields are touched by __d_lookup. Place them here
* so they all fit in a cache line.
*/
struct hlist_node d_hash; /* lookup hash list */
struct dentry *d_parent; /* parent directory */
struct qstr d_name; /* 文件名 */
/* 用于未使用目录项链表的指针 */
struct list_head d_lru; /* LRU list */
/*
* d_child and d_rcu can share memory
*/
union {
/* 对于目录而言,用于同一父目录中的目录项链表的指针 */
struct list_head d_child; /* child of parent list */
/* 回收目录项对象时,有RCU描述符使用 */
struct rcu_head d_rcu;
} d_u;
/* 对于目录而言,子目录项链表的头 */
struct list_head d_subdirs; /* our children */
/* 用于与同一索引节点相关的目录项链表指针 */
struct list_head d_alias; /* inode alias list */
unsigned long d_time; /* used by d_revalidate */
const struct dentry_operations *d_op;
struct super_block *d_sb; /* The root of the dentry tree */
void *d_fsdata; /* fs-specific data */
unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
};
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-76619-6.html
无可厚非