Lines Matching refs:zfp

117 static int fatfs_open(struct fs_file_t *zfp, const char *file_name,  in fatfs_open()  argument
126 zfp->filep = ptr; in fatfs_open()
133 res = f_open(zfp->filep, translate_path(file_name), fs_mode); in fatfs_open()
137 zfp->filep = NULL; in fatfs_open()
143 static int fatfs_close(struct fs_file_t *zfp) in fatfs_close() argument
147 res = f_close(zfp->filep); in fatfs_close()
150 k_mem_slab_free(&fatfs_filep_pool, zfp->filep); in fatfs_close()
151 zfp->filep = NULL; in fatfs_close()
193 static ssize_t fatfs_read(struct fs_file_t *zfp, void *ptr, size_t size) in fatfs_read() argument
198 res = f_read(zfp->filep, ptr, size, &br); in fatfs_read()
206 static ssize_t fatfs_write(struct fs_file_t *zfp, const void *ptr, size_t size) in fatfs_write() argument
212 off_t pos = f_size((FIL *)zfp->filep); in fatfs_write()
220 if (zfp->flags & FS_O_APPEND) { in fatfs_write()
221 res = f_lseek(zfp->filep, pos); in fatfs_write()
225 res = f_write(zfp->filep, ptr, size, &bw); in fatfs_write()
238 static int fatfs_seek(struct fs_file_t *zfp, off_t offset, int whence) in fatfs_seek() argument
248 pos = f_tell((FIL *)zfp->filep) + offset; in fatfs_seek()
251 pos = f_size((FIL *)zfp->filep) + offset; in fatfs_seek()
257 if ((pos < 0) || (pos > f_size((FIL *)zfp->filep))) { in fatfs_seek()
261 res = f_lseek(zfp->filep, pos); in fatfs_seek()
266 static off_t fatfs_tell(struct fs_file_t *zfp) in fatfs_tell() argument
268 return f_tell((FIL *)zfp->filep); in fatfs_tell()
271 static int fatfs_truncate(struct fs_file_t *zfp, off_t length) in fatfs_truncate() argument
276 off_t cur_length = f_size((FIL *)zfp->filep); in fatfs_truncate()
279 res = f_lseek(zfp->filep, length); in fatfs_truncate()
285 res = f_truncate(zfp->filep); in fatfs_truncate()
292 length = f_tell((FIL *)zfp->filep); in fatfs_truncate()
294 res = f_lseek(zfp->filep, cur_length); in fatfs_truncate()
309 res = f_write(zfp->filep, &c, 1, &bw); in fatfs_truncate()
322 static int fatfs_sync(struct fs_file_t *zfp) in fatfs_sync() argument
327 res = f_sync(zfp->filep); in fatfs_sync()