Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
textsearch.c File Reference
#include <linux/module.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
#include <linux/err.h>
#include <linux/textsearch.h>
#include <linux/slab.h>

Go to the source code of this file.

Data Structures

struct  ts_linear_state
 

Functions

int textsearch_register (struct ts_ops *ops)
 
int textsearch_unregister (struct ts_ops *ops)
 
unsigned int textsearch_find_continuous (struct ts_config *conf, struct ts_state *state, const void *data, unsigned int len)
 
struct ts_configtextsearch_prepare (const char *algo, const void *pattern, unsigned int len, gfp_t gfp_mask, int flags)
 
void textsearch_destroy (struct ts_config *conf)
 
 EXPORT_SYMBOL (textsearch_register)
 
 EXPORT_SYMBOL (textsearch_unregister)
 
 EXPORT_SYMBOL (textsearch_prepare)
 
 EXPORT_SYMBOL (textsearch_find_continuous)
 
 EXPORT_SYMBOL (textsearch_destroy)
 

Function Documentation

EXPORT_SYMBOL ( textsearch_register  )
EXPORT_SYMBOL ( textsearch_unregister  )
EXPORT_SYMBOL ( textsearch_prepare  )
EXPORT_SYMBOL ( textsearch_find_continuous  )
EXPORT_SYMBOL ( textsearch_destroy  )
void textsearch_destroy ( struct ts_config conf)

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.

struct ts_config* textsearch_prepare ( const char algo,
const void pattern,
unsigned int  len,
gfp_t  gfp_mask,
int  flags 
)
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.

int textsearch_register ( struct ts_ops ops)

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.

int textsearch_unregister ( struct ts_ops ops)

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.