blob: f39168b11391c48810ec30d60d2f49eb45d87650 (
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
|
#include "io/io.h"
int open(struct file* file) {
file->fops->open(file);
}
int ioctl(struct file* file, int cmd, long args) {
file->fops->ioctl(file, cmd, args);
}
ssize_t read(struct file* file, char* const buffer, size_t size) {
struct file_operations* fops = file->fops;
if (fops->read == NULL) return -1;
else fops->read(file, buffer, size);
}
ssize_t write(struct file* file, const char* const buffer, size_t size) {
struct file_operations* fops = file->fops;
if (fops->write == NULL) return -1;
else fops->write(file, buffer, size);
}
int close(struct file* file) {
file->fops->close(file);
}
|