1 /* 2 * Filesystem client functions. 3 * 4 * Copyright (C) 2018, 2019, 2020, 2021 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 /* Opening and closing operations. */ 37 38 void client_close(file_t *file); 39 file_t *client_open(const char *name, flags_t flags); 40 file_t *client_open_using(const char *name, flags_t flags, l4_cap_idx_t server); 41 42 file_t *client_opendir(file_t *file); 43 44 long client_pipe(file_t **reader, file_t **writer, flags_t flags); 45 long client_pipe_using(file_t **reader, file_t **writer, flags_t flags, l4_cap_idx_t server); 46 47 /* File and region operations. */ 48 49 long client_flush(file_t *file); 50 void *client_mmap(file_t *file, offset_t position, offset_t length); 51 52 /* Pipe region operations. */ 53 54 long client_current_region(file_t *file); 55 long client_next_region(file_t *file); 56 57 /* File data operations. */ 58 59 offset_t client_read(file_t *file, void *buf, offset_t count); 60 offset_t client_write(file_t *file, const void *buf, offset_t count); 61 62 /* File navigation operations. */ 63 64 offset_t client_seek(file_t *file, offset_t offset, int whence); 65 long client_tell(file_t *file); 66 67 /* Directory reading operations. */ 68 69 struct dirent *client_readdir(file_t *file); 70 71 /* Notification operations. */ 72 73 long client_set_blocking(file_t *file, notify_flags_t flags); 74 75 /* More advanced notification operations. */ 76 77 void client_notifier_close(file_notifier_t *notifier); 78 file_notifier_t *client_notifier_local(void); 79 file_notifier_t *client_notifier_task(void); 80 81 long client_subscribe(file_t *file, notify_flags_t flags, file_notifier_t *notifier); 82 long client_unsubscribe(file_t *file, file_notifier_t *notifier); 83 long client_wait_file(file_t *file, file_notifier_t *notifier); 84 long client_wait_files(file_t **file, file_notifier_t *notifier); 85 86 EXTERN_C_END 87 88 // vim: tabstop=2 expandtab shiftwidth=2