forked from ish-app/ish
-
Notifications
You must be signed in to change notification settings - Fork 12
/
dyndev.h
34 lines (29 loc) · 1012 Bytes
/
dyndev.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef FS_DYN_DEV_H
#define FS_DYN_DEV_H
// dyn_dev's are dynamically added devices (character only for now)
// with custom dev_ops assigned
// It's useful to add new device "drivers" in runtime (for example,
// devices only present on some platforms)
// dev_ops handing char device with DYN_DEV_MAJOR major number
extern struct dev_ops dyn_dev_char;
// Implement fake rtc -mke
extern struct dev_ops rtc_dev_char;
// Registeres new block/character device with provided major and
// minor numbers, handled by provided ops
//
// ops should be valid for "kernel" lifetime (should not be freed, but
// might be static), and should not be null
//
// type is DEV_BLOCK or DEV_CHAR
// (only char is supported for now)
//
// major should be DYN_DEV_MAJOR
//
// minor should be 0-255
//
// Return value:
// - 0 on success
// - _EEXIST if provided minor number is alredy taken
// - _EINVAL if provided arguments are invalid
extern int dyn_dev_register(struct dev_ops *ops, int type, int major, int minor);
#endif