blob: 63e96695ab49282c692541a11ec889aa0f78dc7c (
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 "mux/io.h"
int open(struct file* file) {
return file->fops->open(file);
}
int ioctl(struct file* file, int cmd, long args) {
return 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 return 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 return fops->write(file, buffer, size);
}
int close(struct file* file) {
return file->fops->close(file);
}
|