当前位置:网站首页>Character device drive structure
Character device drive structure
2022-07-28 20:24: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);边栏推荐
- [C language] Gobang game [array and function]
- C语言简单实例 1
- [C language] simulation implementation of pow function (recursion)
- Array out of bounds
- 读取json配置文件,实现数据驱动测试
- What is the variance?
- Token verification program index.php when configuring wechat official account server
- [C language] comprehensively analyze the pointer and sort out the pointer knowledge points
- C language - question brushing column
- Multi-Modal Knowledge Graph Construction and Application: A Survey
猜你喜欢

Longest Palindromic Substring
![[C language] string reverse order implementation (recursion and iteration)](/img/c3/02d0a72f6026df8a67669293e55ef2.png)
[C language] string reverse order implementation (recursion and iteration)

WUST-CTF2021-re校赛wp
![[C language] function](/img/81/c185e2bb5eccc13433483f9558f52a.png)
[C language] function

Related concepts of multitasking programming

【CodeForces】Educational Codeforces Round 132 (Rated for Div. 2)

Introduction to seven kinds of polling (practice link attached)

Solve the cookie splitting problem (DP)

4. Const and difine and the problem of initializing arrays with const and define

C language data 3 (2)
随机推荐
robobrowser的简单使用
How to automatically store email attachments in SharePoint
Implementation of memmove in C language
DSACTF7月re
Raspberry Pie 3 connected to WiFi
[C language] function
Raspberrypico serial communication
[C language] comprehensively analyze the pointer and sort out the pointer knowledge points
Raspberrypico analytic PWM
Implementation of strstr in C language
最大交换[贪心思想&单调栈实现]
Item exception handling in SSM
Raspberry connects EC20 for PPP dialing
Richpedia: A Large-Scale, Comprehensive Multi-Modal Knowledge Graph
[C language] initial C language reflection and summary
XOR operation and its usage
C language - question brushing column
CM4 development cross compilation tool chain production
CNN convolution neural network learning process (weight update)
[C language] header file of complex number four operations and complex number operations