aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2005-10-30[PATCH] lib/string.c cleanup: remove pointless register keywordJesper Juhl1-2/+2
Removes a few pointless register keywords. register is merely a compiler hint that access to the variable should be optimized, but gcc (3.3.6 in my case) generates the exact same code with and without the keyword, and even if gcc did something different with register present I think it is doubtful we would want to optimize access to these variables - especially since this is generic library code and there are supposed to be optimized versions in asm/ for anything that really matters speed wise. (akpm: iirc, keyword register is a gcc no-op unless using -O0) Signed-off-by: Jesper Juhl <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-10-30[PATCH] lib/string.c cleanup: whitespace and CodingStyle cleanupsJesper Juhl1-60/+53
Removes some blank lines, removes some trailing whitespace, adds spaces after commas and a few similar changes. Signed-off-by: Jesper Juhl <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-10-30[PATCH] CONFIG_IA32Brian Gerst1-1/+1
Add CONFIG_X86_32 for i386. This allows selecting options that only apply to 32-bit systems. (X86 && !X86_64) becomes X86_32 (X86 || X86_64) becomes X86 Signed-off-by: Brian Gerst <[email protected]> Cc: Sam Ravnborg <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-10-29[PATCH] ppc64 boot: remove include from lib/zlib_inflate/inflate.cOlaf Hering1-1/+0
There is no need to include module.h in inflate.c Signed-off-by: Olaf Hering <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Anton Blanchard <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
2005-10-28Merge ../bleed-2.6Greg KH4-5/+5
2005-10-28[PATCH] kobject_uevent.c has a typo in a commentErik Hovland1-1/+1
This patch changes trough to through in a comment in kobject_uevent.c. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-10-28[PATCH] gfp_t: lib/*Al Viro4-5/+5
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-10-23[PATCH] inotify/idr leak fixAndrew Morton1-0/+13
Fix a bug which was reported and diagnosed by Stefan Jones <[email protected]> IDR trees include a cache of idr_layer objects. There's no way to destroy this cache, so when we discard an overall idr tree we end up leaking some memory. Add and use idr_destroy() for this. v9fs and infiniband also need to use idr_destroy() to avoid leaks. Or, we make the cache global, like radix_tree_preload(). Which is probably better. Later. Cc: Eric Van Hensbergen <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Robert Love <[email protected]> Cc: John McCutchan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-10-20Update from upstream with manual merge of Yasunori Goto'sTony Luck7-6/+47
changes to swiotlb.c made in commit 281dd25cdc0d6903929b79183816d151ea626341 since this file has been moved from arch/ia64/lib/swiotlb.c to lib/swiotlb.c Signed-off-by: Tony Luck <[email protected]>
2005-10-18Add some basic .gitignore filesLinus Torvalds1-0/+6
This still leaves driver and architecture-specific subdirectories alone, but gets rid of the bulk of the "generic" generated files that we should ignore. Signed-off-by: Linus Torvalds <[email protected]>
2005-10-08[PATCH] gfp flags annotations - part 1Al Viro4-4/+4
- added typedef unsigned int __nocast gfp_t; - replaced __nocast uses for gfp flags with gfp_t - it gives exactly the same warnings as far as sparse is concerned, doesn't change generated code (from gcc point of view we replaced unsigned int with typedef) and documents what's going on far better. Signed-off-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-10-04[TEXTSEARCH]: fix sparse gfp nocast warningsRandy Dunlap3-3/+3
Fix nocast sparse warnings: include/linux/textsearch.h:165:57: warning: implicit cast to nocast type Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2005-09-29[PATCH] Removed remaining PCI specific references from swiotlb.cTony Luck1-14/+14
Matthew Wilcox pointed out that swiotlb.c implements a generic interface that is not tied to just PCI. Remove includes of <linux/pci.h>, <asm/pci.h>. Fix comments and printk() messages to no longer refer to PCI. Signed-off-by: Tony Luck <[email protected]>
2005-09-29[PATCH] swiotlb: file header commentsJohn W. Linville1-2/+4
Change comment at top of swiotlb.c to reflect that the code is shared with EM64T (i.e. Intel x86_64). Also add an entry for myself so that if I "broke it", everyone knows who "bought it"... :-) Signed-off-by: John W. Linville <[email protected]> Signed-off-by: Tony Luck <[email protected]>
2005-09-29[PATCH] swiotlb: support syncing DMA_BIDIRECTIONAL mappingsJohn W. Linville1-22/+40
The current implementation of sync_single in swiotlb.c chokes on DMA_BIDIRECTIONAL mappings. This patch adds the capability to sync those mappings, and optimizes other syncs by accounting for the sync target (i.e. cpu or device) in addition to the DMA direction of the mapping. Signed-off-by: John W. Linville <[email protected]> Signed-off-by: Tony Luck <[email protected]>
2005-09-29[PATCH] swiotlb: support syncing sub-ranges of mappingsJohn W. Linville1-0/+33
This patch implements swiotlb_sync_single_range_for_{cpu,device}. This is intended to support an x86_64 implementation of dma_sync_single_range_for_{cpu,device}. Signed-off-by: John W. Linville <[email protected]> Signed-off-by: Tony Luck <[email protected]>
2005-09-29[PATCH] swiotlb: cleanup some code duplication cruftJohn W. Linville1-23/+22
The implementations of swiotlb_sync_single_for_{cpu,device} are identical. Likewise for swiotlb_syng_sg_for_{cpu,device}. This patch move the guts of those functions to two new inline functions, and calls the appropriate one from the bodies of those functions. Signed-off-by: John W. Linville <[email protected]> Signed-off-by: Tony Luck <[email protected]>
2005-09-29[PATCH] swiotlb: move from arch/ia64/lib/ to lib/John W. Linville2-0/+761
The swiotlb implementation is shared by both IA-64 and EM64T. However, the source itself lives under arch/ia64. This patch moves swiotlb.c from arch/ia64/lib to lib/ and fixes-up the appropriate Makefile and Kconfig files. No actual changes are made to swiotlb.c. Signed-off-by: John W. Linville <[email protected]> Signed-off-by: Tony Luck <[email protected]>
2005-09-14[LIB]: Consolidate _atomic_dec_and_lock()David S. Miller1-0/+35
Several implementations were essentialy a common piece of C code using the cmpxchg() macro. Put the implementation in one spot that everyone can share, and convert sparc64 over to using this. Alpha is the lone arch-specific implementation, which codes up a special fast path for the common case in order to avoid GP reloading which a pure C version would require. Signed-off-by: David S. Miller <[email protected]>
2005-09-12[PATCH] x86-64: Allow frame pointer and fix help text.Andi Kleen1-4/+4
Allow frame pointer and fix help text. Signed-off-by: Andi Kleen <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-10[PATCH] lib/sort.c: small cleanupsAdrian Bunk1-2/+3
This patch contains the following small cleanups: - make two needlessly global functions static - every file should #include the header files containing the prototypes of it's global functions Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-10[PATCH] lib/radix-tree: Fix "nocast type" warningsVictor Fusco1-1/+1
Fix the sparse warning "implicit cast to nocast type" Signed-off-by: Victor Fusco <[email protected]> Signed-off-by: Domen Puncer <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-10[PATCH] spinlock consolidationIngo Molnar4-5/+259
This patch (written by me and also containing many suggestions of Arjan van de Ven) does a major cleanup of the spinlock code. It does the following things: - consolidates and enhances the spinlock/rwlock debugging code - simplifies the asm/spinlock.h files - encapsulates the raw spinlock type and moves generic spinlock features (such as ->break_lock) into the generic code. - cleans up the spinlock code hierarchy to get rid of the spaghetti. Most notably there's now only a single variant of the debugging code, located in lib/spinlock_debug.c. (previously we had one SMP debugging variant per architecture, plus a separate generic one for UP builds) Also, i've enhanced the rwlock debugging facility, it will now track write-owners. There is new spinlock-owner/CPU-tracking on SMP builds too. All locks have lockup detection now, which will work for both soft and hard spin/rwlock lockups. The arch-level include files now only contain the minimally necessary subset of the spinlock code - all the rest that can be generalized now lives in the generic headers: include/asm-i386/spinlock_types.h | 16 include/asm-x86_64/spinlock_types.h | 16 I have also split up the various spinlock variants into separate files, making it easier to see which does what. The new layout is: SMP | UP ----------------------------|----------------------------------- asm/spinlock_types_smp.h | linux/spinlock_types_up.h linux/spinlock_types.h | linux/spinlock_types.h asm/spinlock_smp.h | linux/spinlock_up.h linux/spinlock_api_smp.h | linux/spinlock_api_up.h linux/spinlock.h | linux/spinlock.h /* * here's the role of the various spinlock/rwlock related include files: * * on SMP builds: * * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the * initializers * * linux/spinlock_types.h: * defines the generic type and initializers * * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel * implementations, mostly inline assembly code * * (also included on UP-debug builds:) * * linux/spinlock_api_smp.h: * contains the prototypes for the _spin_*() APIs. * * linux/spinlock.h: builds the final spin_*() APIs. * * on UP builds: * * linux/spinlock_type_up.h: * contains the generic, simplified UP spinlock type. * (which is an empty structure on non-debug builds) * * linux/spinlock_types.h: * defines the generic type and initializers * * linux/spinlock_up.h: * contains the __raw_spin_*()/etc. version of UP * builds. (which are NOPs on non-debug, non-preempt * builds) * * (included on UP-non-debug builds:) * * linux/spinlock_api_up.h: * builds the _spin_*() APIs. * * linux/spinlock.h: builds the final spin_*() APIs. */ All SMP and UP architectures are converted by this patch. arm, i386, ia64, ppc, ppc64, s390/s390x, x64 was build-tested via crosscompilers. m32r, mips, sh, sparc, have not been tested yet, but should be mostly fine. From: Grant Grundler <[email protected]> Booted and lightly tested on a500-44 (64-bit, SMP kernel, dual CPU). Builds 32-bit SMP kernel (not booted or tested). I did not try to build non-SMP kernels. That should be trivial to fix up later if necessary. I converted bit ops atomic_hash lock to raw_spinlock_t. Doing so avoids some ugly nesting of linux/*.h and asm/*.h files. Those particular locks are well tested and contained entirely inside arch specific code. I do NOT expect any new issues to arise with them. If someone does ever need to use debug/metrics with them, then they will need to unravel this hairball between spinlocks, atomic ops, and bit ops that exist only because parisc has exactly one atomic instruction: LDCW (load and clear word). From: "Luck, Tony" <[email protected]> ia64 fix Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Arjan van de Ven <[email protected]> Signed-off-by: Grant Grundler <[email protected]> Cc: Matthew Wilcox <[email protected]> Signed-off-by: Hirokazu Takata <[email protected]> Signed-off-by: Mikael Pettersson <[email protected]> Signed-off-by: Benoit Boissinot <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-08[PATCH] lib/crc16: added crc16 algorithm.Evgeniy Polyakov3-1/+77
Add the crc16 routines, as used by w1 devices. Signed-off-by: Ben Gardner <[email protected]> Signed-off-by: Evgeniy Polyakov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-09-07[PATCH] fix klist semantics for lists which have elements removed on traversalJames Bottomley1-1/+17
The problem is that klists claim to provide semantics for safe traversal of lists which are being modified. The failure case is when traversal of a list causes element removal (a fairly common case). The issue is that although the list node is refcounted, if it is embedded in an object (which is universally the case), then the object will be freed regardless of the klist refcount leading to slab corruption because the klist iterator refers to the prior element to get the next. The solution is to make the klist take and release references to the embedding object meaning that the embedding object won't be released until the list relinquishes the reference to it. (akpm: fast-track this because it's needed for the 2.6.13 scsi merge) Signed-off-by: James Bottomley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-07[PATCH] radix_tag_get(): differentiate between no present node and tag unset ↵Marcelo Tosatti1-8/+9
cases Simple patch to radix_tree_tag_get() to return different values for non present node and tag unset. The function is not used by any in-kernel callers (yet), but this information is definitely useful. Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-07[PATCH] radix-tree: Remove unnecessary indirections and clean up codeChristoph Lameter1-77/+82
- There is frequent use of indirections in the radix code. This patch removes those indirections, makes the code more readable and allows the compilers to generate better code. - Removing indirections allows the removal of several casts. - Removing indirections allows the reduction of the radix_tree_path size from 3 to 2 words. - Use pathp-> consistently. - Remove unnecessary tmp variable in radix_tree_insert - Separate the upper layer processing from the lowest layer in __lookup() in order to make it easier to understand what is going on and allow compilers to generate better code for the loop. Signed-off-by: Christoph Lameter <[email protected]> Cc: Nick Piggin <[email protected]> Cc: James Bottomley <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-07[PATCH] detect soft lockupsIngo Molnar1-0/+19
This patch adds a new kernel debug feature: CONFIG_DETECT_SOFTLOCKUP. When enabled then per-CPU watchdog threads are started, which try to run once per second. If they get delayed for more than 10 seconds then a callback from the timer interrupt detects this condition and prints out a warning message and a stack dump (once per lockup incident). The feature is otherwise non-intrusive, it doesnt try to unlock the box in any way, it only gets the debug info out, automatically, and on all CPUs affected by the lockup. Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Nishanth Aravamudan <[email protected]> Signed-Off-By: Matthias Urlichs <[email protected]> Signed-off-by: Richard Purdie <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-05[PATCH] klist: fix klist to have the same klist_add semantics as list_headJames Bottomley1-4/+4
at the moment, the list_head semantics are list_add(node, head) whereas current klist semantics are klist_add(head, node) This is bound to cause confusion, and since klist is the newcomer, it should follow the list_head semantics. I also added missing include guards to klist.h Signed-off-by: James Bottomley <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-09-05[PATCH] unify x86/x86-64 semaphore codeBenjamin LaHaise2-0/+178
This patch moves the common code in x86 and x86-64's semaphore.c into a single file in lib/semaphore-sleepers.c. The arch specific asm stubs are left in the arch tree (in semaphore.c for i386 and in the asm for x86-64). There should be no changes in code/functionality with this patch. Signed-off-by: Benjamin LaHaise <[email protected]> Cc: Andi Kleen <[email protected]> Signed-off-by: Jeff Dike <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-08-29[LIB]: Make TEXTSEARCH_BM plain tristate like the othersDavid S. Miller1-8/+1
And select it when the relevant modules are enabled. Signed-off-by: David S. Miller <[email protected]>
2005-08-29[LIB]: Boyer-Moore extension for textsearch infrastructure strike #2Pablo Neira Ayuso3-0/+196
Attached the implementation of the Boyer-Moore string search algorithm for the new textsearch infrastructure. I've added as well a note about the limitations that this approach presents, as Thomas has remarked. Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2005-08-29[NETLINK]: Add "groups" argument to netlink_kernel_createPatrick McHardy1-1/+1
Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2005-08-29[NETLINK]: Convert netlink users to use group numbers instead of bitmasksPatrick McHardy1-1/+1
Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2005-08-29[NETLINK]: Fix missing dst_groups initializations in netlink_broadcast usersPatrick McHardy1-0/+1
netlink_broadcast users must initialize NETLINK_CB(skb).dst_groups to the destination group mask for netlink_recvmsg. Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2005-08-29[NETLINK]: Add properly module refcounting for kernel netlink sockets.Harald Welte1-1/+2
- Remove bogus code for compiling netlink as module - Add module refcounting support for modules implementing a netlink protocol - Add support for autoloading modules that implement a netlink protocol as soon as someone opens a socket for that protocol Signed-off-by: Harald Welte <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2005-08-26[PATCH] Document idr_get_new_above() semantics, update inotifyJohn McCutchan1-1/+1
There is an off by one problem with idr_get_new_above. The comment and function name suggest that it will return an id > starting_id, but it actually returned an id >= starting_id, and kernel callers other than inotify treated it as such. The patch below fixes the comment, and fixes inotifys usage. The function name still doesn't match the behaviour, but it never did. Signed-off-by: John McCutchan <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-08-23[PATCH] %t... in vsnprintfAl Viro1-1/+4
handling of %t... (ptrdiff_t) in vsnprintf Signed-off-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-08-17Revert unnecessary zlib_inflate/inftrees.c fixLinus Torvalds1-1/+1
It turns out that empty distance code tables are not an error, and that a compressed block with only literals can validly have an empty table and should not be flagged as a data error. Some old versions of gzip had problems with this case, but it does not affect the zlib code in the kernel. Analysis and explanations thanks to Sergey Vlasov <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-08-07[PATCH] crc32.c typo fixDominik Hackl1-1/+1
This patch fixes a typo in lib/crc32.c which results in incorrect debug output. Signed-off-by: Dominik Hackl <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-08-05[PATCH] Update in-kernel zlib routinesTim Yamin2-8/+10
These bugs have been fixed in the standard zlib for a while. See for example a) http://sources.redhat.com/ml/bug-gnu-utils/1999-06/msg00183.html b) http://bugs.gentoo.org/show_bug.cgi?id=94584 Signed-off-by: Tim Yamin <[email protected]> Signed-off-by: Tavis Ormandy <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-07-29[PATCH] DEBUG_FS must depend on SYSFSAdrian Bunk1-1/+1
CONFIG_DEBUG_FS=y and CONFIG_SYSFS=n results in the following compile error: <-- snip --> ... LD vmlinux fs/built-in.o: In function `debugfs_init': inode.c:(.init.text+0x31be): undefined reference to `kernel_subsys' make: *** [vmlinux] Error 1 <-- snip --> Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-07-27[PATCH] statically link halfmd4Andrew Morton1-2/+2
For some reason halfmd4 isn't being linked into the kernel any more and modular ext3 wants it. So statically link the halfmd4 code into the kernel. Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-07-07[PATCH] mostly_read data sectionChristoph Lameter1-1/+1
Add a new section called ".data.read_mostly" for data items that are read frequently and rarely written to like cpumaps etc. If these maps are placed in the .data section then these frequenly read items may end up in cachelines with data is is frequently updated. In that case all processors in an SMP system must needlessly reload the cachelines again and again containing elements of those frequently used variables. The ability to share these cachelines will allow each cpu in an SMP system to keep local copies of those shared cachelines thereby optimizing performance. Signed-off-by: Alok N Kataria <[email protected]> Signed-off-by: Shobhit Dayal <[email protected]> Signed-off-by: Christoph Lameter <[email protected]> Signed-off-by: Shai Fultheim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-06-25[PATCH] Use ALIGN to remove duplicate codeNick Wilson1-2/+1
This patch makes use of ALIGN() to remove duplicate round-up code. Signed-off-by: Nick Wilson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-06-25[PATCH] lib/sha1.c: fix sparse warningDomen Puncer1-1/+1
lib/sha1.c:44:10: warning: cast to restricted type Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Domen Puncer <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-06-24[PKT_SCHED]: Make TEXTSEARCH* options only selected.David S. Miller1-22/+6
Do not present these confusing new options to the user unless he picked some facility that makes use of it, such as NET_EMATCH_TEXT. Signed-off-by: David S. Miller <[email protected]>
2005-06-23[LIB]: textsearch.o needs to be obj-y not lib-y.David S. Miller1-1/+1
It exports symbols. Signed-off-by: David S. Miller <[email protected]>
2005-06-23[LIB]: Naive finite state machine based textsearchThomas Graf3-0/+350
A finite state machine consists of n states (struct ts_fsm_token) representing the pattern as a finite automation. The data is read sequentially on a octet basis. Every state token specifies the number of recurrences and the type of value accepted which can be either a specific character or ctype based set of characters. The available type of recurrences include 1, (0|1), [0 n], and [1 n]. The algorithm differs between strict/non-strict mode specyfing whether the pattern has to start at the first octect. Strict mode is enabled by default and can be disabled by inserting TS_FSM_HEAD_IGNORE as the first token in the chain. The runtime performance of the algorithm should be around O(n), however while in strict mode the average runtime can be better. Signed-off-by: Thomas Graf <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2005-06-23[LIB]: Knuth-Morris-Pratt textsearch algorithmThomas Graf3-0/+156
Implements a linear-time string-matching algorithm due to Knuth, Morris, and Pratt [1]. Their algorithm avoids the explicit computation of the transition function DELTA altogether. Its matching time is O(n), for n being length(text), using just an auxiliary function PI[1..m], for m being length(pattern), precomputed from the pattern in time O(m). The array PI allows the transition function DELTA to be computed efficiently "on the fly" as needed. Roughly speaking, for any state "q" = 0,1,...,m and any character "a" in SIGMA, the value PI["q"] contains the information that is independent of "a" and is needed to compute DELTA("q", "a") [2]. Since the array PI has only m entries, whereas DELTA has O(m|SIGMA|) entries, we save a factor of |SIGMA| in the preprocessing time by computing PI rather than DELTA. [1] Cormen, Leiserson, Rivest, Stein Introdcution to Algorithms, 2nd Edition, MIT Press [2] See finite automation theory Signed-off-by: Thomas Graf <[email protected]> Signed-off-by: David S. Miller <[email protected]>