Lines Matching refs:jtf
85 lws_fts_filepath(struct lws_fts_file *jtf, int filepath_index, char *result, in lws_fts_filepath() argument
94 if (filepath_index > jtf->filepaths) in lws_fts_filepath()
97 if (lseek(jtf->fd, jtf->filepath_table + (4 * filepath_index), in lws_fts_filepath()
104 ra = read(jtf->fd, buf, 4); in lws_fts_filepath()
109 if (lseek(jtf->fd, o, SEEK_SET) < 0) { in lws_fts_filepath()
115 ra = read(jtf->fd, buf, sizeof(buf)); in lws_fts_filepath()
148 lws_fts_adopt(struct lws_fts_file *jtf) in lws_fts_adopt() argument
153 if (read(jtf->fd, buf, TRIE_FILE_HDR_SIZE) != TRIE_FILE_HDR_SIZE) { in lws_fts_adopt()
165 jtf->root = b32(&buf[4]); in lws_fts_adopt()
167 ot = lseek(jtf->fd, 0, SEEK_END); in lws_fts_adopt()
173 jtf->flen = ot; in lws_fts_adopt()
175 if (jtf->flen != b32(&buf[8])) { in lws_fts_adopt()
181 jtf->filepath_table = b32(&buf[12]); in lws_fts_adopt()
182 jtf->filepaths = b32(&buf[16]); in lws_fts_adopt()
184 return jtf->fd; in lws_fts_adopt()
193 struct lws_fts_file *jtf; in lws_fts_open() local
195 jtf = lws_malloc(sizeof(*jtf), "fts open"); in lws_fts_open()
196 if (!jtf) in lws_fts_open()
199 jtf->fd = open(filepath, O_RDONLY); in lws_fts_open()
200 if (jtf->fd < 0) { in lws_fts_open()
205 if (lws_fts_adopt(jtf) < 0) in lws_fts_open()
208 return jtf; in lws_fts_open()
211 close(jtf->fd); in lws_fts_open()
213 lws_free(jtf); in lws_fts_open()
219 lws_fts_close(struct lws_fts_file *jtf) in lws_fts_close() argument
221 close(jtf->fd); in lws_fts_close()
222 lws_free(jtf); in lws_fts_close()
227 if (lseek(jtf->fd, _pos, SEEK_SET) < 0) { \
233 ra = read(jtf->fd, buf, _size); \
239 lws_fts_cache_chunktable(struct lws_fts_file *jtf, uint32_t ofs_linetable, in lws_fts_cache_chunktable() argument
284 lws_fts_getfileoffset(struct lws_fts_file *jtf, struct linetable *ltstart, in lws_fts_getfileoffset() argument
334 ac_record(struct lws_fts_file *jtf, struct lwsac **results_head, in ac_record() argument
391 lws_fts_search(struct lws_fts_file *jtf, struct lws_fts_search_params *ftsp) in lws_fts_search() argument
432 o = jtf->root; in lws_fts_search()
638 if (lws_fts_filepath(jtf, fi, path, sizeof(path) - 1, in lws_fts_search()
647 ltst = lws_fts_cache_chunktable(jtf, ofs_linetable, <_head); in lws_fts_search()
706 if (lws_fts_getfileoffset(jtf, ltst, line, &fo)) in lws_fts_search()
837 n = ac_record(jtf, &ftsp->results_head, needle, pos, s, 0, in lws_fts_search()
854 n = ac_record(jtf, &ftsp->results_head, needle, pos, s, in lws_fts_search()