XenevaOS
Loading...
Searching...
No Matches
cdev.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_CDEV_H
3#define _LINUX_CDEV_H
4
5#include <linux/kobject.h>
6#include <linux/kdev_t.h>
7#include <linux/list.h>
8#include <linux/device.h>
9
10struct file_operations;
11struct inode;
12struct module;
13
14/*
15 * DCL delta: mainline declares `struct cdev` here, in its own words. DCL
16 * already carries it in <linux/fs.h> (:141), measured against linux-7.2.6 at
17 * kobj 0 / owner 64 / ops 72 / list 80 / dev 96 / count 100 / size 104, and
18 * pinned there by static asserts because fs.h's layout is the ABI the rest of
19 * the tree is compiled against. Two definitions of the same struct in one
20 * translation unit is a hard redefinition error, and fs.h is the one file that
21 * must not move -- so this header yields and routes instead: the struct comes
22 * from where it is authoritative, and only the function declarations, which
23 * DCL/linux_cdev_shim.c actually implements, are spelled here.
24 *
25 * __randomize_layout is dropped with it: DCL has no struct-randomization pass,
26 * and the layout above is pinned by assertion anyway.
27 */
28#include <linux/fs.h>
29#include <linux/file.h> /* nonseekable_open() and the FMODE_ bits it clears;
30 * see file.h for why that helper is not here. */
31
32void cdev_init(struct cdev *, const struct file_operations *);
33
34struct cdev *cdev_alloc(void);
35
36void cdev_put(struct cdev *p);
37
38int cdev_add(struct cdev *, dev_t, unsigned);
39
40void cdev_set_parent(struct cdev *p, struct kobject *kobj);
41int cdev_device_add(struct cdev *cdev, struct device *dev);
42void cdev_device_del(struct cdev *cdev, struct device *dev);
43
44void cdev_del(struct cdev *);
45
46void cd_forget(struct inode *);
47
48#endif
struct cdev * cdev_alloc(void)
void cdev_set_parent(struct cdev *p, struct kobject *kobj)
int cdev_device_add(struct cdev *cdev, struct device *dev)
int cdev_add(struct cdev *, dev_t, unsigned)
void cdev_device_del(struct cdev *cdev, struct device *dev)
void cdev_put(struct cdev *p)
void cdev_init(struct cdev *, const struct file_operations *)
void cd_forget(struct inode *)
void cdev_del(struct cdev *)
const struct device * dev
Definition drm_print.h:519
uint32_t dev_t
Definition kernel.h:52
Definition fs.h:210
unsigned char kobj[64]
Definition fs.h:211
Definition fs.h:255
Definition fs.h:67
Definition fs.h:183
Definition kobject.h:64