ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

各种结构体

2022-02-23 15:33:45  阅读:267  来源: 互联网

标签:dma 各种 struct list dev device inode 结构


一、inode结构体

struct inode {  
  struct hlist_node i_hash;  
  struct list_head i_list;  
  struct list_head i_sb_list;  
  struct list_head i_dentry;  
  unsigned long  i_ino;  
  atomic_t  i_count;  
  unsigned int  i_nlink;  
  uid_t   i_uid;//inode拥有者id  
  gid_t   i_gid;//inode所属群组id  
  dev_t   i_rdev;//若是设备文件,表示记录设备的设备号  
  u64   i_version;  
  loff_t   i_size;//inode所代表大少  
#ifdef __NEED_I_SIZE_ORDERED  
  seqcount_t  i_size_seqcount;  
#endif  
  struct timespec  i_atime;//inode最近一次的存取时间  
  struct timespec  i_mtime;//inode最近一次修改时间  
  struct timespec  i_ctime;//inode的生成时间  
  unsigned int  i_blkbits;  
  blkcnt_t  i_blocks;  
  unsigned short          i_bytes;  
  umode_t   i_mode;  
  spinlock_t  i_lock;   
  struct mutex  i_mutex;  
  struct rw_semaphore i_alloc_sem;  
  const struct inode_operations *i_op;  
  const struct file_operations *i_fop;   
  struct super_block *i_sb;  
  struct file_lock *i_flock;  
  struct address_space *i_mapping;  
  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;//若是字符设备,对应的为cdev结构  
  }; 
}; 

二、cdev结构体

struct cdev {
	struct kobject kobj;
	struct module *owner;
	const struct file_operations *ops;
	struct list_head list;
	dev_t dev;
	unsigned int count;
	//int	gpio;
};

三、platform_device结构体

struct platform_device {
	const char	*name;
	int		id;
	bool		id_auto;
	struct device	dev;
	u32		num_resources;
	struct resource	*resource;

	const struct platform_device_id	*id_entry;
	char *driver_override; /* Driver name to force a match */

	/* MFD cell pointer */
	struct mfd_cell *mfd_cell;

	/* arch specific additions */
	struct pdev_archdata	archdata;
};

四、device结构体

struct device {
	struct device		*parent;

	struct device_private	*p;

	struct kobject kobj;
	const char		*init_name; /* initial name of the device */
	const struct device_type *type;

	struct mutex		mutex;	/* mutex to synchronize calls to
					 * its driver.
					 */

	struct bus_type	*bus;		/* type of bus device is on */
	struct device_driver *driver;	/* which driver has allocated this
					   device */
	void		*platform_data;	/* Platform specific data, device
					   core doesn't touch it */
	void		*driver_data;	/* Driver data, set and get with
					   dev_set/get_drvdata */
	struct dev_pm_info	power;
	struct dev_pm_domain	*pm_domain;

#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
	struct irq_domain	*msi_domain;
#endif
#ifdef CONFIG_PINCTRL
	struct dev_pin_info	*pins;
#endif
#ifdef CONFIG_GENERIC_MSI_IRQ
	struct list_head	msi_list;
#endif

#ifdef CONFIG_NUMA
	int		numa_node;	/* NUMA node this device is close to */
#endif
	u64		*dma_mask;	/* dma mask (if dma'able device) */
	u64		coherent_dma_mask;/* Like dma_mask, but for
					     alloc_coherent mappings as
					     not all hardware supports
					     64 bit addresses for consistent
					     allocations such descriptors. */
	unsigned long	dma_pfn_offset;

	struct device_dma_parameters *dma_parms;

	struct list_head	dma_pools;	/* dma pools (if dma'ble) */

	struct dma_coherent_mem	*dma_mem; /* internal for coherent mem
					     override */
#ifdef CONFIG_DMA_CMA
	struct cma *cma_area;		/* contiguous memory area for dma
					   allocations */
#endif
	/* arch specific additions */
	struct dev_archdata	archdata;

	struct device_node	*of_node; /* associated device tree node */
	struct fwnode_handle	*fwnode; /* firmware device node */

	dev_t			devt;	/* dev_t, creates the sysfs "dev" */
	u32			id;	/* device instance */

	spinlock_t		devres_lock;
	struct list_head	devres_head;

	struct klist_node	knode_class;
	struct class		*class;
	const struct attribute_group **groups;	/* optional groups */

	void	(*release)(struct device *dev);
	struct iommu_group	*iommu_group;

	bool			offline_disabled:1;
	bool			offline:1;
	int				gpio;/* num of gpio */
};

五、file结构体

标签:dma,各种,struct,list,dev,device,inode,结构
来源: https://blog.csdn.net/qq_45613171/article/details/123090969

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有