aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2004-08-22[PATCH] idr.c: remove stale commentChristoph Hellwig1-90/+74
The generation counters were removed from the idr code. Update idr.c comments, now uses doc-book style API documentation. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-08-07[PATCH] Teach sscanf about 'hh' and 'll'Alexander Viro1-2/+19
Adds support for 'hh' (store number in char *) and 'll' (proper C99 for long long) modifiers to sscanf().
2004-07-28[PATCH] Export all functions in lib/string.cRoland Dreier1-1/+21
Quite a few functions in lib/string.c are not exported. I ran into this trying to use strnchr() in a module. This patch - exports every function defined in lib/string.c - adds some missing __HAVE_ARCH_xxx defines for i386 - gets rid of the exports of functions from lib/string.c in arch/s390 (BTW, why is s390 exporting things NOVERS?) Signed-off-by: Roland Dreier <roland@topspin.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-07-14Merge kroah.com:/home/greg/linux/BK/bleed-2.6Greg Kroah-Hartman1-3/+4
into kroah.com:/home/greg/linux/BK/driver-2.6
2004-07-10[PATCH] fix CRC16 misnamingAndrey Panin3-15/+15
As pointed by Thomas Sailer, crc16.c module contains CRC16-CCITT (x^16 + x^12 + x^5 + 1) implementation, not IBM CRC16 (x^16 + x^15 + x^2 + 1) one. Looks like we need to rename it accordingly and this patchset does exactly this. Signed-off-by: Andrey Panin <pazke@donpac.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-07-08[PATCH] Driver core: kset_find_obj should increment refcount of the found objectDmitry Torokhov1-3/+4
kset_find_obj should increment refcount of the found object so users of the function can safely use returned object Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2004-07-04[PATCH] gcc 3.5 fixes #2Anton Blanchard1-1/+1
gcc 3.5 is warning about unused static variables, add __attribute_unused__ to the 2 places to silence it. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-07-01[PATCH] 64 bit bug in radix-tree lookup.Martin Schwidefsky1-4/+4
The radix tree functions __lookup and __lookup_tag uses (1 << shift) in their index calculations. On 64 bit systems the shift can be bigger than 32. The shift of an integer by more than 32 bits evaluates to zero which causes the lookup to fail. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-29sparse: get rid of more integer/pointer confusionLinus Torvalds4-6/+6
Use NULL, not 0, where appropriate.
2004-06-29[PATCH] Combined patch for remaining trivial sparse warnings in allnoconfig ↵Mika Kukkonen2-2/+2
build Well, one of these (fs/block_dev.c) is little non-trivial, but i felt throwing that away would be a shame (and I did add comments ;-). Also almost all of these have been submitted earlier through other channels, but have not been picked up (the only controversial is again the fs/block_dev.c patch, where Linus felt a better job would be done with __ffs(), but I could not convince myself that is does the same thing as original code). Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-26[PATCH] crc: add common CRC16 moduleAndrey Panin3-0/+79
Currently we have 8 copies of CRC16 calculation table in different device drivers, this patch creates common crc16.c module to replace them. Signed-off-by: Andrey Panin <pazke@donpac.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-23[PATCH] cpumask: bitmap inlining and optimizationsAndrew Morton1-44/+47
From: Paul Jackson <pj@sgi.com> These bitmap improvements make it a suitable basis for fully supporting cpumask_t and nodemask_t. Inline macros with compile-time checks enable generating tight code on both small and large systems (large meaning cpumask_t requires more than one unsigned long's worth of bits). The existing bitmap_<op> macros in lib/bitmap.c are renamed to __bitmap_<op>, and wrappers for each bitmap_<op> are exposed in include/linux/bitmap.h This patch _includes_ Bill Irwins rewrite of the bitmap_shift operators to not require a fixed length intermediate bitmap. Improved comments list each available operator for easy browsing. Signed-off-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-23[PATCH] cpumask: bitmap cleanup preparation for cpumask overhaulAndrew Morton1-6/+81
From: Paul Jackson <pj@sgi.com> Document the bitmap bit model and handling of unused bits. Tighten up bitmap so it does not generate nonzero bits in the unused tail if it is not given any on input. Add intersects, subset, xor and andnot operators. Change bitmap_complement to take two operands. Add a couple of missing 'const' qualifiers on bitops test_bit and bitmap_equal args. Signed-off-by: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-21[PATCH] sparse: zlib stray extern removalAlexander Viro1-1/+1
2004-06-20[PATCH] lindent rwsemNick Piggin2-96/+110
Lindent rwsem.c and rwsem-spinlock.c and fix a few things by hand. Also added a couple of comments for the memory barriers. Added the __sched annotation that was left out of rwsem-spinlock.c. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-18[PATCH] sparse: lib/string.c sparse fixRandy Dunlap1-1/+1
A classic.. lib/string.c:165:19: warning: assignment expression in conditional From: Mika Kukkonen <mika@osdl.org> Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
2004-06-17[PATCH] fix simple_strtoul base 16 handlingChris Wright1-2/+8
I know it's simple_strtoul, but is it meant to be that simple? Fix up for both simple_strtoul and simple_strtoull. simple_strtoul(0x401b, NULL, 0) = 0x401b simple_strtoul(0X401b, NULL, 0) = 0x0 simple_strtoul(0x401b, NULL, 16) = 0x0 simple_strtoul(0X401b, NULL, 16) = 0x0 simple_strtoull(0x401b, NULL, 0) = 0x401b simple_strtoull(0X401b, NULL, 0) = 0x0 simple_strtoull(0x401b, NULL, 16) = 0x0 simple_strtoull(0X401b, NULL, 16) = 0x0 Signed-off-by: Chris Wright <chrisw@osdl.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-17[PATCH] IDR fixupsCorey Minyard1-14/+31
There were definately some problems in there. I've made some changes and tested with a lot of bounds. I don't have a machine with enough memory to fill it up (it would take ~16GB on a 64-bit machine), but I use the "above" code to simulate a lot of situations. The problems were: * IDR_FULL was not the right value * idr_get_new_above() was not defined in the headers or documented. * idr_alloc() bug-ed if there was a race and not enough memory was allocated. It should have returned NULL. * id will overflow when you go past the end. * There was a "(id >= (1 << (layers*IDR_BITS)))" comparison, but at the top layer it would overflow the id and be zero. * The allocation should return ENOSPC for an "above" value with nothing above it, but it returned EAGAIN. I have not tested on 64-bits (as I don't have a 64-bit machine). I've included the files, a diff from the previous version, and my test programs. For the test programs, idr_test <size> will just attempt to allocate <size> elements, check them, free them, and check them again. idr_test2 <size> <incr> will allocate <size> element with <incr> between them. idr_test3 just tests some bounds and tries all values with just a few in the idr. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-17[PATCH] idr: remove counter bits from id'sAndrew Morton1-16/+3
idr_get_new() currently returns an incrementing counter in the top 8 bits of the counter. Which means that most users have to mask it off again, and we only have a 24-bit range. So remove that counter. Also: - Remove the BITS_PER_INT define due to namespace collision risk. - Make MAX_ID_SHIFT 31, so counters have a 0 to 2G-1 range. - Why is MAX_ID_SHIFT using sizeof(int) and not sizeof(long)? If it's for consistency across 32- and 64-bit machines, why not just make it "31"? - Does this still hold true with the counter removed? /* We can only use half the bits in the top level because there are only four possible bits in the top level (5 bits * 4 levels = 25 bits, but you only use 24 bits in the id). */ If not, what needs to change? Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-17[PATCH] Fixes for idr codeCorey Minyard1-8/+37
* On a 32-bit architecture, the idr code will cease to work if you add more than 2^20 entries. You will not be able to find many of the entries. The problem is that the IDR code uses 5-bit chunks of the number and the lower portion used by IDR is 24 bits, so you have one bit that leaks over into the comparisons that should not be there. The solution is to mask off that bit before doing IDR processing. This actually causes the POSIX timer code to crash if you create that many timers. I have included an idr_test.tar.gz file that demonstrates this with and without the fix, in case you need more evidence :). * When the IDR fills up, it returns -1. However, there was no way to check for this condition. This patch adds the ability to check for the idr being full and fixes all the users. It also fixes a problem in fs/super.c where the idr code wasn't checking for -1. * There was a race condition creating POSIX timers. The timer was added to a task struct for another process then the data for the timer was filled out. The other task could use/destroy time timer as soon as it is in the task's queue and the lock is released. This moves settup up the timer data to before the timer is enqueued or (for some data) into the lock. * Change things so that the caller doesn't need to run idr_full() to find out the reason for an idr_get_new() failure. Just return -ENOSPC if the tree was full, or -EAGAIN if the caller needs to re-run idr_pre_get() and try again. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-06-07[PATCH] Fix semaphore downgrade_write()David Howells1-15/+20
Stop downgrade_write() from under-adjusting the rwsem counter in optimised rw-semaphores. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-05-22[PATCH] slab: consolidate panic codeAndrew Morton1-3/+1
Many places do: if (kmem_cache_create(...) == NULL) panic(...); We can consolidate all that by passing another flag to kmem_cache_create() which says "panic if it doesn't work".
2004-05-14Merge kroah.com:/home/greg/linux/BK/bleed-2.6Greg Kroah-Hartman1-3/+7
into kroah.com:/home/greg/linux/BK/driver-2.6
2004-05-13[PATCH] sysfs_rename_dir-cleanupManeesh Soni1-3/+7
o The following patch cleans up sysfs_rename_dir(). It now checks the return code of kobject_set_name() and propagates the error code to its callers. Because of this there are changes in the following two APIs. Both return int instead of void. int sysfs_rename_dir(struct kobject * kobj, const char *new_name) int kobject_rename(struct kobject * kobj, char *new_name)
2004-05-10[PATCH] Kill some 'No description found...' warnings. (kernel-api.sgml)Andrew Morton1-2/+2
From: Alexey Dobriyan <adobriyan@mail.ru> Fix various kernel-doc parameters.
2004-05-03Be more careful about waking up rwsem waitersLinus Torvalds2-5/+13
Get a reference count on the the sleeper, so that it can't possibly go away before we've sent it the wakeup event. Noted by Nick Piggin <nickpiggin@yahoo.com.au> David Howells <dhowells@redhat.com>
2004-05-01Be more careful about semaphore contention memory ordering.Linus Torvalds2-15/+28
Don't touch the wakee stack after marking it runnable.
2004-04-27Merge davem@nuts.davemloft.net:/disk1/BK/net-2.6David S. Miller1-2/+1
into kernel.bkbits.net:/home/davem/net-2.6
2004-04-27[LIB]: Use compiler.h's pure attribute macros in crc32.c.Clay Haapala1-11/+5
2004-04-27[LIB]: Add CRC32c (Castagnoli, et al Cyclic Redundancy-Check)Clay Haapala3-0/+210
2004-04-27[PATCH] Fix rwsem contention case on alpha/s390xIvan Kokshaysky1-2/+1
Thanks to Dru <andru@treshna.com>, who provided an easy way to reproduce the problem. What we have in lib/rwsem.c:__rwsem_do_wake(): int woken, loop; ^^^ and several lines below: loop = woken; woken *= RWSEM_ACTIVE_BIAS-RWSEM_WAITING_BIAS; woken -= RWSEM_ACTIVE_BIAS; However, rw_semaphore->count is 64-bit on Alpha, so RWSEM_WAITING_BIAS has been defined as -0x0000000100000000L. Obviously, this blows up in the write contention case.
2004-04-18[PATCH] idr.c: extra features enhancementsAndrew Morton1-75/+115
From: Jim Houston <jim.houston@comcast.net> - Adds idr_get_new_above(), whihc permits us to do a first-fit search from a specified offset rather than always from zero. - Add IDR_INIT() DEFINE_IDR() constructors. Often idr's are singletons and having to cook up an initcall for them is a pain. This is needed by the "Increase number of dynamic inodes in procfs" patch.
2004-04-14Merge kroah.com:/home/greg/linux/BK/bleed-2.6Greg Kroah-Hartman1-3/+3
into kroah.com:/home/greg/linux/BK/driver-2.6
2004-04-14[PATCH] radix-tree comment fixAndrew Morton1-6/+1
Fix various bogons and outright lies.
2004-04-12[PATCH] Rename bitmap_clear to bitmap_zero, remove CLEAR_BITMAPAndrew Morton1-1/+1
From: Rusty Russell <rusty@rustcorp.com.au> clear_bit(n, addr) clears the nth bit. test_and_clear_bit(n, addr) clears the nth bit. cpu_clear(n, cpumask) clears the nth bit (vs. cpus_clear()). bitmap_clear(bitmap, n) clears out all the bits up to n. Moreover, there's a CLEAR_BITMAP() in linux/types.h which bitmap_clear() is a wrapper for. Rename bitmap_clear to bitmap_zero, which is harder to confuse (yes, it bit me), and make everyone use it.
2004-04-11[PATCH] radix-tree tags for selective lookupAndrew Morton1-44/+400
Add radix-tree tagging so we can look up dirty or writeback pages in O(log64(n)) time. Each radix-tree node gains two bits for each slot: one for page dirtiness and one for page writebackness. If a tag bit is set on a leaf node, it indicates that item at the corresponding slot is tagged (say, a dirty page). If a tag bit is set in a non-leaf node it indicates that the same tag bit is set in the subtree which lies under the corresponding slot. ie: "there is a dirty page under here somewhere, but you need to search down further to find it". A gang lookup function is provided which can walk the radix tree in logarithmic time looking for items which are tagged, starting from a specified offset. We use this for in-order searches for dirty or writeback pages. There is a userspace test harness for this code at http://www.zip.com.au/~akpm/linux/patches/stuff/rtth.tar.gz
2004-04-11[PATCH] Remove bitmap_shift_*() bitmap length limitsAndrew Morton1-21/+49
From: William Lee Irwin III <wli@holomorphy.com> Chang bitmap_shift_left()/bitmap_shift_right() to have O(1) stackspace requirements. Given zeroed tail preconditions these implementations satisfy zeroed tail postconditions, which makes them compatible with whatever changes from Paul Jackson one may want to merge in the future. No particular effort was required to ensure this. A small (but hopefully forgiveable) cleanup is a spelling correction: s/bitmap_shift_write/bitmap_shift_right/ in one of the kerneldoc comments. The primary effect of the patch is to remove the MAX_BITMAP_BITS limitation, so restoring the NR_CPUS to be limited only by stackspace and slab allocator maximums. They also look vaguely more efficient than the current code, though as this was not done for performance reasons, no performance testing was done.
2004-04-11[PATCH] Broken bitmap_parse for ncpus > 32Andrew Morton1-1/+23
From: Joe Korty <joe.korty@ccur.com> This patch replaces the call to bitmap_shift_right() in bitmap_parse() with bitmap_shift_left(). I also prepended comments to the bitmap_shift_* functions defining what 'left' and 'right' means. This is under the theory that if I and all the reviewers were bamboozled, others in the future occasionally might be too.
2004-04-11[PATCH] Fix get_wchan() FIXME wrt. order of functionsAndrew Morton1-2/+3
From: William Lee Irwin III <wli@holomorphy.com> This addresses the issue with get_wchan() that the various functions acting as scheduling-related primitives are not, in fact, contiguous in the text segment. It creates an ELF section for scheduling primitives to be placed in, and places currently-detected (i.e. skipped during stack decoding) scheduling primitives and others like io_schedule() and down(), which are currently missed by get_wchan() code, into this section also. The net effects are more reliability of get_wchan()'s results and the new ability, made use of by this code, to arbitrarily place scheduling primitives in the source code without disturbing get_wchan()'s accuracy. Suggestions by Arnd Bergmann and Matthew Wilcox regarding reducing the invasiveness of the patch were incorporated during prior rounds of review. I've at least tried to sweep all arches in this patch.
2004-03-30[PATCH] kobject_set_name() doesn't allocate enough spaceLinda Xie1-3/+3
2004-03-30[PATCH] double semicolon cleanupAlexander Stohr1-1/+1
This cleans up a larger amount of superfluos ";;" statements in current Linux kernel sources by converting them to the regular single ";" statments. It seems to be a common problem that at the end of a line the semicolon key is producing an echo.
2004-03-21[PATCH] Fix missing "noinline" on x86-64Arnd Bergmann1-0/+1
The gcc-3.5 patch broke building on x86_64 and possibly others, because inflate.c does not pull in the definition for noinline.
2004-03-20[PATCH] make inflate use less stack space with gcc3.5Andrew Morton1-4/+8
From: Matt Mackall <mpm@selenic.com> Quick fix to work around gcc3.5's automatic inline and broken stack requirements calculation. Without this, I see stack overflows at boot with 4k stacks.
2004-03-18[PATCH] Hotplug CPUs: Other CPU_DEAD NotifiersRusty Russell1-0/+25
Various files keep per-cpu caches which need to be freed/moved when a CPU goes down. All under CONFIG_HOTPLUG_CPU ifdefs. scsi.c: drain dead cpu's scsi_done_q onto this cpu. buffer.c: brelse the bh_lrus queue for dead cpu. timer.c: migrate timers from dead cpu, being careful of lock order vs __mod_timer. radix_tree.c: free dead cpu's radix_tree_preloads page_alloc.c: empty dead cpu's nr_pagecache_local into nr_pagecache, and free pages on cpu's local cache. slab.c: stop reap_timer for dead cpu, adjust each cache's free limit, and free each slab cache's per-cpu block. swap.c: drain dead cpu's lru_add_pvecs into ours, and empty its committed_space counter into global counter. dev.c: drain device queues from dead cpu into this one. flow.c: drain dead cpu's flow cache.
2004-03-18[PATCH] zlib: use kernel min/maxAndrew Morton1-5/+1
From: "Randy.Dunlap" <rddunlap@osdl.org> From: Michael Veeck <michael.veeck@gmx.net> Remove unnecessary min/max macros and changes calls to use kernel.h macros instead.
2004-03-14kref: add kref structure to kernel tree.Greg Kroah-Hartman2-0/+63
Based on the kobject structure, but much smaller and simpler to use.
2004-03-06[PATCH] fastcall / regparm fixesAndrew Morton2-12/+12
From: Gerd Knorr <kraxel@suse.de> Current gcc's error out if a function's declaration and definition disagree about the register passing convention. The patch adds a new `fastcall' declatation primitive, and uses that in all the FASTCALL functions which we could find. A number of inconsistencies were fixed up along the way.
2004-02-26kobject: clean up kobject_get() convoluted logic.Greg Kroah-Hartman1-5/+2
2004-02-26kobject: fix kobject hotplug debug message to show more needed info.Greg Kroah-Hartman1-2/+2
2004-02-18[PATCH] crc32.c copyright fixAndrew Morton1-9/+8
From: Matt Domsch <Matt_Domsch@dell.com> Patch below applies to both 2.4.25 and 2.6.3, and replaces the public domain statement and non-warranty with the GPL, as is permitted by the code being in the public domain, and is done with legal advice.
2004-02-18[PATCH] remove max_anon limitAndrew Morton1-6/+6
From: Tim Hockin <thockin@sun.com> Remove the max_anon via dynamically allocation. We also change the idr_pre_get() interface to take a gfp mask, which should have always been there.
2004-02-18[PATCH] Rename bitmap_snprintf() and cpumask_snprintf() to *_scnprintf()Andrew Morton1-3/+3
From: Joe Korty <joe.korty@ccur.com> Rename bitmap_snprintf() to bitmap_scnprintf() and cpumask_snprintf() to cpumask_scnprintf(), as these functions now belong to the scnprintf family of functions.
2004-02-18[PATCH] #if versus #ifdef cleanupAndrew Morton1-1/+1
From: Valdis.Kletnieks@vt.edu 15 changes of #if to #ifdef and 2 places CONFIG_FOO should be defined(CONFIG_FOO). This gets rid of spurious warnings if you build with "-Wundef" so you get a warning if you have a preprocessor command like: #if CONFIG_ETRAX_DS1302_RSTBIT == 27 and you'll be told if it's substituting a zero rather than silent weirdness and unexpected code generation.
2004-02-18[PATCH] snprintf fixesAndrew Morton2-14/+75
From: Juergen Quade <quade@hsnr.de> Lots of places in the kernel are using [v]snprintf wrongly: they assume it returns the number of characters copied. It doesn't. It returns the number of characters which _would_ have been copied had the buffer not been filled up. So create new functions vscnprintf() and scnprintf() which have the expected (sane) semaptics, and migrate callers over to using them.
2004-02-08Merge kroah.com:/home/greg/linux/BK/bleed-2.6Greg Kroah-Hartman1-0/+3
into kroah.com:/home/greg/linux/BK/driver-2.6
2004-02-07[PATCH] bitmap_snprintf() optimizationAndrew Morton1-4/+2
From: Joe Korty <joe.korty@ccur.com> Now that bitmap_parse is part of bitmap.[ch], it is allowed to manipulate bits directly as the other bitmap routines do.
2004-02-05[NET]: Support for lots of netdevs -- faster dev_alloc_nameStephen Hemminger1-0/+16
Convert dev_alloc_name from O(n^2) lookup to O(n) by using a page as bitmap to figure out how many devices of that pattern have been allocated. This works for up to 32k devices (PAGE_SIZE*8) on i386, more on other platforms. Correctly handles the boundary cases where number of devices won't fit because name length is limited. Adds strnchr to the string libraries since we need to find the % format character, but only care if it is in the first 15 bytes.
2004-02-05Merge kroah.com:/home/greg/linux/BK/bleed-2.6Greg Kroah-Hartman1-0/+3
into kroah.com:/home/greg/linux/BK/driver-2.6
2004-02-05[PATCH] Improper handling of %c in vsscanfAndrew Morton1-1/+1
From: <gb@phonema.ea.univpm.it> The "%c" in sscanf actually reads and writes one extra character (i.e. 2 characters insted of just one), and may thus easily overflow caller's buffer. Also affects 2.4 tree, even if there "%c" seems not to be used at all.
2004-02-05[PATCH] snprintf() commentaryAndrew Morton1-0/+10
From: Paul Jackson <pj@sgi.com> Explain the snprintf() return value.
2004-02-03[PATCH] u_int32_t causes cross-compile problemsAndrew Morton1-6/+6
From: Pratik Solanki <pratik.solanki@timesys.com> I came across this C standards issue while cross-compiling the Linux kernel with gcc on Solaris. The file gen_crc32table.c uses the non-standard type u_int32_t. It's possible that the host machine's sys/types.h does not define u_int32_t. The attached patch replaces u_int32_t with the POSIX standard uint32_t and includes POSIX inttypes.h instead of sys/types.h.
2004-02-03[PATCH] bitmap parsing/printing routines, version 4Andrew Morton3-182/+147
From: Joe Korty <joe.korty@ccur.com> 1) the version in 2.6.1 is broken, doesn't work on 64bit big endian machines at all. This needed fixing. I thought it best to fix by rewriting the printer/parser with an algorithm that is naturally endian & sizeof(long) resistant. 2) I wanted all digits to print, eg, 0000ffff,00000004 not ffff,4. 3) I wanted exactly NR_CPUS bits to print (or whatever the bitmap size is in bits, and not have what is displayed rounded up to the nearest full byte, as the current version did. 4) The bitmap printer and parser should be part of bitmap.[ch] with syntax and semantics to match. The original lib/mask.c versions did not recognize this commonality.
2004-02-03[PATCH] string fixes for gcc 3.4Andrew Morton1-3/+6
From: Andi Kleen <ak@muc.de> gcc 3.4 optimizes sprintf(foo,"%s",string) into strcpy. Unfortunately that isn't seen by the inliner and linux/i386 has no out-of-line strcpy so you end up with a linker error. This patch adds out of line copies for most string functions to avoid this. Actually it doesn't export them to modules yet, that would be the next step. BTW In my opinion we shouldn't use inline string functions at all. The __builtin_str* in modern gcc are better (I used them very successfully on x86-64) and for the bigger functions like strrchr,strtok et.al. it just doesn't make any sense to inline them or even code them in assembler. Also fix the bcopy prototype gcc was complaining about.
2004-02-03[PATCH] Fix more gcc 3.4 warningsAndrew Morton1-4/+12
From: Andi Kleen <ak@muc.de> Just many more warning fixes for a gcc 3.4 snapshot. It warns for a lot of things now, e.g. for ?: and ({ ... }) and casts as lvalues. And for functions marked inline in headers, but no body. Actually there are more warnings, i stopped fixing at some point. Some of the warnings seem to be dubious (e.g. the binfmt_elf.c one, which looks more like a compiler bug to me) I also fixed the _exit() prototype to be void because gcc was complaining about this.
2004-02-02Warn loudly if somebody passes a negative value asLinus Torvalds1-1/+10
the size to "vsnprintf()". That's a pretty clear case of overflow.
2004-02-01[PATCH] Kobject: export some missing symbolsEugene Teo1-0/+3
2004-01-20[PATCH] do not use shared extable code for ia64Andrew Morton1-0/+4
From: Jes Sorensen <jes@trained-monkey.org> The new sort_extable and shared search_extable code doesn't work on ia64. I have introduced two new #defines that archs can define to avoid the common code being built. ARCH_HAS_SEARCH_EXTABLE and ARCH_HAS_SORT_EXTABLE.
2004-01-20[PATCH] exception table search fixAndrew Morton1-7/+9
The exception table search code currently fails if addresses differ by more than 2G. This is only a problem when using the 4g/4g address space split, but it's more robust this way. Also, shuffle the comparison order n there so the least likely case comes last.
2004-01-19[PATCH] sort exception tablesPaul Mackerras2-1/+76
This patch arranges for the exception tables to be sorted on most architectures. It sorts the main kernel exception table on startup and the module exception tables when they get loaded. The main table is sorted reasonably early - just after kmem_cache_init - but that could be moved even earlier if necessary. There is now a lib/extable.c which includes the sort_extable() function from arch/ppc/mm/extable.c and the search_extable() function from arch/i386/mm/extable.c, which had been copied to many architectures. On many architectures, arch/$(ARCH)/mm/extable.c became empty and so I have removed it. There are four architectures which do things differently from i386: alpha, ia64, sparc and sparc64. Alpha and ia64 store the offset from the offset from the exception table entry to the instruction, and sparc and sparc64 have range entries in the table. For those architectures I have added empty sort_extable functions. The maintainers for those architectures can implement something better if they care to. As it is they are no worse off than before. Although it is a moderately sizable patch, it ends up with a net reduction of 377 lines in the size of the kernel source. :) I have tested this on x86 and ppc with a module that uses __get_user in an init function, deliberately laid out to get the exception table out of order, and it works (whereas it oopsed without this patch).
2004-01-19Merge bk://kernel.bkbits.net/gregkh/linux/driver-2.6Linus Torvalds2-1/+143
into home.osdl.org:/home/torvalds/v2.5/linux
2004-01-19[PATCH] work around gcc bug in bitmap.cAndrew Morton1-1/+2
gcc miscompiles this. Scary.
2004-01-19[PATCH] uninline bitmap functionsAndrew Morton2-1/+142
- A couple of them are using alloca (via DECLARE_BITMAP) and this generates a cannot-inline warning with -Winline. - These functions are too big to inline anwyay.
2004-01-19[PATCH] Kobject: prevent oops in kset_find_obj() if kobject_name() is NULLGreg Kroah-Hartman1-1/+1
Thanks to Hollis Blanchard <hollisb@us.ibm.com> for pointing this out.
2004-01-19[PATCH] kobject: make kobject hotplug function publicDmitry Torokhov1-28/+21
make kobject hotplug mechanism public so that others may call it.
2003-12-29[PATCH] lib/inflate.c fixAndrew Morton1-23/+42
From: "H. Peter Anvin" <hpa@zytor.com> This patch fixes the "non-terminating inflate" problem that Russell King complained about on LKML earlier today. I chose to use "goto" much like zlib does, in order to not require setjmp/longjmp inside the kernel. It's a bit ugly, but it also lets each function chose how it needs to be terminated on error, which is a good thing.
2003-12-29[PATCH] new /proc/irq cpumask format; consolidate cpumask display and input codeAndrew Morton2-1/+179
From: Paul Jackson <pj@sgi.com> This patch is a followup to one from Bill Irwin. On Nov 17, he had consolidated the half-dozen chunks of code that displayed cpumasks in /proc/irq/prof_cpu_mask and /proc/irq/<pid>/smp_affinity into a single routine, which he called format_cpumask(). I believe that Andrew Morton has accepted Bill's patch into his 2.6.0-test10-mm1 patch set as the "format_cpumask" patch. I hope that the following patch will replace Bill's patch. I look forward to Bill's feedback on this patch. The following patch carries Bill's work further: 1) It also consolidates the input side (write syscalls). 2) It adapts a new format, same on input and output. 3) The core routines work for any multi-word bitmask, not just cpumasks. 4) The core routines avoid overrunning their output buffers. Note esp. for David Mosberger: The small patch I sent you and the linux-ia64 list yesterday entitled: "check user access ok writing /proc/irq/<pid>/smp_affinity" for arch ia64 only is _separate_ from the following patch. Neither presumes the other. However, they do collide on one line. Last one in is a Monkey's Uncle and will need an updated patch from me (or otherwise need to resolve the one obvious collision). Details of the following patch: Both the display and input of cpumasks on 9 arch's are consolidated into a single pair of routines, which use the same format for input and output, as recommended by Tony Luck. The two common routines work on any multi-word bitmask (array of unsigned longs). A pair of trivial inline wrappers cpumask_snprintf() and cpumask_parse() hide this generality for the common case of cpumask input and output. My real motivation for consolidating this code will become visible later - when I seek to add a nodemask_t that resembles cpumask_t (just a different length). These common underlying routines will be used there as well, following up on a suggestion of Christoph Hellwig that I investigate implementing nodemask_t as an ADT sharing infrastructure with cpumask_t. However, I believe that this patch stands on its own merit, consolidating a couple hundred lines of duplicated code, and making the cpumask display format usable on very large systems. There are two exceptions to the consolidation - the alpha and sparc64 arch's manipulate bare unsigned longs, not cpumask_t's, on input (write syscall), and do stuff that was more funky than I could make sense of. So the input side of these two arch's was left as-is. I'd welcome someone with access to either of these systems to provide additional patches. The new format consists of multiple 32 bit words, separated by commas, displayed and input in hex. The following comment from this patch describes this format further: * The ascii representation of multi-word bit masks displays each * 32bit word in hex (not zero filled), and for masks longer than * one word, uses a comma separator between words. Words are * displayed in big-endian order most significant first. And hex * digits within a word are also in big-endian order, of course. * * Examples: * A mask with just bit 0 set displays as "1". * A mask with just bit 127 set displays as "80000000,0,0,0". * A mask with just bit 64 set displays as "1,0,0". * A mask with bits 0, 1, 2, 4, 8, 16, 32 and 64 set displays * as "1,1,10117". The first "1" is for bit 64, the second * for bit 32, the third for bit 16, and so forth, to the * "7", which is for bits 2, 1 and 0. * A mask with bits 32 through 39 set displays as "ff,0". The essential reason for adding the comma breaks was to make the long masks from our (SGI's) big 512 CPU systems parsable by humans. An unbroken string of 128 hex digits is pretty difficult to read. For those who are compiling systems with CONFIG_NR_CPUS of 32 or less, there should be no visible change in format. There are of course a thousand possible output formats that meet similar criteria. If someone wants to lobby for and seek consensus behind another such format, that's fine. Now that the format is consolidated into a single pair of routines, it should be easy to adapt whatever we choose. Internally, the display routine uses snprintf to track the remaining space in its output buffer, to avoid the risk of overrunning it. A new file, lib/mask.c, is added to the lib directory, to hold the two common routines. I anticipate adding a few more common routines for generic support of multi-word bit masks to lib/mask.c, in subsequent patches that will add a nodemask_t type as an ADT sharing implementation with cpumask_t.
2003-12-29[PATCH] Add lib/parser.c kernel-docAndrew Morton1-0/+79
From: Will Dyson <will_dyson@pobox.com> Add documentation and comments to lib/parser.c and include/linux/parser.h
2003-12-29[PATCH] sqrt() fixesAndrew Morton2-1/+33
It turns out that the int_sqrt() function in oom_kill.c gets it wrong. But fb_sqrt() in fbmon.c gets its math right. Move that function into lib/int_sqrt.c, and consolidate. (oom_kill.c fix from Thomas Schlichter <schlicht@uni-mannheim.de>)
2003-12-10kobject: fix bug where a parent could be deleted before a child device.Greg Kroah-Hartman1-4/+7
2003-11-18[PATCH] fix percpu_counter_mod linkage problemAndrew Morton2-22/+0
If both ext2 and ext3 are built as modules there is nothing to pull percpu_counter_mod() into the kernel build and the ext2 and ext3 modules do not load. So move percpu_counter_mod() out of lib.a.
2003-10-25[PATCH] fix __div64_32 to do division properlyRandolph Chung1-19/+28
This fixes the generic __div64_32() to correctly handle divisions by large 32-bit values (as used by nanosleep() and friends, for example). It's a simple bit-at-a-time implementation with a reduction of the high 32-bits handled manually. Architectures that can do 64/32-bit divisions in hardware should implement their own more efficient versions.
2003-10-21bcopy() doesn't return anything.Linus Torvalds1-3/+1
2003-10-21[PATCH] make printk more robust with "null" pointersAndrew Morton1-1/+1
Expand printk's traditional handling of null pointers so that anything in the first page is considered a null pointer. This gives us better behaviour when someone (acpi..) accidentally prints a string which is embedded in a struct, the pointer to which is null.
2003-10-08Merge kernel.bkbits.net:/home/repos/linux-2.5Patrick Mochel5-2/+31
into kernel.bkbits.net:/home/mochel/linux-2.5-core
2003-10-07o kernel/ksyms.c: move remaining EXPORT_SYMBOLs, remove this file from the treeArnaldo Carvalho de Melo5-2/+31
2003-10-06Merge kernel.bkbits.net:/home/repos/linux-2.5Patrick Mochel1-5/+16
into kernel.bkbits.net:/home/mochel/linux-2.5-core
2003-10-05[PATCH] lib/parser: Not recognize nul string as "%s" (6/6)Hirofumi Ogawa1-1/+3
Current match_token recognize "foo=" as "foo=%s". So this change the nul string does not recognize as "%s".
2003-10-02Merge kernel.bkbits.net:/home/repos/linux-2.5Patrick Mochel1-5/+16
into kernel.bkbits.net:/home/mochel/linux-2.5-core
2003-10-01[PATCH] table-driven filesystems option parsingAndrew Morton2-1/+139
From: "Randy.Dunlap" <rddunlap@osdl.org>, Will Dyson <will_dyson@pobox.com>, me Add generic filesystem options parser (infrastructure) and use it to parse mount options in several filesystems (adfs, affs, autofs, autofs4, ext2, ext3, fat, hfs, hpfs, isofs, jfs, procfs, udf, and ufs). It saves between 128 and 512 bytes per filesystem.
2003-09-29[kobject] Fix memory leak in kobject_set_name().Patrick Mochel1-5/+14
If kobject_set_name() is called when the kobject already has a name that was dynamically allocated (too long for the static array), then we must free that memory. Noticed by Jon Corbet.
2003-09-28Merge osdl.org:/home/mochel/src/kernel/linux-2.5-virginPatrick Mochel1-0/+2
into osdl.org:/home/mochel/src/kernel/linux-2.5-core
2003-09-26[PATCH] select ZLIB_{IN,DE}FLATEAdrian Bunk1-6/+1
Similar to the patch Brian Gerst sent for CRC32, this patch changes ZLIB_{IN,DE}FLATE to be select'ed. The dependencies are much better maintainable that way.
2003-09-26[PATCH] select CRC32Brian Gerst1-6/+0
Use "select CRC32" in Kconfig instead of makefile includes.
2003-09-24[kobject] export kset syms for module usePatrick Mochel1-0/+2
From John Rose <johnrose@austin.ibm.com> The patch below exposes some kset functions for use by modules. In the development of a PPC64 pci hotplug drv, we have found it necessary to use ksets of different types under a single subsystem. After discussing with GregKH, we agreed that this change makes this possible.
2003-09-09[PATCH] tidy up lib/inflate.c error messagesAndrew Morton1-5/+5
From: Andre McCurdy <armcc2000@yahoo.com> There is some inconsistency within lib/inflate.c and its users about whether the error message text or the error() function should provide the '\n'. This patch tries to make everyone consistent - by removing the newline from all message texts, and adding one to the only error() function which did not provide it (in init/do_mounts_rd.c).
2003-09-02[kobject] Don't use kobject->k_name after it's been freed. Patrick Mochel1-3/+3
Bah, stupid mistake. After you call ->release(), you cannot touch the object.
2003-08-28[kobject] Support unlimited name lengths.Patrick Mochel1-10/+65
Add ->k_name pointer which points to the name for a kobject. By default, this points to ->name (the static name array). Users of kobjects may use the helper function kobject_set_name() (and are encouraged to do so in all cases). This function will determined whether or not the name is short enough to fit in ->name. If so, great. Otherwise, a dyanamic string is allocated and the name is stored there. ->k_name will point to that, and will be freed when the kobject is released. kobject_set_name() may take a format string, like: kobject_set_name(kobj,"%s%d",base_name,id); and will behave as expected (will put in ->name, unless it's too long, in which case a new string will be allocated and it will be stored in there).
2003-08-16[PATCH] fast AND correct strncpyAlbert Cahalan1-5/+4
This is Erik Andersen's excellent strncpy. It works like magic. That "if" isn't a jump; gcc uses a few integer instructions to wipe out all jumps except for the loop itself and the function call/return. This has been exhaustively tested against glibc. The existing code has 5 extra branches and is over twice as large. (my gcc, etc.)
2003-08-14[PATCH] Fix strncpy off-by-one errorAndrew Morton1-1/+1
From: Yoshinori Sato <ysato@users.sourceforge.jp> It writes one too many zeroes when nulling out the destination.
2003-08-01Merge davem@nuts.ninka.net:/home/davem/src/BK/sparc-2.5David S. Miller1-3/+5
into kernel.bkbits.net:/home/davem/sparc-2.5
2003-08-01[STRING]: Fix bug in generic strncpy() change.David S. Miller1-3/+5
2003-08-01[PATCH] janitor: don't init statics to 0Randy Dunlap1-1/+1
From: Leann Ogasawara <ogasawara@osdl.org> Uninitialize static variables initialized to 0 so they are pushed to the .bss instead of .data.
2003-07-31[PATCH] fix strncpy on generic user platformsAlan Cox1-3/+3
2003-07-11Fix signedness tests in vsnprintf by making it explicit.Linus Torvalds1-2/+2
It used to depend on us having a signed type (which in turn is incorrect for the later division).
2003-07-11[PATCH] asm-generic/div64.h breakageBernardo Innocenti1-1/+1
- __div64_32(): remove __attribute_pure__ qualifier from the prototype since this function obviously clobbers memory through &(n); - do_div(): add a check to ensure (n) is type-compatible with uint64_t; - as_update_iohist(): Use sector_div() instead of do_div(). (Whether the result of the addition should always be stored in 64bits regardless of CONFIG_LBD is still being discussed, therefore it's unadderessed here); - Fix all places where do_div() was being called with a bad divisor argument.
2003-07-08[PATCH] Fix problem introduced by do_div() patchBernardo Innocenti1-1/+8
- export the __div64_32 symbol for modules; - add likely() to the fast path (divisor>>32 == 0); - add __attribute__((pure)) to __div64_32() prototype so the compiler knows global memory isn't clobbered; - avoid building __div64_32() on 64bit architectures.
2003-07-05[PATCH] Fix do_div() for all architecturesBernardo Innocenti2-1/+46
This offers a generic do_div64() that actually does the right thing, unlike some architectures that "optimized" the 64-by-32 divide into just a 32-bit divide. Both ppc and sh were already providing an assembly optimized __div64_32(). I called my function the same, so that their optimized versions will automatically override mine in lib.a. I've only tested extensively on m68knommu (uClinux) and made sure generated code is reasonably short. Should be ok also on parisc, since it's the same algorithm they were using before. - add generic C implementations of the do_div() for 32bit and 64bit archs in asm-generic/div64.h; - add generic library support function __div64_32() to handle the full 64/32 case on 32bit archs; - kill multiple copies of generic do_div() in architecture specific subdirs. Most copies were either buggy or not doing what they were supposed to do; - ensure all surviving instances of do_div() have their parameters correctly parenthesized to avoid funny side-effects;
2003-07-03[PATCH] kobject: add kobject_rename()Greg Kroah-Hartman1-0/+15
Based on a patch written by Dan Aloni <da-x@gmx.net>
2003-06-22[PATCH] add dvb subsystem as a crc32 lib userMichael Hunold1-0/+1
- add dvb subsystem as a crc32 lib user
2003-06-15[kobject] Add sequence number to kobject hotplug.Patrick Mochel1-0/+11
2003-06-12Merge tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5Kai Germaschewski1-11/+10
into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.make
2003-06-10[kobject] Don't specially order objects in lists based on parent.Patrick Mochel1-6/+7
Previously, we would insert kobjects into their kset's lists at different locations based on if they had a parent or not - We kept an explicit depth-first list by placing devices directly before their parents. However, we don't need strict ordering. Assuming that a subordinate device is always added after its parent (true), then by adding them to the end of the list, then subordinate objects will always be farther down the list than their parent objects. We don't need to do anything special..
2003-06-10Merge bk://linux-sam.bkbits.net/kbuildKai Germaschewski1-11/+10
into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.make
2003-06-08[PATCH] Two more sources of "non-ANSI parameter list" warningsSteven Cole1-3/+4
This removes the last sources of "non-ANSI parameter list" warnings for zlib_deflate.
2003-06-09Merge mars.ravnborg.org:/home/sam/src/linux/kernel/bk/linux-2.5Sam Ravnborg1-11/+10
into mars.ravnborg.org:/home/sam/src/linux/kernel/bk/kbuild
2003-06-07[PATCH] zlib merge: avoid 8-bit window errorsJörn Engel1-1/+1
More merging from zlib-1.1.4 force windowBits > 8 to avoid a bug in the encoder for a window size of 256 bytes. (A complete fix will be available in 1.1.5). James Carlson: The problem is that s->strstart gets set to a very large positive integer when wsize (local copy of s->w_size) is subtracted in deflate.c:fill_window(). This happens because MAX_DIST(s) resolves as a negative number when the window size is 8 -- MAX_DIST(s) is defined as s->w_size-MIN_LOOKAHEAD in deflate.h. MIN_LOOKAHEAD is MAX_MATCH+MIN_MATCH+1, and that is 258+3+1 or 262. Since a window size of 8 gives s->w_size 256, MAX_DIST(s) is 256-262 or -6. This results in read_buf() writing over memory outside of s->window, and a crash.
2003-06-07[PATCH] zlib merge: return codeJörn Engel1-1/+1
Don't think anyone actually bothers to check specific error codes, but it shouldn't hurt either.
2003-06-07[PATCH] zlib cleanup: unnecessary cast removalJörn Engel3-7/+6
This removes unnecessary NULL casting.
2003-06-07[PATCH] zlib cleanup: Z_NULL removalJörn Engel5-46/+46
s/Z_NULL/NULL/g.
2003-06-07[PATCH] zlib cleanup: localJörn Engel5-76/+76
Simple s/local/static/.
2003-06-07[PATCH] zlib merge: inffast.cJörn Engel1-16/+29
Most of it is reformatting, but the functional bits should fix real problems. A loop is introduced, just like in the turboc patch and one of the three condition bodies has been expanded.
2003-06-07[PATCH] zlib merge: turbocJörn Engel1-8/+2
This is the first bit of the missing merge towards 1.1.4. Applies on top of the previous cleanups. This one rips out an ugly #ifdef and seems to catch a theoretical error possibility. Always thought that they fixed more than they officially admitted.
2003-06-07[PATCH] be more flexible about creating library archivesSam Ravnborg1-6/+5
New makefile variable introduced: lib-y The lib-y syntax allows you to do the usual tricks such as: lib-$(CONFIG_SMP) += percpu_counter.o A built-in.o is always present in a directory that list .o files in either obj-* or lib-*. In contrast, lib.a is made only when lib-y is defined. I also updated lib/Makefile, so that crc32.o is now always built-in if selected.
2003-06-06[PATCH] Another final K&R to ANSI C cleanup of zlibSteven Cole2-28/+39
Here is another final K&R to ANSI C cleanup patch for zlib.
2003-06-07kbuild: Nice output when generating crc32 tableSam Ravnborg1-11/+10
2003-06-05zlib cleanup: final fixupsLinus Torvalds1-3/+3
Jörn missed a few places of FAR conversion in inflate
2003-06-05[PATCH] zlib cleanup: OFJörn Engel9-72/+72
Remove the stale support for K&R function declarations through the OF() macro. This is the last patch to clean up zconf.h, at least for now.
2003-06-05[PATCH] zlib cleanup: ZEXPORTJörn Engel2-10/+10
Just a simple s/ZEXPORT//.
2003-06-05[PATCH] zlib cleanup: ZEXTERNJörn Engel1-1/+1
This one was just simple s/ZEXTERN/extern/g.
2003-06-05[PATCH] zlib cleanup: remove FAR macroJörn Engel12-129/+128
This removes FAR, the typedefs using FAR (Bytef and friends) and the function prototypes for zalloc and zfree that should have gone earlier already.
2003-06-04[kobject] Add warning + back trace if kobject_get() is called with 0 refcount.Patrick Mochel1-2/+3
2003-06-04[kobject] Remove kobj_lock and use lockless refcounting. Patrick Mochel1-16/+2
The only thing preventing this from happening earlier was the circular sysfs registration dependency - it would need to be initialized before it was registered, but needed to be registered before it was initialized. With kobjects gone from struct filesystem_type, the dependency no longer exists and we don't have to special-case the possibility that a kobject will be passed to kobject_get with a refcount == 0. Note that a kobject with a count of 0 in that function is still a bug, but one in the subsystem making the call. We should add a debugging hook to dump the stack if it does happen.
2003-06-03[kobject] Update Documentation and licenses. Patrick Mochel1-0/+5
- Make it very explicit that supplying an object desctructor is imperative if using the interface for object reference counting. - Add GPL statement to the source files. - Add GFL (http://www.fsf.org/licenses/fdl.html) statement to documentation.
2003-05-30[PATCH] More ANSI C cleanup of zlibSteven Cole1-22/+29
More zlib K&R to ANSI C function header conversions.
2003-05-29[PATCH] Yet more K&R to ANSI C conversionsSteven Cole1-60/+79
More K&R to ANSI C conversions for lib/zlib_deflate.
2003-05-29[PATCH] K&R to ANSI C conversions for zlibSteven Cole1-15/+16
Here are some more K&R to ANSI C conversions.
2003-05-27Make zlib_inflate look more like ANSI C code.Linus Torvalds6-98/+124
Anybody who still thinks K&R makes sense should just be shot.
2003-05-25Do a strlcat() to go with the strlcpy().Linus Torvalds1-0/+27
2003-05-24Add 'strlcpy()' implementationLinus Torvalds1-0/+27
2003-05-14Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virginPatrick Mochel1-1/+5
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
2003-05-14[PATCH] Fix types on inflate.c constantsDave Jones1-2/+2
This patch from Alan went into 2.4 last august with the comment "get the types right on the lib/inflate.c constants"
2003-05-12Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virginPatrick Mochel1-1/+5
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
2003-05-11[BRLOCK]: Kill big reader locks, no longer used.Stephen Hemminger2-73/+1
2003-05-07Make lib/inflate.c look remotely like ANSI C, so that it can beLinus Torvalds1-19/+25
properly checked with the rest of the kernel.
2003-04-29[PATCH] percpu counters cause UML compilation errors in with SMPAndrew Morton1-0/+1
The percpu counters break UML SMP compilation (in current 2.5.58 bk snapshot) (first NR_CPUS undeclared in header, then dereference of incomplete structure in .c file)
2003-04-28kobject: kobj_lock needs to be grabed using spinlock_irqGreg Kroah-Hartman1-6/+18
This is because some subsystems (cough, usb...) can grab a kobject from irq context. This lock can be completely removed once the sysfs_init() code is cleaned up. Patch originally by Andrew Morton.
2003-04-16kobject: Add better debugging for failed registrations.Patrick Mochel1-1/+5
From Steve Hemminger (shemminger@osdl.org)
2003-04-12[PATCH] percpu_counters: approximate but scalable countersAndrew Morton2-0/+19
Several places in ext2 and ext3 are using filesystem-wide counters which use global locking. Mainly for the orlov allocator's heuristics. To solve the contention which this causes we can trade off accuracy against speed. This patch introduces a "percpu_counter" library type in which the counts are per-cpu and are periodically spilled into a global counter. Readers only read the global counter. These objects are *large*. On a 32 CPU P4, they are 4 kbytes. On a 4 way p3, 128 bytes.
2003-04-12[PATCH] radix_tree_delete API improvementAndrew Morton1-7/+11
radix_tree_delete() currently returns 0 on success, -ENOENT if there was nothing to delete. But it is more useful to return the address of the deleted item on success and NULL if there was no matching item. It can potentially save a lookup+delete operation.
2003-04-12[PATCH] kobject hotplug fixesAndrew Morton1-16/+12
- allocated storage `envp' was being leaked on an error path - kmalloc() returns void*, no need to cast it - don't return 0 from a void-returning function Greg has acked this patch.
2003-04-04kobject: cause /sbin/hotplug to be called when kobjects are added and removedGreg Kroah-Hartman1-8/+162
This only happens if a kobject belongs to a subsystem that has specified a set of hotplug operations. Based on work done by Kevin Fleming <kpfleming@cox.net>
2003-03-30Merge nuts.ninka.net:/home/davem/src/BK/network-2.5David S. Miller1-4/+5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
2003-03-28[CRYPTO]: Add Deflate algorithm to crypto API.James Morris1-4/+5
2003-03-28[PATCH] POSIX timers interface long/int cleanupAndrew Morton1-2/+2
From: Eric Piel <Eric.Piel@Bull.Net> Fixes some long/int confusion on 64-bit machines which was causing failures on ia64 - we end up trying to set bits in the 32-63 range on an int and the kernel locks up. Also cleans up idr.h. George has acked this change.
2003-02-24[PATCH] crc32 optimizationsAndrew Morton2-26/+22
Patch from Joakim Tjernlund <joakim.tjernlund@lumentis.se> Here is another update(against BK curr) for crc32(). A kind soul pointed out the optimizations below. lib/crc32defs.h: - Make it possible to define new values for CRC_LE_BITS/CRC_BE_BITS without modifying the source. lib/crc32.c: - Eliminate the need for ENDIAN_SHIFT. Saves a 24 bit shift in the byte loops. - Swap the XOR expression in DO_CRC. gcc for x86 can not do that simple optimization itself(gcc 3.2.2 and RH gcc 2.96 tested). Will improve performance with 20-25% on x86.
2003-02-18[PATCH] lib/idr.c 64-bit fixesAndrew Morton1-4/+4
Various overflow problems compiling the lib/idr.c code for ppc64
2003-02-18Merge kroah.com:/home/greg/linux/BK/bleeding_edge-2.5Greg Kroah-Hartman1-1/+1
into kroah.com:/home/greg/linux/BK/gregkh-2.5
2003-02-17[PATCH] POSIX clocks & timersGeorge Anzinger2-1/+343
This is version 23 or so of the POSIX timer code. Internal changelog: - Changed the signals code to match the new order of things. Also the new xtime_lock code needed to be picked up. It made some things a lot simpler. - Fixed a spin lock hand off problem in locking timers (thanks to Randy). - Fixed nanosleep to test for out of bound nanoseconds (thanks to Julie). - Fixed a couple of id deallocation bugs that left old ids laying around (hey I get this one). - This version has a new timer id manager. Andrew Morton suggested elimination of recursion (done) and I added code to allow it to release unused nodes. The prior version only released the leaf nodes. (The id manager uses radix tree type nodes.) Also added is a reuse count so ids will not repeat for at least 256 alloc/ free cycles. - The changes for the new sys_call restart now allow one restart function to handle both nanosleep and clock_nanosleep. Saves a bit of code, nice. - All the requested changes and Lindent too :). - I also broke clock_nanosleep() apart much the same way nanosleep() was with the 2.5.50-bk5 changes. TIMER STORMS The POSIX clocks and timers code prevents "timer storms" by not putting repeating timers back in the timer list until the signal is delivered for the prior expiry. Timer events missed by this delay are accounted for in the timer overrun count. The net result is MUCH lower system overhead while presenting the same info to the user as would be the case if an interrupt and timer processing were required for each increment in the overrun count.
2003-02-17[PATCH] USB speedtouch: replace speedtouch crc routinesDuncan Sands1-1/+1
Use the kernel CRC routines rather than a do-it-yourself version. By the way, I created a common USB Makefile.lib, rather than having one for the class drivers, and one for speedtouch.
2003-02-14[PATCH] Use table lookup for radix_tree_maxindex()Andrew Morton1-6/+22
Patch from Szabolcs Berecz <szabi@mplayerhq.hu> With the following patch maxindex is taken from an array instead of recalculating it all the time.
2003-02-14[PATCH] crc32 improvementsAndrew Morton1-82/+73
Patch from Joakim Tjernlund <joakim.tjernlund@lumentis.se> I did the optimizations in the crc32 patch Brian Murphy submitted a while ago. Now I have cleaned it up a little and made some more optimizations. gcc is quite bad at loop optimizations (at least for PPC) so I have rewritten them to make gcc to generate better code. Even recent gcc's(3.2.x) produces better code. Also reduced the unrolling since it did not make a noticeable difference.
2003-02-11[PATCH] printk size_t qualifier confusionAndrew Morton1-4/+7
My printf manpage says: z A following integer conversion corresponds to a size_t or ssize_t argument. (Linux libc5 has Z with this meaning. Don't use it.) And the opengroup spec says z Specifies that a following d , i , o , u , x , or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to a size_t argument. yet our vsnprintf implementation has /* 'z' support added 23/7/1999 S.H. */ /* 'z' changed to 'Z' --davidm 1/25/99 */ I guess the path of least surprise is to support both. gcc-3.2.1 doesn't seem to care.
2003-02-10[PATCH] remove unneeded test from radix_tree_extend()Andrew Morton1-2/+1
Patch from: Szabolcs Berecz <szabi@mplayerhq.hu> No need to check root->rnode in the loop. In the loop it remains nonzero.
2003-02-03kbuild: Remove export-objs := ... statementsKai Germaschewski3-7/+0
One of the goals of the whole new modversions implementation: export-objs is gone for good!
2003-01-13kobject: export kset_find_obj.Patrick Mochel1-1/+3
From Louis Zhang.
2003-01-09kobject: make sure we remove kobject from list if kobject_add() failes.Patrick Mochel1-10/+26
Originally from Louis Zhang.
2003-01-09kobject.c fix compile when DEBUG is defined.Patrick Mochel1-2/+2
- From Greg k-h
2003-01-06Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virginPatrick Mochel2-27/+66
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
2003-01-06Merge bk://linux.bkbits.net/linux-2.5Patrick Mochel1-2/+2
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
2003-01-06add kset_find_obj() to search for object in a kset's list.Patrick Mochel1-0/+33
The operation is simple: - Take read lock for kset. - Iterate over kset->list. - Compare name to each kobject's name. - Return kobject if found.
2003-01-06Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-corePatrick Mochel1-34/+103
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-kobject
2003-01-05kobjects: Remove kobject::subsys and subsystem::kobj.Patrick Mochel1-10/+12
The kobject core no longer references a subsystem directly through a kobject, instead using the kobject's dominant kset to reference the subsystem. The registrants of kobjects have been fixed up. To aid in this process, a few helpers were introdcuced: - kobj_set_kset_s(obj,subsys) - kset_set_kset_s(obj,subsys) - subsys_set_kset(obj,subsys) that set the kset ptr of embedded kobjects for objects that have different embedded types. See include/linux/kobject.h for more description and usage. struct subsystem::kobj is also removed, relying solely on a subsystem's embedded kset for hierarchy information. Since this requires modification of the subsystem declarations, a helper macro has been defined: decl_subsys(name,type) which initializes the name and ktype fields of the subsystem's embedded kset. All the subsystem declarations have been fixed up.
2003-01-05Merge bk://linux.bkbits.net/linux-2.5Patrick Mochel1-25/+64
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
2003-01-05Introduce struct kset.Patrick Mochel1-27/+93
struct kset is what struct subsystem should have originally been called. It is a set of kobjects, and nothing more, with a much less confusing name than 'subsystem.' struct kset contains an embedded kobject, making it possible to represent it in the object hierarchy, and sysfs. This also provides a means for objects to easily express a list of subordinate objects. struct subsystem still exists, and contains an rwsem, which its subordinate ksets use to protect their lists. An arbitrary number of ksets may belong to a subsystem. A ksets specifies the subsystem it belongs to via its ->subsys field. struct subsystem also contains a default kset, which may be used without having to define a separate kset. The objects that defined subordinate subsystems (bus and class drivers) have been converted to use subordinate ksets instead. Note that the usage of ksets is flexible. - ksets may contain a list of objects of any type, not just kobjects. - The objects registered with a kset do not have to be registered. - ksets themselves do not have to be registered. One can be used by simply calling kset_init(). - ksets do not need a name if they are not registered. - Note however that locking must be done manually in these cases.
2003-01-05[CRC32]: Fix pointer casts on 64-bit.David S. Miller1-2/+2
2003-01-05[PATCH] infrastructure for handling radix_tree_node allocationAndrew Morton1-25/+64
radix_tree_node_alloc() uses GFP_ATOMIC, under spinlocking. If the allocation fails then userspace sees ENOMEM and application failure occurs. A single add_to_page_cache() will require up to six radix_tree_nodes on 32-bit machines, twice this on 64-bit machines (quadruple the worst-case storage on 64-bit). My approach to solving this problem is to create a per-cpu pool of preallocated radix_tree_nodes, private to the radix-tree code. The radix-tree user will call the new radix-tree API function radix_tree_preload() to ensure that this pool has sufficient nodes to cover the worst-case. radix_tree_preload() should be called outside locks, with GFP_KERNEL so that it can run page reclaim. If it succeeds, radix_tree_preload() will return with preemption disabled so that the per-cpu radix_tree_node pool is protected. The user must call radix_tree_preload_end() to terminate the transaction. In the common case, the per-cpu pools will never be touched: radix_tree_insert() will only dip into the pool if kmem_cache_alloc() fails. The pools will remain full at all times. This is to optimise the fastpath - it is just a few instructions. This patch also removes the now-unneeded radix-tree mempool. This saves 130 kbytes of permanently allocated kernel memory. 260k on 64-bit platforms.
2003-01-04kobject: Introduce struct kobj_type. Patrick Mochel1-5/+6
This is the first step in morphing struct subsystem into something meaningful. A subsystem is defined simply as a list of kobjects of a certain type, which is far too generic. A subsystem should be representative of a large entity of code (i.e. a subsystem of the kernel), not just a simple list. This changeset: - Creates struct kobj_type, a descriptor of the type a kobject is embedded in. - Extracts the fields that are specific to a particular object type from struct subsystem and puts them in struct kobj_type, which are - the object's release method. - the sysfs operations for the object type. - the default attributes of the object type. - Adds ptr to struct kobject to point to its type descriptor. - Converts the existing subsystem definitions to define struct kobj_type. struct kobj_type's are not registered, as they do not have any explicit representation in the object hierarchy, nor do they have any fields that need runtime initialization. A kobject's ktype should be set when it is registered, like its subsystem. Note this obviates the need for defining a struct subsystem when an object type does not need to be kept in a global list.
2003-01-03Merge bk://linux.bkbits.net/linux-2.5Patrick Mochel1-10/+11
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
2003-01-03[netdrvr] ethernet crc fixesJeff Garzik1-10/+11
* ether_crc has always been wrong in 2.5.x. ug. we want bitreverse crc32_le instead * use ether_crc in natsemi
2003-01-01Merge bk://linux.bkbits.net/linux-2.5Patrick Mochel1-1/+2
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
2003-01-01From louis.zhuang@intel.com: missed field_width reset in vsscanf()Linus Torvalds1-1/+2
2002-12-30Merge bk://linux.bkbits.net/linux-2.5Patrick Mochel4-150/+241
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
2002-12-29[PATCH] crc32 speedup/use anywhereBrian Murphy4-150/+241
This patch combines my patch which statically initialises the crc32 tables so they can be used at any time (during initialisation) and Joakim Tjernlund's patch to speed up the crc calculations by doing word operations instead of exclusively byte. The crc routines are used extensively in jffs2 where speed is very important. I need the crc32 routines to calculate a checksum on values read from an eeprom which contain cpu speed and memory size information - so they are needed very much earlier in the initialisation process than they are currently available.
2002-12-23Merge bk://linux.bkbits.net/linux-2.5Patrick Mochel1-4/+7
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
2002-12-21[PATCH] don't cacheline-align radix_tree_nodesAndrew Morton1-1/+1
They are 260 bytes. We can get 15 per page without cacheline alignment. But we're currently only getting ten per page on P4.
2002-12-19kobjects: minor updatesPatrick Mochel1-4/+7
- check if subsystem is NULL during subsys_get(). - Don't increment parent's reference count before we check if we have a valid kobject during kobject_add() - Do kobject_add() in subsys_register(), instead of kobject_register(), since we've already done kobject_init().
2002-12-14[PATCH] Module Parameter Core PatchRusty Russell1-3/+3
This patch is a rewrite of the insmod and boot parameter handling, to unify them. The new format is fairly simple: built on top of __module_param_call there are several helpers, eg "module_param(foo, int, 000)". The final argument is the permissions bits, for exposing parameters in sysfs (if non-zero) at a later stage.
2002-12-14[PATCH] Remove Rules.make from Makefiles (3/3)Brian Gerst3-6/+0
Makefiles no longer need to include Rules.make, which is currently an empty file. This patch removes it from the remaining Makefiles, and removes the empty Rules.make file.
2002-12-14[PATCH] handle overflows in radix_tree_gang_lookup()Andrew Morton1-11/+9
Fix a radix-tree bug spotted by Vladimir Saveliev <vs@namesys.com>. Each step in the radix tree spans six address bits. So a height=6 tree spans 36-bits worth of nodes. On 32-bit machines radix_tree_gang_lookup() doesn't handle this right - at the 12TB mark it wraps back to zero, and returns pages at quite wrong indices. The patch fixes all that up, and tidies a couple of things. A user-space test harness was developed so that the code can be sanely tested. It is at http://www.zip.com.au/~akpm/linux/patches/stuff/rtth.tar.gz
2002-12-01kobjects: don't do cleanup if kobject_add() fails.Patrick Mochel1-2/+1
kobject_register() has the rude behavior that it will attempt to clean up the kobject if kobject_add() fails. This replaces that with a WARN_ON() for the return value, and leaves the cleanup to the caller.
2002-12-01Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virginPatrick Mochel2-4/+0
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
2002-12-01[PATCH] module names fixRusty Russell2-4/+0
By Kai Germaschewski: "Well, I have another solution, which doesn't need additional Makefile magic or anything. I just put the module name into each .o file where <linux/module.h> is included. Putting it into the section .gnu.linkonce.modname has the effect that even for multi-part modules, we only end up with one copy of the name. Caveat: I'm using the preprocessor macro KBUILD_MODNAME to know what to put into .gnu.linkonce.modname. The following used to happen: (drivers/isdn/eicon/Makefile) divas-objs := common.o Divas_mod.o ... eicon-objs := common.o eicon_mod.o ... Divas_mod.o is compiled with -DKBUILD_MODNAME=divas eicon_mod.o is compiled with -DKBUILD_MODNAME=eicon common.o is compiled with -DKBUILD_MODNAME=divas_eicon So in the case above, both divas.o and eicon.o would end up with a .gnu.linkonce.modname section containing "divas_eicon" My fix to this is to not define KBUILD_MODNAME when compiling an object whilch will be linked into more than one module - so common.o gets no .gnu.linkonce.modname section at all. Works fine here. Now, doing this I remove one of the reasons why we would need modules linked as '.ko' ;), but it seems much cleaner than generating a temporary file, using objcopy etc."
2002-11-24Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virginPatrick Mochel1-0/+34
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
2002-11-21[PATCH] radix-tree reinitialisation fixAndrew Morton1-0/+3
This patch fixes a problem which was discovered by Vladimir Saveliev <vs@namesys.com> Radix trees have a `height' field, which defines how far the pages are from the root of the tree. It starts out at zero and increases as the trees depth is grown. But it is never decreased. It cannot be decreased without a full tree traversal. Because radix_tree_delete() does not decrease `height', we end up returning inodes to their filesystem's inode slab cache with a non-zero height. And when that inode is reused from slab for a new file, it still has a non-zero height. So we're breaking the slab rules by not putting objects back in a fully reinitialised state. So the new file starts out life with whatever height the previous owner of the inode had. Which is space- and speed-inefficient. The most efficient place to fix this would be in destroy_inode(). But that only fixes the problem for inodes - there are other users of radix trees. So fix it in radix_tree_delete(): if the tree was emptied, reset `height' to zero.
2002-11-21Allow subsystem to have attributes, too. Patrick Mochel1-0/+34
This is really handy for subsystems that have any attributes they want to export, esp. if they have just a few, since they don't have to define all of the infrastructure for creating and tearing down the attributes for the high level type that they are. - define struct subsys_attribute for declaring attributes of subsystems themselves. - define subsys_create_file() and subsys_remove_file(). - define subsys_sysfs_ops for forwarding sysfs reads and writes to the subsystem attribute callbacks. - Set the sysfs_ops to be the subsystem ones if the kobject doesn't belong to a subsystem itself (meaning that it is a subsystem).
2002-11-18kobject - expose backend helpers to registration interface.Patrick Mochel1-58/+94
The interface should now be more sane and protect against races better. kobject_register() was split into two helpers: kobject_init() and kobject_add(). It calls both consecutively, though both are also exposed for use by users that want to use the objects w/o adding them to the object hierarchy. kobject_unregister() was made simply a wrapper for kobject_del() and kobject_put(), which are both also exposed. The guts of kobject_put() was moved into kobject_cleanup(), which it calls when the reference count hits 0. (This was done for clarity). The infrastructure now takes a lot in kobject_get() and kobject_put() when checking and modifying the objects' reference counts. This was an obvious one that hsould have been fixed long ago. kobject_add() increments the refcount of the object, which is decremented when kobject_del() is called. This guarantees that the object's memory cannot be freed if it has been added to the hierarchy, and kobject_del() has not been called on it. kobject_init() is now the function that increments the refcount on the object's subsystem, which is decremented only after its release() method has been called for the object in kobject_cleanup(). The documentation has been updated to reflect these changes.
2002-11-18make sure DEBUG is #undef'd so it's really turned offPatrick Mochel1-1/+1
...since macro using it was changed from #if to #ifdef..
2002-11-16[PATCH] add strcspn() library functionRusty Russell1-0/+23
This patch implements a generic strcspn.
2002-11-10[PATCH] In-kernel Module LoaderRusty Russell2-0/+4
This is an implementation of the in-kernel module loader extending the try_inc_mod_count() primitive and making its use compulsory. This has the benifit of simplicity, and similarity to the existing scheme. To reduce the cost of the constant increments and decrements, reference counters are lockless and per-cpu. Eliminated (coming in following patches): o Modversions o Module parameters o kallsyms o EXPORT_SYMBOL_GPL and MODULE_LICENCE checks o DEVICE_TABLE support. New features: o Typesafe symbol_get/symbol_put o Single "insert this module" syscall interface allows trivial userspace. o Raceless loading and unloading You will need the trivial replacement module utilities from: http://ozlabs.org/~rusty/module-init-tools-0.6.tar.gz
2002-11-07[PATCH] Fix sscanf("-1", "%d", &i)Randy Dunlap1-6/+11