Re: Significance Of sort() In include/linux/sort.h
From: Valdis . Kletnieks
Date: Wed Jun 18 2008 - 15:00:46 EST
On Wed, 18 Jun 2008 20:39:38 +0200, Soumyadip Das Mahapatra said:
> Hello everybody,
> I dont understand what is the significance of keeping
> include/linux/sort.h and lib/sort.c while i think there is
> none using (#include<linux/sort.h>) it. Can anyone explaint it?
Huh? Am I missing something here?
[/usr/src/linux-2.6] find . -name '*.[ch]' | xargs grep linux/sort
./arch/x86/kernel/setup_64.c:#include <linux/sort.h>
./arch/x86/kernel/mmconf-fam10h_64.c:#include <linux/sort.h>
./arch/x86/kernel/test_nx.c:#include <linux/sort.h>
./arch/sparc/prom/memory.c:#include <linux/sort.h>
./arch/sparc64/mm/init.c:#include <linux/sort.h>
./arch/powerpc/kernel/module_32.c:#include <linux/sort.h>
./arch/powerpc/kernel/module_64.c:#include <linux/sort.h>
./arch/ia64/mm/extable.c:#include <linux/sort.h>
./kernel/cgroup.c:#include <linux/sort.h>
./kernel/cpuset.c:#include <linux/sort.h>
./kernel/lockdep_proc.c:#include <linux/sort.h>
./drivers/net/pppol2tp.c:#include <linux/sort.h>
./drivers/media/video/saa7134/saa7134-video.c:#include <linux/sort.h>
./drivers/media/video/v4l2-int-device.c:#include <linux/sort.h>
./drivers/message/fusion/mptfc.c:#include <linux/sort.h>
./lib/extable.c:#include <linux/sort.h>
./lib/sort.c:#include <linux/sort.h>
./fs/nfs_common/nfsacl.c:#include <linux/sort.h>
./fs/gfs2/glock.c:#include <linux/sort.h>
./fs/gfs2/inode.c:#include <linux/sort.h>
./fs/gfs2/quota.c:#include <linux/sort.h>
./fs/gfs2/dir.c:#include <linux/sort.h>
./fs/xfs/linux-2.6/xfs_linux.h:#include <linux/sort.h>
./mm/page_alloc.c:#include <linux/sort.h>
Lotta includes of the header. And does anybody use the one function in it?
[/usr/src/linux-2.6] find . -name '*.c' | xargs grep 'sort(' | wc
66 376 5054
[/usr/src/linux-2.6] find . -name '*.c' | xargs grep '[ ]sort(' | head
./arch/x86/kernel/mmconf-fam10h_64.c: sort(range, hi_mmio_num, sizeof(struct range), cmp_range, NULL);
./arch/sparc/prom/memory.c: sort(sp_banks, num_ents, sizeof(struct sparc_phys_banks),
./arch/sparc64/mm/init.c: sort(regs, ents, sizeof(struct linux_prom64_registers),
./arch/sparc64/mm/init.c: sort(prom_trans, ents, sizeof(struct linux_prom_translation),
./arch/powerpc/kernel/module_32.c: sort((void *)hdr + sechdrs[i].sh_offset,
./arch/powerpc/kernel/module_64.c: sort((void *)sechdrs[i].sh_addr,
./arch/ia64/mm/extable.c: sort(start, finish - start, sizeof(struct exception_table_entry),
./kernel/cgroup.c: sort(pidarray, npids, sizeof(pid_t), cmppid, NULL);
./kernel/lockdep_proc.c: sort(data->stats, data->iter_end - data->iter,
./drivers/media/video/saa7134/saa7134-video.c: sort(col, cols, sizeof col[0], cliplist_cmp, NULL);
Looks like people call it too. OK, I admit I haven't gone and checked
whether all of those have #ifdef-0 magic around them that render them dead code,
but I suspect lots of them are live code...
What made you think it wasn't used?
Attachment:
pgp00000.pgp
Description: PGP signature