1/* 2 * Copyright 2018, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12 13#pragma once 14 15 16typedef struct { 17 void *ext_buf; 18 int (*ext_open)(const char *name, int flags); 19 ssize_t (*ext_read)(int fd, size_t size); 20 int64_t (*ext_seek)(int fd, int64_t offset, int whence); 21 int (*ext_close)(int fd); 22} file_server_interface_t; 23 24 25/* 26 * This is a macro for defining an interface based on the camkes component 27 * interface name. 28 */ 29#define FILE_SERVER_INTERFACE(fs) \ 30 (file_server_interface_t) { \ 31 .ext_buf = fs##_buf, \ 32 .ext_open = fs##_open, \ 33 .ext_read = fs##_read, \ 34 .ext_seek = fs##_seek, \ 35 .ext_close = fs##_close, \ 36 } 37 38 39void install_fileserver(file_server_interface_t fs_interface); 40