Break ioctl() up into smaller syscalls
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
#include <system/system.h>
|
||||
#include <syscall/syscall.h>
|
||||
#include <sysdefs/syscall.h>
|
||||
#include <sysdefs/ioctl.h>
|
||||
#include <sysdefs/fs.h>
|
||||
#include <sysdefs/proc.h>
|
||||
#include <sysdefs/devctl.h>
|
||||
#include <uprintf.h>
|
||||
@ -11,10 +11,6 @@ void debugprint(const char *string) {
|
||||
syscall(SYS_DEBUGPRINT, (uint64_t)string, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int32_t ioctl(uint64_t ioh, uint64_t cmd, uint64_t arg1, uint64_t arg2, uint64_t arg3) {
|
||||
return syscall(SYS_IOCTL, ioh, cmd, arg1, arg2, arg3, 0);
|
||||
}
|
||||
|
||||
int32_t mman_map(uint8_t *addr, size_t size, uint64_t prot, uint64_t flags, uint8_t **out) {
|
||||
return syscall(SYS_MMAN_MAP, (uint64_t)addr, (uint64_t)size, prot, flags, (uint64_t)out, 0);
|
||||
}
|
||||
@ -99,3 +95,30 @@ int32_t proc_stat(size_t idx, ProcStat *pstat) {
|
||||
return syscall(SYS_PROC_STAT, (uint64_t)idx, (uint64_t)pstat, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int32_t fs_openf(char *path, uint64_t flags) {
|
||||
return syscall(SYS_FS_OPENF, (uint64_t)path, flags, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int32_t fs_closef(int32_t fsh) {
|
||||
return syscall(SYS_FS_CLOSEF, (uint64_t)fsh, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int32_t fs_write(int32_t fsh, const uint8_t *buffer, size_t len, size_t off) {
|
||||
return syscall(SYS_FS_WRITE, (uint64_t)fsh, (uint64_t)buffer, (uint64_t)len, (uint64_t)off, 0, 0);
|
||||
}
|
||||
|
||||
int32_t fs_read(int32_t fsh, uint8_t *const buffer, size_t len, size_t off) {
|
||||
return syscall(SYS_FS_READ, (uint64_t)fsh, (uint64_t)buffer, (uint64_t)len, (uint64_t)off, 0, 0);
|
||||
}
|
||||
|
||||
int32_t fs_stat(char *path, FsStat *statbuf) {
|
||||
return syscall(SYS_FS_STAT, (uint64_t)path, (uint64_t)statbuf, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int32_t fs_fetchdirent(char *path, FsDirent *direntbuf, size_t idx) {
|
||||
return syscall(SYS_FS_FETCHDIRENT, (uint64_t)path, (uint64_t)direntbuf, (uint64_t)idx, 0, 0, 0);
|
||||
}
|
||||
|
||||
int32_t fs_mkdir(char *path) {
|
||||
return syscall(SYS_FS_MKDIR, (uint64_t)path, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <sysdefs/devctl.h>
|
||||
#include <sysdefs/proc.h>
|
||||
#include <sysdefs/fs.h>
|
||||
|
||||
void debugprint(const char *string);
|
||||
int32_t ioctl(uint64_t ioh, uint64_t cmd, uint64_t arg1, uint64_t arg2, uint64_t arg3);
|
||||
int32_t mman_map(uint8_t *addr, size_t size, uint64_t prot, uint64_t flags, uint8_t **out);
|
||||
int32_t mman_unmap(uint8_t *addr);
|
||||
int32_t schedrelease(void);
|
||||
@ -30,5 +30,12 @@ int32_t proc_arglen(PID_t pid);
|
||||
int32_t proc_argv(PID_t pid, size_t *argslen1, char **argbuf1, size_t maxargs);
|
||||
int32_t proc_listsize(void);
|
||||
int32_t proc_stat(size_t idx, ProcStat *pstat);
|
||||
int32_t fs_openf(char *path, uint64_t flags);
|
||||
int32_t fs_closef(int32_t fsh);
|
||||
int32_t fs_write(int32_t fsh, const uint8_t *buffer, size_t len, size_t off);
|
||||
int32_t fs_read(int32_t fsh, uint8_t *const buffer, size_t len, size_t off);
|
||||
int32_t fs_stat(char *path, FsStat *statbuf);
|
||||
int32_t fs_fetchdirent(char *path, FsDirent *direntbuf, size_t idx);
|
||||
int32_t fs_mkdir(char *path);
|
||||
|
||||
#endif // ULIB_SYSTEM_SYSTEM_H_
|
||||
|
||||
Reference in New Issue
Block a user