Lines Matching +full:block +full:- +full:fetch

1 // SPDX-License-Identifier: GPL-2.0-or-later
16 * both linear and non-linear data. Individual search algorithms are
21 * .. code-block:: none
24 * +----------------+
25 * | finish()|<--------------(6)-----------------+
26 * |get_next_block()|<--------------(5)---------------+ |
28 * | | +------------------------------+
30 * | | +------------------------------+
32 * | | +---------------+ (2) (4) (8)
33 * | (1)|----->| prepare() |---+ | |
34 * | (3)|----->| find()/next() |-----------+ |
35 * | (7)|----->| destroy() |----------------------+
36 * +----------------+ +---------------+
43 * textsearch_next() to fetch subsequent occurrences. A state variable
48 * to fetch the data to be searched in block by block.
119 if (!strcmp(name, o->name)) { in lookup_ts_algo()
120 if (!try_module_get(o->owner)) in lookup_ts_algo()
132 * textsearch_register - register a textsearch module
140 * Returns 0 or -EEXISTS if another module has already registered
145 int err = -EEXIST; in textsearch_register()
148 if (ops->name == NULL || ops->find == NULL || ops->init == NULL || in textsearch_register()
149 ops->get_pattern == NULL || ops->get_pattern_len == NULL) in textsearch_register()
150 return -EINVAL; in textsearch_register()
154 if (!strcmp(ops->name, o->name)) in textsearch_register()
158 list_add_tail_rcu(&ops->list, &ts_ops); in textsearch_register()
167 * textsearch_unregister - unregister a textsearch module
175 * Returns 0 on success or -ENOENT if no matching textsearch
186 list_del_rcu(&o->list); in textsearch_unregister()
191 err = -ENOENT; in textsearch_unregister()
208 struct ts_linear_state *st = (struct ts_linear_state *) state->cb; in get_linear_data()
210 if (likely(consumed < st->len)) { in get_linear_data()
211 *dst = st->data + consumed; in get_linear_data()
212 return st->len - consumed; in get_linear_data()
219 * textsearch_find_continuous - search a pattern in continuous/linear data
235 struct ts_linear_state *st = (struct ts_linear_state *) state->cb; in textsearch_find_continuous()
237 conf->get_next_block = get_linear_data; in textsearch_find_continuous()
238 st->data = data; in textsearch_find_continuous()
239 st->len = len; in textsearch_find_continuous()
246 * textsearch_prepare - Prepare a search
266 int err = -ENOENT; in textsearch_prepare()
271 return ERR_PTR(-EINVAL); in textsearch_prepare()
289 conf = ops->init(pattern, len, gfp_mask, flags); in textsearch_prepare()
295 conf->ops = ops; in textsearch_prepare()
300 module_put(ops->owner); in textsearch_prepare()
307 * textsearch_destroy - destroy a search configuration
315 if (conf->ops) { in textsearch_destroy()
316 if (conf->ops->destroy) in textsearch_destroy()
317 conf->ops->destroy(conf); in textsearch_destroy()
318 module_put(conf->ops->owner); in textsearch_destroy()