summaryrefslogtreecommitdiff
path: root/src/user/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/include')
-rw-r--r--src/user/include/knob/file.h2
-rw-r--r--src/user/include/pland/syscall.h12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/user/include/knob/file.h b/src/user/include/knob/file.h
index 8862098..d283288 100644
--- a/src/user/include/knob/file.h
+++ b/src/user/include/knob/file.h
@@ -12,12 +12,14 @@ struct file *open_file(const char *path);
void close_file(struct file *f);
uint32_t read_from_file(struct file *f, uint32_t max, void *buf);
+uint32_t write_to_file(struct file *f, uint32_t max, void *buf);
//return value and max_length don't include null terminator
uint32_t read_line_from_file(struct file *f, char *sz, uint32_t max_length);
uint32_t seek_file_to(struct file *f, uint32_t to);
int32_t seek_file_by(struct file *f, int32_t by);
uint32_t file_size(struct file *f) __attribute__ ((pure));
+void trunc_file(struct file *f);
//return value must be manually freed, unless it is a null pointer
_dir_info_entry_t *get_directory_info(const char *path, uint32_t *count_out);
diff --git a/src/user/include/pland/syscall.h b/src/user/include/pland/syscall.h
index 9518d09..3c4f421 100644
--- a/src/user/include/pland/syscall.h
+++ b/src/user/include/pland/syscall.h
@@ -51,7 +51,9 @@ enum _scn {
_SCN_FIND_UNREAD_IPC,
_SCN_WAIT_IPC_READ,
_SCN_IS_TASK_RUNNING,
- _SCN_GET_TIMESTAMP
+ _SCN_GET_TIMESTAMP,
+ _SCN_FILE_WRITE,
+ _SCN_SET_FILE_SIZE
};
static inline uint32_t _sc0(enum _scn eax) {
@@ -240,4 +242,12 @@ static inline uint32_t _get_timestamp() {
return _sc0(_SCN_GET_TIMESTAMP);
}
+static inline uint32_t _file_write(_file_handle_t handle, uint32_t offset, uint32_t count, const void *from) {
+ return _sc4(_SCN_FILE_WRITE, handle, offset, count, (uint32_t)from);
+}
+
+static inline void _set_file_size(_file_handle_t handle, uint32_t new_size) {
+ _sc2(_SCN_SET_FILE_SIZE, handle, new_size);
+}
+
#endif \ No newline at end of file