Linux Driver Development Record

Source: Internet
Author: User
Tags mutex

Inode:

Include/linux/fs.h

1 /*2 * Keep mostly read-only and often accessed (especially for3 * The RCU path lookup and ' stat ' data) fields at the beginning4 * of the ' struct Inode '5  */6 structInode {7 umode_t I_mode;8Unsigned Shorti_opflags;9 kuid_t I_uid;Ten kgid_t I_gid; OneUnsignedinti_flags; A  - #ifdef CONFIG_FS_POSIX_ACL -     structPosix_acl *I_acl; the     structPosix_acl *I_default_acl; - #endif -  -     Const structInode_operations *I_op; +     structSuper_block *I_SB; -     structAddress_space *i_mapping; +  A #ifdef config_security at     void*i_security; - #endif -  -     /*Stat data, not accessed from path walking*/ -UnsignedLongI_ino; -     /* in * filesystems may only read I_nlink directly. They shall use the - * Following functions for modification: to      * + * (set|clear|inc|drop) _nlink - * Inode_ (INC|DEC) _link_count the      */ * Union { $         ConstUnsignedintI_nlink;Panax NotoginsengUnsignedint__i_nlink; -     }; the dev_t I_rdev; + loff_t i_size; A     structTimespec i_atime; the     structTimespec i_mtime; +     structTimespec i_ctime; -spinlock_t I_lock;/*I_blocks, I_bytes, maybe I_size*/ $Unsigned Shorti_bytes; $Unsignedinti_blkbits; - blkcnt_t i_blocks; -  the #ifdef __need_i_size_ordered - seqcount_t I_size_seqcount;Wuyi #endif the  -     /*Misc*/ WuUnsignedLongi_state; -     structMutex I_mutex; About  $UnsignedLongDirtied_when;/*jiffies of First dirtying*/ -  -     structHlist_node I_hash; -     structList_head i_wb_list;/*backing Dev IO list*/ A     structList_head I_lru;/*inode LRU List*/ +     structList_head i_sb_list; the Union { -         structHlist_head i_dentry; $         structRcu_head I_rcu; the     }; the U64 i_version; the atomic_t I_count; the atomic_t I_dio_count; - atomic_t I_writecount; in #ifdef Config_ima theatomic_t I_readcount;/*struct files open RO*/ the #endif About     Const structFile_operations *i_fop;/*former->i_op->default_file_ops*/ the     structFile_lock_context *I_flctx; the     structaddress_space I_data; the     structList_head i_devices; + Union { -         structPipe_inode_info *I_pipe; the         structBlock_device *I_bdev;Bayi        struct cdev *i_cdev;  the     }; the  - __u32 i_generation; -  the #ifdef config_fsnotify the__u32 I_fsnotify_mask;/*All Events This inode cares about*/ the     structHlist_head I_fsnotify_marks; the #endif -  the     void*i_private;/*FS or device private pointer*/ the};

File

Include/linux/fs.h

1 structfile {2 Union {3         structLlist_node fu_llist;4         structRcu_head Fu_rcuhead;5 } F_u;6     structpath F_path;7      struct inode *f_inode; /* Cached Value */8      const struct file_operations *f_op; 9 Ten     /* One * Protects F_ep_links, f_flags. A * must not being taken from IRQ context. -      */ - spinlock_t F_lock; the atomic_long_t F_count; -Unsignedintf_flags; - fmode_t F_mode; -     structMutex F_pos_lock; + loff_t F_pos; -     structfown_struct F_owner; +     Const structCred *f_cred; A     structfile_ra_state F_ra; at  - U64 f_version; - #ifdef config_security -     void*f_security; - #endif -     /*needed for TTY driver, and maybe others*/ in      void *private_data;  -  to #ifdef Config_epoll +     /*used by fs/eventpoll.c to link all the hooks to this file*/ -     structList_head f_ep_links; the     structList_head F_tfile_llink; * #endif/* #ifdef Config_epoll */ $     structAddress_space *f_mapping;Panax Notoginseng} __attribute__ ((Aligned (4)));/*lest something weird decides that 2 is OK*/

Cdev

Include/linux/cdev.h

1  structCdev {2   -         structKobject kobj;3   -         structModule *owner;4   the         Const structFile_operations *ops;5   -         structlist_head list;6   -dev_t Dev;7   -Unsignedintcount;8   +};

Linux Driver Development Record

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.