Lines Matching refs:fop_fd
87 lws_fop_fd_t fop_fd; in _lws_plat_file_open() local
95 fop_fd = malloc(sizeof(*fop_fd)); in _lws_plat_file_open()
96 if (!fop_fd) in _lws_plat_file_open()
99 fop_fd->fops = fops; in _lws_plat_file_open()
100 fop_fd->flags = *flags; in _lws_plat_file_open()
101 fop_fd->fd = ret; in _lws_plat_file_open()
102 fop_fd->filesystem_priv = NULL; /* we don't use it */ in _lws_plat_file_open()
103 fop_fd->len = (lws_filepos_t)stat_buf.st_size; in _lws_plat_file_open()
104 fop_fd->pos = 0; in _lws_plat_file_open()
106 return fop_fd; in _lws_plat_file_open()
114 _lws_plat_file_close(lws_fop_fd_t *fop_fd) in _lws_plat_file_close() argument
116 int fd = (*fop_fd)->fd; in _lws_plat_file_close()
118 free(*fop_fd); in _lws_plat_file_close()
119 *fop_fd = NULL; in _lws_plat_file_close()
125 _lws_plat_file_seek_cur(lws_fop_fd_t fop_fd, lws_fileofs_t offset) in _lws_plat_file_seek_cur() argument
130 offset > (lws_fileofs_t)fop_fd->len - (lws_fileofs_t)fop_fd->pos) in _lws_plat_file_seek_cur()
131 offset = (lws_fileofs_t)(fop_fd->len - fop_fd->pos); in _lws_plat_file_seek_cur()
133 if ((lws_fileofs_t)fop_fd->pos + offset < 0) in _lws_plat_file_seek_cur()
134 offset = (lws_fileofs_t)(-fop_fd->pos); in _lws_plat_file_seek_cur()
136 r = lseek(fop_fd->fd, (off_t)offset, SEEK_CUR); in _lws_plat_file_seek_cur()
139 fop_fd->pos = (lws_filepos_t)r; in _lws_plat_file_seek_cur()
142 (long)fop_fd->pos, (long)offset); in _lws_plat_file_seek_cur()
148 _lws_plat_file_read(lws_fop_fd_t fop_fd, lws_filepos_t *amount, in _lws_plat_file_read() argument
153 n = read((int)fop_fd->fd, buf, (size_t)len); in _lws_plat_file_read()
158 fop_fd->pos = (lws_filepos_t)(fop_fd->pos + (lws_filepos_t)n); in _lws_plat_file_read()
160 (long)n, (long)len, (long)fop_fd->pos, in _lws_plat_file_read()
161 (long)fop_fd->len); in _lws_plat_file_read()
168 _lws_plat_file_write(lws_fop_fd_t fop_fd, lws_filepos_t *amount, in _lws_plat_file_write() argument
173 n = write((int)fop_fd->fd, buf, (size_t)len); in _lws_plat_file_write()
179 fop_fd->pos = (lws_filepos_t)(fop_fd->pos + (lws_filepos_t)n); in _lws_plat_file_write()