blob: 3c83cdcb51b4dfd456764e1117ccf9e7fc738ac5 (
plain) (
blame)
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
|
#ifndef IO_H
#define IO_H
#include <stddef.h>
typedef long ssize_t;
struct file;
struct file_operations;
struct file {
struct file_operations* const fops;
void* private_data;
};
struct file_operations {
int (*open)(struct file* file);
int (*ioctl)(struct file* file, int cmd, long args);
ssize_t (*read)(struct file* file, char* const buffer, size_t size);
ssize_t (*write)(struct file* file, const char* const buffer, size_t size);
int (*close)(struct file* file);
};
int open(struct file* file);
int ioctl(struct file* file, int cmd, long args);
ssize_t read(struct file* file, char* const buffer, size_t size);
ssize_t write(struct file* file, const char* const buffer, size_t size);
int close(struct file* file);
#endif
|