亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標題:
linux內(nèi)核主要結(jié)構(gòu)體
[打印本頁]
作者:
liebo
時間:
2010-01-16 17:37
標題:
linux內(nèi)核主要結(jié)構(gòu)體
一、file結(jié)構(gòu)體 linux/include/linux/fs.h
struct file
{
/*
* fu_list becomes invalid after file_free is called and queued via
* fu_rcuhead for RCU freeing
*/
union {
struct list_head fu_list;
// linux/include/linux/list.h:
// struct list_head {
// struct list_head *next, *prev;
// };
struct rcu_head fu_rcuhead;
// linux/include/linux/rcupdate.h:
// struct rcu_head {
// struct rcu_head *next;
// void (*func)(struct rcu_head *head);
// };
} f_u;
struct path f_path;
// linux/include/linux/namei.h:
// struct path {
// struct vfsmount *mnt;
// struct dentry *dentry;
// };
#define f_dentry f_path.dentry //與文件關聯(lián)的目錄入口(dentry)結(jié)構(gòu)
//
#define f_vfsmnt f_path.mnt //已安裝的文件系統(tǒng)
//
const struct file_operations *f_op; //和文件關聯(lián)的操作
atomic_t f_count; //記錄對文件對象的引用計數(shù)
//typedef struct { volatile int counter; } atomic_t;
unsigned int f_flags; //文件標志,如:O_RDONLY、O_NONBLOCK、O_SYNC
mode_t f_mode; //文件讀/寫模式,如:FMODE_READ和FMODE_WRITE
// typedef unsigned int __kernel_mode_t;
// typedef __kernel_mode_t mode_t;
loff_t f_pos; //當前讀寫位置
// typedef long long __kernel_loff_t;
// typedef __kernel_loff_t loff_t;
struct fown_struct f_owner;
// struct fown_struct {
// rwlock_t lock; /* protects pid, uid, euid fields */
// struct pid *pid; /* pid or -pgrp where SIGIO should be sent */
// enum pid_type pid_type; /* Kind of process group SIGIO should be sent to*/
// uid_t uid, euid; /* uid/euid of process setting the owner */
// int signum; /* posix.1b rt signal to be delivered on IO */ 694
// };
unsigned int f_uid, f_gid;
struct file_ra_state f_ra;
//struct file_ra_state { //新版的結(jié)構(gòu)體會有不同
// pgoff_t start; /* where readahead started */
// unsigned long size; /* # of readahead pages */
// unsigned long async_size; /* do asynchronous readahead when there are only # of pages ahead */
// unsigned long ra_pages; /* Maximum readahead window */
// unsigned long mmap_hit; /* Cache hit stat for mmap accesses */
// unsigned long mmap_miss; /* Cache miss stat for mmap accesses */
// unsigned long prev_index; /* Cache last read() position */
// unsigned int prev_offset; /* Offset where last read() ended in a page */710
// };
unsigned long f_version;
#ifdef CONFIG_SECURITY
void *f_security;
#endif
/* needed for tty driver, and maybe others */
void *private_data; //文件私有指針,一般指向設備驅(qū)動自定義的描述設備的結(jié)構(gòu)體
#ifdef CONFIG_EPOLL
/* Used by fs/eventpoll.c to link all the hooks to this file */
struct list_head f_ep_links; //f_ep_lock是保護f_ep_links鏈表的自旋鎖。
spinlock_t f_ep_lock;
// typedef struct {
// raw_spinlock_t raw_lock;
// #ifdef CONFIG_GENERIC_LOCKBREAK
// unsigned int break_lock;
// #endif
// } spinlock_t;
// typedef struct {
// volatile unsigned int lock;
// } raw_spinlock_t;
#endif /* #ifdef CONFIG_EPOLL */
struct address_space *f_mapping; //映射的地址空間
// struct address_space {
// struct inode *host; /* owner: inode, block_device */
// struct radix_tree_root page_tree; /* radix tree of all pages */
// spinlock_t tree_lock; /* and lock protecting it */
// unsigned int i_mmap_writable;/* count VM_SHARED mappings */
// struct prio_tree_root i_mmap; /* tree of private and shared mappings */
// struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
// spinlock_t i_mmap_lock; /* protect tree, count, list */
// unsigned int truncate_count; /* Cover race condition with truncate */
// unsigned long nrpages; /* number of total pages */
// pgoff_t writeback_index;/* writeback starts here */
// const struct address_space_operations *a_ops; /* methods */
// unsigned long flags; /* error bits/gfp mask */
// struct backing_dev_info *backing_dev_info; /* device readahead, etc */
// spinlock_t private_lock; /* for use by the address_space */
// struct list_head private_list; /* ditto */
// struct address_space *assoc_mapping; /* ditto */
// } __attribute__((aligned(sizeof(long))));
};
文件結(jié)構(gòu)體代表一個打開的文件,系統(tǒng)中每個打開的文件在內(nèi)核空間都有一個關聯(lián)的struct file。
它由內(nèi)核打開文件時創(chuàng)建,并傳遞給在文件上進行操作的任何函數(shù)。
本文來自ChinaUnix博客,如果查看原文請點:
http://blog.chinaunix.net/u3/105293/showart_2150878.html
歡迎光臨 Chinaunix (http://www.72891.cn/)
Powered by Discuz! X3.2