STRUCT TS_CONFIG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct ts_config(9) β€” search configuration, bestie ✨

okay so welcome to the Kernel API Manual page for struct ts_config πŸŽ€ this is literally the search config struct and she is the main character of textsearch setup, no cap. sit down, grab a strawberry drink πŸ“, and let's get into it.


🌸 NAME 🌸

struct ts_config β€” search configuration. that's it, that's the vibe check πŸ’…


✨ SYNOPSIS ✨

struct ts_config {
    struct ts_ops           *ops;
    int flags;
    unsigned int            (*get_next_block)(unsigned int consumed,
const u8 **dst, struct ts_config *conf, struct ts_state *state);
    void (*finish)(struct ts_config *conf, struct ts_state *state);
 };

like, look at her. two function pointers, two plain fields. iconic honestly πŸ‘‘


πŸ¦‹ Members πŸ¦‹

ops πŸ’œ

operations of chosen algorithm. that's the algorithm's whole ops table, the personality she picked.

flags ⭐

flags. yes bestie that is genuinely the entire description. flags. 😭 it's giving "the vibes are the documentation".

get_next_block πŸ”₯

fetch next block of data. here's the tea on the parameters:

  • consumed β€” number of bytes consumed by the caller
  • dst β€” destination buffer
  • conf β€” search configuration
  • state β€” search state

and listen, she gets called repeatedly until 0 is returned β€” that's the loop condition, don't sleep on it. she must assign the head of the next block of data to &*dst and return the length of the block, or 0 if you've hit the end. also consumed == 0 indicates a new search, so like, pay attention to that. may store/read persistent values in state->cb. ok that's the whole contract, periodt πŸ’…

finish 🧚

finalize/clean a series of get_next_block calls. her params:

  • conf β€” search configuration
  • state β€” search state

called after the last use of get_next_block (so like, the afterparty clean-up crew 🫢), may be used to cleanup any leftovers.


πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./include/linux/textsearch.h, plus these besties:


bestie reminder 🫢 all of this lives at ./include/linux πŸ¦‹ and the bookkeeping timestamp on this one is October 2026 β€” so yeah, she's dated, she's filed, she's slaying in the source tree forever. mwah πŸ’–βœ¨πŸŒˆ
πŸ“¦ where this page comes from