paul@90 | 1 | /* |
paul@90 | 2 | * Filesystem client functions. |
paul@90 | 3 | * |
paul@475 | 4 | * Copyright (C) 2018, 2019, 2020, 2021, 2022, |
paul@475 | 5 | * 2023 Paul Boddie <paul@boddie.org.uk> |
paul@90 | 6 | * |
paul@90 | 7 | * This program is free software; you can redistribute it and/or |
paul@90 | 8 | * modify it under the terms of the GNU General Public License as |
paul@90 | 9 | * published by the Free Software Foundation; either version 2 of |
paul@90 | 10 | * the License, or (at your option) any later version. |
paul@90 | 11 | * |
paul@90 | 12 | * This program is distributed in the hope that it will be useful, |
paul@90 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@90 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@90 | 15 | * GNU General Public License for more details. |
paul@90 | 16 | * |
paul@90 | 17 | * You should have received a copy of the GNU General Public License |
paul@90 | 18 | * along with this program; if not, write to the Free Software |
paul@90 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@90 | 20 | * Boston, MA 02110-1301, USA |
paul@90 | 21 | */ |
paul@90 | 22 | |
paul@90 | 23 | #pragma once |
paul@90 | 24 | |
paul@174 | 25 | #include <dirent.h> |
paul@99 | 26 | #include <fsclient/file.h> |
paul@99 | 27 | |
paul@99 | 28 | |
paul@90 | 29 | |
paul@90 | 30 | EXTERN_C_BEGIN |
paul@90 | 31 | |
paul@144 | 32 | /* Filesystem access operations. */ |
paul@144 | 33 | |
paul@150 | 34 | l4_cap_idx_t client_open_for_user(user_t user); |
paul@150 | 35 | l4_cap_idx_t client_open_for_user_using(user_t user, l4_cap_idx_t server); |
paul@144 | 36 | |
paul@117 | 37 | /* Opening and closing operations. */ |
paul@90 | 38 | |
paul@90 | 39 | void client_close(file_t *file); |
paul@90 | 40 | file_t *client_open(const char *name, flags_t flags); |
paul@144 | 41 | file_t *client_open_using(const char *name, flags_t flags, l4_cap_idx_t server); |
paul@144 | 42 | |
paul@204 | 43 | file_t *client_opendir(const char *name); |
paul@204 | 44 | file_t *client_opendir_using(const char *name, l4_cap_idx_t server); |
paul@204 | 45 | |
paul@204 | 46 | file_t *client_opendir_at(file_t *file); |
paul@475 | 47 | file_t *client_reopen(file_t *file, flags_t flags); |
paul@175 | 48 | |
paul@178 | 49 | long client_pipe(file_t **reader, file_t **writer, flags_t flags); |
paul@178 | 50 | long client_pipe_using(file_t **reader, file_t **writer, flags_t flags, l4_cap_idx_t server); |
paul@90 | 51 | |
paul@402 | 52 | /* File status testing. */ |
paul@402 | 53 | |
paul@402 | 54 | int client_opened(file_t *file); |
paul@402 | 55 | |
paul@232 | 56 | /* Other file operations. */ |
paul@232 | 57 | |
paul@271 | 58 | long client_mkdir(const char *path, mode_t mode); |
paul@271 | 59 | long client_mkdir_using(const char *path, mode_t mode, l4_cap_idx_t server); |
paul@271 | 60 | |
paul@266 | 61 | long client_remove(const char *path); |
paul@266 | 62 | long client_remove_using(const char *path, l4_cap_idx_t server); |
paul@232 | 63 | |
paul@236 | 64 | long client_rename(const char *source, const char *target); |
paul@236 | 65 | long client_rename_using(const char *source, const char *target, l4_cap_idx_t server); |
paul@236 | 66 | |
paul@266 | 67 | long client_stat(const char *path, struct stat *st); |
paul@266 | 68 | long client_stat_using(const char *path, struct stat *st, l4_cap_idx_t server); |
paul@266 | 69 | |
paul@90 | 70 | /* File and region operations. */ |
paul@90 | 71 | |
paul@90 | 72 | long client_flush(file_t *file); |
paul@339 | 73 | void *client_mmap(file_t *file, offset_t position, offset_t length, |
paul@339 | 74 | offset_t start_visible, offset_t end_visible, |
paul@332 | 75 | l4re_rm_flags_t region_flags); |
paul@330 | 76 | l4re_rm_flags_t client_region_flags(prot_t prot, flags_t flags); |
paul@90 | 77 | |
paul@90 | 78 | /* Pipe region operations. */ |
paul@90 | 79 | |
paul@116 | 80 | long client_current_region(file_t *file); |
paul@116 | 81 | long client_next_region(file_t *file); |
paul@90 | 82 | |
paul@90 | 83 | /* File data operations. */ |
paul@90 | 84 | |
paul@90 | 85 | offset_t client_read(file_t *file, void *buf, offset_t count); |
paul@90 | 86 | offset_t client_write(file_t *file, const void *buf, offset_t count); |
paul@90 | 87 | |
paul@90 | 88 | /* File navigation operations. */ |
paul@90 | 89 | |
paul@90 | 90 | offset_t client_seek(file_t *file, offset_t offset, int whence); |
paul@411 | 91 | offset_t client_tell(file_t *file); |
paul@90 | 92 | |
paul@174 | 93 | /* Directory reading operations. */ |
paul@174 | 94 | |
paul@174 | 95 | struct dirent *client_readdir(file_t *file); |
paul@174 | 96 | |
paul@117 | 97 | /* Notification operations. */ |
paul@117 | 98 | |
paul@122 | 99 | long client_set_blocking(file_t *file, notify_flags_t flags); |
paul@180 | 100 | |
paul@180 | 101 | /* More advanced notification operations. */ |
paul@180 | 102 | |
paul@180 | 103 | void client_notifier_close(file_notifier_t *notifier); |
paul@180 | 104 | file_notifier_t *client_notifier_local(void); |
paul@180 | 105 | file_notifier_t *client_notifier_task(void); |
paul@180 | 106 | |
paul@180 | 107 | long client_subscribe(file_t *file, notify_flags_t flags, file_notifier_t *notifier); |
paul@180 | 108 | long client_unsubscribe(file_t *file, file_notifier_t *notifier); |
paul@180 | 109 | long client_wait_file(file_t *file, file_notifier_t *notifier); |
paul@180 | 110 | long client_wait_files(file_t **file, file_notifier_t *notifier); |
paul@117 | 111 | |
paul@90 | 112 | EXTERN_C_END |
paul@90 | 113 | |
paul@90 | 114 | // vim: tabstop=2 expandtab shiftwidth=2 |