f676b45151
This adds a filesystem which is backed by the host's filesystem. It is modeled off of sandboxfs, which has very similar aims. Semihosting doesn't support listing directories (except with SYS_SYSTEM), so neither do we. it's possible to optimize a bit for the common case of reading a whole file by omitting a call to smh_seek, but this is left as a future optimization. Signed-off-by: Sean Anderson <sean.anderson@seco.com>
22 lines
598 B
C
22 lines
598 B
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* Copyright (C) 2022, Sean Anderson <sean.anderson@seco.com>
|
|
* Copyright (c) 2012, Google Inc.
|
|
*/
|
|
|
|
#ifndef __SEMIHOSTING_FS__
|
|
#define __SEMIHOSTING_FS__
|
|
|
|
struct blk_desc;
|
|
struct disk_partition;
|
|
|
|
int smh_fs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info);
|
|
void smh_fs_close(void);
|
|
int smh_fs_size(const char *filename, loff_t *size);
|
|
int smh_fs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
|
loff_t *actread);
|
|
int smh_fs_write(const char *filename, void *buf, loff_t offset,
|
|
loff_t len, loff_t *actwrite);
|
|
|
|
#endif
|