LDD和scull相关各种结构体的故事(学习笔记 不定期更新)
来源:互联网 发布:金特软件 编辑:程序博客网 时间:2024/06/01 15:55
LDD和各种结构体的故事
struct scull_dev 位置:scull/scull.h
struct scull_dev {struct scull_qset *data; /* Pointer to first quantum set */int quantum; /* the current quantum size */int qset; /* the current array size */unsigned long size; /* amount of data stored here */unsigned int access_key; /* used by sculluid and scullpriv */struct mutex mutex; /* mutual exclusion semaphore */struct cdev cdev; /* Char device structure*/};
struct mutex 位置:/usr/src/linux-source/include/linux/
struct mutex { /* 1: unlocked, 0: locked, negative: locked, possible waiters */ atomic_t count; spinlock_t wait_lock; struct list_head wait_list;#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) struct task_struct *owner;#endif#ifdef CONFIG_DEBUG_MUTEXES const char *name; void *magic;#endif#ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map dep_map;#endif};
这个有点点长哇。。。
struct inode 位置:/usr/src/linux-source/include/linux/fs.h
/* * Keep mostly read-only and often accessed (especially for * the RCU path lookup and 'stat' data) fields at the beginning * of the 'struct inode' */struct inode { umode_t i_mode; unsigned short i_opflags; kuid_t i_uid; kgid_t i_gid; unsigned int i_flags;#ifdef CONFIG_FS_POSIX_ACL struct posix_acl *i_acl; struct posix_acl *i_default_acl;#endif const struct inode_operations *i_op; struct super_block *i_sb; struct address_space *i_mapping;#ifdef CONFIG_SECURITY void *i_security;#endif /* Stat data, not accessed from path walking */ unsigned long i_ino; /* * Filesystems may only read i_nlink directly. They shall use the * following functions for modification: * * (set|clear|inc|drop)_nlink * inode_(inc|dec)_link_count */ union { const unsigned int i_nlink; unsigned int __i_nlink; }; dev_t i_rdev; loff_t i_size; struct timespec i_atime; struct timespec i_mtime; struct timespec i_ctime; spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ unsigned short i_bytes; unsigned int i_blkbits; blkcnt_t i_blocks;#ifdef __NEED_I_SIZE_ORDERED seqcount_t i_size_seqcount;#endif /* Misc */ unsigned long i_state; struct mutex i_mutex; unsigned long dirtied_when; /* jiffies of first dirtying */ struct hlist_node i_hash; struct list_head i_wb_list; /* backing dev IO list */ struct list_head i_lru; /* inode LRU list */ struct list_head i_sb_list; union { struct hlist_head i_dentry; struct rcu_head i_rcu; }; u64 i_version; atomic_t i_count; atomic_t i_dio_count; atomic_t i_writecount; const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ struct file_lock *i_flock; struct address_space i_data;#ifdef CONFIG_QUOTA struct dquot *i_dquot[MAXQUOTAS];#endif struct list_head i_devices; union { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; }; __u32 i_generation;#ifdef CONFIG_FSNOTIFY __u32 i_fsnotify_mask; /* all events this inode cares about */ struct hlist_head i_fsnotify_marks;#endif#ifdef CONFIG_IMA atomic_t i_readcount; /* struct files open RO */#endif void *i_private; /* fs or device private pointer */};
struct file 位置:/usr/src/linux-source/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; struct rcu_head fu_rcuhead; } f_u; struct path f_path;#define f_dentry f_path.dentry#define f_vfsmnt f_path.mnt const struct file_operations *f_op; /* * Protects f_ep_links, f_flags, f_pos vs i_size in lseek SEEK_CUR. * Must not be taken from IRQ context. */ spinlock_t f_lock;#ifdef CONFIG_SMP int f_sb_list_cpu;#endif atomic_long_t f_count; unsigned int f_flags; fmode_t f_mode; loff_t f_pos; struct fown_struct f_owner; const struct cred *f_cred; struct file_ra_state f_ra; u64 f_version;#ifdef CONFIG_SECURITY void *f_security;#endif /* needed for tty driver, and maybe others */ void *private_data;#ifdef CONFIG_EPOLL /* Used by fs/eventpoll.c to link all the hooks to this file */ struct list_head f_ep_links; struct list_head f_tfile_llink;#endif /* #ifdef CONFIG_EPOLL */ struct address_space *f_mapping;#ifdef CONFIG_DEBUG_WRITECOUNT unsigned long f_mnt_write_state;#endif};
struct cdev 位置:/usr/src/linux-source/include/linux/cdev.h
struct cdev { struct kobject kobj; struct module *owner; const struct file_operations *ops; struct list_head list; dev_t dev; unsigned int count;};
struct scull_qset 位置:scull/scull.h
struct scull_qset {void **data;struct scull_qset *next;};
struct seq_file 位置:/usr/src/linux-source/include/linux/sqe_file.h
struct seq_file { char *buf; size_t size; size_t from; size_t count; loff_t index; loff_t read_pos; u64 version; struct mutex lock; const struct seq_operations *op; int poll_event;#ifdef CONFIG_USER_NS struct user_namespace *user_ns;#endif void *private;};
kmem_cache
位置:/usr/src/linux-source/include/linux/slab.h
struct kmem_cache {unsigned int object_size;/* The original size of the object */unsigned int size;/* The aligned/padded/added on size */unsigned int align;/* Alignment as calculated */unsigned long flags;/* Active flags on the slab */const char *name;/* Slab name for sysfs */int refcount;/* Use counter */void (*ctor)(void *);/* Called on object slot creation */struct list_head list;/* List of all slab caches on the system */};
poll_table
位置:/usr/src/linux-source/include/linux/poll.h
typedef struct poll_table_struct {poll_queue_proc _qproc;unsigned long _key;} poll_table;
work_struct
位置:/usr/src/linux-source/include/linux/workqueue.h
struct work_struct {atomic_long_t data;struct list_head entry;work_func_t func;#ifdef CONFIG_LOCKDEPstruct lockdep_map lockdep_map;#endif};
"也哭也笑,平凡着"
—— 平凡之路
0 0
- LDD和scull相关各种结构体的故事(学习笔记 不定期更新)
- 不定期更新--lnmp配置各种坑的笔记
- 不定期更新ML学习笔记
- angularjs学习笔记【不定期更新】
- 编译LDD的第二个例子scull
- Nokia N9 相关的网站,不定期更新
- SQLite学习笔记(不定期更新)
- Bootrap学习笔记——不定期更新
- Pandas学习笔记(不定期更新)
- 【安卓学习笔记】( 不定期更新)
- Hadoop学习笔记(不定期更新)
- LDD3学习笔记--scull的编译
- sphinx 笔记(不定期更新)
- 各种零碎知识【不定期更新】
- 分享几一些网络安全和编程相关的书1(不定期更新........)
- scull的阅读笔记
- TensorFlow及深度学习相关资料积累汇总【不定期更新】
- 各种乱七八糟常用函数的简单用法(不定期更新)
- socket实现服务端与客户端的通讯
- debug正常,release有问题
- ibatis queryForObject() 、queryForList()、queryForMap()
- Julia的Dates库是重要和必要的补充!
- 【互动问答分享】第5期决胜云计算大数据时代Spark亚太研究院公益大讲堂
- LDD和scull相关各种结构体的故事(学习笔记 不定期更新)
- Android零基础开发专题一:Android 4.0环境搭建
- 数码机顶盒设置IP
- MTK6592平台 touchpanel驱动设备加载(二)
- Android App 内存泄露之Handler
- Java多线程的wait()和notify()例子
- 编译使用 libmp4v2库 libmp4v2.lib(atom_tkhd.obj) : error LNK2001: 无法解析的外部符号 _gettimeofday 错误解决办法.
- 杭电 4681
- 五大常用算法之一:分治算法