当前位置:网站首页>字符设备驱动结构
字符设备驱动结构
2022-07-28 18:15:00 【InfoQ】
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_CDEV_H
#define _LINUX_CDEV_H
#include <linux/kobject.h>
#include <linux/kdev_t.h>
#include <linux/list.h>
#include <linux/device.h>
struct file_operations;
struct inode;
struct module;
struct cdev {
struct kobject kobj;
struct module *owner;
const struct file_operations *ops;
struct list_head list;
dev_t dev;
unsigned int count;
} __randomize_layout;
void cdev_init(struct cdev *, const struct file_operations *);
struct cdev *cdev_alloc(void);
void cdev_put(struct cdev *p);
int cdev_add(struct cdev *, dev_t, unsigned);
void cdev_set_parent(struct cdev *p, struct kobject *kobj);
int cdev_device_add(struct cdev *cdev, struct device *dev);
void cdev_device_del(struct cdev *cdev, struct device *dev);
void cdev_del(struct cdev *);
void cd_forget(struct inode *);
#endifstruct kobject {
const char *name;
struct list_head entry;
struct kobject *parent;
struct kset *kset;
const struct kobj_type *ktype;
struct kernfs_node *sd; /* sysfs directory entry */
struct kref kref;
#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
struct delayed_work release;
#endif
unsigned int state_initialized:1;
unsigned int state_in_sysfs:1;
unsigned int state_add_uevent_sent:1;
unsigned int state_remove_uevent_sent:1;
unsigned int uevent_suppress:1;
};alloc_chrdev_regionregister_chrdev_region
extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
extern int register_chrdev_region(dev_t, unsigned, const char *);
extern void unregister_chrdev_region(dev_t, unsigned);边栏推荐
- Can China make a breakthrough in the future development of the meta universe and occupy the highland?
- Kubeedge releases white paper on cloud native edge computing threat model and security protection technology
- Tencent cloud deployment lamp_ Experience of building a station
- C language - pointer
- 3、 Are formal and actual parameters in a programming language variables?
- C language operators and input and output
- Cdga | how can the industrial Internet industry do a good job in data governance?
- C+ + core programming
- Maximum exchange [greedy thought & monotonic stack implementation]
- Basic mathematical knowledge (update)
猜你喜欢

9. Pointer of C language (2) wild pointer, what is wild pointer, and the disadvantages of wild pointer

软考中级(系统集成项目管理工程师)高频考点

一文读懂如何部署具有外部数据库的高可用 K3s

Cdga | how can the industrial Internet industry do a good job in data governance?

9. Pointer of C language (4) pointer and one-dimensional array, pointer operation

Basic usage of docker
![[C language] random number generation and `include < time. H > 'learning](/img/bb/3e47bf2e3b25653d9048884d65cda3.png)
[C language] random number generation and `include < time. H > 'learning
![[C language] Hanoi Tower problem [recursion]](/img/d8/ff66928c2bc2ad906e38a360a8cf94.png)
[C language] Hanoi Tower problem [recursion]

C语言数据 3(2)
![[C language] print pattern summary](/img/48/d8ff17453e810fcd9269f56eda4d47.png)
[C language] print pattern summary
随机推荐
zfoo增加类似于mydog的路由
What is the process of swing event processing?
C language implementation of strncpy
Crawl IP
JVM(二十四) -- 性能监控与调优(五) -- 分析GC日志
flask_ Mail source code error
产品经理访谈 | 第五代验证码的创新与背景
A chip company fell in round B
Token verification program index.php when configuring wechat official account server
[C language] header file of complex number four operations and complex number operations
Raspberry pie 4B ffmpeg RTMP streaming
Wust-ctf2021-re school match WP
Sequential linear table - practice in class
Practice of real-time push demo of three web messages: long polling, iframe and SSE
为什么客户支持对SaaS公司很重要?
What is the variance?
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
C language pointer and two-dimensional array
8. Compilation errors of C language and Chinese explanation
HSETNX KEY_ Name field value usage