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 /* Opening and closing operations. */ 38 39 void client_close(file_t *file); 40 file_t *client_open(const char *name, flags_t flags); 41 file_t *client_open_using(const char *name, flags_t flags, l4_cap_idx_t server); 42 43 file_t *client_opendir(const char *name); 44 file_t *client_opendir_using(const char *name, l4_cap_idx_t server); 45 46 file_t *client_opendir_at(file_t *file); 47 file_t *client_reopen(file_t *file, flags_t flags); 48 49 long client_pipe(file_t **reader, file_t **writer, flags_t flags); 50 long client_pipe_using(file_t **reader, file_t **writer, flags_t flags, l4_cap_idx_t server); 51 52 /* File status testing. */ 53 54 int client_opened(file_t *file); 55 56 /* Other file operations. */ 57 58 long client_mkdir(const char *path, mode_t mode); 59 long client_mkdir_using(const char *path, mode_t mode, l4_cap_idx_t server); 60 61 long client_remove(const char *path); 62 long client_remove_using(const char *path, l4_cap_idx_t server); 63 64 long client_rename(const char *source, const char *target); 65 long client_rename_using(const char *source, const char *target, l4_cap_idx_t server); 66 67 long client_stat(const char *path, struct stat *st); 68 long client_stat_using(const char *path, struct stat *st, l4_cap_idx_t server); 69 70 /* File and region operations. */ 71 72 long client_flush(file_t *file); 73 void *client_mmap(file_t *file, offset_t position, offset_t length, 74 offset_t start_visible, offset_t end_visible, 75 l4re_rm_flags_t region_flags); 76 l4re_rm_flags_t client_region_flags(prot_t prot, flags_t flags); 77 78 /* Pipe region operations. */ 79 80 long client_current_region(file_t *file); 81 long client_next_region(file_t *file); 82 83 /* File data operations. */ 84 85 offset_t client_read(file_t *file, void *buf, offset_t count); 86 offset_t client_write(file_t *file, const void *buf, offset_t count); 87 88 /* File navigation operations. */ 89 90 offset_t client_seek(file_t *file, offset_t offset, int whence); 91 offset_t client_tell(file_t *file); 92 93 /* Directory reading operations. */ 94 95 struct dirent *client_readdir(file_t *file); 96 97 /* Notification operations. */ 98 99 long client_set_blocking(file_t *file, notify_flags_t flags); 100 101 /* More advanced notification operations. */ 102 103 void client_notifier_close(file_notifier_t *notifier); 104 file_notifier_t *client_notifier_local(void); 105 file_notifier_t *client_notifier_task(void); 106 107 long client_subscribe(file_t *file, notify_flags_t flags, file_notifier_t *notifier); 108 long client_unsubscribe(file_t *file, file_notifier_t *notifier); 109 long client_wait_file(file_t *file, file_notifier_t *notifier); 110 long client_wait_files(file_t **file, file_notifier_t *notifier); 111 112 EXTERN_C_END 113 114 // vim: tabstop=2 expandtab shiftwidth=2