forked from aristomenisTheod/ntua-oslab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lunix-chrdev.h
67 lines (50 loc) · 1.24 KB
/
lunix-chrdev.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* lunix-chrdev.h
*
* Definition file for the
* Lunix:TNG character device
*
* Vangelis Koukis <[email protected]>
*/
#ifndef _LUNIX_CHRDEV_H
#define _LUNIX_CHRDEV_H
/*
* Lunix:TNG character device
*/
#define LUNIX_CHRDEV_MAJOR 60 /* Reserved for local / experimental use */
#define LUNIX_CHRDEV_BUFSZ 20 /* Buffer size used to hold textual info */
/* Compile-time parameters */
#ifdef __KERNEL__
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include "lunix.h"
/*
* Private state for an open character device node
*/
struct lunix_chrdev_state_struct {
enum lunix_msr_enum type;
struct lunix_sensor_struct *sensor;
/* A buffer used to hold cached textual info */
int buf_lim;
unsigned char buf_data[LUNIX_CHRDEV_BUFSZ];
uint32_t buf_timestamp;
struct semaphore lock;
/*
* Fixme: Any mode settings? e.g. blocking vs. non-blocking
*/
};
/*
* Function prototypes
*/
int lunix_chrdev_init(void);
void lunix_chrdev_destroy(void);
#endif /* __KERNEL__ */
#include <linux/ioctl.h>
/*
* Definition of ioctl commands
*/
#define LUNIX_IOC_MAGIC LUNIX_CHRDEV_MAJOR
//#define LUNIX_IOC_EXAMPLE _IOR(LUNIX_IOC_MAGIC, 0, void *)
#define LUNIX_IOC_MAXNR 0
#endif /* _LUNIX_H */