9p: Make sure we are able to clunk the cached fid on umount
[safe/jmp/linux-2.6] / include / linux / textsearch.h
index 1a4990e..d9a85d6 100644 (file)
@@ -1,25 +1,22 @@
 #ifndef __LINUX_TEXTSEARCH_H
 #define __LINUX_TEXTSEARCH_H
 
-#ifdef __KERNEL__
-
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/err.h>
+#include <linux/slab.h>
 
 struct ts_config;
 
-/**
- * TS_AUTOLOAD - Automatically load textsearch modules when needed
- */
-#define TS_AUTOLOAD    1
+#define TS_AUTOLOAD    1 /* Automatically load textsearch modules when needed */
+#define TS_IGNORECASE  2 /* Searches string case insensitively */
 
 /**
  * struct ts_state - search state
  * @offset: offset for next match
- * @cb: control buffer, for persistant variables of get_next_block()
+ * @cb: control buffer, for persistent variables of get_next_block()
  */
 struct ts_state
 {
@@ -40,7 +37,7 @@ struct ts_state
 struct ts_ops
 {
        const char              *name;
-       struct ts_config *      (*init)(const void *, unsigned int, int);
+       struct ts_config *      (*init)(const void *, unsigned int, gfp_t, int);
        unsigned int            (*find)(struct ts_config *,
                                        struct ts_state *);
        void                    (*destroy)(struct ts_config *);
@@ -53,12 +50,14 @@ struct ts_ops
 /**
  * struct ts_config - search configuration
  * @ops: operations of chosen algorithm
+ * @flags: flags
  * @get_next_block: callback to fetch the next block to search in
  * @finish: callback to finalize a search
  */
 struct ts_config
 {
        struct ts_ops           *ops;
+       int                     flags;
 
        /**
         * get_next_block - fetch next block of data
@@ -70,7 +69,7 @@ struct ts_config
         * Called repeatedly until 0 is returned. Must assign the
         * head of the next block of data to &*dst and return the length
         * of the block or 0 if at the end. consumed == 0 indicates
-        * a new search. May store/read persistant values in state->cb.
+        * a new search. May store/read persistent values in state->cb.
         */
        unsigned int            (*get_next_block)(unsigned int consumed,
                                                  const u8 **dst,
@@ -148,7 +147,7 @@ static inline unsigned int textsearch_get_pattern_len(struct ts_config *conf)
 extern int textsearch_register(struct ts_ops *);
 extern int textsearch_unregister(struct ts_ops *);
 extern struct ts_config *textsearch_prepare(const char *, const void *,
-                                           unsigned int, int, int);
+                                           unsigned int, gfp_t, int);
 extern void textsearch_destroy(struct ts_config *conf);
 extern unsigned int textsearch_find_continuous(struct ts_config *,
                                               struct ts_state *,
@@ -159,15 +158,14 @@ extern unsigned int textsearch_find_continuous(struct ts_config *,
 #define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1))
 
 static inline struct ts_config *alloc_ts_config(size_t payload,
-                                               unsigned int __nocast gfp_mask)
+                                               gfp_t gfp_mask)
 {
        struct ts_config *conf;
 
-       conf = kmalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask);
+       conf = kzalloc(TS_PRIV_ALIGN(sizeof(*conf)) + payload, gfp_mask);
        if (conf == NULL)
                return ERR_PTR(-ENOMEM);
 
-       memset(conf, 0, TS_PRIV_ALIGN(sizeof(*conf)) + payload);
        return conf;
 }
 
@@ -176,6 +174,4 @@ static inline void *ts_config_priv(struct ts_config *conf)
        return ((u8 *) conf + TS_PRIV_ALIGN(sizeof(struct ts_config)));
 }
 
-#endif /* __KERNEL__ */
-
 #endif