当前位置:网站首页>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] scanf format input and modifier summary
- Does any elder brother know how to solve the huge flinksql log
- 9. Pointer of C language (2) wild pointer, what is wild pointer, and the disadvantages of wild pointer
- [C language] Fibonacci sequence [recursion and iteration]
- Item exception handling in SSM
- Vivado designs PC and ram
- Explain RESNET residual network in detail
- Raspberry pie 4B parsing PWM
- 1. C language variable type, global variable, local variable
- Quick sort template
猜你喜欢

C语言简单实例 1

Dsactf July re

How to use pycharm to quickly create a flask project

一碰撞就自燃,谁来关心电池安全?上汽通用有话说

LeetCode-297-二叉树的序列化与反序列化

Basic mathematical knowledge (update)
![最大交换[贪心思想&单调栈实现]](/img/ad/8f0914f23648f37e1d1ce69086fd2e.png)
最大交换[贪心思想&单调栈实现]
![[experiment sharing] CCIE BGP reflector experiment](/img/e4/1ddd611c8438cb6ca1be32f34fa67a.png)
[experiment sharing] CCIE BGP reflector experiment

Rand function generates pseudo-random numbers
![[C language] step jumping problem [recursion]](/img/0c/32870484e89b494e41068f7c38b08e.png)
[C language] step jumping problem [recursion]
随机推荐
[C language] Fibonacci sequence [recursion and iteration]
Regular symbol description
Representation of base and number 2
Rand function generates pseudo-random numbers
Anaconda creation environment
CM4 development cross compilation tool chain production
Quick sort template
Solve the kangaroo crossing problem (DP)
Raspberrypico analytic PWM
Store and guarantee rancher data based on Minio objects
Reverse string
Vivado design single cycle CPU
plt. What does it mean when linestyle, marker, color equals none in plot()
[C language] function
Related concepts of multitasking programming
Introduction to seven kinds of polling (practice link attached)
【CodeForces】Educational Codeforces Round 132 (Rated for Div. 2)
C language data 3 (1)
长轮询,iframe和sse三种web消息实时推送demo实践
Practice of real-time push demo of three web messages: long polling, iframe and SSE