Linux Kernel
3.7.1
|
#include <linux/types.h>
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/slab.h>
Go to the source code of this file.
Data Structures | |
struct | ts_state |
struct | ts_ops |
struct | ts_config |
Macros | |
#define | TS_AUTOLOAD 1 /* Automatically load textsearch modules when needed */ |
#define | TS_IGNORECASE 2 /* Searches string case insensitively */ |
: name of search algorithm | |
struct ts_ops - search module operations : initialization function to prepare a search : find the next occurrence of the pattern : destroy algorithm specific parts of a search configuration : return head of pattern : return length of pattern : module reference to algorithm | |
#define | TS_PRIV_ALIGNTO 8 |
#define | TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) |
int | textsearch_register (struct ts_ops *) |
int | textsearch_unregister (struct ts_ops *) |
struct ts_config * | textsearch_prepare (const char *, const void *, unsigned int, gfp_t, int) |
void | textsearch_destroy (struct ts_config *conf) |
unsigned int | textsearch_find_continuous (struct ts_config *, struct ts_state *, const void *, unsigned int) |
#define TS_AUTOLOAD 1 /* Automatically load textsearch modules when needed */ |
Definition at line 14 of file textsearch.h.
#define TS_IGNORECASE 2 /* Searches string case insensitively */ |
Definition at line 15 of file textsearch.h.
#define TS_PRIV_ALIGN | ( | len | ) | (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) |
Definition at line 159 of file textsearch.h.
#define TS_PRIV_ALIGNTO 8 |
Definition at line 158 of file textsearch.h.
textsearch_destroy - destroy a search configuration : search configuration
Releases all references of the configuration and frees up the memory.
Definition at line 309 of file textsearch.c.
unsigned int textsearch_find_continuous | ( | struct ts_config * | conf, |
struct ts_state * | state, | ||
const void * | data, | ||
unsigned int | len | ||
) |
textsearch_find_continuous - search a pattern in continuous/linear data : search configuration : search state : data to search in : length of data
A simplified version of textsearch_find() for continuous/linear data. Call textsearch_next() to retrieve subsequent matches.
Returns the position of first occurrence of the pattern or UINT_MAX if no occurrence was found.
Definition at line 227 of file textsearch.c.
|
read |
textsearch_prepare - Prepare a search : name of search algorithm : pattern data : length of pattern : allocation mask : search flags
Looks up the search algorithm module and creates a new textsearch configuration for the specified pattern. Upon completion all necessary refcnts are held and the configuration must be put back using textsearch_put() after usage.
Note: The format of the pattern may not be compatible between the various search algorithms.
Returns a new textsearch configuration according to the specified parameters or a ERR_PTR(). If a zero length pattern is passed, this function returns EINVAL.
Definition at line 260 of file textsearch.c.
textsearch_register - register a textsearch module : operations lookup table
This function must be called by textsearch modules to announce their presence. The specified & must have name set to a unique identifier and the callbacks find(), init(), get_pattern(), and get_pattern_len() must be implemented.
Returns 0 or -EEXISTS if another module has already registered with same name.
Definition at line 141 of file textsearch.c.
textsearch_unregister - unregister a textsearch module : operations lookup table
This function must be called by textsearch modules to announce their disappearance for examples when the module gets unloaded. The &ops parameter must be the same as the one during the registration.
Returns 0 on success or -ENOENT if no matching textsearch registration was found.
Definition at line 175 of file textsearch.c.