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