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