当前位置:网站首页>字符设备驱动结构
字符设备驱动结构
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);边栏推荐
- Hebei: stabilizing grain and expanding beans to help grain and oil production improve quality and efficiency
- Wust-ctf2021-re school match WP
- Simple use of robobrowser
- Raspberry pie 4B ffmpeg RTMP streaming
- C language - control statement
- What is the variance?
- Circular linked list OJ question
- Solve the problem of adding the least number of parentheses (interval DP)
- A chip company fell in round B
- Practice of real-time push demo of three web messages: long polling, iframe and SSE
猜你喜欢

Durham High Lord (classic DP)
![[C language] advanced pointer exercise 1](/img/ee/c62919330edb4a0b5a2a4b027e5b5c.png)
[C language] advanced pointer exercise 1

JVM (24) -- performance monitoring and tuning (5) -- Analyzing GC logs

Advanced notes (Part 2)
![Maximum exchange [greedy thought & monotonic stack implementation]](/img/ad/8f0914f23648f37e1d1ce69086fd2e.png)
Maximum exchange [greedy thought & monotonic stack implementation]
![[C language] Gobang game [array and function]](/img/73/1e708b0640c2dbc86393206840b059.png)
[C language] Gobang game [array and function]

Basic mathematical knowledge (update)

Kubeedge releases white paper on cloud native edge computing threat model and security protection technology

3、 Are formal and actual parameters in a programming language variables?

Raspberry connects EC20 for PPP dialing
随机推荐
Scene thread allocation in MMO real-time combat games
C language - data type
Why is customer support important to SaaS?
JS preventdefault() keyboard input limit onmousewheel stoppropagation stop event propagation
A chip company fell in round B
私有化部署的即时通讯平台,为企业移动业务安全保驾护航
[C language] header file of complex number four operations and complex number operations
Solve the problem of adding the least number of parentheses (interval DP)
robobrowser的简单使用
flask_ Mail source code error
Two methods to judge the size end
[C language] step jumping problem [recursion]
9. Pointer of C language (5) how many bytes does the pointer variable occupy
8. Compilation errors of C language and Chinese explanation
Const pointer of C language and parameter passing of main function
Introduction to seven kinds of polling (practice link attached)
Raspberry pie CM4 -- using metartc3.0 to integrate ffmpeg to realize webrtc push-pull streaming
Basic mathematical knowledge (update)
4. Const and difine and the problem of initializing arrays with const and define
83. (cesium home) how the cesium example works