Lines Matching refs:file
44 int fs_open_custom(struct fs_file *file, const char *name);
45 void fs_close_custom(struct fs_file *file);
47 u8_t fs_canread_custom(struct fs_file *file);
48 u8_t fs_wait_read_custom(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg);
49 int fs_read_async_custom(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, voi…
51 int fs_read_custom(struct fs_file *file, char *buffer, int count);
57 fs_open(struct fs_file *file, const char *name) in fs_open() argument
61 if ((file == NULL) || (name == NULL)) { in fs_open()
66 if (fs_open_custom(file, name)) { in fs_open()
67 file->is_custom_file = 1; in fs_open()
70 file->is_custom_file = 0; in fs_open()
75 file->data = (const char *)f->data; in fs_open()
76 file->len = f->len; in fs_open()
77 file->index = f->len; in fs_open()
78 file->pextension = NULL; in fs_open()
79 file->flags = f->flags; in fs_open()
81 file->chksum_count = f->chksum_count; in fs_open()
82 file->chksum = f->chksum; in fs_open()
85 file->state = fs_state_init(file, name); in fs_open()
96 fs_close(struct fs_file *file) in fs_close() argument
99 if (file->is_custom_file) { in fs_close()
100 fs_close_custom(file); in fs_close()
104 fs_state_free(file, file->state); in fs_close()
106 LWIP_UNUSED_ARG(file); in fs_close()
112 fs_read_async(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback… in fs_read_async() argument
115 fs_read(struct fs_file *file, char *buffer, int count) in fs_read_async()
119 if (file->index == file->len) { in fs_read_async()
127 if (file->is_custom_file) { in fs_read_async()
129 return fs_read_async_custom(file, buffer, count, callback_fn, callback_arg); in fs_read_async()
131 return fs_read_custom(file, buffer, count); in fs_read_async()
136 read = file->len - file->index; in fs_read_async()
141 MEMCPY(buffer, (file->data + file->index), read); in fs_read_async()
142 file->index += read; in fs_read_async()
150 fs_is_file_ready(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg) in fs_is_file_ready() argument
152 if (file != NULL) { in fs_is_file_ready()
155 if (!fs_canread_custom(file)) { in fs_is_file_ready()
156 if (fs_wait_read_custom(file, callback_fn, callback_arg)) { in fs_is_file_ready()
171 fs_bytes_left(struct fs_file *file) in fs_bytes_left() argument
173 return file->len - file->index; in fs_bytes_left()