Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux...
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 17 Oct 2007 16:00:30 +0000 (09:00 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 17 Oct 2007 16:00:30 +0000 (09:00 -0700)
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup:
  Remove magic macros for screen_info structure members
  [x86] remove uses of magic macros for boot_params access

666 files changed:
Documentation/00-INDEX
Documentation/CodingStyle
Documentation/DMA-mapping.txt
Documentation/DocBook/deviceiobook.tmpl
Documentation/DocBook/filesystems.tmpl
Documentation/DocBook/gadget.tmpl
Documentation/DocBook/kernel-api.tmpl
Documentation/HOWTO
Documentation/RCU/00-INDEX [new file with mode: 0644]
Documentation/SM501.txt
Documentation/accounting/getdelays.c
Documentation/atomic_ops.txt
Documentation/dontdiff
Documentation/early-userspace/README
Documentation/email-clients.txt [new file with mode: 0644]
Documentation/feature-removal-schedule.txt
Documentation/filesystems/00-INDEX
Documentation/filesystems/quota.txt [new file with mode: 0644]
Documentation/filesystems/ramfs-rootfs-initramfs.txt
Documentation/firmware_class/firmware_sample_firmware_class.c
Documentation/initrd.txt
Documentation/kdump/kdump.txt
Documentation/kernel-parameters.txt
Documentation/keys-request-key.txt
Documentation/keys.txt
Documentation/local_ops.txt
Documentation/m68k/kernel-options.txt
Documentation/make/headers_install.txt [new file with mode: 0644]
Documentation/mips/00-INDEX [new file with mode: 0644]
Documentation/mutex-design.txt
Documentation/networking/rxrpc.txt
Documentation/power/00-INDEX [new file with mode: 0644]
Documentation/power/drivers-testing.txt
Documentation/powerpc/00-INDEX
Documentation/ramdisk.txt
Documentation/scsi/ChangeLog.ncr53c8xx
Documentation/scsi/ibmmca.txt
Documentation/scsi/ncr53c8xx.txt
Documentation/sysctl/00-INDEX [new file with mode: 0644]
Documentation/sysctl/kernel.txt
Documentation/sysctl/vm.txt
Documentation/telephony/00-INDEX [new file with mode: 0644]
Documentation/vm/00-INDEX [new file with mode: 0644]
Documentation/vm/slabinfo.c
Documentation/w1/00-INDEX [new file with mode: 0644]
Documentation/w1/masters/00-INDEX [new file with mode: 0644]
Documentation/w1/masters/ds2482
Documentation/w1/masters/ds2490
Documentation/xterm-linux.xpm [deleted file]
MAINTAINERS
arch/arm/kernel/sys_arm.c
arch/arm/kernel/sys_oabi-compat.c
arch/arm/plat-s3c24xx/dma.c
arch/avr32/mm/dma-coherent.c
arch/cris/kernel/sys_cris.c
arch/frv/kernel/sys_frv.c
arch/h8300/kernel/sys_h8300.c
arch/i386/Kconfig
arch/ia64/Kconfig
arch/ia64/ia32/binfmt_elf32.c
arch/ia64/ia32/elfcore32.h
arch/ia64/kernel/machine_kexec.c
arch/ia64/mm/discontig.c
arch/m32r/kernel/sys_m32r.c
arch/m68k/kernel/sys_m68k.c
arch/m68knommu/kernel/sys_m68k.c
arch/mips/Makefile
arch/mips/kernel/irixelf.c
arch/mips/kernel/linux32.c
arch/mips/kernel/syscall.c
arch/mips/mm/cache.c
arch/mips/pci/ops-pmcmsp.c
arch/powerpc/Kconfig
arch/powerpc/kernel/binfmt_elf32.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/rtas_flash.c
arch/powerpc/kernel/sys_ppc32.c
arch/powerpc/kernel/syscalls.c
arch/powerpc/mm/hugetlbpage.c
arch/powerpc/mm/init_64.c
arch/powerpc/mm/slice.c
arch/powerpc/platforms/cell/spufs/inode.c
arch/powerpc/platforms/pasemi/setup.c
arch/s390/kernel/compat_linux.c
arch/s390/kernel/sys_s390.c
arch/s390/mm/cmm.c
arch/sh/drivers/pci/dma-dreamcast.c
arch/sh/kernel/sys_sh.c
arch/sh/mm/consistent.c
arch/sh/mm/pmb.c
arch/sh64/kernel/sys_sh64.c
arch/sh64/mm/consistent.c
arch/sparc/Kconfig
arch/sparc/kernel/sys_sparc.c
arch/sparc64/Kconfig
arch/sparc64/kernel/binfmt_aout32.c
arch/sparc64/kernel/sys_sparc.c
arch/sparc64/kernel/sys_sparc32.c
arch/sparc64/solaris/ipc.c
arch/um/sys-i386/syscalls.c
arch/v850/kernel/syscalls.c
arch/x86/ia32/ia32_aout.c
arch/x86/ia32/ia32_binfmt.c
arch/x86/ia32/ipc32.c
arch/x86/kernel/machine_kexec_32.c
arch/x86/kernel/machine_kexec_64.c
arch/x86/kernel/mce_64.c
arch/x86/kernel/sys_i386_32.c
arch/x86/mm/pgtable_32.c
arch/x86_64/Kconfig
block/ll_rw_blk.c
drivers/acorn/char/defkeymap-l7200.c
drivers/base/dmapool.c
drivers/block/aoe/aoe.h
drivers/block/aoe/aoecmd.c
drivers/block/aoe/aoenet.c
drivers/block/cciss.c
drivers/block/floppy.c
drivers/block/loop.c
drivers/block/nbd.c
drivers/block/rd.c
drivers/char/Kconfig
drivers/char/agp/hp-agp.c
drivers/char/agp/i460-agp.c
drivers/char/agp/parisc-agp.c
drivers/char/consolemap.c
drivers/char/defkeymap.c_shipped
drivers/char/epca.c
drivers/char/hvc_console.c
drivers/char/ip2/ip2main.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/keyboard.c
drivers/char/lp.c
drivers/char/mbcs.c
drivers/char/mem.c
drivers/char/mxser.h
drivers/char/n_hdlc.c
drivers/char/ppdev.c
drivers/char/synclink.c
drivers/char/sysrq.c
drivers/char/tpm/tpm_tis.c
drivers/char/tty_ioctl.c
drivers/char/vt.c
drivers/char/vt_ioctl.c
drivers/dma/iop-adma.c
drivers/i2c/chips/menelaus.c
drivers/macintosh/adbhid.c
drivers/md/md.c
drivers/md/raid0.c
drivers/md/raid1.c
drivers/message/i2o/exec-osm.c
drivers/misc/Kconfig
drivers/misc/Makefile
drivers/misc/atmel-ssc.c [new file with mode: 0644]
drivers/mmc/host/mmc_spi.c
drivers/mtd/ubi/eba.c
drivers/net/3c59x.c
drivers/net/Kconfig
drivers/net/bonding/bond_main.c
drivers/net/bonding/bonding.h
drivers/net/e1000e/ethtool.c
drivers/net/e1000e/hw.h
drivers/net/forcedeth.c
drivers/net/gianfar.c
drivers/net/ibm_newemac/mal.c
drivers/net/skge.c
drivers/net/skge.h
drivers/net/spider_net.h
drivers/net/tokenring/3c359.c
drivers/pcmcia/Kconfig
drivers/pcmcia/Makefile
drivers/pcmcia/electra_cf.c [new file with mode: 0644]
drivers/pnp/Makefile
drivers/pnp/card.c
drivers/pnp/core.c
drivers/pnp/driver.c
drivers/pnp/interface.c
drivers/pnp/manager.c
drivers/pnp/pnpacpi/core.c
drivers/pnp/pnpacpi/rsparser.c
drivers/pnp/pnpbios/core.c
drivers/pnp/pnpbios/proc.c
drivers/pnp/quirks.c
drivers/pnp/resource.c
drivers/pnp/system.c
drivers/s390/char/defkeymap.c
drivers/s390/char/keyboard.c
drivers/s390/char/keyboard.h
drivers/serial/jsm/jsm_tty.c
drivers/tc/.gitignore [deleted file]
drivers/tc/Makefile
drivers/tc/lk201-map.c_shipped [deleted file]
drivers/tc/lk201-map.map [deleted file]
drivers/tc/lk201-remap.c [deleted file]
drivers/tc/lk201.c [deleted file]
drivers/tc/lk201.h [deleted file]
drivers/usb/core/usb.c
drivers/usb/mon/mon_text.c
drivers/usb/storage/libusual.c
drivers/video/omap/lcd_h3.c
drivers/video/omap/lcd_inn1610.c
drivers/w1/masters/matrox_w1.c
fs/Kconfig
fs/Makefile
fs/adfs/super.c
fs/affs/bitmap.c
fs/affs/super.c
fs/afs/callback.c
fs/afs/cell.c
fs/afs/cmservice.c
fs/afs/internal.h
fs/afs/mntpt.c
fs/afs/proc.c
fs/afs/rxrpc.c
fs/afs/server.c
fs/afs/super.c
fs/afs/vlocation.c
fs/afs/write.c
fs/aio.c
fs/anon_inodes.c
fs/attr.c
fs/autofs4/inode.c
fs/befs/linuxvfs.c
fs/bfs/inode.c
fs/binfmt_aout.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/binfmt_flat.c
fs/binfmt_som.c
fs/block_dev.c
fs/buffer.c
fs/char_dev.c
fs/cifs/cifsfs.c
fs/coda/inode.c
fs/compat_ioctl.c
fs/configfs/configfs_internal.h
fs/configfs/dir.c
fs/configfs/inode.c
fs/configfs/mount.c
fs/cramfs/inode.c
fs/dcache.c
fs/dlm/Kconfig
fs/dquot.c
fs/ecryptfs/main.c
fs/efs/super.c
fs/exec.c
fs/ext2/balloc.c
fs/ext2/ext2.h
fs/ext2/file.c
fs/ext2/ialloc.c
fs/ext2/inode.c
fs/ext2/ioctl.c
fs/ext2/super.c
fs/ext2/xattr.c
fs/ext3/balloc.c
fs/ext3/bitmap.c
fs/ext3/dir.c
fs/ext3/ialloc.c
fs/ext3/namei.c
fs/ext3/resize.c
fs/ext3/super.c
fs/ext4/balloc.c
fs/ext4/bitmap.c
fs/ext4/dir.c
fs/ext4/ialloc.c
fs/ext4/resize.c
fs/ext4/super.c
fs/fat/cache.c
fs/fat/inode.c
fs/fcntl.c
fs/file_table.c
fs/fs-writeback.c
fs/fuse/dev.c
fs/fuse/dir.c
fs/fuse/file.c
fs/fuse/fuse_i.h
fs/fuse/inode.c
fs/gfs2/main.c
fs/gfs2/ops_file.c
fs/hfs/super.c
fs/hfsplus/super.c
fs/hpfs/super.c
fs/hugetlbfs/inode.c
fs/inode.c
fs/inotify_user.c
fs/isofs/compress.c
fs/isofs/inode.c
fs/isofs/namei.c
fs/jffs2/super.c
fs/jfs/jfs_metapage.c
fs/jfs/jfs_txnmgr.c
fs/jfs/super.c
fs/libfs.c
fs/locks.c
fs/minix/bitmap.c
fs/minix/inode.c
fs/minix/itree_v1.c
fs/minix/itree_v2.c
fs/namei.c
fs/namespace.c
fs/ncpfs/inode.c
fs/nfs/client.c
fs/nfs/inode.c
fs/nfs/write.c
fs/nfsd/vfs.c
fs/nls/Kconfig
fs/nls/nls_ascii.c
fs/nls/nls_base.c
fs/nls/nls_cp1250.c
fs/nls/nls_cp1251.c
fs/nls/nls_cp1255.c
fs/nls/nls_cp437.c
fs/nls/nls_cp737.c
fs/nls/nls_cp775.c
fs/nls/nls_cp850.c
fs/nls/nls_cp852.c
fs/nls/nls_cp855.c
fs/nls/nls_cp857.c
fs/nls/nls_cp860.c
fs/nls/nls_cp861.c
fs/nls/nls_cp862.c
fs/nls/nls_cp863.c
fs/nls/nls_cp864.c
fs/nls/nls_cp865.c
fs/nls/nls_cp866.c
fs/nls/nls_cp869.c
fs/nls/nls_cp874.c
fs/nls/nls_cp932.c
fs/nls/nls_cp936.c
fs/nls/nls_cp949.c
fs/nls/nls_cp950.c
fs/nls/nls_euc-jp.c
fs/nls/nls_iso8859-1.c
fs/nls/nls_iso8859-13.c
fs/nls/nls_iso8859-14.c
fs/nls/nls_iso8859-15.c
fs/nls/nls_iso8859-2.c
fs/nls/nls_iso8859-3.c
fs/nls/nls_iso8859-4.c
fs/nls/nls_iso8859-5.c
fs/nls/nls_iso8859-6.c
fs/nls/nls_iso8859-7.c
fs/nls/nls_iso8859-9.c
fs/nls/nls_koi8-r.c
fs/nls/nls_koi8-u.c
fs/ntfs/file.c
fs/ntfs/super.c
fs/ocfs2/dir.c
fs/ocfs2/dlm/dlmfs.c
fs/ocfs2/super.c
fs/open.c
fs/openpromfs/inode.c
fs/proc/base.c
fs/proc/inode.c
fs/proc/mmu.c
fs/proc/proc_misc.c
fs/qnx4/inode.c
fs/ramfs/Makefile
fs/ramfs/inode.c
fs/reiserfs/bitmap.c
fs/reiserfs/dir.c
fs/reiserfs/inode.c
fs/reiserfs/journal.c
fs/reiserfs/super.c
fs/romfs/inode.c
fs/select.c
fs/signalfd.c
fs/smbfs/inode.c
fs/splice.c
fs/super.c
fs/sysfs/dir.c
fs/sysfs/inode.c
fs/sysfs/mount.c
fs/sysfs/sysfs.h
fs/sysv/inode.c
fs/udf/balloc.c
fs/udf/super.c
fs/udf/udftime.c
fs/ufs/balloc.c
fs/ufs/cylinder.c
fs/ufs/dir.c
fs/ufs/file.c
fs/ufs/ialloc.c
fs/ufs/inode.c
fs/ufs/namei.c
fs/ufs/super.c
fs/ufs/symlink.c
fs/ufs/truncate.c
fs/ufs/ufs.h [new file with mode: 0644]
fs/ufs/util.c
fs/ufs/util.h
fs/utimes.c
fs/xfs/linux-2.6/kmem.h
fs/xfs/linux-2.6/xfs_aops.c
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/linux-2.6/xfs_super.c
include/Kbuild
include/asm-alpha/elf.h
include/asm-alpha/floppy.h
include/asm-alpha/io.h
include/asm-alpha/semaphore.h
include/asm-alpha/system.h
include/asm-arm/floppy.h
include/asm-arm/ipc.h [deleted file]
include/asm-arm/semaphore.h
include/asm-arm/types.h
include/asm-arm26/irq_regs.h [new file with mode: 0644]
include/asm-avr32/io.h
include/asm-avr32/semaphore.h
include/asm-avr32/types.h
include/asm-blackfin/io.h
include/asm-blackfin/ipc.h [deleted file]
include/asm-blackfin/semaphore.h
include/asm-blackfin/types.h
include/asm-cris/ipc.h [deleted file]
include/asm-cris/irq_regs.h [new file with mode: 0644]
include/asm-cris/semaphore.h
include/asm-cris/types.h
include/asm-frv/ipc.h [deleted file]
include/asm-frv/semaphore.h
include/asm-frv/types.h
include/asm-generic/Kbuild
include/asm-generic/Kbuild.asm
include/asm-generic/ipc.h [deleted file]
include/asm-h8300/io.h
include/asm-h8300/ipc.h [deleted file]
include/asm-h8300/semaphore.h
include/asm-h8300/types.h
include/asm-ia64/elf.h
include/asm-ia64/io.h
include/asm-ia64/numa.h
include/asm-ia64/semaphore.h
include/asm-ia64/system.h
include/asm-m32r/ipc.h [deleted file]
include/asm-m32r/semaphore.h
include/asm-m32r/types.h
include/asm-m68k/floppy.h
include/asm-m68k/io.h
include/asm-m68k/ipc.h [deleted file]
include/asm-m68k/semaphore.h
include/asm-m68k/types.h
include/asm-m68knommu/io.h
include/asm-m68knommu/ipc.h [deleted file]
include/asm-m68knommu/semaphore.h
include/asm-mips/floppy.h
include/asm-mips/io.h
include/asm-mips/ipc.h [deleted file]
include/asm-mips/semaphore.h
include/asm-mips/types.h
include/asm-parisc/floppy.h
include/asm-parisc/io.h
include/asm-parisc/semaphore.h
include/asm-parisc/types.h
include/asm-powerpc/Kbuild
include/asm-powerpc/elf.h
include/asm-powerpc/floppy.h
include/asm-powerpc/io.h
include/asm-powerpc/ipc.h [deleted file]
include/asm-powerpc/semaphore.h
include/asm-powerpc/system.h
include/asm-powerpc/types.h
include/asm-ppc/floppy.h
include/asm-ppc/io.h
include/asm-ppc/irq_regs.h [new file with mode: 0644]
include/asm-s390/ipc.h [deleted file]
include/asm-s390/semaphore.h
include/asm-s390/types.h
include/asm-sh/elf.h
include/asm-sh/floppy.h
include/asm-sh/io.h
include/asm-sh/ipc.h [deleted file]
include/asm-sh/semaphore.h
include/asm-sh/system.h
include/asm-sh/types.h
include/asm-sh64/dma-mapping.h
include/asm-sh64/io.h
include/asm-sh64/ipc.h [deleted file]
include/asm-sh64/semaphore.h
include/asm-sh64/types.h
include/asm-sparc/floppy.h
include/asm-sparc/io.h
include/asm-sparc/ipc.h [deleted file]
include/asm-sparc/semaphore.h
include/asm-sparc64/Kbuild
include/asm-sparc64/floppy.h
include/asm-sparc64/io.h
include/asm-sparc64/ipc.h [deleted file]
include/asm-sparc64/semaphore.h
include/asm-sparc64/shmparam.h
include/asm-um/ipc.h [deleted file]
include/asm-v850/ipc.h [deleted file]
include/asm-v850/irq_regs.h [new file with mode: 0644]
include/asm-v850/semaphore.h
include/asm-v850/types.h
include/asm-x86/elf_32.h
include/asm-x86/floppy_32.h
include/asm-x86/floppy_64.h
include/asm-x86/io_32.h
include/asm-x86/io_64.h
include/asm-x86/ipc.h [deleted file]
include/asm-x86/pgtable_32.h
include/asm-x86/semaphore_32.h
include/asm-x86/semaphore_64.h
include/asm-x86/system_32.h
include/asm-x86/types_32.h
include/asm-xtensa/semaphore.h
include/asm-xtensa/types.h
include/keys/rxrpc-type.h
include/linux/Kbuild
include/linux/atmel-ssc.h [new file with mode: 0644]
include/linux/auxvec.h
include/linux/backing-dev.h
include/linux/binfmts.h
include/linux/capability.h
include/linux/compiler-gcc.h
include/linux/compiler-gcc3.h
include/linux/compiler-gcc4.h
include/linux/compiler-intel.h
include/linux/consolemap.h
include/linux/cpuset.h
include/linux/cramfs_fs.h
include/linux/elf.h
include/linux/elfcore-compat.h [new file with mode: 0644]
include/linux/ext2_fs.h
include/linux/ext2_fs_sb.h
include/linux/ext3_fs.h
include/linux/ext3_fs_sb.h
include/linux/ext4_fs_sb.h
include/linux/fcntl.h
include/linux/file.h
include/linux/fs.h
include/linux/if_fddi.h
include/linux/init.h
include/linux/init_task.h
include/linux/interrupt.h
include/linux/ipc.h
include/linux/kbd_diacr.h
include/linux/kd.h
include/linux/kernel.h
include/linux/kexec.h
include/linux/key-type.h [new file with mode: 0644]
include/linux/key.h
include/linux/list.h
include/linux/log2.h
include/linux/magic.h
include/linux/mm.h
include/linux/mm_types.h
include/linux/mmzone.h
include/linux/module.h
include/linux/moduleparam.h
include/linux/mutex.h
include/linux/namei.h
include/linux/nbd.h
include/linux/nls.h
include/linux/nsproxy.h
include/linux/oom.h
include/linux/percpu_counter.h
include/linux/pnp.h
include/linux/profile.h
include/linux/proportions.h [new file with mode: 0644]
include/linux/quota.h
include/linux/raid/bitmap.h
include/linux/rcupdate.h
include/linux/reiserfs_fs.h
include/linux/sched.h
include/linux/security.h
include/linux/seq_file.h
include/linux/shm.h
include/linux/signalfd.h
include/linux/slab.h
include/linux/slub_def.h
include/linux/swap.h
include/linux/time.h
include/linux/tty.h
include/linux/ufs_fs.h
include/linux/ufs_fs_i.h [deleted file]
include/linux/ufs_fs_sb.h [deleted file]
include/linux/vt_kern.h
include/linux/writeback.h
include/scsi/Kbuild [deleted file]
init/Kconfig
ipc/ipc_sysctl.c
ipc/mqueue.c
ipc/shm.c
kernel/Kconfig.preempt
kernel/auditsc.c
kernel/capability.c
kernel/cpuset.c
kernel/exit.c
kernel/fork.c
kernel/futex.c
kernel/irq/chip.c
kernel/irq/manage.c
kernel/kexec.c
kernel/ksysfs.c
kernel/module.c
kernel/nsproxy.c
kernel/params.c
kernel/posix-timers.c
kernel/printk.c
kernel/profile.c
kernel/rcupdate.c
kernel/rcutorture.c
kernel/rtmutex-debug.c
kernel/sched.c
kernel/signal.c
kernel/softlockup.c
kernel/sys_ni.c
kernel/sysctl.c
kernel/taskstats.c
kernel/time.c
kernel/time/tick-broadcast.c
kernel/time/tick-sched.c
kernel/time/timekeeping.c
kernel/user.c
lib/Makefile
lib/argv_split.c
lib/bust_spinlocks.c
lib/idr.c
lib/iomap.c
lib/ioremap.c
lib/percpu_counter.c
lib/proportions.c [new file with mode: 0644]
lib/radix-tree.c
lib/sort.c
mm/backing-dev.c
mm/filemap.c
mm/fremap.c
mm/mmap.c
mm/nommu.c
mm/oom_kill.c
mm/page-writeback.c
mm/page_alloc.c
mm/readahead.c
mm/rmap.c
mm/shmem.c
mm/slab.c
mm/slob.c
mm/slub.c
mm/swap.c
mm/tiny-shmem.c
mm/truncate.c
mm/vmscan.c
mm/vmstat.c
net/rxrpc/af_rxrpc.c
net/rxrpc/ar-key.c
net/sctp/protocol.c
net/socket.c
net/sunrpc/rpc_pipe.c
scripts/checkpatch.pl
scripts/checkstack.pl
scripts/kernel-doc
security/Kconfig
security/capability.c
security/commoncap.c
security/dummy.c
security/inode.c
security/keys/internal.h
security/keys/key.c
security/keys/process_keys.c
security/keys/request_key.c
security/keys/request_key_auth.c
security/root_plug.c
security/security.c
security/selinux/hooks.c
security/selinux/xfrm.c

index cc10ce7dc339913b7c17c25f2e35533a67fb34e1..299615d821ac73ab81a0e18d28331f869f03629a 100644 (file)
@@ -22,6 +22,8 @@ CodingStyle
        - how the boss likes the C code in the kernel to look.
 DMA-API.txt
        - DMA API, pci_ API & extensions for non-consistent memory machines.
+DMA-ISA-LPC.txt
+       - How to do DMA with ISA (and LPC) devices.
 DMA-mapping.txt
        - info for PCI drivers using DMA portably across all platforms.
 DocBook/
@@ -50,6 +52,8 @@ README.cycladesZ
        - info on Cyclades-Z firmware loading.
 SAK.txt
        - info on Secure Attention Keys.
+SM501.txt
+       - Silicon Motion SM501 multimedia companion chip
 SecurityBugs
        - procedure for reporting security bugs found in the kernel.
 SubmitChecklist
@@ -244,6 +248,8 @@ md.txt
        - info on boot arguments for the multiple devices driver.
 memory-barriers.txt
        - info on Linux kernel memory barriers.
+memory-hotplug.txt
+       - Hotpluggable memory support, how to use and current status.
 memory.txt
        - info on typical Linux memory problems.
 mips/
@@ -294,6 +300,8 @@ pm.txt
        - info on Linux power management support.
 pnp.txt
        - Linux Plug and Play documentation.
+power_supply_class.txt
+       - Tells userspace about battery, UPS, AC or DC power supply properties
 power/
        - directory with info on Linux PCI power management.
 powerpc/
@@ -330,8 +338,12 @@ sched-coding.txt
        - reference for various scheduler-related methods in the O(1) scheduler.
 sched-design.txt
        - goals, design and implementation of the Linux O(1) scheduler.
+sched-design-CFS.txt
+       - goals, design and implementation of the Complete Fair Scheduler.
 sched-domains.txt
        - information on scheduling domains.
+sched-nice-design.txt
+       - How and why the scheduler's nice levels are implemented.
 sched-stats.txt
        - information on schedstats (Linux Scheduler Statistics).
 scsi/
@@ -376,6 +388,8 @@ stallion.txt
        - info on using the Stallion multiport serial driver.
 svga.txt
        - short guide on selecting video modes at boot via VGA BIOS.
+sysfs-rules.txt
+       - How not to use sysfs.
 sx.txt
        - info on the Specialix SX/SI multiport serial driver.
 sysctl/
@@ -406,6 +420,8 @@ video4linux/
        - directory with info regarding video/TV/radio cards and linux.
 vm/
        - directory with info on the Linux vm code.
+volatile-considered-harmful.txt
+       - Why the "volatile" type class should not be used
 voyager.txt
        - guide to running Linux on the Voyager architecture.
 w1/
@@ -414,7 +430,5 @@ watchdog/
        - how to auto-reboot Linux if it has "fallen and can't get up". ;-)
 x86_64/
        - directory with info on Linux support for AMD x86-64 (Hammer) machines.
-xterm-linux.xpm
-       - XPM image of penguin logo (see logo.txt) sitting on an xterm.
 zorro.txt
        - info on writing drivers for Zorro bus devices found on Amigas.
index 7f1730f1a1ae2e9a6f368bdb10ff65f4568863d5..6caa146155788c8a67fc940c1879f2faf4fac1bb 100644 (file)
@@ -77,12 +77,15 @@ Get a decent editor and don't leave whitespace at the end of lines.
 Coding style is all about readability and maintainability using commonly
 available tools.
 
-The limit on the length of lines is 80 columns and this is a hard limit.
+The limit on the length of lines is 80 columns and this is a strongly
+preferred limit.
 
 Statements longer than 80 columns will be broken into sensible chunks.
 Descendants are always substantially shorter than the parent and are placed
 substantially to the right. The same applies to function headers with a long
-argument list. Long strings are as well broken into shorter strings.
+argument list. Long strings are as well broken into shorter strings. The
+only exception to this is where exceeding 80 columns significantly increases
+readability and does not hide information.
 
 void fun(int a, int b, int c)
 {
index 3c8ae020b6a7e3aeb183a5690ea3f0938c66c4f0..d84f89dbf921401ac0e7afbe2d291b4dc304ef97 100644 (file)
@@ -189,12 +189,6 @@ smaller mask as pci_set_dma_mask(). However for the rare case that a
 device driver only uses consistent allocations, one would have to
 check the return value from pci_set_consistent_dma_mask().
 
-If your 64-bit device is going to be an enormous consumer of DMA
-mappings, this can be problematic since the DMA mappings are a
-finite resource on many platforms.  Please see the "DAC Addressing
-for Address Space Hungry Devices" section near the end of this
-document for how to handle this case.
-
 Finally, if your device can only drive the low 24-bits of
 address during PCI bus mastering you might do something like:
 
@@ -203,8 +197,6 @@ address during PCI bus mastering you might do something like:
                       "mydev: 24-bit DMA addressing not available.\n");
                goto ignore_this_device;
        }
-[Better use DMA_24BIT_MASK instead of 0x00ffffff.
-See linux/include/dma-mapping.h for reference.]
 
 When pci_set_dma_mask() is successful, and returns zero, the PCI layer
 saves away this mask you have provided.  The PCI layer will use this
@@ -652,18 +644,6 @@ It is planned to completely remove virt_to_bus() and bus_to_virt() as
 they are entirely deprecated.  Some ports already do not provide these
 as it is impossible to correctly support them.
 
-               64-bit DMA and DAC cycle support
-
-Do you understand all of the text above?  Great, then you already
-know how to use 64-bit DMA addressing under Linux.  Simply make
-the appropriate pci_set_dma_mask() calls based upon your cards
-capabilities, then use the mapping APIs above.
-
-It is that simple.
-
-Well, not for some odd devices.  See the next section for information
-about that.
-
                Optimizing Unmap State Space Consumption
 
 On many platforms, pci_unmap_{single,page}() is simply a nop.
index 361c884d860d3a10f1d14f970ed11edf5761e6d1..9ee6f3cbb4148b8363208328912c119dc7ee71b5 100644 (file)
@@ -85,7 +85,7 @@
 
   <chapter id="mmio">
     <title>Memory Mapped IO</title>
-    <sect1>
+    <sect1 id="getting_access_to_the_device">
       <title>Getting Access to the Device</title>
       <para>
        The most widely supported form of IO is memory mapped IO.
       </para>
     </sect1>
 
-    <sect1>
+    <sect1 id="accessing_the_device">
       <title>Accessing the device</title>
       <para>
        The part of the interface most used by drivers is reading and
@@ -272,9 +272,9 @@ CPU B:  spin_unlock_irqrestore(&amp;dev_lock, flags)
 
   </chapter>
 
-  <chapter>
+  <chapter id="port_space_accesses">
     <title>Port Space Accesses</title>
-    <sect1>
+    <sect1 id="port_space_explained">
       <title>Port Space Explained</title>
 
       <para>
@@ -291,7 +291,7 @@ CPU B:  spin_unlock_irqrestore(&amp;dev_lock, flags)
       </para>
 
     </sect1>
-    <sect1>
+    <sect1 id="accessing_port_space">
       <title>Accessing Port Space</title>
       <para>
        Accesses to this space are provided through a set of functions
index 39fa2aba7f9b141d13912d04994ebc4335499000..5eaef87e8f1b50a298cacf19d0d53dff418283ff 100644 (file)
 
   <chapter id="vfs">
      <title>The Linux VFS</title>
-     <sect1><title>The Filesystem types</title>
+     <sect1 id="the_filesystem_types"><title>The Filesystem types</title>
 !Iinclude/linux/fs.h
      </sect1>
-     <sect1><title>The Directory Cache</title>
+     <sect1 id="the_directory_cache"><title>The Directory Cache</title>
 !Efs/dcache.c
 !Iinclude/linux/dcache.h
      </sect1>
-     <sect1><title>Inode Handling</title>
+     <sect1 id="inode_handling"><title>Inode Handling</title>
 !Efs/inode.c
 !Efs/bad_inode.c
      </sect1>
-     <sect1><title>Registration and Superblocks</title>
+     <sect1 id="registration_and_superblocks"><title>Registration and Superblocks</title>
 !Efs/super.c
      </sect1>
-     <sect1><title>File Locks</title>
+     <sect1 id="file_locks"><title>File Locks</title>
 !Efs/locks.c
 !Ifs/locks.c
      </sect1>
-     <sect1><title>Other Functions</title>
+     <sect1 id="other_functions"><title>Other Functions</title>
 !Efs/mpage.c
 !Efs/namei.c
 !Efs/buffer.c
   <chapter id="proc">
      <title>The proc filesystem</title>
 
-     <sect1><title>sysctl interface</title>
+     <sect1 id="sysctl_interface"><title>sysctl interface</title>
 !Ekernel/sysctl.c
      </sect1>
 
-     <sect1><title>proc filesystem interface</title>
+     <sect1 id="proc_filesystem_interface"><title>proc filesystem interface</title>
 !Ifs/proc/base.c
      </sect1>
   </chapter>
@@ -92,7 +92,7 @@
   <chapter id="debugfs">
      <title>The debugfs filesystem</title>
 
-     <sect1><title>debugfs interface</title>
+     <sect1 id="debugfs_interface"><title>debugfs interface</title>
 !Efs/debugfs/inode.c
 !Efs/debugfs/file.c
      </sect1>
 
   <title>The Linux Journalling API</title>
 
-    <sect1>
+    <sect1 id="journaling_overview">
      <title>Overview</title>
-    <sect2>
+    <sect2 id="journaling_details">
      <title>Details</title>
 <para>
 The journalling layer is  easy to use. You need to
@@ -307,7 +307,7 @@ particular inode.
 
     </sect2>
 
-    <sect2>
+    <sect2 id="jbd_summary">
      <title>Summary</title>
 <para>
 Using the journal is a matter of wrapping the different context changes,
@@ -349,7 +349,7 @@ an example.
 
     </sect1>
 
-    <sect1>
+    <sect1 id="data_types">
      <title>Data Types</title>
      <para>
        The journalling layer uses typedefs to 'hide' the concrete definitions
@@ -358,27 +358,27 @@ an example.
 
        Obviously the hiding is not enforced as this is 'C'.
      </para>
-       <sect2><title>Structures</title>
+       <sect2 id="structures"><title>Structures</title>
 !Iinclude/linux/jbd.h
        </sect2>
     </sect1>
 
-    <sect1>
+    <sect1 id="functions">
      <title>Functions</title>
      <para>
        The functions here are split into two groups those that
        affect a journal as a whole, and those which are used to
        manage transactions
      </para>
-       <sect2><title>Journal Level</title>
+       <sect2 id="journal_level"><title>Journal Level</title>
 !Efs/jbd/journal.c
 !Ifs/jbd/recovery.c
        </sect2>
-       <sect2><title>Transasction Level</title>
+       <sect2 id="transaction_level"><title>Transasction Level</title>
 !Efs/jbd/transaction.c
        </sect2>
     </sect1>
-    <sect1>
+    <sect1 id="see_also">
      <title>See also</title>
        <para>
          <citation>
index 6996d977bf8fe0fc077a034e02d1acaa75f29f57..5a8ffa761e09991bfc59dc97fa01a4deef94e9f7 100644 (file)
@@ -144,7 +144,7 @@ with the lowest level (which directly handles hardware).
        <para>This is the lowest software level.
        It is the only layer that talks to hardware,
        through registers, fifos, dma, irqs, and the like.
-       The <filename>&lt;linux/usb_gadget.h&gt;</filename> API abstracts
+       The <filename>&lt;linux/usb/gadget.h&gt;</filename> API abstracts
        the peripheral controller endpoint hardware.
        That hardware is exposed through endpoint objects, which accept
        streams of IN/OUT buffers, and through callbacks that interact
@@ -494,7 +494,7 @@ side drivers (and usbcore).
 <sect1 id="core"><title>Core Objects and Methods</title>
 
 <para>These are declared in
-<filename>&lt;linux/usb_gadget.h&gt;</filename>,
+<filename>&lt;linux/usb/gadget.h&gt;</filename>,
 and are used by gadget drivers to interact with
 USB peripheral controller drivers.
 </para>
@@ -509,7 +509,7 @@ USB peripheral controller drivers.
             unless the explanations are trivial.
          -->
 
-!Iinclude/linux/usb_gadget.h
+!Iinclude/linux/usb/gadget.h
 </sect1>
 
 <sect1 id="utils"><title>Optional Utilities</title>
index 230cbf7537824d8f91136c9c4e772f2e29871a98..d3290c46af51c0068148752d8b6ddab4d8bf88ca 100644 (file)
@@ -340,7 +340,7 @@ X!Earch/x86/kernel/mca_32.c
 
   <chapter id="security">
      <title>Security Framework</title>
-!Esecurity/security.c
+!Isecurity/security.c
   </chapter>
 
   <chapter id="audit">
@@ -386,8 +386,7 @@ X!Edrivers/base/interface.c
 !Edrivers/base/bus.c
      </sect1>
      <sect1><title>Device Drivers Power Management</title>
-!Edrivers/base/power/resume.c
-!Edrivers/base/power/suspend.c
+!Edrivers/base/power/main.c
      </sect1>
      <sect1><title>Device Drivers ACPI Support</title>
 <!-- Internal functions only
index dceb3092149821029161477756d0871a72b8e4dc..54835610b3d6564945ac5be5f32077bf07626923 100644 (file)
@@ -77,7 +77,7 @@ documentation files are also added which explain how to use the feature.
 When a kernel change causes the interface that the kernel exposes to
 userspace to change, it is recommended that you send the information or
 a patch to the manual pages explaining the change to the manual pages
-maintainer at mtk-manpages@gmx.net.
+maintainer at mtk.manpages@gmail.com.
 
 Here is a list of files that are in the kernel source tree that are
 required reading:
diff --git a/Documentation/RCU/00-INDEX b/Documentation/RCU/00-INDEX
new file mode 100644 (file)
index 0000000..461481d
--- /dev/null
@@ -0,0 +1,22 @@
+00-INDEX
+       - This file
+arrayRCU.txt
+       - Using RCU to Protect Read-Mostly Arrays
+checklist.txt
+       - Review Checklist for RCU Patches
+listRCU.txt
+       - Using RCU to Protect Read-Mostly Linked Lists
+NMI-RCU.txt
+       - Using RCU to Protect Dynamic NMI Handlers
+rcuref.txt
+       - Reference-count design for elements of lists/arrays protected by RCU
+rcu.txt
+       - RCU Concepts
+RTFP.txt
+       - List of RCU papers (bibliography) going back to 1980.
+torture.txt
+       - RCU Torture Test Operation (CONFIG_RCU_TORTURE_TEST)
+UP.txt
+       - RCU on Uniprocessor Systems
+whatisRCU.txt
+       - What is RCU?
index 3a1bd95d3767d48ea9380ad331ceeeb4abb10a99..6fc656035925a91b219ab70e4a9333d14a486cb9 100644 (file)
@@ -3,6 +3,11 @@
 
 Copyright 2006, 2007 Simtec Electronics
 
+The Silicon Motion SM501 multimedia companion chip is a multifunction device
+which may provide numerous interfaces including USB host controller USB gadget,
+Asyncronous Serial ports, Audio functions and a dual display video interface.
+The device may be connected by PCI or local bus with varying functions enabled.
+
 Core
 ----
 
index cbee3a27f76889f04e7615caae54e8a867f39f5c..ab82b7f53312a58719766e68dd5081d0724a4d75 100644 (file)
@@ -21,7 +21,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
-#include <sys/types.h>
 #include <signal.h>
 
 #include <linux/genetlink.h>
index 05851e9982edfefbab5ead5b774ab976926a12e4..d46306fea230cda4a21ee19da45337ab39898918 100644 (file)
@@ -14,8 +14,15 @@ suffice:
 
        typedef struct { volatile int counter; } atomic_t;
 
-       The first operations to implement for atomic_t's are the
-initializers and plain reads.
+Historically, counter has been declared volatile.  This is now discouraged.
+See Documentation/volatile-considered-harmful.txt for the complete rationale.
+
+local_t is very similar to atomic_t. If the counter is per CPU and only
+updated by one CPU, local_t is probably more appropriate. Please see
+Documentation/local_ops.txt for the semantics of local_t.
+
+The first operations to implement for atomic_t's are the initializers and
+plain reads.
 
        #define ATOMIC_INIT(i)          { (i) }
        #define atomic_set(v, i)        ((v)->counter = (i))
@@ -24,6 +31,12 @@ The first macro is used in definitions, such as:
 
 static atomic_t my_counter = ATOMIC_INIT(1);
 
+The initializer is atomic in that the return values of the atomic operations
+are guaranteed to be correct reflecting the initialized value if the
+initializer is used before runtime.  If the initializer is used at runtime, a
+proper implicit or explicit read memory barrier is needed before reading the
+value with atomic_read from another thread.
+
 The second interface can be used at runtime, as in:
 
        struct foo { atomic_t counter; };
@@ -36,13 +49,43 @@ The second interface can be used at runtime, as in:
                return -ENOMEM;
        atomic_set(&k->counter, 0);
 
+The setting is atomic in that the return values of the atomic operations by
+all threads are guaranteed to be correct reflecting either the value that has
+been set with this operation or set with another operation.  A proper implicit
+or explicit memory barrier is needed before the value set with the operation
+is guaranteed to be readable with atomic_read from another thread.
+
 Next, we have:
 
        #define atomic_read(v)  ((v)->counter)
 
-which simply reads the current value of the counter.
-
-Now, we move onto the actual atomic operation interfaces.
+which simply reads the counter value currently visible to the calling thread.
+The read is atomic in that the return value is guaranteed to be one of the
+values initialized or modified with the interface operations if a proper
+implicit or explicit memory barrier is used after possible runtime
+initialization by any other thread and the value is modified only with the
+interface operations.  atomic_read does not guarantee that the runtime
+initialization by any other thread is visible yet, so the user of the
+interface must take care of that with a proper implicit or explicit memory
+barrier.
+
+*** WARNING: atomic_read() and atomic_set() DO NOT IMPLY BARRIERS! ***
+
+Some architectures may choose to use the volatile keyword, barriers, or inline
+assembly to guarantee some degree of immediacy for atomic_read() and
+atomic_set().  This is not uniformly guaranteed, and may change in the future,
+so all users of atomic_t should treat atomic_read() and atomic_set() as simple
+C statements that may be reordered or optimized away entirely by the compiler
+or processor, and explicitly invoke the appropriate compiler and/or memory
+barrier for each use case.  Failure to do so will result in code that may
+suddenly break when used with different architectures or compiler
+optimizations, or even changes in unrelated code which changes how the
+compiler optimizes the section accessing atomic_t variables.
+
+*** YOU HAVE BEEN WARNED! ***
+
+Now, we move onto the atomic operation interfaces typically implemented with
+the help of assembly code.
 
        void atomic_add(int i, atomic_t *v);
        void atomic_sub(int i, atomic_t *v);
@@ -117,6 +160,12 @@ operation.
 
 Then:
 
+       int atomic_xchg(atomic_t *v, int new);
+
+This performs an atomic exchange operation on the atomic variable v, setting
+the given new value.  It returns the old value that the atomic variable v had
+just before the operation.
+
        int atomic_cmpxchg(atomic_t *v, int old, int new);
 
 This performs an atomic compare exchange operation on the atomic value v,
index 7b9551fc6fe3ffdea3523b1571da44748059d312..f2d658a6a942dff1cf79a0222105128299e723e2 100644 (file)
@@ -42,6 +42,9 @@
 *.9.gz
 .*
 .cscope
+.gitignore
+.mailmap
+.mm
 53c700_d.h
 53c7xx_d.h
 53c7xx_u.h
@@ -121,7 +124,6 @@ kxgettext
 lkc_defs.h
 lex.c*
 lex.*.c
-lk201-map.c
 logo_*.c
 logo_*_clut224.c
 logo_*_mono.c
@@ -176,11 +178,13 @@ times.h*
 tkparse
 trix_boot.h
 utsrelease.h*
+vdso.lds
 version.h*
 vmlinux
 vmlinux-*
 vmlinux.aout
-vmlinux.lds
+vmlinux*.lds*
+vmlinux*.scr
 vsyscall.lds
 wanxlfw.inc
 uImage
index cddbac456c290d6bc9409e99fdd6d6f82d1338fa..766d320c8eb6cf184756286c0f389405fd95e99b 100644 (file)
@@ -19,7 +19,7 @@ It consists of several major infrastructure components:
 - klibc, a userspace C library, currently packaged separately, that is
   optimized for correctness and small size.
 
-The cpio file format used by initramfs is the "newc" (aka "cpio -c")
+The cpio file format used by initramfs is the "newc" (aka "cpio -H newc")
 format, and is documented in the file "buffer-format.txt".  There are
 two ways to add an early userspace image: specify an existing cpio
 archive to be used as the image or have the kernel build process build
@@ -44,7 +44,7 @@ The image is specified as one or more sources in
 CONFIG_INITRAMFS_SOURCE.  Sources can be either directories or files -
 cpio archives are *not* allowed when building from sources.
 
-A source directory will have it and all of it's contents packaged.  The
+A source directory will have it and all of its contents packaged.  The
 specified directory name will be mapped to '/'.  When packaging a
 directory, limited user and group ID translation can be performed.
 INITRAMFS_ROOT_UID can be set to a user ID that needs to be mapped to
@@ -144,7 +144,7 @@ c) using initramfs.  The call to prepare_namespace() must be skipped.
    initrd format, an cpio archive.  It must be called "/init".  This binary
    is responsible to do all the things prepare_namespace() would do.
 
-   To remain backwards compatibility, the /init binary will only run if it
+   To maintain backwards compatibility, the /init binary will only run if it
    comes via an initramfs cpio archive.  If this is not the case,
    init/main.c:init() will run prepare_namespace() to mount the final root
    and exec one of the predefined init binaries.
diff --git a/Documentation/email-clients.txt b/Documentation/email-clients.txt
new file mode 100644 (file)
index 0000000..113165b
--- /dev/null
@@ -0,0 +1,217 @@
+Email clients info for Linux
+======================================================================
+
+General Preferences
+----------------------------------------------------------------------
+Patches for the Linux kernel are submitted via email, preferably as
+inline text in the body of the email.  Some maintainers accept
+attachments, but then the attachments should have content-type
+"text/plain".  However, attachments are generally frowned upon because
+it makes quoting portions of the patch more difficult in the patch
+review process.
+
+Email clients that are used for Linux kernel patches should send the
+patch text untouched.  For example, they should not modify or delete tabs
+or spaces, even at the beginning or end of lines.
+
+Don't send patches with "format=flowed".  This can cause unexpected
+and unwanted line breaks.
+
+Don't let your email client do automatic word wrapping for you.
+This can also corrupt your patch.
+
+Email clients should not modify the character set encoding of the text.
+Emailed patches should be in ASCII or UTF-8 encoding only.
+If you configure your email client to send emails with UTF-8 encoding,
+you avoid some possible charset problems.
+
+Email clients should generate and maintain References: or In-Reply-To:
+headers so that mail threading is not broken.
+
+Copy-and-paste (or cut-and-paste) usually does not work for patches
+because tabs are converted to spaces.  Using xclipboard, xclip, and/or
+xcutsel may work, but it's best to test this for yourself or just avoid
+copy-and-paste.
+
+Don't use PGP/GPG signatures in mail that contains patches.
+This breaks many scripts that read and apply the patches.
+(This should be fixable.)
+
+It's a good idea to send a patch to yourself, save the received message,
+and successfully apply it with 'patch' before sending patches to Linux
+mailing lists.
+
+
+Some email client (MUA) hints
+----------------------------------------------------------------------
+Here are some specific MUA configuration hints for editing and sending
+patches for the Linux kernel.  These are not meant to be complete
+software package configuration summaries.
+
+Legend:
+TUI = text-based user interface
+GUI = graphical user interface
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Alpine (TUI)
+
+Config options:
+In the "Sending Preferences" section:
+
+- "Do Not Send Flowed Text" must be enabled
+- "Strip Whitespace Before Sending" must be disabled
+
+When composing the message, the cursor should be placed where the patch
+should appear, and then pressing CTRL-R let you specify the patch file
+to insert into the message.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Evolution (GUI)
+
+Some people use this successfully for patches.
+
+When composing mail select: Preformat
+  from Format->Heading->Preformatted (Ctrl-7)
+  or the toolbar
+
+Then use:
+  Insert->Text File... (Alt-n x)
+to insert the patch.
+
+You can also "diff -Nru old.c new.c | xclip", select Preformat, then
+paste with the middle button.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Kmail (GUI)
+
+Some people use Kmail successfully for patches.
+
+The default setting of not composing in HTML is appropriate; do not
+enable it.
+
+When composing an email, under options, uncheck "word wrap". The only
+disadvantage is any text you type in the email will not be word-wrapped
+so you will have to manually word wrap text before the patch. The easiest
+way around this is to compose your email with word wrap enabled, then save
+it as a draft. Once you pull it up again from your drafts it is now hard
+word-wrapped and you can uncheck "word wrap" without losing the existing
+wrapping.
+
+At the bottom of your email, put the commonly-used patch delimiter before
+inserting your patch:  three hyphens (---).
+
+Then from the "Message" menu item, select insert file and choose your patch.
+As an added bonus you can customise the message creation toolbar menu
+and put the "insert file" icon there.
+
+You can safely GPG sign attachments, but inlined text is preferred for
+patches so do not GPG sign them.  Signing patches that have been inserted
+as inlined text will make them tricky to extract from their 7-bit encoding.
+
+If you absolutely must send patches as attachments instead of inlining
+them as text, right click on the attachment and select properties, and
+highlight "Suggest automatic display" to make the attachment inlined to
+make it more viewable.
+
+When saving patches that are sent as inlined text, select the email that
+contains the patch from the message list pane, right click and select
+"save as".  You can use the whole email unmodified as a patch if it was
+properly composed.  There is no option currently to save the email when you
+are actually viewing it in its own window -- there has been a request filed
+at kmail's bugzilla and hopefully this will be addressed.  Emails are saved
+as read-write for user only so you will have to chmod them to make them
+group and world readable if you copy them elsewhere.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Lotus Notes (GUI)
+
+Run away from it.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Mutt (TUI)
+
+Plenty of Linux developers use mutt, so it must work pretty well.
+
+Mutt doesn't come with an editor, so whatever editor you use should be
+used in a way that there are no automatic linebreaks.  Most editors have
+an "insert file" option that inserts the contents of a file unaltered.
+
+To use 'vim' with mutt:
+  set editor="vi"
+
+  If using xclip, type the command
+  :set paste
+  before middle button or shift-insert or use
+  :r filename
+
+if you want to include the patch inline.
+(a)ttach works fine without "set paste".
+
+Config options:
+It should work with default settings.
+However, it's a good idea to set the "send_charset" to:
+  set send_charset="us-ascii:utf-8"
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Pine (TUI)
+
+Pine has had some whitespace truncation issues in the past, but these
+should all be fixed now.
+
+Use alpine (pine's successor) if you can.
+
+Config options:
+- quell-flowed-text is needed for recent versions
+- the "no-strip-whitespace-before-send" option is needed
+
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Sylpheed (GUI)
+
+- Works well for inlining text (or using attachments).
+- Allows use of an external editor.
+- Not good for IMAP.
+- Is slow on large folders.
+- Won't do TLS SMTP auth over a non-SSL connection.
+- Has a helpful ruler bar in the compose window.
+- Adding addresses to address book doesn't understand the display name
+  properly.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Thunderbird (GUI)
+
+By default, thunderbird likes to mangle text, but there are ways to
+coerce it into being nice.
+
+- Under account settings, composition and addressing, uncheck "Compose
+  messages in HTML format".
+
+- Edit your Thunderbird config settings to tell it not to wrap lines:
+      user_pref("mailnews.wraplength", 0);
+
+- Edit your Thunderbird config settings so that it won't use format=flowed:
+      user_pref("mailnews.send_plaintext_flowed", false);
+
+- You need to get Thunderbird into preformat mode:
+. If you compose HTML messages by default, it's not too hard. Just select
+  "Preformat" from the drop-down box just under the subject line.
+. If you compose in text by default, you have to tell it to compose a new
+  message in HTML (just as a one-off), and then force it from there back to
+  text, else it will wrap lines. To do this, use shift-click on the Write
+  icon to compose to get HTML compose mode, then select "Preformat" from
+  the drop-down box just under the subject line.
+
+- Allows use of an external editor:
+  The easiest thing to do with Thunderbird and patches is to use an
+  "external editor" extension and then just use your favorite $EDITOR
+  for reading/merging patches into the body text.  To do this, download
+  and install the extension, then add a button for it using
+  View->Toolbars->Customize... and finally just click on it when in the
+  Compose dialog.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+TkRat (GUI)
+
+Works.  Use "Insert file..." or external editor.
+
+                                ###
index fb8258ebc577bcfaa7923f9ee2ebc7736cb69a6a..280ec06573e659314a4ddcb4e0b17511e8208ea6 100644 (file)
@@ -82,6 +82,17 @@ Who: Dominik Brodowski <linux@brodo.de>
 
 ---------------------------
 
+What:  a.out interpreter support for ELF executables
+When:  2.6.25
+Files: fs/binfmt_elf.c
+Why:   Using a.out interpreters for ELF executables was a feature for
+       transition from a.out to ELF. But now it is unlikely to be still
+       needed anymore and removing it would simplify the hairy ELF
+       loader code.
+Who:   Andi Kleen <ak@suse.de>
+
+---------------------------
+
 What:  remove EXPORT_SYMBOL(kernel_thread)
 When:  August 2006
 Files: arch/*/kernel/*_ksyms.c
index 599593a170679b55589fca87263b7406c6aad609..1de155e2dc3664c0a3932b4b2ba880224a0e2478 100644 (file)
@@ -44,10 +44,16 @@ files.txt
        - info on file management in the Linux kernel.
 fuse.txt
        - info on the Filesystem in User SpacE including mount options.
+gfs2.txt
+       - info on the Global File System 2.
 hfs.txt
        - info on the Macintosh HFS Filesystem for Linux.
+hfsplus.txt
+       - info on the Macintosh HFSPlus Filesystem for Linux.
 hpfs.txt
        - info and mount options for the OS/2 HPFS.
+inotify.txt
+       - info on the powerful yet simple file change notification system.
 isofs.txt
        - info and mount options for the ISO 9660 (CDROM) filesystem.
 jfs.txt
diff --git a/Documentation/filesystems/quota.txt b/Documentation/filesystems/quota.txt
new file mode 100644 (file)
index 0000000..a590c40
--- /dev/null
@@ -0,0 +1,59 @@
+
+Quota subsystem
+===============
+
+Quota subsystem allows system administrator to set limits on used space and
+number of used inodes (inode is a filesystem structure which is associated
+with each file or directory) for users and/or groups. For both used space and
+number of used inodes there are actually two limits. The first one is called
+softlimit and the second one hardlimit.  An user can never exceed a hardlimit
+for any resource. User is allowed to exceed softlimit but only for limited
+period of time. This period is called "grace period" or "grace time". When
+grace time is over, user is not able to allocate more space/inodes until he
+frees enough of them to get below softlimit.
+
+Quota limits (and amount of grace time) are set independently for each
+filesystem.
+
+For more details about quota design, see the documentation in quota-tools package
+(http://sourceforge.net/projects/linuxquota).
+
+Quota netlink interface
+=======================
+When user exceeds a softlimit, runs out of grace time or reaches hardlimit,
+quota subsystem traditionally printed a message to the controlling terminal of
+the process which caused the excess. This method has the disadvantage that
+when user is using a graphical desktop he usually cannot see the message.
+Thus quota netlink interface has been designed to pass information about
+the above events to userspace. There they can be captured by an application
+and processed accordingly.
+
+The interface uses generic netlink framework (see
+http://lwn.net/Articles/208755/ and http://people.suug.ch/~tgr/libnl/ for more
+details about this layer). The name of the quota generic netlink interface
+is "VFS_DQUOT". Definitions of constants below are in <linux/quota.h>.
+  Currently, the interface supports only one message type QUOTA_NL_C_WARNING.
+This command is used to send a notification about any of the above mentioned
+events. Each message has six attributes. These are (type of the argument is
+in parentheses):
+        QUOTA_NL_A_QTYPE (u32)
+         - type of quota being exceeded (one of USRQUOTA, GRPQUOTA)
+        QUOTA_NL_A_EXCESS_ID (u64)
+         - UID/GID (depends on quota type) of user / group whose limit
+           is being exceeded.
+        QUOTA_NL_A_CAUSED_ID (u64)
+         - UID of a user who caused the event
+        QUOTA_NL_A_WARNING (u32)
+         - what kind of limit is exceeded:
+               QUOTA_NL_IHARDWARN - inode hardlimit
+               QUOTA_NL_ISOFTLONGWARN - inode softlimit is exceeded longer
+                 than given grace period
+               QUOTA_NL_ISOFTWARN - inode softlimit
+               QUOTA_NL_BHARDWARN - space (block) hardlimit
+               QUOTA_NL_BSOFTLONGWARN - space (block) softlimit is exceeded
+                 longer than given grace period.
+               QUOTA_NL_BSOFTWARN - space (block) softlimit
+        QUOTA_NL_A_DEV_MAJOR (u32)
+         - major number of a device with the affected filesystem
+        QUOTA_NL_A_DEV_MINOR (u32)
+         - minor number of a device with the affected filesystem
index 25981e2e51be785dca94c029f93d8040e67741ac..339c6a4f220ec036a7bc681d512ef65982dcdcef 100644 (file)
@@ -8,7 +8,7 @@ What is ramfs?
 
 Ramfs is a very simple filesystem that exports Linux's disk caching
 mechanisms (the page cache and dentry cache) as a dynamically resizable
-ram-based filesystem.
+RAM-based filesystem.
 
 Normally all files are cached in memory by Linux.  Pages of data read from
 backing store (usually the block device the filesystem is mounted on) are kept
@@ -34,7 +34,7 @@ ramfs and ramdisk:
 ------------------
 
 The older "ram disk" mechanism created a synthetic block device out of
-an area of ram and used it as backing store for a filesystem.  This block
+an area of RAM and used it as backing store for a filesystem.  This block
 device was of fixed size, so the filesystem mounted on it was of fixed
 size.  Using a ram disk also required unnecessarily copying memory from the
 fake block device into the page cache (and copying changes back out), as well
@@ -46,8 +46,8 @@ unnecessary work for the CPU, and pollutes the CPU caches.  (There are tricks
 to avoid this copying by playing with the page tables, but they're unpleasantly
 complicated and turn out to be about as expensive as the copying anyway.)
 More to the point, all the work ramfs is doing has to happen _anyway_,
-since all file access goes through the page and dentry caches.  The ram
-disk is simply unnecessary, ramfs is internally much simpler.
+since all file access goes through the page and dentry caches.  The RAM
+disk is simply unnecessary; ramfs is internally much simpler.
 
 Another reason ramdisks are semi-obsolete is that the introduction of
 loopback devices offered a more flexible and convenient way to create
@@ -103,7 +103,7 @@ All this differs from the old initrd in several ways:
     initramfs archive is a gzipped cpio archive (like tar only simpler,
     see cpio(1) and Documentation/early-userspace/buffer-format.txt).  The
     kernel's cpio extraction code is not only extremely small, it's also
-    __init data that can be discarded during the boot process.
+    __init text and data that can be discarded during the boot process.
 
   - The program run by the old initrd (which was called /initrd, not /init) did
     some setup and then returned to the kernel, while the init program from
@@ -220,7 +220,7 @@ device) but the separate packaging of initrd (which is nice if you have
 non-GPL code you'd like to run from initramfs, without conflating it with
 the GPL licensed Linux kernel binary).
 
-It can also be used to supplement the kernel's built-in initamfs image.  The
+It can also be used to supplement the kernel's built-in initramfs image.  The
 files in the external archive will overwrite any conflicting files in
 the built-in initramfs archive.  Some distributors also prefer to customize
 a single kernel image with task-specific initramfs images, without recompiling.
@@ -339,7 +339,7 @@ smooth transition and allowing early boot functionality to gradually move to
 The move to early userspace is necessary because finding and mounting the real
 root device is complex.  Root partitions can span multiple devices (raid or
 separate journal).  They can be out on the network (requiring dhcp, setting a
-specific mac address, logging into a server, etc).  They can live on removable
+specific MAC address, logging into a server, etc).  They can live on removable
 media, with dynamically allocated major/minor numbers and persistent naming
 issues requiring a full udev implementation to sort out.  They can be
 compressed, encrypted, copy-on-write, loopback mounted, strangely partitioned,
index fba943aacf93e2a8b040996bf26c408ee737e1a3..2de62854f0e5c90aa6643b0b72d59cc8e96758f7 100644 (file)
@@ -109,15 +109,15 @@ static int fw_setup_class_device(struct class_device *class_dev,
                                 const char *fw_name,
                                 struct device *device)
 {
-       int retval = 0;
-       struct firmware_priv *fw_priv = kmalloc(sizeof(struct firmware_priv),
-                                               GFP_KERNEL);
+       int retval;
+       struct firmware_priv *fw_priv;
 
-       if(!fw_priv){
+       fw_priv = kzalloc(sizeof(struct firmware_priv), GFP_KERNEL);
+       if (!fw_priv) {
                retval = -ENOMEM;
                goto out;
        }
-       memset(fw_priv, 0, sizeof(*fw_priv));
+
        memset(class_dev, 0, sizeof(*class_dev));
 
        strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX);
index d3dc505104da67897db9201875e4fc7c9493b3cc..74f68b35f7c161d0e6efe9a0822a8e45e6f49b49 100644 (file)
@@ -80,8 +80,8 @@ Compressed cpio images
 ----------------------
 
 Recent kernels have support for populating a ramdisk from a compressed cpio
-archive, on such systems, the creation of a ramdisk image doesn't need to
-involve special block devices or loopbacks, you merely create a directory on
+archive. On such systems, the creation of a ramdisk image doesn't need to
+involve special block devices or loopbacks; you merely create a directory on
 disk with the desired initrd content, cd to that directory, and run (as an
 example):
 
@@ -293,7 +293,7 @@ information as small as possible. In this case, a common initrd could be
 generated with all the necessary modules. Then, only /sbin/init or a file
 read by it would have to be different.
 
-A third scenario are more convenient recovery disks, because information
+A third scenario is more convenient recovery disks, because information
 like the location of the root FS partition doesn't have to be provided at
 boot time, but the system loaded from initrd can invoke a user-friendly
 dialog and it can also perform some sanity checks (or even some form of
@@ -339,8 +339,8 @@ the new, supported mechanism is called "pivot_root".
 Mixed change_root and pivot_root mechanism
 ------------------------------------------
 
-In case you did not want to use root=/dev/ram0 to trig the pivot_root mechanism,
-you may create both /linuxrc and /sbin/init in your initrd image.
+In case you did not want to use root=/dev/ram0 to trigger the pivot_root
+mechanism, you may create both /linuxrc and /sbin/init in your initrd image.
 
 /linuxrc would contain only the following:
 
@@ -350,7 +350,7 @@ echo 0x0100 >/proc/sys/kernel/real-root-dev
 umount -n /proc
 
 Once linuxrc exited, the kernel would mount again your initrd as root,
-this time executing /sbin/init. Again, it would be duty of this init
+this time executing /sbin/init. Again, it would be the duty of this init
 to build the right environment (maybe using the root= device passed on
 the cmdline) before the final execution of the real /sbin/init.
 
index 2fedc081b4c8533e2897f1b456b406a0f2555c4b..1b37b28cc2343b82a7150d8c74724f4d2ecb8e7f 100644 (file)
@@ -13,7 +13,7 @@ dump of the system kernel's memory needs to be taken (for example, when
 the system panics). The system kernel's memory image is preserved across
 the reboot and is accessible to the dump-capture kernel.
 
-You can use common Linux commands, such as cp and scp, to copy the
+You can use common commands, such as cp and scp, to copy the
 memory image to a dump file on the local disk, or across the network to
 a remote system.
 
@@ -69,7 +69,7 @@ http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools-test
 
 This is a symlink to the latest version, which at the time of writing is
 20061214, the only release of kexec-tools-testing so far. As other versions
-are made released, the older onese will remain available at
+are released, the older ones will remain available at
 http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
 
 Note: Latest kexec-tools-testing git tree is available at
@@ -159,16 +159,17 @@ Dump-capture kernel config options (Arch Independent)
    CONFIG_PROC_VMCORE=y
    (CONFIG_PROC_VMCORE is set by default when CONFIG_CRASH_DUMP is selected.)
 
-Dump-capture kernel config options (Arch Dependent, i386)
---------------------------------------------------------
-1) On x86, enable high memory support under "Processor type and
+Dump-capture kernel config options (Arch Dependent, i386 and x86_64)
+--------------------------------------------------------------------
+
+1) On i386, enable high memory support under "Processor type and
    features":
 
    CONFIG_HIGHMEM64G=y
    or
    CONFIG_HIGHMEM4G
 
-2) On x86 and x86_64, disable symmetric multi-processing support
+2) On i386 and x86_64, disable symmetric multi-processing support
    under "Processor type and features":
 
    CONFIG_SMP=n
@@ -203,28 +204,6 @@ Dump-capture kernel config options (Arch Dependent, i386)
 5) Make and install the kernel and its modules. DO NOT add this kernel
    to the boot loader configuration files.
 
-Dump-capture kernel config options (Arch Dependent, x86_64)
-----------------------------------------------------------
-1) On x86 and x86_64, disable symmetric multi-processing support
-   under "Processor type and features":
-
-   CONFIG_SMP=n
-
-   (If CONFIG_SMP=y, then specify maxcpus=1 on the kernel command line
-   when loading the dump-capture kernel, see section "Load the Dump-capture
-   Kernel".)
-
-2) Use a suitable value for "Physical address where the kernel is
-   loaded" (under "Processor type and features"). This only appears when
-   "kernel crash dumps" is enabled. By default this value is 0x1000000
-   (16MB). It should be the same as X in the "crashkernel=Y@X" boot
-   parameter.
-
-   For x86_64, normally "CONFIG_PHYSICAL_START=0x1000000".
-
-3) Make and install the kernel and its modules. DO NOT add this kernel
-   to the boot loader configuration files.
-
 Dump-capture kernel config options (Arch Dependent, ppc64)
 ----------------------------------------------------------
 
@@ -282,11 +261,9 @@ Based on the architecture and type of image (relocatable or not), one
 can choose to load the uncompressed vmlinux or compressed bzImage/vmlinuz
 of dump-capture kernel. Following is the summary.
 
-For i386:
+For i386 and x86_64:
        - Use vmlinux if kernel is not relocatable.
        - Use bzImage/vmlinuz if kernel is relocatable.
-For x86_64:
-       - Use vmlinux
 For ppc64:
        - Use vmlinux
 For ia64:
@@ -315,20 +292,22 @@ Following are the arch specific command line options to be used while
 loading dump-capture kernel.
 
 For i386, x86_64 and ia64:
-       "1 irqpoll maxcpus=1"
+       "1 irqpoll maxcpus=1 reset_devices"
 
 For ppc64:
-       "1 maxcpus=1 noirqdistrib"
+       "1 maxcpus=1 noirqdistrib reset_devices"
 
 
 Notes on loading the dump-capture kernel:
 
 * By default, the ELF headers are stored in ELF64 format to support
-  systems with more than 4GB memory. The --elf32-core-headers option can
-  be used to force the generation of ELF32 headers. This is necessary
-  because GDB currently cannot open vmcore files with ELF64 headers on
-  32-bit systems. ELF32 headers can be used on non-PAE systems (that is,
-  less than 4GB of memory).
+  systems with more than 4GB memory. On i386, kexec automatically checks if
+  the physical RAM size exceeds the 4 GB limit and if not, uses ELF32.
+  So, on non-PAE systems, ELF32 is always used.
+
+  The --elf32-core-headers option can be used to force the generation of ELF32
+  headers. This is necessary because GDB currently cannot open vmcore files
+  with ELF64 headers on 32-bit systems.
 
 * The "irqpoll" boot parameter reduces driver initialization failures
   due to shared interrupts in the dump-capture kernel.
@@ -360,7 +339,7 @@ If die() is called, and it happens to be a thread with pid 0 or 1, or die()
 is called inside interrupt context or die() is called and panic_on_oops is set,
 the system will boot into the dump-capture kernel.
 
-On powererpc systems when a soft-reset is generated, die() is called by all cpus
+On powerpc systems when a soft-reset is generated, die() is called by all cpus
 and the system will boot into the dump-capture kernel.
 
 For testing purposes, you can trigger a crash by using "ALT-SysRq-c",
@@ -426,9 +405,3 @@ Contact
 Vivek Goyal (vgoyal@in.ibm.com)
 Maneesh Soni (maneesh@in.ibm.com)
 
-
-Trademark
-=========
-
-Linux is a trademark of Linus Torvalds in the United States, other
-countries, or both.
index eb247997f6791fa535b0bcec101cfa658634d3ba..63bda3637085370906497b9edde036123cb441a5 100644 (file)
@@ -75,10 +75,12 @@ parameter is applicable:
        PPT     Parallel port support is enabled.
        PS2     Appropriate PS/2 support is enabled.
        RAM     RAM disk support is enabled.
+       ROOTPLUG The example Root Plug LSM is enabled.
        S390    S390 architecture is enabled.
        SCSI    Appropriate SCSI support is enabled.
                        A lot of drivers has their options described inside of
                        Documentation/scsi/.
+       SECURITY Different security models are enabled.
        SELINUX SELinux support is enabled.
        SERIAL  Serial support is enabled.
        SH      SuperH architecture is enabled.
@@ -373,6 +375,12 @@ and is between 256 and 4096 characters. It is defined in the file
                        possible to determine what the correct size should be.
                        This option provides an override for these situations.
 
+       capability.disable=
+                       [SECURITY] Disable capabilities.  This would normally
+                       be used only if an alternative security model is to be
+                       configured.  Potentially dangerous and should only be
+                       used if you are entirely sure of the consequences.
+
        chandev=        [HW,NET] Generic channel device initialisation
 
        checkreqprot    [SELINUX] Set initial checkreqprot flag value.
@@ -1473,14 +1481,10 @@ and is between 256 and 4096 characters. It is defined in the file
        raid=           [HW,RAID]
                        See Documentation/md.txt.
 
-       ramdisk=        [RAM] Sizes of RAM disks in kilobytes [deprecated]
-                       See Documentation/ramdisk.txt.
-
        ramdisk_blocksize=      [RAM]
                        See Documentation/ramdisk.txt.
 
        ramdisk_size=   [RAM] Sizes of RAM disks in kilobytes
-                       New name for the ramdisk parameter.
                        See Documentation/ramdisk.txt.
 
        rcu.blimit=     [KNL,BOOT] Set maximum number of finished
@@ -1543,6 +1547,15 @@ and is between 256 and 4096 characters. It is defined in the file
                        Useful for devices that are detected asynchronously
                        (e.g. USB and MMC devices).
 
+       root_plug.vendor_id=
+                       [ROOTPLUG] Override the default vendor ID
+
+       root_plug.product_id=
+                       [ROOTPLUG] Override the default product ID
+
+       root_plug.debug=
+                       [ROOTPLUG] Enable debugging output
+
        rw              [KNL] Mount root device read-write on boot
 
        S               [KNL] Run init in single mode
index c1f64fdf84cba2ba6a9f04fc1d5315da7a732ecc..266955d23ee6eb9bff2e98ad1bc6d2bc916d9369 100644 (file)
@@ -20,6 +20,19 @@ or:
                                             const char *callout_string,
                                             void *aux);
 
+or:
+
+       struct key *request_key_async(const struct key_type *type,
+                                     const char *description,
+                                     const char *callout_string);
+
+or:
+
+       struct key *request_key_async_with_auxdata(const struct key_type *type,
+                                                  const char *description,
+                                                  const char *callout_string,
+                                                  void *aux);
+
 Or by userspace invoking the request_key system call:
 
        key_serial_t request_key(const char *type,
@@ -32,10 +45,14 @@ does not need to link the key to a keyring to prevent it from being immediately
 destroyed.  The kernel interface returns a pointer directly to the key, and
 it's up to the caller to destroy the key.
 
-The request_key_with_auxdata() call is like the in-kernel request_key() call,
-except that it permits auxiliary data to be passed to the upcaller (the default
-is NULL).  This is only useful for those key types that define their own upcall
-mechanism rather than using /sbin/request-key.
+The request_key*_with_auxdata() calls are like the in-kernel request_key*()
+calls, except that they permit auxiliary data to be passed to the upcaller (the
+default is NULL).  This is only useful for those key types that define their
+own upcall mechanism rather than using /sbin/request-key.
+
+The two async in-kernel calls may return keys that are still in the process of
+being constructed.  The two non-async ones will wait for construction to
+complete first.
 
 The userspace interface links the key to a keyring associated with the process
 to prevent the key from going away, and returns the serial number of the key to
index 947d57d53453be799851155b0231cce1c9593217..51652d39e61c3d0d25bba568699f249f6e1fa0f4 100644 (file)
@@ -4,7 +4,7 @@
 
 This service allows cryptographic keys, authentication tokens, cross-domain
 user mappings, and similar to be cached in the kernel for the use of
-filesystems other kernel services.
+filesystems and other kernel services.
 
 Keyrings are permitted; these are a special type of key that can hold links to
 other keys. Processes each have three standard keyring subscriptions that a
@@ -726,6 +726,15 @@ call, and the key released upon close. How to deal with conflicting keys due to
 two different users opening the same file is left to the filesystem author to
 solve.
 
+To access the key manager, the following header must be #included:
+
+       <linux/key.h>
+
+Specific key types should have a header file under include/keys/ that should be
+used to access that type.  For keys of type "user", for example, that would be:
+
+       <keys/user-type.h>
+
 Note that there are two different types of pointers to keys that may be
 encountered:
 
@@ -791,6 +800,36 @@ payload contents" for more information.
     passed to the key_type->request_key() op if it exists.
 
 
+(*) A key can be requested asynchronously by calling one of:
+
+       struct key *request_key_async(const struct key_type *type,
+                                     const char *description,
+                                     const char *callout_string);
+
+    or:
+
+       struct key *request_key_async_with_auxdata(const struct key_type *type,
+                                                  const char *description,
+                                                  const char *callout_string,
+                                                  void *aux);
+
+    which are asynchronous equivalents of request_key() and
+    request_key_with_auxdata() respectively.
+
+    These two functions return with the key potentially still under
+    construction.  To wait for contruction completion, the following should be
+    called:
+
+       int wait_for_key_construction(struct key *key, bool intr);
+
+    The function will wait for the key to finish being constructed and then
+    invokes key_validate() to return an appropriate value to indicate the state
+    of the key (0 indicates the key is usable).
+
+    If intr is true, then the wait can be interrupted by a signal, in which
+    case error ERESTARTSYS will be returned.
+
+
 (*) When it is no longer required, the key should be released using:
 
        void key_put(struct key *key);
@@ -924,7 +963,11 @@ DEFINING A KEY TYPE
 
 A kernel service may want to define its own key type. For instance, an AFS
 filesystem might want to define a Kerberos 5 ticket key type. To do this, it
-author fills in a struct key_type and registers it with the system.
+author fills in a key_type struct and registers it with the system.
+
+Source files that implement key types should include the following header file:
+
+       <linux/key-type.h>
 
 The structure has a number of fields, some of which are mandatory:
 
@@ -1053,22 +1096,44 @@ The structure has a number of fields, some of which are mandatory:
      as might happen when the userspace buffer is accessed.
 
 
- (*) int (*request_key)(struct key *key, struct key *authkey, const char *op,
+ (*) int (*request_key)(struct key_construction *cons, const char *op,
                        void *aux);
 
-     This method is optional.  If provided, request_key() and
-     request_key_with_auxdata() will invoke this function rather than
-     upcalling to /sbin/request-key to operate upon a key of this type.
+     This method is optional.  If provided, request_key() and friends will
+     invoke this function rather than upcalling to /sbin/request-key to operate
+     upon a key of this type.
+
+     The aux parameter is as passed to request_key_async_with_auxdata() and
+     similar or is NULL otherwise.  Also passed are the construction record for
+     the key to be operated upon and the operation type (currently only
+     "create").
+
+     This method is permitted to return before the upcall is complete, but the
+     following function must be called under all circumstances to complete the
+     instantiation process, whether or not it succeeds, whether or not there's
+     an error:
+
+       void complete_request_key(struct key_construction *cons, int error);
+
+     The error parameter should be 0 on success, -ve on error.  The
+     construction record is destroyed by this action and the authorisation key
+     will be revoked.  If an error is indicated, the key under construction
+     will be negatively instantiated if it wasn't already instantiated.
+
+     If this method returns an error, that error will be returned to the
+     caller of request_key*().  complete_request_key() must be called prior to
+     returning.
+
+     The key under construction and the authorisation key can be found in the
+     key_construction struct pointed to by cons:
+
+     (*) struct key *key;
+
+        The key under construction.
 
-     The aux parameter is as passed to request_key_with_auxdata() or is NULL
-     otherwise.  Also passed are the key to be operated upon, the
-     authorisation key for this operation and the operation type (currently
-     only "create").
+     (*) struct key *authkey;
 
-     This function should return only when the upcall is complete.  Upon return
-     the authorisation key will be revoked, and the target key will be
-     negatively instantiated if it is still uninstantiated.  The error will be
-     returned to the caller of request_key*().
+        The authorisation key.
 
 
 ============================
index b0aca0705d1eab9e815d40902e61803061b4de37..4269a1105b378fafcc689435a2531b9d9d4287db 100644 (file)
@@ -27,7 +27,7 @@ CPU which owns the data. Therefore, care must taken to make sure that only one
 CPU writes to the local_t data. This is done by using per cpu data and making
 sure that we modify it from within a preemption safe context. It is however
 permitted to read local_t data from any CPU : it will then appear to be written
-out of order wrt other memory writes on the owner CPU.
+out of order wrt other memory writes by the owner CPU.
 
 
 * Implementation for a given architecture
@@ -45,6 +45,29 @@ long fails. The definition looks like :
 typedef struct { atomic_long_t a; } local_t;
 
 
+* Rules to follow when using local atomic operations
+
+- Variables touched by local ops must be per cpu variables.
+- _Only_ the CPU owner of these variables must write to them.
+- This CPU can use local ops from any context (process, irq, softirq, nmi, ...)
+  to update its local_t variables.
+- Preemption (or interrupts) must be disabled when using local ops in
+  process context to   make sure the process won't be migrated to a
+  different CPU between getting the per-cpu variable and doing the
+  actual local op.
+- When using local ops in interrupt context, no special care must be
+  taken on a mainline kernel, since they will run on the local CPU with
+  preemption already disabled. I suggest, however, to explicitly
+  disable preemption anyway to make sure it will still work correctly on
+  -rt kernels.
+- Reading the local cpu variable will provide the current copy of the
+  variable.
+- Reads of these variables can be done from any CPU, because updates to
+  "long", aligned, variables are always atomic. Since no memory
+  synchronization is done by the writer CPU, an outdated copy of the
+  variable can be read when reading some _other_ cpu's variables.
+
+
 * How to use local atomic operations
 
 #include <linux/percpu.h>
index 59108cebe163aadb1c6c1dd903b8b93ff15be51a..8a523f6af48ab754ad1fc51dc9a65d726bde9c23 100644 (file)
@@ -192,10 +192,10 @@ Devices possible for Atari:
            seconds.
 
 
-2.6) ramdisk=
+2.6) ramdisk_size=
 -------------
 
-Syntax: ramdisk=<size>
+Syntax: ramdisk_size=<size>
 
   This option instructs the kernel to set up a ramdisk of the given
 size in KBytes. Do not use this option if the ramdisk contents are
diff --git a/Documentation/make/headers_install.txt b/Documentation/make/headers_install.txt
new file mode 100644 (file)
index 0000000..f2481ca
--- /dev/null
@@ -0,0 +1,46 @@
+Exporting kernel headers for use by userspace
+=============================================
+
+The "make headers_install" command exports the kernel's header files in a
+form suitable for use by userspace programs.
+
+The linux kernel's exported header files describe the API for user space
+programs attempting to use kernel services.  These kernel header files are
+used by the system's C library (such as glibc or uClibc) to define available
+system calls, as well as constants and structures to be used with these
+system calls.  The C library's header files include the kernel header files
+from the "linux" subdirectory.  The system's libc headers are usually
+installed at the default location /usr/include and the kernel headers in
+subdirectories under that (most notably /usr/include/linux and
+/usr/include/asm).
+
+Kernel headers are backwards compatible, but not forwards compatible.  This
+means that a program built against a C library using older kernel headers
+should run on a newer kernel (although it may not have access to new
+features), but a program built against newer kernel headers may not work on an
+older kernel.
+
+The "make headers_install" command can be run in the top level directory of the
+kernel source code (or using a standard out-of-tree build).  It takes two
+optional arguments:
+
+  make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr/include
+
+ARCH indicates which architecture to produce headers for, and defaults to the
+current architecture.  The linux/asm directory of the exported kernel headers
+is platform-specific, to see a complete list of supported architectures use
+the command:
+
+  ls -d include/asm-* | sed 's/.*-//'
+
+INSTALL_HDR_PATH indicates where to install the headers.  It defaults to
+"./usr/include".
+
+The command "make headers_install_all" exports headers for all architectures
+simultaneously.  (This is mostly of interest to distribution maintainers,
+who create an architecture-independent tarball from the resulting include
+directory.)  Remember to provide the appropriate linux/asm directory via "mv"
+or "ln -s" before building a C library with headers exported this way.
+
+The kernel header export infrastructure is maintained by David Woodhouse
+<dwmw2@infradead.org>.
diff --git a/Documentation/mips/00-INDEX b/Documentation/mips/00-INDEX
new file mode 100644 (file)
index 0000000..9df8a2e
--- /dev/null
@@ -0,0 +1,8 @@
+00-INDEX
+       - this file.
+AU1xxx_IDE.README
+       - README for MIPS AU1XXX IDE driver.
+GT64120.README
+       - README for dir with info on MIPS boards using GT-64120 or GT-64120A.
+time.README
+       - README for MIPS time services.
index cbf79881a41c8dc1b9382d5848716a76b6c37438..51f935191ae5d86fbf21fb801853eb20dff546a3 100644 (file)
@@ -90,7 +90,8 @@ of advantages of mutexes:
    * - task may not exit with mutex held
    * - memory areas where held locks reside must not be freed
    * - held mutexes must not be reinitialized
-   * - mutexes may not be used in irq contexts
+   * - mutexes may not be used in hardware or software interrupt
+   *   contexts such as tasklets and timers
 
    furthermore, there are also convenience features in the debugging
    code:
index cae231b1c1341597d2435d0c2481300408224243..c36b64b0020fc670063519c4c8e64ac4f44af3d1 100644 (file)
@@ -857,3 +857,10 @@ The kernel interface functions are as follows:
 
      This is used to extract the error number from a message indicating either
      a local error occurred or a network error occurred.
+
+ (*) Allocate a null key for doing anonymous security.
+
+       struct key *rxrpc_get_null_key(const char *keyname);
+
+     This is used to allocate a null RxRPC key that can be used to indicate
+     anonymous security for a particular domain.
diff --git a/Documentation/power/00-INDEX b/Documentation/power/00-INDEX
new file mode 100644 (file)
index 0000000..8db4e41
--- /dev/null
@@ -0,0 +1,34 @@
+00-INDEX
+       - This file
+basic-pm-debugging.txt
+       - Debugging suspend and resume
+devices.txt
+       - How drivers interact with system-wide power management
+drivers-testing.txt
+       - Testing suspend and resume support in device drivers
+freezing-of-tasks.txt
+       - How processes and controlled during suspend
+interface.txt
+       - Power management user interface in /sys/power
+notifiers.txt
+       - Registering suspend notifiers in device drivers
+pci.txt
+       - How the PCI Subsystem Does Power Management
+s2ram.txt
+       - How to get suspend to ram working (and debug it when it isn't)
+states.txt
+       - System power management states
+swsusp-and-swap-files.txt
+       - Using swap files with software suspend (to disk)
+swsusp-dmcrypt.txt
+       - How to use dm-crypt and software suspend (to disk) together
+swsusp.txt
+       - Goals, implementation, and usage of software suspend (ACPI S3)
+tricks.txt
+       - How to trick software suspend (to disk) into working when it isn't
+userland-swsusp.txt
+       - Experimental implementation of software suspend in userspace
+video_extension.txt
+       - ACPI video extensions
+video.txt
+       - Video issues during resume from suspend
index 33016c2f18dd2542b7dec11f26500ee005089361..e4bdcaee24e46e6805caf0e0a9edfc9d57638402 100644 (file)
@@ -14,8 +14,8 @@ the machine's BIOS.
 Of course, for this purpose the test system has to be known to suspend and
 resume without the driver being tested.  Thus, if possible, you should first
 resolve all suspend/resume-related problems in the test system before you start
-testing the new driver.  Please see Documents/power/basic-pm-debugging.txt for
-more information about the debugging of suspend/resume functionality.
+testing the new driver.  Please see Documentation/power/basic-pm-debugging.txt
+for more information about the debugging of suspend/resume functionality.
 
 2. Testing the driver
 
index d6d65b9bcfe325c6360183093975b89b19073c68..94a3c577b083a7e4c9b31b6f7c403773b6d84a8c 100644 (file)
@@ -5,6 +5,8 @@ please mail me.
 
 00-INDEX
        - this file
+booting-without-of.txt
+       - Booting the Linux/ppc kernel without Open Firmware
 cpu_features.txt
        - info on how we support a variety of CPUs with minimal compile-time
        options.
@@ -14,6 +16,8 @@ hvcs.txt
        - IBM "Hypervisor Virtual Console Server" Installation Guide
 mpc52xx.txt
        - Linux 2.6.x on MPC52xx family
+mpc52xx-device-tree-bindings.txt
+       - MPC5200 Device Tree Bindings
 ppc_htab.txt
        - info about the Linux/PPC /proc/ppc_htab entry
 SBC8260_memory_mapping.txt
index 52f75b7d51c2208bcb8352fd7c02e6e45b22474b..6c820baa19a6edb3a4bc5127d884377ebcd36b60 100644 (file)
@@ -22,16 +22,14 @@ The RAM disk dynamically grows as more space is required. It does this by using
 RAM from the buffer cache. The driver marks the buffers it is using as dirty
 so that the VM subsystem does not try to reclaim them later.
 
-Also, the RAM disk supports up to 16 RAM disks out of the box, and can
-be reconfigured to support up to 255 RAM disks - change "#define NUM_RAMDISKS"
-in drivers/block/rd.c.  To use RAM disk support with your system, run
-'./MAKEDEV ram' from the /dev directory.  RAM disks are all major number 1, and
-start with minor number 0 for /dev/ram0, etc.  If used, modern kernels use
-/dev/ram0 for an initrd.
-
-The old "ramdisk=<ram_size>" has been changed to "ramdisk_size=<ram_size>" to
-make it clearer.  The original "ramdisk=<ram_size>" has been kept around for
-compatibility reasons, but it may be removed in the future.
+The RAM disk supports up to 16 RAM disks by default, and can be reconfigured
+to support an unlimited number of RAM disks (at your own risk).  Just change
+the configuration symbol BLK_DEV_RAM_COUNT in the Block drivers config menu
+and (re)build the kernel.
+
+To use RAM disk support with your system, run './MAKEDEV ram' from the /dev
+directory.  RAM disks are all major number 1, and start with minor number 0
+for /dev/ram0, etc.  If used, modern kernels use /dev/ram0 for an initrd.
 
 The new RAM disk also has the ability to load compressed RAM disk images,
 allowing one to squeeze more programs onto an average installation or
index 7d03e9d5b5f71e065669e402eabcbe67e9487481..a9f721aeb11c88fcb1d1af0b1607c6e969ef21d3 100644 (file)
@@ -195,9 +195,9 @@ Sun Feb  14:00 1999 Gerard Roudier (groudier@club-internet.fr)
          Pointed out by Leonard Zubkoff.
        - Allow to tune request_irq() flags from the boot command line using 
          ncr53c8xx=irqm:??, as follows:
-         a) If bit 0x10 is set in irqm, SA_SHIRQ flag is not used.
-         b) If bit 0x20 is set in irqm, SA_INTERRUPT flag is not used.
-         By default the driver uses both SA_SHIRQ and SA_INTERRUPT.
+         a) If bit 0x10 is set in irqm, IRQF_SHARED flag is not used.
+         b) If bit 0x20 is set in irqm, IRQF_DISABLED flag is not used.
+         By default the driver uses both IRQF_SHARED and IRQF_DISABLED.
          Option 'ncr53c8xx=irqm:0x20' may be used when an IRQ is shared by 
          a 53C8XX adapter and a network board.
        - Tiny mispelling fixed (ABORT instead of ABRT). Was fortunately 
index 9707941704e36ece47dd763cc9ac21dcf5d2468b..a08e225653d6fae25fdf0fe0be7a577a0639927c 100644 (file)
        and 15 get ignored by the driver & adapter!
      Q: I have a 9595 and I get a NMI during heavy SCSI I/O e.g. during fsck.
         A COMMAND ERROR is reported and characters on the screen are missing.
-       Warm reboot is not possible. Things look like quite weired.
+       Warm reboot is not possible. Things look like quite weird.
      A: Check the processor type of your 9595. If you have an 80486 or 486DX-2
         processor complex on your mainboard and you compiled a kernel that
        supports 80386 processors, it is possible, that the kernel cannot
index 39d409a8efe57709e2c1c17b6f5e76f0fceef483..230e30846ef2c1537619a2b8e0118a3cbc098acd 100644 (file)
@@ -785,8 +785,8 @@ port address 0x1400.
         irqm:0     always open drain
         irqm:1     same as initial settings (assumed BIOS settings)
         irqm:2     always totem pole
-        irqm:0x10  driver will not use SA_SHIRQ flag when requesting irq
-        irqm:0x20  driver will not use SA_INTERRUPT flag when requesting irq
+        irqm:0x10  driver will not use IRQF_SHARED flag when requesting irq
+        irqm:0x20  driver will not use IRQF_DISABLED flag when requesting irq
 
     (Bits 0x10 and 0x20 can be combined with hardware irq mode option)
 
@@ -1236,15 +1236,15 @@ when the SCSI DATA IN phase is reentered after a phase mismatch.
 When an IRQ is shared by devices that are handled by different drivers, it 
 may happen that one driver complains about the request of the IRQ having 
 failed. Inder Linux-2.0, this may be due to one driver having requested the 
-IRQ using the SA_INTERRUPT flag but some other having requested the same IRQ 
+IRQ using the IRQF_DISABLED flag but some other having requested the same IRQ
 without this flag. Under both Linux-2.0 and linux-2.2, this may be caused by 
-one driver not having requested the IRQ with the SA_SHIRQ flag.
+one driver not having requested the IRQ with the IRQF_SHARED flag.
 
 By default, the ncr53c8xx and sym53c8xx drivers request IRQs with both the 
-SA_INTERRUPT and the SA_SHIRQ flag under Linux-2.0 and with only the SA_SHIRQ 
+IRQF_DISABLED and the IRQF_SHARED flag under Linux-2.0 and with only the IRQF_SHARED
 flag under Linux-2.2.
 
-Under Linux-2.0, you can disable use of SA_INTERRUPT flag from the boot 
+Under Linux-2.0, you can disable use of IRQF_DISABLED flag from the boot
 command line by using the following option:
 
      ncr53c8xx=irqm:0x20   (for the generic ncr53c8xx driver)
@@ -1252,7 +1252,7 @@ command line by using the following option:
 
 If this does not fix the problem, then you may want to check how all other 
 drivers are requesting the IRQ and report the problem. Note that if at least 
-a single driver does not request the IRQ with the SA_SHIRQ flag (share IRQ), 
+a single driver does not request the IRQ with the IRQF_SHARED flag (share IRQ),
 then the request of the IRQ obviously will not succeed for all the drivers.
 
 15. SCSI problem troubleshooting
diff --git a/Documentation/sysctl/00-INDEX b/Documentation/sysctl/00-INDEX
new file mode 100644 (file)
index 0000000..a20a906
--- /dev/null
@@ -0,0 +1,16 @@
+00-INDEX
+       - this file.
+README
+       - general information about /proc/sys/ sysctl files.
+abi.txt
+       - documentation for /proc/sys/abi/*.
+ctl_unnumbered.txt
+       - explanation of why one should not add new binary sysctl numbers.
+fs.txt
+       - documentation for /proc/sys/fs/*.
+kernel.txt
+       - documentation for /proc/sys/kernel/*.
+sunrpc.txt
+       - documentation for /proc/sys/sunrpc/*.
+vm.txt
+       - documentation for /proc/sys/vm/*.
index 111fd28727ec3754931d5de68ab21037871382c0..8984a53962716f3f528964d6c318a9e7dcdf8a47 100644 (file)
@@ -320,6 +320,14 @@ kernel.  This value defaults to SHMMAX.
 
 ==============================================================
 
+softlockup_thresh:
+
+This value can be used to lower the softlockup tolerance
+threshold. The default threshold is 10s.  If a cpu is locked up
+for 10s, the kernel complains.  Valid values are 1-60s.
+
+==============================================================
+
 tainted: 
 
 Non-zero if the kernel has been tainted.  Numeric values, which
index a0ccc5b60260e0df99fed83c71336a373da0f60a..b89570c304346f4ddf928996044bcbc7f2e72a72 100644 (file)
@@ -31,6 +31,7 @@ Currently, these files are in /proc/sys/vm:
 - min_unmapped_ratio
 - min_slab_ratio
 - panic_on_oom
+- oom_kill_allocating_task
 - mmap_min_address
 - numa_zonelist_order
 
@@ -111,6 +112,12 @@ of kilobytes free.  The VM uses this number to compute a pages_min
 value for each lowmem zone in the system.  Each lowmem zone gets 
 a number of reserved free pages based proportionally on its size.
 
+Some minimal ammount of memory is needed to satisfy PF_MEMALLOC
+allocations; if you set this to lower than 1024KB, your system will
+become subtly broken, and prone to deadlock under high loads.
+
+Setting this too high will OOM your machine instantly.
+
 ==============================================================
 
 percpu_pagelist_fraction
@@ -220,6 +227,27 @@ The default value is 0.
 1 and 2 are for failover of clustering. Please select either
 according to your policy of failover.
 
+=============================================================
+
+oom_kill_allocating_task
+
+This enables or disables killing the OOM-triggering task in
+out-of-memory situations.
+
+If this is set to zero, the OOM killer will scan through the entire
+tasklist and select a task based on heuristics to kill.  This normally
+selects a rogue memory-hogging task that frees up a large amount of
+memory when killed.
+
+If this is set to non-zero, the OOM killer simply kills the task that
+triggered the out-of-memory condition.  This avoids the expensive
+tasklist scan.
+
+If panic_on_oom is selected, it takes precedence over whatever value
+is used in oom_kill_allocating_task.
+
+The default value is 0.
+
 ==============================================================
 
 mmap_min_addr
diff --git a/Documentation/telephony/00-INDEX b/Documentation/telephony/00-INDEX
new file mode 100644 (file)
index 0000000..4ffe0ed
--- /dev/null
@@ -0,0 +1,4 @@
+00-INDEX
+       - this file.
+ixj.txt
+       - document describing the Quicknet drivers.
diff --git a/Documentation/vm/00-INDEX b/Documentation/vm/00-INDEX
new file mode 100644 (file)
index 0000000..2131b00
--- /dev/null
@@ -0,0 +1,20 @@
+00-INDEX
+       - this file.
+balance
+       - various information on memory balancing.
+hugetlbpage.txt
+       - a brief summary of hugetlbpage support in the Linux kernel.
+locking
+       - info on how locking and synchronization is done in the Linux vm code.
+numa
+       - information about NUMA specific code in the Linux vm.
+numa_memory_policy.txt
+       - documentation of concepts and APIs of the 2.6 memory policy support.
+overcommit-accounting
+       - description of the Linux kernels overcommit handling modes.
+page_migration
+       - description of page migration in NUMA systems.
+slabinfo.c
+       - source code for a tool to get reports about slabs.
+slub.txt
+       - a short users guide for SLUB.
index 1af7bd5a2183ec83d1b4481191b61973006f2a46..7047696c47a18b6172549c9174b5988a7c2881c4 100644 (file)
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <strings.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdarg.h>
@@ -84,7 +85,7 @@ void fatal(const char *x, ...)
        va_start(ap, x);
        vfprintf(stderr, x, ap);
        va_end(ap);
-       exit(1);
+       exit(EXIT_FAILURE);
 }
 
 void usage(void)
@@ -119,14 +120,14 @@ void usage(void)
        );
 }
 
-unsigned long read_obj(char *name)
+unsigned long read_obj(const char *name)
 {
        FILE *f = fopen(name, "r");
 
        if (!f)
                buffer[0] = 0;
        else {
-               if (!fgets(buffer,sizeof(buffer), f))
+               if (!fgets(buffer, sizeof(buffer), f))
                        buffer[0] = 0;
                fclose(f);
                if (buffer[strlen(buffer)] == '\n')
@@ -139,7 +140,7 @@ unsigned long read_obj(char *name)
 /*
  * Get the contents of an attribute
  */
-unsigned long get_obj(char *name)
+unsigned long get_obj(const char *name)
 {
        if (!read_obj(name))
                return 0;
@@ -147,7 +148,7 @@ unsigned long get_obj(char *name)
        return atol(buffer);
 }
 
-unsigned long get_obj_and_str(char *name, char **x)
+unsigned long get_obj_and_str(const char *name, char **x)
 {
        unsigned long result = 0;
        char *p;
@@ -166,12 +167,12 @@ unsigned long get_obj_and_str(char *name, char **x)
        return result;
 }
 
-void set_obj(struct slabinfo *s, char *name, int n)
+void set_obj(struct slabinfo *s, const char *name, int n)
 {
        char x[100];
        FILE *f;
 
-       sprintf(x, "%s/%s", s->name, name);
+       snprintf(x, 100, "%s/%s", s->name, name);
        f = fopen(x, "w");
        if (!f)
                fatal("Cannot write to %s\n", x);
@@ -180,13 +181,13 @@ void set_obj(struct slabinfo *s, char *name, int n)
        fclose(f);
 }
 
-unsigned long read_slab_obj(struct slabinfo *s, char *name)
+unsigned long read_slab_obj(struct slabinfo *s, const char *name)
 {
        char x[100];
        FILE *f;
-       int l;
+       size_t l;
 
-       sprintf(x, "%s/%s", s->name, name);
+       snprintf(x, 100, "%s/%s", s->name, name);
        f = fopen(x, "r");
        if (!f) {
                buffer[0] = 0;
@@ -453,7 +454,7 @@ void slabcache(struct slabinfo *s)
                return;
 
        store_size(size_str, slab_size(s));
-       sprintf(dist_str,"%lu/%lu/%d", s->slabs, s->partial, s->cpu_slabs);
+       snprintf(dist_str, 40, "%lu/%lu/%d", s->slabs, s->partial, s->cpu_slabs);
 
        if (!line++)
                first_line();
@@ -1062,6 +1063,7 @@ void read_slab_dir(void)
                        slab->partial = get_obj("partial");
                        slab->partial = get_obj_and_str("partial", &t);
                        decode_numa_list(slab->numa_partial, t);
+                       free(t);
                        slab->poison = get_obj("poison");
                        slab->reclaim_account = get_obj("reclaim_account");
                        slab->red_zone = get_obj("red_zone");
@@ -1069,6 +1071,7 @@ void read_slab_dir(void)
                        slab->slab_size = get_obj("slab_size");
                        slab->slabs = get_obj_and_str("slabs", &t);
                        decode_numa_list(slab->numa, t);
+                       free(t);
                        slab->store_user = get_obj("store_user");
                        slab->trace = get_obj("trace");
                        chdir("..");
@@ -1148,7 +1151,7 @@ int main(int argc, char *argv[])
 
        while ((c = getopt_long(argc, argv, "ad::efhil1noprstvzTS",
                                                opts, NULL)) != -1)
-       switch(c) {
+               switch (c) {
                case '1':
                        show_single_ref = 1;
                        break;
diff --git a/Documentation/w1/00-INDEX b/Documentation/w1/00-INDEX
new file mode 100644 (file)
index 0000000..5270cf4
--- /dev/null
@@ -0,0 +1,8 @@
+00-INDEX
+       - This file
+masters/
+       - Individual chips providing 1-wire busses.
+w1.generic
+       - The 1-wire (w1) bus
+w1.netlink
+       - Userspace communication protocol over connector [1].
diff --git a/Documentation/w1/masters/00-INDEX b/Documentation/w1/masters/00-INDEX
new file mode 100644 (file)
index 0000000..752613c
--- /dev/null
@@ -0,0 +1,6 @@
+00-INDEX
+       - This file
+ds2482
+       - The Maxim/Dallas Semiconductor DS2482 provides 1-wire busses.
+ds2490
+       - The Maxim/Dallas Semiconductor DS2490 builds USB <-> W1 bridges.
index c5d5478d90b27a6508682ff67d038d72303c6058..9210d6fa50247a687e0e51e242c15e3ecbbaad28 100644 (file)
@@ -15,7 +15,7 @@ Author: Ben Gardner <bgardner@wabtec.com>
 Description
 -----------
 
-The Maixm/Dallas Semiconductor DS2482 is a I2C device that provides
+The Maxim/Dallas Semiconductor DS2482 is a I2C device that provides
 one (DS2482-100) or eight (DS2482-800) 1-wire busses.
 
 
index 44a4918bd7f2a73aa1b0b2313f12fd9e747b909c..239f9ae018432c0ad23a33603bf429e062a40866 100644 (file)
@@ -10,7 +10,7 @@ Author: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
 Description
 -----------
 
-The Maixm/Dallas Semiconductor DS2490 is a chip
+The Maxim/Dallas Semiconductor DS2490 is a chip
 which allows to build USB <-> W1 bridges.
 
 DS9490(R) is a USB <-> W1 bus master device
diff --git a/Documentation/xterm-linux.xpm b/Documentation/xterm-linux.xpm
deleted file mode 100644 (file)
index f469c1a..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* XPM */
-/*****************************************************************************/
-/**       This pixmap was made by Torsten Poulin - 1996 - torsten@diku.dk   **/
-/**       It was made by combining xterm-blank.xpm with                     **/
-/**       the wonderfully cute Linux penguin mascot by Larry Ewing.         **/
-/**       I had to change Larry's penguin a little to make it fit.          **/
-/**       xterm-blank.xpm contained the following comment:                  **/
-/**       This pixmap is kindly offered by Ion Cionca - 1992 -              **/
-/**       Swiss Federal Institute of Technology                             **/
-/**       Central Computing Service                                         **/
-/*****************************************************************************/
-static char * image_name [] = {
-/**/
-"64 38 8 1",
-/**/
-"      s mask  c none",
-".     c gray70",
-"X     c gray85",
-"o     c gray50",
-"O     c yellow",
-"+     c darkolivegreen",
-"@     c white",
-"#     c black",
-"              ######                                            ",
-"             ########                                           ",
-"            ##########    ...........................           ",
-"            ###########  .XXXXXXXXXXXXXXXXXXXXXXXXXXX.          ",
-"            ########### .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXoo        ",
-"            #@@@#@@@### .XX+++++++++++++++++++++++XXXXoo        ",
-"            #@#@#@#@### .XX++++++++++++++++++++++++XXXooo       ",
-"            #@#####@### .XX++@@+@++@+@@@@++@+++++++XXXooo       ",
-"            ###OOO######.XX++++++++++++++++++++++++XXXoooo      ",
-"            ##OOOOOO####.XX++@@@@+@@+@@@+++++++++++XXXoooo      ",
-"            #O#OOO#O####.XX++++++++++++++++++++++++XXXooooo     ",
-"            ##O###OO####.XX++@@@@@@@@@@+@@@@@++++++XXXooooo     ",
-"            ###OOOO@#####XX++++++++++++++++++++++++XXXooooo     ",
-"           ##@###@@@@####XX++@@@+@@@@+@@++@@@++++++XXXooooo     ",
-"           #@@@@@@@@@@####X++++++++++++++++++++++++XXXooooo     ",
-"          ##@@@@@@@@@@#####++@+++++++++++++++++++++XXXooooo     ",
-"         ###@@@@@@@@@@######+++++++++++++++++++++++XXXooooo     ",
-"        ####@@@@@@@@@@@#####+@@@@+@+@@@+@++++++++++XXXooooo     ",
-"        ###@@@@@@@@@@@@######++++++++++++++++++++++XXXooooo     ",
-"        ##@@@@@@@@@@@@@@#####@+@@@@++++++++++++++++XXXooooo     ",
-"       ###@@@@@@@@@@@@@@######++++++++++++++++++++XXXXoooo      ",
-"       ###@@@@@@@@@@@@@@######XXXXXXXXXXXXXXXXXXXXXXXXooo       ",
-"      ###@@@@@@@@@@@@@@@######XXXXXXXXXXXXXXXXXXXXXXXooo        ",
-"      ###@@@@@@@@@@@@@@@@#####ooooooooooooooooooooooo...oo      ",
-"      ###@@@@@@@@@@@@@@@######.........................ooo      ",
-"     #OO##@@@@@@@@@@@@@#######oooooooooooooooooooooooooooo      ",
-"     #OOO##@@@@@@@@@@@#OO####O#XXXXXXXXXXXXXXXXXXXXXXXoooo.. .. ",
-"  ###OOOOO##@@@@@@@@@@#OOO#OOO#XXXXXXXXXXXXXX#######XXoooo  .  .",
-" #OOOOOOOO###@@@@@@@@@#OOOOOOO#ooooooooooooooooooooXXXooo     . ",
-" #OOOOOOOOO###@@@@@@@@@#OOOOOOO##XXXXXXXXXXXXXXXXXooooo      .  ",
-"  #OOOOOOOOO#@@@@@@@@###OOOOOOOOO#XXXXXXXXXXXXXXXoo      oooooo ",
-"  #OOOOOOOOO#@@@@@@@####OOOOOOOO#@@@@@@@@@@@XXXXXoo   ooooo...o ",
-" #OOOOOOOOOOO###########OOOOOO##XXXXXXXXXXXXXXXXoo   ooXXXoo..o ",
-"  ##OOOOOOOOO###########OOOO##@@@@@@@@@@@@@XXXXoo    oXXXXX..o  ",
-"     ###OOOO###    oXX##OOO#XXXXXXXXXXXXXXXXXXoo     o.....oo   ",
-"         ####      oooo####oooooooooooooooooooo      ooooooo    ",
-"                                                                ",
-"                                                                "};
index cc3b233ccaca7b13cc2296ee779967f9f16a38ab..10deabeb3929f674e462da6f6a5667fd08784e17 100644 (file)
@@ -1877,10 +1877,8 @@ T:       quilt kernel.org/pub/linux/kernel/people/bart/pata-2.6/
 S:     Maintained
 
 IDE/ATAPI CDROM DRIVER
-P:     Alan Cox
-M:     alan@lxorguk.ukuu.org.uk
 L:     linux-ide@vger.kernel.org
-S:     Maintained
+S:     Unmaintained
 
 IDE/ATAPI FLOPPY DRIVERS
 P:     Paul Bristow
@@ -2488,7 +2486,7 @@ S:        Supported
 
 MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
 P:     Michael Kerrisk
-M:     mtk-manpages@gmx.net
+M:     mtk.manpages@gmail.com
 W:     ftp://ftp.kernel.org/pub/linux/docs/manpages
 S:     Maintained
 
@@ -3709,7 +3707,7 @@ S:      Maintained
 
 TI OMAP MMC INTERFACE DRIVER
 P:     Carlos Aguiar, Anderson Briglia and Syed Khasim
-M:     linux-omap-open-source@linux.omap.com 
+M:     linux-omap-open-source@linux.omap.com (subscribers only)
 W:     http://linux.omap.com
 W:     http://www.muru.com/linux/omap/
 S:     Maintained
index 4d25e49a14f7ca4eed6eea0a932fea2518fd8908..9bd1870d980ec74b5c77936828a1f7e6f481047b 100644 (file)
@@ -26,9 +26,9 @@
 #include <linux/fs.h>
 #include <linux/file.h>
 #include <linux/utsname.h>
+#include <linux/ipc.h>
 
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 
 extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
                               unsigned long new_len, unsigned long flags,
index 8e2f9bc3368b0600f99c6eef4ae6c3cc70db1fe3..e8b98046895b9b3907e9f02b2dc4d7393cdfc424 100644 (file)
@@ -80,7 +80,7 @@
 #include <linux/sem.h>
 #include <linux/socket.h>
 #include <linux/net.h>
-#include <asm/ipc.h>
+#include <linux/ipc.h>
 #include <asm/uaccess.h>
 
 struct oldabi_stat64 {
index 992ca435a9222a0cf4241ec632135878cfb21a01..29696e46ed659bab0fdb00cc5fc0f17aaf8f1040 100644 (file)
@@ -1272,7 +1272,7 @@ struct sysdev_class dma_sysclass = {
 
 /* kmem cache implementation */
 
-static void s3c2410_dma_cache_ctor(void *p, struct kmem_cache *c, unsigned long f)
+static void s3c2410_dma_cache_ctor(struct kmem_cache *c, void *p)
 {
        memset(p, 0, sizeof(struct s3c2410_dma_buf));
 }
index 099212d4567c5d33d649c2c0988ec538dfb49803..177fea8f7b711e90d87e208db5f9d36adaef3be6 100644 (file)
@@ -21,13 +21,13 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, int direction)
 
        switch (direction) {
        case DMA_FROM_DEVICE:           /* invalidate only */
-               dma_cache_inv(vaddr, size);
+               invalidate_dcache_region(vaddr, size);
                break;
        case DMA_TO_DEVICE:             /* writeback only */
-               dma_cache_wback(vaddr, size);
+               clean_dcache_region(vaddr, size);
                break;
        case DMA_BIDIRECTIONAL:         /* writeback and invalidate */
-               dma_cache_wback_inv(vaddr, size);
+               flush_dcache_region(vaddr, size);
                break;
        default:
                BUG();
index 0aa0e0ebb3a9e8411509915cf7af48a541c89394..514359b8122e5b14a2e99a8f6c0a001953f1a27a 100644 (file)
@@ -21,9 +21,9 @@
 #include <linux/stat.h>
 #include <linux/mman.h>
 #include <linux/file.h>
+#include <linux/ipc.h>
 
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 #include <asm/segment.h>
 
 /*
index 6fbe2665c5776d794f2594dbe2a51784585dcae9..04c6b1677ccf7eb49d5eea003979c6c223e6d00d 100644 (file)
 #include <linux/file.h>
 #include <linux/utsname.h>
 #include <linux/syscalls.h>
+#include <linux/ipc.h>
 
 #include <asm/setup.h>
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 
 /*
  * sys_pipe() is the normal C calling standard for creating
index ddc62727dc9f42ac3a38097dd32367a5acb985ee..00608be6d56772cb0ece55d72b7ff5dab9440352 100644 (file)
 #include <linux/file.h>
 #include <linux/utsname.h>
 #include <linux/fs.h>
+#include <linux/ipc.h>
 
 #include <asm/setup.h>
 #include <asm/uaccess.h>
 #include <asm/cachectl.h>
 #include <asm/traps.h>
-#include <asm/ipc.h>
 #include <asm/unistd.h>
 
 /*
index bf9aafad49788a49d5dc331a7189eb88ae3eb082..7a95c58947e42043f96580024b307e5ef7efcbcc 100644 (file)
@@ -831,12 +831,13 @@ config CRASH_DUMP
        depends on HIGHMEM
        help
          Generate crash dump after being started by kexec.
-          This should be normally only set in special crash dump kernels
+         This should be normally only set in special crash dump kernels
          which are loaded in the main kernel with kexec-tools into
          a specially reserved region and then later executed after
          a crash by kdump/kexec. The crash dump kernel must be compiled
-          to a memory address not used by the main kernel or BIOS using
-          PHYSICAL_START.
+         to a memory address not used by the main kernel or BIOS using
+         PHYSICAL_START, or it must be built as a relocatable image
+         (CONFIG_RELOCATABLE=y).
          For more details see Documentation/kdump/kdump.txt
 
 config PHYSICAL_START
@@ -882,17 +883,17 @@ config PHYSICAL_START
          Don't change this unless you know what you are doing.
 
 config RELOCATABLE
-       bool "Build a relocatable kernel(EXPERIMENTAL)"
+       bool "Build a relocatable kernel (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        help
          This builds a kernel image that retains relocation information
-          so it can be loaded someplace besides the default 1MB.
+         so it can be loaded someplace besides the default 1MB.
          The relocations tend to make the kernel binary about 10% larger,
-          but are discarded at runtime.
+         but are discarded at runtime.
 
          One use is for the kexec on panic case where the recovery kernel
-          must live at a different physical address than the primary
-          kernel.
+         must live at a different physical address than the primary
+         kernel.
 
 config PHYSICAL_ALIGN
        hex "Alignment value to which kernel should be aligned"
@@ -1256,7 +1257,6 @@ source "fs/Kconfig"
 
 menuconfig INSTRUMENTATION
        bool "Instrumentation Support"
-       depends on EXPERIMENTAL
        default y
        ---help---
          Say Y here to get to see options related to performance measurement,
index 59b91ac861ac5cbabc3373a770fa76e51955e287..c60532d93c541714efd6111b871a530bedf3479a 100644 (file)
@@ -593,7 +593,6 @@ config IRQ_PER_CPU
 source "arch/ia64/hp/sim/Kconfig"
 
 menu "Instrumentation Support"
-        depends on EXPERIMENTAL
 
 source "arch/ia64/oprofile/Kconfig"
 
index 1cfab326fb7e33260c88c3a533bc01a61d267540..f6ae3ec938105c8f94b688823f0e16c9e28f06d3 100644 (file)
@@ -240,7 +240,7 @@ static int __init check_elf32_binfmt(void)
 {
        if (cpu_uses_ia32el()) {
                printk("Please use IA-32 EL for executing IA-32 binaries\n");
-               return unregister_binfmt(&elf_format);
+               unregister_binfmt(&elf_format);
        }
        return 0;
 }
index a47f63b204fbbc8d1cf02b982dab0d2992aeac0d..446c9aac924dce0271f14068dcd99ee4e84907aa 100644 (file)
@@ -117,6 +117,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
 }
 
 #define ELF_CORE_COPY_XFPREGS 1
+#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
 static inline int
 elf_core_copy_task_xfpregs(struct task_struct *tsk, elf_fpxregset_t *xfpu)
 {
index 58e943a5d95c6256778704e3e4e33de36e5188e6..0dd3b2394cdd7275a97888d2143f6996877382a8 100644 (file)
 #include <linux/cpu.h>
 #include <linux/irq.h>
 #include <linux/efi.h>
+#include <linux/numa.h>
+#include <linux/mmzone.h>
 #include <asm/mmu_context.h>
 #include <asm/setup.h>
 #include <asm/delay.h>
 #include <asm/meminit.h>
+#include <asm/processor.h>
 
 typedef NORET_TYPE void (*relocate_new_kernel_t)(
                                        unsigned long indirection_page,
@@ -121,3 +124,28 @@ void machine_kexec(struct kimage *image)
        unw_init_running(ia64_machine_kexec, image);
        for(;;);
 }
+
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+       VMCOREINFO_SYMBOL(pgdat_list);
+       VMCOREINFO_LENGTH(pgdat_list, MAX_NUMNODES);
+
+       VMCOREINFO_SYMBOL(node_memblk);
+       VMCOREINFO_LENGTH(node_memblk, NR_NODE_MEMBLKS);
+       VMCOREINFO_SIZE(node_memblk_s);
+       VMCOREINFO_OFFSET(node_memblk_s, start_paddr);
+       VMCOREINFO_OFFSET(node_memblk_s, size);
+#endif
+#ifdef CONFIG_PGTABLE_3
+       VMCOREINFO_CONFIG(PGTABLE_3);
+#elif  CONFIG_PGTABLE_4
+       VMCOREINFO_CONFIG(PGTABLE_4);
+#endif
+}
+
+unsigned long paddr_vmcoreinfo_note(void)
+{
+       return ia64_tpa((unsigned long)(char *)&vmcoreinfo_note);
+}
+
index 5628067a74d2f1c81f4d6b5f1d24cd3a718c8d77..0b567398f38e0319568c43154f00e9fe2456a344 100644 (file)
@@ -48,7 +48,7 @@ struct early_node_data {
 static struct early_node_data mem_data[MAX_NUMNODES] __initdata;
 static nodemask_t memory_less_mask __initdata;
 
-static pg_data_t *pgdat_list[MAX_NUMNODES];
+pg_data_t *pgdat_list[MAX_NUMNODES];
 
 /*
  * To prevent cache aliasing effects, align per-node structures so that they
index b13dbbeaeafa0b6c3c0c77bd240e53a282315ea9..0fc2efec18f635f91f8191cebf001bd22dce7642 100644 (file)
 #include <linux/mman.h>
 #include <linux/file.h>
 #include <linux/utsname.h>
+#include <linux/ipc.h>
 
 #include <asm/uaccess.h>
 #include <asm/cachectl.h>
 #include <asm/cacheflush.h>
-#include <asm/ipc.h>
 #include <asm/syscall.h>
 #include <asm/unistd.h>
 
index 36d78cf1a7bc14ea5c86550a8a209846829d6f41..e892f17ba3fac4984a84bbdd7d5e501cab80fe90 100644 (file)
 #include <linux/mman.h>
 #include <linux/file.h>
 #include <linux/utsname.h>
+#include <linux/ipc.h>
 
 #include <asm/setup.h>
 #include <asm/uaccess.h>
 #include <asm/cachectl.h>
 #include <asm/traps.h>
-#include <asm/ipc.h>
 #include <asm/page.h>
 #include <asm/unistd.h>
 
index 15d62c5279a95d91642391c5365d7cfa4922ca10..65f7a95f056e9726281521b792e5d12a9a9b6282 100644 (file)
 #include <linux/mman.h>
 #include <linux/file.h>
 #include <linux/utsname.h>
+#include <linux/ipc.h>
 #include <linux/fs.h>
 
 #include <asm/setup.h>
 #include <asm/uaccess.h>
 #include <asm/cachectl.h>
 #include <asm/traps.h>
-#include <asm/ipc.h>
 #include <asm/cacheflush.h>
 #include <asm/unistd.h>
 
index 6b663bec4752af5c8102c97fc2b8316e17bb9f02..14164c2b8791f00f13ae22b5c74e7b750ba7df11 100644 (file)
@@ -279,7 +279,6 @@ core-$(CONFIG_MACH_DECSTATION)      += arch/mips/dec/
 cflags-$(CONFIG_MACH_DECSTATION)+= -Iinclude/asm-mips/mach-dec
 libs-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/prom/
 load-$(CONFIG_MACH_DECSTATION) += 0xffffffff80040000
-CLEAN_FILES                    += drivers/tc/lk201-map.c
 
 #
 # Wind River PPMC Board (4KC + GT64120)
index 8ef5cf4cc42355e846eddfd65382e3e83c820137..b997af713eb393aa6d4322d8f1d3d326e5dd57e9 100644 (file)
 static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs);
 static int load_irix_library(struct file *);
 static int irix_core_dump(long signr, struct pt_regs * regs,
-                          struct file *file);
+                          struct file *file, unsigned long limit);
 
 static struct linux_binfmt irix_format = {
-       NULL, THIS_MODULE, load_irix_binary, load_irix_library,
-       irix_core_dump, PAGE_SIZE
+       .module         = THIS_MODULE,
+       .load_binary    = load_irix_binary,
+       .load_shlib     = load_irix_library,
+       .core_dump      = irix_core_dump,
+       .min_coredump   = PAGE_SIZE,
 };
 
 /* Debugging routines. */
@@ -1088,7 +1091,7 @@ end_coredump:
  * and then they are actually written out.  If we run out of core limit
  * we just truncate.
  */
-static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
+static int irix_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
 {
        int has_dumped = 0;
        mm_segment_t fs;
@@ -1098,7 +1101,6 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
        struct vm_area_struct *vma;
        struct elfhdr elf;
        off_t offset = 0, dataoff;
-       int limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
        int numnote = 3;
        struct memelfnote notes[3];
        struct elf_prstatus prstatus;   /* NT_PRSTATUS */
index d6e01215fb2b8e09426eab0b2dfc1e6da6b1a82e..2b8ec1102e863329393ad57eee20aea2e5581afa 100644 (file)
 #include <linux/security.h>
 #include <linux/compat.h>
 #include <linux/vfs.h>
+#include <linux/ipc.h>
 
 #include <net/sock.h>
 #include <net/scm.h>
 
 #include <asm/compat-signal.h>
-#include <asm/ipc.h>
 #include <asm/sim.h>
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
index 17c4374d22091c50c6e3bea6fad75b0276a65509..b95fe93dd646dad70290be9694bba0d7e37715c6 100644 (file)
 #include <linux/shm.h>
 #include <linux/compiler.h>
 #include <linux/module.h>
+#include <linux/ipc.h>
 
 #include <asm/branch.h>
 #include <asm/cachectl.h>
 #include <asm/cacheflush.h>
-#include <asm/ipc.h>
 #include <asm/asm-offsets.h>
 #include <asm/signal.h>
 #include <asm/sim.h>
index 43dde874f4140a554148464040647fde608923b2..81f30ac2bff95fe7c406e3dcf7429899c0e74380 100644 (file)
@@ -47,8 +47,6 @@ void (*_dma_cache_wback)(unsigned long start, unsigned long size);
 void (*_dma_cache_inv)(unsigned long start, unsigned long size);
 
 EXPORT_SYMBOL(_dma_cache_wback_inv);
-EXPORT_SYMBOL(_dma_cache_wback);
-EXPORT_SYMBOL(_dma_cache_inv);
 
 #endif /* CONFIG_DMA_NONCOHERENT */
 
index 09fa007c1d1bf12a7543ae6089cef0052b1f3b64..059eade96f2e74fdd3aa29da8fe30919f5a84379 100644 (file)
@@ -206,7 +206,7 @@ static void pci_proc_init(void)
 }
 #endif /* CONFIG_PROC_FS && PCI_COUNTERS */
 
-spinlock_t bpci_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(bpci_lock);
 
 /*****************************************************************************
  *
index 5e001ad588a7d385ea5f916ccd32b72c92ed93fe..d11a746975bc26b608cc7ba85f8d0ccdea25ef44 100644 (file)
@@ -670,7 +670,6 @@ source "arch/powerpc/sysdev/qe_lib/Kconfig"
 source "lib/Kconfig"
 
 menu "Instrumentation Support"
-       depends on EXPERIMENTAL
 
 source "arch/powerpc/oprofile/Kconfig"
 
index 5cb58757e1b1badcf32744c28a62abc87542941e..1d45d7782d4ec7d454e57240791c1896d0432e48 100644 (file)
  * 2 of the License, or (at your option) any later version.
  */
 
-#define ELF_ARCH               EM_PPC
-#define ELF_CLASS              ELFCLASS32
-#define ELF_DATA               ELFDATA2MSB;
-
 #include <asm/processor.h>
 #include <linux/module.h>
-#include <linux/elfcore.h>
 #include <linux/compat.h>
+#include <linux/elfcore-compat.h>
+
+#undef ELF_ARCH
+#undef ELF_CLASS
+#define ELF_CLASS      ELFCLASS32
+#define ELF_ARCH       EM_PPC
+
+#undef elfhdr
+#undef elf_phdr
+#undef elf_note
+#undef elf_addr_t
+#define elfhdr         elf32_hdr
+#define elf_phdr       elf32_phdr
+#define elf_note       elf32_note
+#define elf_addr_t     Elf32_Off
 
-#define elf_prstatus elf_prstatus32
-struct elf_prstatus32
+#define elf_prstatus   compat_elf_prstatus
+#define elf_prpsinfo   compat_elf_prpsinfo
+
+#define elf_core_copy_regs compat_elf_core_copy_regs
+static inline void compat_elf_core_copy_regs(compat_elf_gregset_t *elf_regs,
+                                            struct pt_regs *regs)
 {
-       struct elf_siginfo pr_info;     /* Info associated with signal */
-       short   pr_cursig;              /* Current signal */
-       unsigned int pr_sigpend;        /* Set of pending signals */
-       unsigned int pr_sighold;        /* Set of held signals */
-       pid_t   pr_pid;
-       pid_t   pr_ppid;
-       pid_t   pr_pgrp;
-       pid_t   pr_sid;
-       struct compat_timeval pr_utime; /* User time */
-       struct compat_timeval pr_stime; /* System time */
-       struct compat_timeval pr_cutime;        /* Cumulative user time */
-       struct compat_timeval pr_cstime;        /* Cumulative system time */
-       elf_gregset_t pr_reg;           /* General purpose registers. */
-       int pr_fpvalid;         /* True if math co-processor being used. */
-};
+       PPC_ELF_CORE_COPY_REGS((*elf_regs), regs);
+}
 
-#define elf_prpsinfo elf_prpsinfo32
-struct elf_prpsinfo32
+#define elf_core_copy_task_regs compat_elf_core_copy_task_regs
+static int compat_elf_core_copy_task_regs(struct task_struct *tsk,
+                                         compat_elf_gregset_t *elf_regs)
 {
-       char    pr_state;       /* numeric process state */
-       char    pr_sname;       /* char for pr_state */
-       char    pr_zomb;        /* zombie */
-       char    pr_nice;        /* nice val */
-       unsigned int pr_flag;   /* flags */
-       u32     pr_uid;
-       u32     pr_gid;
-       pid_t   pr_pid, pr_ppid, pr_pgrp, pr_sid;
-       /* Lots missing */
-       char    pr_fname[16];   /* filename of executable */
-       char    pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
-};
+       struct pt_regs *regs = tsk->thread.regs;
+       if (regs)
+               compat_elf_core_copy_regs(elf_regs, regs);
+       return 1;
+}
 
 #include <linux/time.h>
 
index 7949c203cb89f5df7a7b27471d1b904e9af672a0..ea6ad7a2a7e3df329b9e56e4aaca83e524905148 100644 (file)
@@ -149,10 +149,32 @@ void flush_altivec_to_thread(struct task_struct *tsk)
        }
 }
 
-int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
+int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
 {
-       flush_altivec_to_thread(current);
-       memcpy(vrregs, &current->thread.vr[0], sizeof(*vrregs));
+       /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
+        * separately, see below */
+       const int nregs = ELF_NVRREG - 2;
+       elf_vrreg_t *reg;
+       u32 *dest;
+
+       if (tsk == current)
+               flush_altivec_to_thread(tsk);
+
+       reg = (elf_vrreg_t *)vrregs;
+
+       /* copy the 32 vr registers */
+       memcpy(reg, &tsk->thread.vr[0], nregs * sizeof(*reg));
+       reg += nregs;
+
+       /* copy the vscr */
+       memcpy(reg, &tsk->thread.vscr, sizeof(*reg));
+       reg++;
+
+       /* vrsave is stored in the high 32bit slot of the final 128bits */
+       memset(reg, 0, sizeof(*reg));
+       dest = (u32 *)reg;
+       *dest = tsk->thread.vrsave;
+
        return 1;
 }
 #endif /* CONFIG_ALTIVEC */
index 62b7bf2f3eab5a9fd77738d3689e167298900fa1..f2276593f41648c7dc00330458622d63bca14b9b 100644 (file)
@@ -286,7 +286,7 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
 }
 
 /* constructor for flash_block_cache */
-void rtas_block_ctor(void *ptr, struct kmem_cache *cache, unsigned long flags)
+void rtas_block_ctor(struct kmem_cache *cache, void *ptr)
 {
        memset(ptr, 0, RTAS_BLK_SIZE);
 }
index bd85b5fd08c818763fda919135ca3268ff0e4520..4a4f5c6b560bb6608cd133e6387929b056990570 100644 (file)
 #include <linux/compat.h>
 #include <linux/ptrace.h>
 #include <linux/elf.h>
+#include <linux/ipc.h>
 
 #include <asm/ptrace.h>
 #include <asm/types.h>
-#include <asm/ipc.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/semaphore.h>
index f85f402ceaefea89461e4e558efed352e91b272e..3b1d5dd65643a0530c2503330a0b88fe48853cfa 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/personality.h>
 
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 #include <asm/semaphore.h>
 #include <asm/syscalls.h>
 #include <asm/time.h>
index 08f0d9ff7712cb64d9a2be9c69f4786db1d93216..71efb38d599be75490f61ca929a160ea8f86ab8c 100644 (file)
@@ -526,7 +526,7 @@ repeat:
        return err;
 }
 
-static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags)
+static void zero_ctor(struct kmem_cache *cache, void *addr)
 {
        memset(addr, 0, kmem_cache_size(cache));
 }
index 702d884a338a2f5da89bb1ee4b03297670cb47e0..e91da675bb3bc1cd4a74fa865c9abe80d2ab5fbd 100644 (file)
@@ -142,7 +142,7 @@ static int __init setup_kcore(void)
 module_init(setup_kcore);
 #endif
 
-static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags)
+static void zero_ctor(struct kmem_cache *cache, void *addr)
 {
        memset(addr, 0, kmem_cache_size(cache));
 }
index 319826ef164519dd301647fed86bb50c9463d80f..ad928edafb0aae614f1f7f121c5a2fb18fba7941 100644 (file)
@@ -34,7 +34,7 @@
 #include <asm/mmu.h>
 #include <asm/spu.h>
 
-static spinlock_t slice_convert_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(slice_convert_lock);
 
 
 #ifdef DEBUG
index 11098747d09b42445d090423f04e82e44025be28..0966d093db4321925baf4fb6057c1760c01a1bf6 100644 (file)
@@ -68,7 +68,7 @@ spufs_destroy_inode(struct inode *inode)
 }
 
 static void
-spufs_init_once(void *p, struct kmem_cache * cachep, unsigned long flags)
+spufs_init_once(struct kmem_cache *cachep, void *p)
 {
        struct spufs_inode_info *ei = p;
 
index 5ddf40a66ae8f189da5fbc4f7d39bf5c3934a40d..3a5d112af5e096632657e59dce37252ef5b7a243 100644 (file)
 #include <asm/time.h>
 #include <asm/of_platform.h>
 
+#include <pcmcia/ss.h>
+#include <pcmcia/cistpl.h>
+#include <pcmcia/ds.h>
+
 #include "pasemi.h"
 
 /* SDC reset register, must be pre-mapped at reset time */
@@ -308,7 +312,57 @@ static void __init pas_init_early(void)
        iommu_init_early_pasemi();
 }
 
+#ifdef CONFIG_PCMCIA
+static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
+                        void *data)
+{
+       struct device *dev = data;
+       struct device *parent;
+       struct pcmcia_device *pdev = to_pcmcia_dev(dev);
+
+       /* We are only intereted in device addition */
+       if (action != BUS_NOTIFY_ADD_DEVICE)
+               return 0;
+
+       parent = pdev->socket->dev.parent;
+
+       /* We know electra_cf devices will always have of_node set, since
+        * electra_cf is an of_platform driver.
+        */
+       if (!parent->archdata.of_node)
+               return 0;
+
+       if (!of_device_is_compatible(parent->archdata.of_node, "electra-cf"))
+               return 0;
+
+       /* We use the direct ops for localbus */
+       dev->archdata.dma_ops = &dma_direct_ops;
+
+       return 0;
+}
+
+static struct notifier_block pcmcia_notifier = {
+       .notifier_call = pcmcia_notify,
+};
+
+static inline void pasemi_pcmcia_init(void)
+{
+       extern struct bus_type pcmcia_bus_type;
+
+       bus_register_notifier(&pcmcia_bus_type, &pcmcia_notifier);
+}
+
+#else
+
+static inline void pasemi_pcmcia_init(void)
+{
+}
+
+#endif
+
+
 static struct of_device_id pasemi_bus_ids[] = {
+       { .type = "localbus", },
        { .type = "sdc", },
        {},
 };
@@ -318,6 +372,8 @@ static int __init pasemi_publish_devices(void)
        if (!machine_is(pasemi))
                return 0;
 
+       pasemi_pcmcia_init();
+
        /* Publish OF platform devices for SDC and other non-PCI devices */
        of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
 
index 5236fdb17fcb4ce154ee0622ccbbc26c4de03b33..50b85d07ddd250ce81a1104ae59793b76a7ec507 100644 (file)
@@ -58,9 +58,9 @@
 #include <linux/vfs.h>
 #include <linux/ptrace.h>
 #include <linux/fadvise.h>
+#include <linux/ipc.h>
 
 #include <asm/types.h>
-#include <asm/ipc.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 
index 1eaff84a1eb652191611d5c7a47a713995342973..fefee99f28aaa792031e4d849e3d2eecfaa9ae06 100644 (file)
@@ -28,9 +28,9 @@
 #include <linux/utsname.h>
 #include <linux/personality.h>
 #include <linux/unistd.h>
+#include <linux/ipc.h>
 
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 
 /*
  * sys_pipe() is the normal C calling standard for creating
index fabc50adc46a4f9447466861883e1b3601b261a1..d4ed93dfb9c7fba3eada5ccbcf4cdf66c39ebc8a 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/ctype.h>
 #include <linux/swap.h>
 #include <linux/kthread.h>
+#include <linux/oom.h>
 
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
index 230d6ec0d2398df92d56525a9cbfbbc212e03d96..888a3405059916541c0781dfc6205f722599a976 100644 (file)
@@ -51,7 +51,7 @@ void *dreamcast_consistent_alloc(struct device *dev, size_t size,
        buf = P2SEGADDR(buf);
 
        /* Flush the dcache before we hand off the buffer */
-       dma_cache_wback_inv((void *)buf, size);
+       __flush_purge_region((void *)buf, size);
 
        return (void *)buf;
 }
index 024ce5dedd8c12d682b3c7f73de7caf769bbd46c..d545a686a201a9d010a616861e40f44cf1d4fdaf 100644 (file)
@@ -22,9 +22,9 @@
 #include <linux/utsname.h>
 #include <linux/module.h>
 #include <linux/fs.h>
+#include <linux/ipc.h>
 #include <asm/cacheflush.h>
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 #include <asm/unistd.h>
 
 /*
index 38c82d890ffda6a5cb332ad3b387bde0476dc551..e220c29a3c00cf03fab0da8c4dd329160269d577 100644 (file)
@@ -34,7 +34,7 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *handle)
        /*
         * We must flush the cache before we pass it on to the device
         */
-       dma_cache_wback_inv(ret, size);
+       __flush_purge_region(ret, size);
 
        page = virt_to_page(ret);
        free = page + (size >> PAGE_SHIFT);
@@ -68,13 +68,13 @@ void consistent_sync(void *vaddr, size_t size, int direction)
 
        switch (direction) {
        case DMA_FROM_DEVICE:           /* invalidate only */
-               dma_cache_inv(p1addr, size);
+               __flush_invalidate_region(p1addr, size);
                break;
        case DMA_TO_DEVICE:             /* writeback only */
-               dma_cache_wback(p1addr, size);
+               __flush_wback_region(p1addr, size);
                break;
        case DMA_BIDIRECTIONAL:         /* writeback and invalidate */
-               dma_cache_wback_inv(p1addr, size);
+               __flush_purge_region(p1addr, size);
                break;
        default:
                BUG();
index 7d43758dc2442276fe9391a6b75ac823d1e0454b..1d45b82f0a638e12ef1afb939feafc2a39b95612 100644 (file)
@@ -292,8 +292,7 @@ void pmb_unmap(unsigned long addr)
        } while (pmbe);
 }
 
-static void pmb_cache_ctor(void *pmb, struct kmem_cache *cachep,
-                          unsigned long flags)
+static void pmb_cache_ctor(struct kmem_cache *cachep, void *pmb)
 {
        struct pmb_entry *pmbe = pmb;
 
index b7f18e298a208e9a6b593200aa7c8d72f928eda0..de0a303ba26fead3304bcce7446724bab7aaaf3d 100644 (file)
@@ -29,8 +29,8 @@
 #include <linux/file.h>
 #include <linux/utsname.h>
 #include <linux/syscalls.h>
+#include <linux/ipc.h>
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 #include <asm/ptrace.h>
 #include <asm/unistd.h>
 
index 8875a2a40da72dafa6eb2f7f8315a76d60bebe67..c439620402cb1812d0666eaa6492ce04ebbabec4 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/io.h>
 
@@ -32,7 +33,7 @@ void *consistent_alloc(struct pci_dev *hwdev, size_t size,
        if (vp != NULL) {
                memset(vp, 0, size);
                *dma_handle = virt_to_phys(ret);
-               dma_cache_wback_inv((unsigned long)ret, size);
+               dma_cache_sync(NULL, ret, size, DMA_BIDIRECTIONAL);
        }
 
        return vp;
index 9d327ec59759746bf0938f53f89ed2569fba7c44..c0f4ba109daab7ef41e302d46de488fa29aa622b 100644 (file)
@@ -321,7 +321,6 @@ endmenu
 source "fs/Kconfig"
 
 menu "Instrumentation Support"
-       depends on EXPERIMENTAL
 
 source "arch/sparc/oprofile/Kconfig"
 
index a954a0c000002410e518e05f9ba905e8f53ff31a..6c0221e9a9f5a8abafefa9f8e26aa55e0c068b5c 100644 (file)
@@ -21,9 +21,9 @@
 #include <linux/utsname.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
+#include <linux/ipc.h>
 
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 #include <asm/unistd.h>
 
 /* #define DEBUG_UNIMP_SYSCALL */
index 2f22fa90461acae3fb9b5a8db81469bc5d594c25..59c4d752d286d5638e02e9e82e190c2b56457074 100644 (file)
@@ -461,7 +461,6 @@ source "drivers/fc4/Kconfig"
 source "fs/Kconfig"
 
 menu "Instrumentation Support"
-        depends on EXPERIMENTAL
 
 source "arch/sparc64/oprofile/Kconfig"
 
index d208cc7804f234583fc8e457f871a96610dfede6..92c1b36a2e16bee668aa11fd414243d8ad0028f2 100644 (file)
 
 static int load_aout32_binary(struct linux_binprm *, struct pt_regs * regs);
 static int load_aout32_library(struct file*);
-static int aout32_core_dump(long signr, struct pt_regs * regs, struct file *file);
+static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
 
 static struct linux_binfmt aout32_format = {
-       NULL, THIS_MODULE, load_aout32_binary, load_aout32_library, aout32_core_dump,
-       PAGE_SIZE
+       .module         = THIS_MODULE,
+       .load_binary    = load_aout32_binary,
+       .load_shlib     = load_aout32_library,
+       .core_dump      = aout32_core_dump,
+       .min_coredump   = PAGE_SIZE,
 };
 
 static void set_brk(unsigned long start, unsigned long end)
@@ -83,7 +86,7 @@ if (file->f_op->llseek) { \
  * dumping of the process results in another error..
  */
 
-static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file)
+static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
 {
        mm_segment_t fs;
        int has_dumped = 0;
@@ -102,13 +105,11 @@ static int aout32_core_dump(long signr, struct pt_regs *regs, struct file *file)
 
 /* If the size of the dump file exceeds the rlimit, then see what would happen
    if we wrote the stack, but not the data area.  */
-       if ((dump.u_dsize+dump.u_ssize) >
-           current->signal->rlim[RLIMIT_CORE].rlim_cur)
+       if (dump.u_dsize + dump.u_ssize > limit)
                dump.u_dsize = 0;
 
 /* Make sure we have enough room to write the stack and data areas. */
-       if ((dump.u_ssize) >
-           current->signal->rlim[RLIMIT_CORE].rlim_cur)
+       if (dump.u_ssize > limit)
                dump.u_ssize = 0;
 
 /* make sure we actually have a data and stack area to dump */
index 0d5c50264945e7b2f91dd738cde7d30a3d1a87ea..560cb1edb1d0d97df195827d88bcf8322450a7a8 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/random.h>
 
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 #include <asm/utrap.h>
 #include <asm/perfctr.h>
 #include <asm/a.out.h>
index e8dce90d05d45022589b4a75805798d35c6c4dbf..78caff926737b532fc3216a8b5312d2be97375df 100644 (file)
@@ -54,7 +54,6 @@
 #include <linux/highuid.h>
 
 #include <asm/types.h>
-#include <asm/ipc.h>
 #include <asm/uaccess.h>
 #include <asm/fpumacro.h>
 #include <asm/semaphore.h>
index a531a2cdb381e49f15804ce704bc94102bf87ba3..499135fa7060957b4986b15ff1746d7a998d6ff3 100644 (file)
 #include <linux/shm.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
+#include <linux/ipc.h>
 
 #include <asm/uaccess.h>
 #include <asm/string.h>
-#include <asm/ipc.h>
 
 #include "conv.h"
 
index 710d5fb807e1d6b9ae7e24e7542814aa36b69348..e2d14268441201d87f09c1adfb27f9a14233f24e 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "linux/sched.h"
 #include "linux/shm.h"
-#include "asm/ipc.h"
+#include "linux/ipc.h"
 #include "asm/mman.h"
 #include "asm/uaccess.h"
 #include "asm/unistd.h"
index f9f00ccf53245e4aa4e0fe36b833e3fc5b69fed4..0a4df4d6e05fcf3b03acd138b54a0520444ce5c3 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/file.h>
 
 #include <asm/uaccess.h>
-#include <asm/ipc.h>
 #include <asm/semaphore.h>
 #include <asm/unistd.h>
 
index 08781370256da313e8b3b7f401b41a1bc10b7373..7cf1c29bf90e36fc91df048e2bf18b3989e89bff 100644 (file)
@@ -40,7 +40,7 @@ static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
 static int load_aout_library(struct file*);
 
 #ifdef CORE_DUMP
-static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file);
+static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
 
 /*
  * fill in the user structure for a core dump..
@@ -148,7 +148,7 @@ if (file->f_op->llseek) { \
  * dumping of the process results in another error..
  */
 
-static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
+static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
 {
        mm_segment_t fs;
        int has_dumped = 0;
@@ -168,13 +168,11 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
 
 /* If the size of the dump file exceeds the rlimit, then see what would happen
    if we wrote the stack, but not the data area.  */
-       if ((dump.u_dsize+dump.u_ssize+1) * PAGE_SIZE >
-           current->signal->rlim[RLIMIT_CORE].rlim_cur)
+       if ((dump.u_dsize + dump.u_ssize + 1) * PAGE_SIZE > limit)
                dump.u_dsize = 0;
 
 /* Make sure we have enough room to write the stack and data areas. */
-       if ((dump.u_ssize+1) * PAGE_SIZE >
-           current->signal->rlim[RLIMIT_CORE].rlim_cur)
+       if ((dump.u_ssize + 1) * PAGE_SIZE > limit)
                dump.u_ssize = 0;
 
 /* make sure we actually have a data and stack area to dump */
index dffd2ac72747b59836de76618f0c74089778424b..d3c53e8b05c0ed8a1b51422948024d4849e0ea91 100644 (file)
@@ -188,6 +188,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
 }
 
 #define ELF_CORE_COPY_XFPREGS 1
+#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
 static inline int 
 elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
 {
index 2e1869ec4db4586b27646cbf6f13a72d757af786..7b3342e5aab59e514770eb1ab361175e9860cd72 100644 (file)
@@ -9,8 +9,6 @@
 #include <linux/ipc.h>
 #include <linux/compat.h>
 
-#include <asm/ipc.h>
-
 asmlinkage long
 sys32_ipc(u32 call, int first, int second, int third,
                compat_uptr_t ptr, u32 fifth)
index deda9a221cf2109950f190e19669f30284c99b21..8459ca64bc2f9c089acca975de93434d57ad065f 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/kexec.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/numa.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
@@ -169,3 +170,15 @@ static int __init parse_crashkernel(char *arg)
        return 0;
 }
 early_param("crashkernel", parse_crashkernel);
+
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+       VMCOREINFO_SYMBOL(node_data);
+       VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
+#endif
+#ifdef CONFIG_X86_PAE
+       VMCOREINFO_CONFIG(X86_PAE);
+#endif
+}
+
index cd1899a2f0c54b4e46db9847500b2b1d5ab3bcb0..7450b69710b5557f2f81c4a5ebf187b9c00ac58e 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/kexec.h>
 #include <linux/string.h>
 #include <linux/reboot.h>
+#include <linux/numa.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/mmu_context.h>
@@ -257,3 +258,11 @@ static int __init setup_crashkernel(char *arg)
 }
 early_param("crashkernel", setup_crashkernel);
 
+void arch_crash_save_vmcoreinfo(void)
+{
+#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
+       VMCOREINFO_SYMBOL(node_data);
+       VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
+#endif
+}
+
index a66d607f5b924e09d864120d1d656c3e1a1c2da0..97d2b757d6bdc0f48724fa230bec98e91042f0c7 100644 (file)
@@ -76,9 +76,6 @@ void mce_log(struct mce *mce)
        wmb();
        for (;;) {
                entry = rcu_dereference(mcelog.next);
-               /* The rmb forces the compiler to reload next in each
-                   iteration */
-               rmb();
                for (;;) {
                        /* When the buffer fills up discard new entries. Assume
                           that the earlier errors are the more interesting. */
index f8bae9ba0324b44fb510f5a323c6986f08452bdd..a86d26f036e1ddcefee7f293964b917d1296b713 100644 (file)
 #include <linux/mman.h>
 #include <linux/file.h>
 #include <linux/utsname.h>
+#include <linux/ipc.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
-#include <asm/ipc.h>
 
 /*
  * sys_pipe() is the normal C calling standard for creating
index 01437c46baae9302e9770f4925d47cd14d8f0f78..ef1f6cd3ea66d7cacce1c70ee2d22106bfe82e3f 100644 (file)
@@ -193,7 +193,7 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
        return pte;
 }
 
-void pmd_ctor(void *pmd, struct kmem_cache *cache, unsigned long flags)
+void pmd_ctor(struct kmem_cache *cache, void *pmd)
 {
        memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t));
 }
index 8c83dbe4c4d0b8a1ce6d18d501443b31a029c675..d681be88ae5d062b1f55240a5abb1344e519e1de 100644 (file)
@@ -582,17 +582,18 @@ config CRASH_DUMP
        bool "kernel crash dumps (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        help
-          Generate crash dump after being started by kexec.
-          This should be normally only set in special crash dump kernels
-          which are loaded in the main kernel with kexec-tools into
-          a specially reserved region and then later executed after
-          a crash by kdump/kexec. The crash dump kernel must be compiled
+         Generate crash dump after being started by kexec.
+         This should be normally only set in special crash dump kernels
+         which are loaded in the main kernel with kexec-tools into
+         a specially reserved region and then later executed after
+         a crash by kdump/kexec. The crash dump kernel must be compiled
          to a memory address not used by the main kernel or BIOS using
-         PHYSICAL_START.
-          For more details see Documentation/kdump/kdump.txt
+         PHYSICAL_START, or it must be built as a relocatable image
+         (CONFIG_RELOCATABLE=y).
+         For more details see Documentation/kdump/kdump.txt
 
 config RELOCATABLE
-       bool "Build a relocatable kernel(EXPERIMENTAL)"
+       bool "Build a relocatable kernel (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        help
          Builds a relocatable kernel. This enables loading and running
@@ -603,8 +604,8 @@ config RELOCATABLE
          must live at a different physical address than the primary
          kernel.
 
-         Note: If CONFIG_RELOCATABLE=y, then kernel run from the address
-         it has been loaded at and compile time physical address
+         Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
+         it has been loaded at and the compile time physical address
          (CONFIG_PHYSICAL_START) is ignored.
 
 config PHYSICAL_START
@@ -796,7 +797,6 @@ source "drivers/firmware/Kconfig"
 source fs/Kconfig
 
 menu "Instrumentation Support"
-        depends on EXPERIMENTAL
 
 source "arch/x86/oprofile/Kconfig"
 
index 9eabac95fbe053917cb25f7ba1e9fb208b8e94d1..524404bd08c19c4532a38c8d477db457e3de250e 100644 (file)
@@ -1786,6 +1786,7 @@ static void blk_release_queue(struct kobject *kobj)
 
        blk_trace_shutdown(q);
 
+       bdi_destroy(&q->backing_dev_info);
        kmem_cache_free(requestq_cachep, q);
 }
 
@@ -1839,21 +1840,27 @@ static struct kobj_type queue_ktype;
 struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
 {
        struct request_queue *q;
+       int err;
 
        q = kmem_cache_alloc_node(requestq_cachep,
                                gfp_mask | __GFP_ZERO, node_id);
        if (!q)
                return NULL;
 
+       q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug;
+       q->backing_dev_info.unplug_io_data = q;
+       err = bdi_init(&q->backing_dev_info);
+       if (err) {
+               kmem_cache_free(requestq_cachep, q);
+               return NULL;
+       }
+
        init_timer(&q->unplug_timer);
 
        kobject_set_name(&q->kobj, "%s", "queue");
        q->kobj.ktype = &queue_ktype;
        kobject_init(&q->kobj);
 
-       q->backing_dev_info.unplug_io_fn = blk_backing_dev_unplug;
-       q->backing_dev_info.unplug_io_data = q;
-
        mutex_init(&q->sysfs_lock);
 
        return q;
index 9e18ce742e3892f9377811218609408988cef64c..28a5fbc6aa1a456d335852914aa24ea48880c74b 100644 (file)
@@ -346,7 +346,7 @@ char *func_table[MAX_NR_FUNC] = {
        0,
 };
 
-struct kbdiacr accent_table[MAX_DIACR] = {
+struct kbdiacruc accent_table[MAX_DIACR] = {
        {'`', 'A', '\300'},     {'`', 'a', '\340'},
        {'\'', 'A', '\301'},    {'\'', 'a', '\341'},
        {'^', 'A', '\302'},     {'^', 'a', '\342'},
index 7647abfe189081dcec38eace34025899dd531a99..fbae8674e491f105269c30a1f10e1c9c4b9929cc 100644 (file)
@@ -302,7 +302,7 @@ restart:
                if (mem_flags & __GFP_WAIT) {
                        DECLARE_WAITQUEUE (wait, current);
 
-                       current->state = TASK_INTERRUPTIBLE;
+                       __set_current_state(TASK_INTERRUPTIBLE);
                        add_wait_queue (&pool->waitq, &wait);
                        spin_unlock_irqrestore (&pool->lock, flags);
 
index ba07f762c4cbf23cabedb7b0feb4903483d213f9..07f02f855ab5562e8faea4600ebd28fc92145d4a 100644 (file)
@@ -48,15 +48,6 @@ struct aoe_hdr {
        __be32 tag;
 };
 
-#ifdef __KERNEL__
-#include <linux/skbuff.h>
-
-static inline struct aoe_hdr *aoe_hdr(const struct sk_buff *skb)
-{
-       return (struct aoe_hdr *)skb_mac_header(skb);
-}
-#endif
-
 struct aoe_atahdr {
        unsigned char aflags;
        unsigned char errfeat;
index 99672017ca56f5212229db8fb9312e7c81842e7b..4d59d5057734ab41686a37a7abb148ab361ee285 100644 (file)
@@ -120,7 +120,7 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
 
        /* initialize the headers & frame */
        skb = f->skb;
-       h = aoe_hdr(skb);
+       h = (struct aoe_hdr *) skb_mac_header(skb);
        ah = (struct aoe_atahdr *) (h+1);
        skb_put(skb, sizeof *h + sizeof *ah);
        memset(h, 0, skb->len);
@@ -209,7 +209,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
                skb->dev = ifp;
                if (sl_tail == NULL)
                        sl_tail = skb;
-               h = aoe_hdr(skb);
+               h = (struct aoe_hdr *) skb_mac_header(skb);
                memset(h, 0, sizeof *h + sizeof *ch);
 
                memset(h->dst, 0xff, sizeof h->dst);
@@ -304,7 +304,7 @@ rexmit(struct aoedev *d, struct frame *f)
        aoechr_error(buf);
 
        skb = f->skb;
-       h = aoe_hdr(skb);
+       h = (struct aoe_hdr *) skb_mac_header(skb);
        ah = (struct aoe_atahdr *) (h+1);
        f->tag = n;
        h->tag = cpu_to_be32(n);
@@ -533,7 +533,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        char ebuf[128];
        u16 aoemajor;
 
-       hin = aoe_hdr(skb);
+       hin = (struct aoe_hdr *) skb_mac_header(skb);
        aoemajor = be16_to_cpu(get_unaligned(&hin->major));
        d = aoedev_by_aoeaddr(aoemajor, hin->minor);
        if (d == NULL) {
@@ -565,7 +565,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        calc_rttavg(d, tsince(f->tag));
 
        ahin = (struct aoe_atahdr *) (hin+1);
-       hout = aoe_hdr(f->skb);
+       hout = (struct aoe_hdr *) skb_mac_header(f->skb);
        ahout = (struct aoe_atahdr *) (hout+1);
        buf = f->buf;
 
@@ -699,7 +699,7 @@ aoecmd_ata_id(struct aoedev *d)
 
        /* initialize the headers & frame */
        skb = f->skb;
-       h = aoe_hdr(skb);
+       h = (struct aoe_hdr *) skb_mac_header(skb);
        ah = (struct aoe_atahdr *) (h+1);
        skb_put(skb, sizeof *h + sizeof *ah);
        memset(h, 0, skb->len);
@@ -730,7 +730,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
        enum { MAXFRAMES = 16 };
        u16 n;
 
-       h = aoe_hdr(skb);
+       h = (struct aoe_hdr *) skb_mac_header(skb);
        ch = (struct aoe_cfghdr *) (h+1);
 
        /*
index 4dc0fb7da94b50dacbdb0084dc7f7f037f0db435..4e6deb7f5c24e2b5ff5e748ef65cef798ce3e861 100644 (file)
@@ -127,7 +127,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
                goto exit;
        skb_push(skb, ETH_HLEN);        /* (1) */
 
-       h = aoe_hdr(skb);
+       h = (struct aoe_hdr *) skb_mac_header(skb);
        n = be32_to_cpu(get_unaligned(&h->tag));
        if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31))
                goto exit;
index 3fb7e8bc436d1b39eb579efc5ddc7b1222d69e4b..ca56a0e5cd5e36b8b4d0a88fe90c8c0763a6b7ba 100644 (file)
@@ -1582,38 +1582,36 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv,
         * allows us to delete disk zero but keep the controller registered.
         */
        if (h->gendisk[0] != disk) {
-               if (disk) {
-                       struct request_queue *q = disk->queue;
-                       if (disk->flags & GENHD_FL_UP)
-                               del_gendisk(disk);
-                       if (q) {
-                               blk_cleanup_queue(q);
-                               /* Set drv->queue to NULL so that we do not try
-                                * to call blk_start_queue on this queue in the
-                                * interrupt handler
-                                */
-                               drv->queue = NULL;
-                       }
-                       /* If clear_all is set then we are deleting the logical
-                        * drive, not just refreshing its info.  For drives
-                        * other than disk 0 we will call put_disk.  We do not
-                        * do this for disk 0 as we need it to be able to
-                        * configure the controller.
+               struct request_queue *q = disk->queue;
+               if (disk->flags & GENHD_FL_UP)
+                       del_gendisk(disk);
+               if (q) {
+                       blk_cleanup_queue(q);
+                       /* Set drv->queue to NULL so that we do not try
+                        * to call blk_start_queue on this queue in the
+                        * interrupt handler
+                        */
+                       drv->queue = NULL;
+               }
+               /* If clear_all is set then we are deleting the logical
+                * drive, not just refreshing its info.  For drives
+                * other than disk 0 we will call put_disk.  We do not
+                * do this for disk 0 as we need it to be able to
+                * configure the controller.
+               */
+               if (clear_all){
+                       /* This isn't pretty, but we need to find the
+                        * disk in our array and NULL our the pointer.
+                        * This is so that we will call alloc_disk if
+                        * this index is used again later.
                        */
-                       if (clear_all){
-                               /* This isn't pretty, but we need to find the
-                                * disk in our array and NULL our the pointer.
-                                * This is so that we will call alloc_disk if
-                                * this index is used again later.
-                               */
-                               for (i=0; i < CISS_MAX_LUN; i++){
-                                       if(h->gendisk[i] == disk){
-                                               h->gendisk[i] = NULL;
-                                               break;
-                                       }
+                       for (i=0; i < CISS_MAX_LUN; i++){
+                               if(h->gendisk[i] == disk){
+                                       h->gendisk[i] = NULL;
+                                       break;
                                }
-                               put_disk(disk);
                        }
+                       put_disk(disk);
                }
        } else {
                set_capacity(disk, 0);
@@ -2365,30 +2363,55 @@ static inline void resend_cciss_cmd(ctlr_info_t *h, CommandList_struct *c)
        start_io(h);
 }
 
+static inline unsigned int make_status_bytes(unsigned int scsi_status_byte,
+       unsigned int msg_byte, unsigned int host_byte,
+       unsigned int driver_byte)
+{
+       /* inverse of macros in scsi.h */
+       return (scsi_status_byte & 0xff) |
+               ((msg_byte & 0xff) << 8) |
+               ((host_byte & 0xff) << 16) |
+               ((driver_byte & 0xff) << 24);
+}
+
 static inline int evaluate_target_status(CommandList_struct *cmd)
 {
        unsigned char sense_key;
-       int error_count = 1;
+       unsigned char status_byte, msg_byte, host_byte, driver_byte;
+       int error_value;
+
+       /* If we get in here, it means we got "target status", that is, scsi status */
+       status_byte = cmd->err_info->ScsiStatus;
+       driver_byte = DRIVER_OK;
+       msg_byte = cmd->err_info->CommandStatus; /* correct?  seems too device specific */
+
+       if (blk_pc_request(cmd->rq))
+               host_byte = DID_PASSTHROUGH;
+       else
+               host_byte = DID_OK;
+
+       error_value = make_status_bytes(status_byte, msg_byte,
+               host_byte, driver_byte);
 
-       if (cmd->err_info->ScsiStatus != 0x02) { /* not check condition? */
+       if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) {
                if (!blk_pc_request(cmd->rq))
                        printk(KERN_WARNING "cciss: cmd %p "
                               "has SCSI Status 0x%x\n",
                               cmd, cmd->err_info->ScsiStatus);
-               return error_count;
+               return error_value;
        }
 
        /* check the sense key */
        sense_key = 0xf & cmd->err_info->SenseInfo[2];
        /* no status or recovered error */
-       if ((sense_key == 0x0) || (sense_key == 0x1))
-               error_count = 0;
+       if (((sense_key == 0x0) || (sense_key == 0x1)) && !blk_pc_request(cmd->rq))
+               error_value = 0;
 
        if (!blk_pc_request(cmd->rq)) { /* Not SG_IO or similar? */
-               if (error_count != 0)
+               if (error_value != 0)
                        printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION"
                               " sense key = 0x%x\n", cmd, sense_key);
-               return error_count;
+               return error_value;
        }
 
        /* SG_IO or similar, copy sense data back */
@@ -2400,7 +2423,7 @@ static inline int evaluate_target_status(CommandList_struct *cmd)
        } else
                cmd->rq->sense_len = 0;
 
-       return error_count;
+       return error_value;
 }
 
 /* checks the status of the job and calls complete buffers to mark all
@@ -2416,7 +2439,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
        rq->errors = 0;
 
        if (timeout)
-               rq->errors = 1;
+               rq->errors = make_status_bytes(0, 0, 0, DRIVER_TIMEOUT);
 
        if (cmd->err_info->CommandStatus == 0)  /* no error has occurred */
                goto after_error_processing;
@@ -2442,32 +2465,44 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
        case CMD_INVALID:
                printk(KERN_WARNING "cciss: cmd %p is "
                       "reported invalid\n", cmd);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
                break;
        case CMD_PROTOCOL_ERR:
                printk(KERN_WARNING "cciss: cmd %p has "
                       "protocol error \n", cmd);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
                break;
        case CMD_HARDWARE_ERR:
                printk(KERN_WARNING "cciss: cmd %p had "
                       " hardware error\n", cmd);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
                break;
        case CMD_CONNECTION_LOST:
                printk(KERN_WARNING "cciss: cmd %p had "
                       "connection lost\n", cmd);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
                break;
        case CMD_ABORTED:
                printk(KERN_WARNING "cciss: cmd %p was "
                       "aborted\n", cmd);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT);
                break;
        case CMD_ABORT_FAILED:
                printk(KERN_WARNING "cciss: cmd %p reports "
                       "abort failed\n", cmd);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
                break;
        case CMD_UNSOLICITED_ABORT:
                printk(KERN_WARNING "cciss%d: unsolicited "
@@ -2481,17 +2516,23 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd,
                        printk(KERN_WARNING
                               "cciss%d: %p retried too "
                               "many times\n", h->ctlr, cmd);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT);
                break;
        case CMD_TIMEOUT:
                printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
                break;
        default:
                printk(KERN_WARNING "cciss: cmd %p returned "
                       "unknown status %x\n", cmd,
                       cmd->err_info->CommandStatus);
-               rq->errors = 1;
+               rq->errors = make_status_bytes(SAM_STAT_GOOD,
+                       cmd->err_info->CommandStatus, DRIVER_OK,
+                       blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR);
        }
 
 after_error_processing:
index 80483aac4cc9b6a166f9ed9c059fb8ec00c8806f..639ed14bb08d5a10644ec7b58f591349509a29dc 100644 (file)
@@ -5,6 +5,7 @@
  *  Copyright (C) 1993, 1994  Alain Knaff
  *  Copyright (C) 1998 Alan Cox
  */
+
 /*
  * 02.12.91 - Changed to static variables to indicate need for reset
  * and recalibrate. This makes some things easier (output_byte reset
 #define REALLY_SLOW_IO
 
 #define DEBUGT 2
-#define DCL_DEBUG              /* debug disk change line */
+#define DCL_DEBUG      /* debug disk change line */
 
 /* do print messages for unexpected interrupts */
 static int print_unex = 1;
@@ -161,10 +162,8 @@ static int print_unex = 1;
 #include <linux/workqueue.h>
 #define FDPATCHES
 #include <linux/fdreg.h>
-
 #include <linux/fd.h>
 #include <linux/hdreg.h>
-
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
@@ -274,8 +273,7 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l)
                return;         /* we have the memory */
        if (can_use_virtual_dma != 2)
                return;         /* no fallback allowed */
-       printk
-           ("DMA memory shortage. Temporarily falling back on virtual DMA\n");
+       printk("DMA memory shortage. Temporarily falling back on virtual DMA\n");
        *addr = (char *)nodma_mem_alloc(l);
 #else
        return;
@@ -291,8 +289,8 @@ static int initialising = 1;
 #define TOMINOR(x) ((x & 3) | ((x & 4) << 5))
 #define UNIT(x) ((x) & 0x03)   /* drive on fdc */
 #define FDC(x) (((x) & 0x04) >> 2)     /* fdc of drive */
+       /* reverse mapping from unit and fdc to drive */
 #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2))
-                               /* reverse mapping from unit and fdc to drive */
 #define DP (&drive_params[current_drive])
 #define DRS (&drive_state[current_drive])
 #define DRWE (&write_errors[current_drive])
@@ -356,7 +354,6 @@ static int inr;                     /* size of reply buffer, when called from interrupt */
 #define R_HEAD (reply_buffer[4])
 #define R_SECTOR (reply_buffer[5])
 #define R_SIZECODE (reply_buffer[6])
-
 #define SEL_DLY (2*HZ/100)
 
 /*
@@ -472,8 +469,8 @@ static struct floppy_struct floppy_type[32] = {
        { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5"   */
        { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5"   */
        { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5"   */
-
        { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5"   */
+
        { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800"  }, /* 30 800KB 3.5"    */
        { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5"    */
 };
@@ -539,12 +536,12 @@ static char *floppy_track_buffer;
 static int max_buffer_sectors;
 
 static int *errors;
-typedef void (*done_f) (int);
+typedef void (*done_f)(int);
 static struct cont_t {
-       void (*interrupt) (void);       /* this is called after the interrupt of the
+       void (*interrupt)(void);        /* this is called after the interrupt of the
                                         * main command */
-       void (*redo) (void);    /* this is called to retry the operation */
-       void (*error) (void);   /* this is called to tally an error */
+       void (*redo)(void);     /* this is called to retry the operation */
+       void (*error)(void);    /* this is called to tally an error */
        done_f done;            /* this is called to say if the operation has
                                 * succeeded/failed */
 } *cont;
@@ -694,7 +691,6 @@ static void reschedule_timeout(int drive, const char *message, int marg)
 }
 
 #define INFBOUND(a,b) (a)=max_t(int, a, b)
-
 #define SUPBOUND(a,b) (a)=min_t(int, a, b)
 
 /*
@@ -733,6 +729,7 @@ static void reschedule_timeout(int drive, const char *message, int marg)
 static int disk_change(int drive)
 {
        int fdc = FDC(drive);
+
 #ifdef FLOPPY_SANITY_CHECK
        if (time_before(jiffies, UDRS->select_date + UDP->select_delay))
                DPRINT("WARNING disk change called early\n");
@@ -771,7 +768,6 @@ static int disk_change(int drive)
                        floppy_sizes[TOMINOR(drive)] = MAX_DISK_SIZE << 1;
                }
 
-               /*USETF(FD_DISK_NEWCHANGE); */
                return 1;
        } else {
                UDRS->last_checked = jiffies;
@@ -787,7 +783,10 @@ static inline int is_selected(int dor, int unit)
 
 static int set_dor(int fdc, char mask, char data)
 {
-       register unsigned char drive, unit, newdor, olddor;
+       unsigned char unit;
+       unsigned char drive;
+       unsigned char newdor;
+       unsigned char olddor;
 
        if (FDCS->address == -1)
                return -1;
@@ -892,7 +891,6 @@ static int _lock_fdc(int drive, int interruptible, int line)
 
                set_current_state(TASK_RUNNING);
                remove_wait_queue(&fdc_wait, &wait);
-
                flush_scheduled_work();
        }
        command_status = FD_COMMAND_NONE;
@@ -942,7 +940,7 @@ static void motor_off_callback(unsigned long nr)
 static void floppy_off(unsigned int drive)
 {
        unsigned long volatile delta;
-       register int fdc = FDC(drive);
+       int fdc = FDC(drive);
 
        if (!(FDCS->dor & (0x10 << UNIT(drive))))
                return;
@@ -968,7 +966,9 @@ static void floppy_off(unsigned int drive)
  */
 static void scandrives(void)
 {
-       int i, drive, saved_drive;
+       int i;
+       int drive;
+       int saved_drive;
 
        if (DP->select_delay)
                return;
@@ -1146,7 +1146,9 @@ static void show_floppy(void);
 /* waits until the fdc becomes ready */
 static int wait_til_ready(void)
 {
-       int counter, status;
+       int status;
+       int counter;
+
        if (FDCS->reset)
                return -1;
        for (counter = 0; counter < 10000; counter++) {
@@ -1193,7 +1195,8 @@ static int output_byte(char byte)
 /* gets the response from the fdc */
 static int result(void)
 {
-       int i, status = 0;
+       int i;
+       int status = 0;
 
        for (i = 0; i < MAX_REPLIES; i++) {
                if ((status = wait_til_ready()) < 0)
@@ -1226,6 +1229,7 @@ static int result(void)
 static int need_more_output(void)
 {
        int status;
+
        if ((status = wait_til_ready()) < 0)
                return -1;
        if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY)
@@ -1309,8 +1313,11 @@ static int fdc_configure(void)
  */
 static void fdc_specify(void)
 {
-       unsigned char spec1, spec2;
-       unsigned long srt, hlt, hut;
+       unsigned char spec1;
+       unsigned char spec2;
+       unsigned long srt;
+       unsigned long hlt;
+       unsigned long hut;
        unsigned long dtr = NOMINAL_DTR;
        unsigned long scale_dtr = NOMINAL_DTR;
        int hlt_max_code = 0x7f;
@@ -1319,7 +1326,6 @@ static void fdc_specify(void)
        if (FDCS->need_configure && FDCS->version >= FDC_82072A) {
                fdc_configure();
                FDCS->need_configure = 0;
-               /*DPRINT("FIFO enabled\n"); */
        }
 
        switch (raw_cmd->rate & 0x03) {
@@ -1472,7 +1478,6 @@ static int interpret_errors(void)
                                tell_sector();
                        }
                        printk("\n");
-
                }
                if (ST2 & ST2_WC || ST2 & ST2_BC)
                        /* wrong cylinder => recal */
@@ -1498,7 +1503,10 @@ static int interpret_errors(void)
  */
 static void setup_rw_floppy(void)
 {
-       int i, r, flags, dflags;
+       int i;
+       int r;
+       int flags;
+       int dflags;
        unsigned long ready_date;
        timeout_fn function;
 
@@ -1728,9 +1736,9 @@ static void print_result(char *message, int inr)
 /* interrupt handler. Note that this can be called externally on the Sparc */
 irqreturn_t floppy_interrupt(int irq, void *dev_id)
 {
-       void (*handler) (void) = do_floppy;
        int do_print;
        unsigned long f;
+       void (*handler)(void) = do_floppy;
 
        lasthandler = handler;
        interruptjiffies = jiffies;
@@ -1912,12 +1920,11 @@ static void floppy_shutdown(unsigned long data)
        is_alive("floppy shutdown");
 }
 
-/*typedef void (*timeout_fn)(unsigned long);*/
-
 /* start motor, check media-changed condition and write protection */
-static int start_motor(void (*function) (void))
+static int start_motor(void (*function)(void))
 {
-       int mask, data;
+       int mask;
+       int data;
 
        mask = 0xfc;
        data = UNIT(current_drive);
@@ -2020,17 +2027,17 @@ static struct cont_t wakeup_cont = {
        .interrupt      = empty,
        .redo           = do_wakeup,
        .error          = empty,
-       .done           = (done_f) empty
+       .done           = (done_f)empty
 };
 
 static struct cont_t intr_cont = {
        .interrupt      = empty,
        .redo           = process_fd_request,
        .error          = empty,
-       .done           = (done_f) empty
+       .done           = (done_f)empty
 };
 
-static int wait_til_done(void (*handler) (void), int interruptible)
+static int wait_til_done(void (*handler)(void), int interruptible)
 {
        int ret;
 
@@ -2049,7 +2056,6 @@ static int wait_til_done(void (*handler) (void), int interruptible)
                                break;
 
                        is_alive("wait_til_done");
-
                        schedule();
                }
 
@@ -2141,6 +2147,7 @@ static void bad_flp_intr(void)
 static void set_floppy(int drive)
 {
        int type = ITYPE(UDRS->fd_device);
+
        if (type)
                _floppy = floppy_type + type;
        else
@@ -2169,11 +2176,14 @@ static void format_interrupt(void)
 #define CT(x) ((x) | 0xc0)
 static void setup_format_params(int track)
 {
+       int n;
+       int il;
+       int count;
+       int head_shift;
+       int track_shift;
        struct fparm {
                unsigned char track, head, sect, size;
        } *here = (struct fparm *)floppy_track_buffer;
-       int il, n;
-       int count, head_shift, track_shift;
 
        raw_cmd = &default_raw_cmd;
        raw_cmd->track = track;
@@ -2344,7 +2354,10 @@ static void request_done(int uptodate)
 /* Interrupt handler evaluating the result of the r/w operation */
 static void rw_interrupt(void)
 {
-       int nr_sectors, ssize, eoc, heads;
+       int eoc;
+       int ssize;
+       int heads;
+       int nr_sectors;
 
        if (R_HEAD >= 2) {
                /* some Toshiba floppy controllers occasionnally seem to
@@ -2476,7 +2489,8 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
 {
        int remaining;          /* number of transferred 512-byte sectors */
        struct bio_vec *bv;
-       char *buffer, *dma_buffer;
+       char *buffer;
+       char *dma_buffer;
        int size;
        struct req_iterator iter;
 
@@ -2556,19 +2570,6 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
 #endif
 }
 
-#if 0
-static inline int check_dma_crossing(char *start,
-                                    unsigned long length, char *message)
-{
-       if (CROSS_64KB(start, length)) {
-               printk("DMA xfer crosses 64KB boundary in %s %p-%p\n",
-                      message, start, start + length);
-               return 1;
-       } else
-               return 0;
-}
-#endif
-
 /* work around a bug in pseudo DMA
  * (on some FDCs) pseudo DMA does not stop when the CPU stops
  * sending data.  Hence we need a different way to signal the
@@ -2578,7 +2579,8 @@ static inline int check_dma_crossing(char *start,
  */
 static void virtualdmabug_workaround(void)
 {
-       int hard_sectors, end_sector;
+       int hard_sectors;
+       int end_sector;
 
        if (CT(COMMAND) == FD_WRITE) {
                COMMAND &= ~0x80;       /* switch off multiple track mode */
@@ -2610,7 +2612,10 @@ static void virtualdmabug_workaround(void)
 static int make_raw_rw_request(void)
 {
        int aligned_sector_t;
-       int max_sector, max_size, tracksize, ssize;
+       int max_sector;
+       int max_size;
+       int tracksize;
+       int ssize;
 
        if (max_buffer_sectors == 0) {
                printk("VFS: Block I/O scheduled on unopened device\n");
@@ -2762,9 +2767,7 @@ static int make_raw_rw_request(void)
                 */
                if (!direct ||
                    (indirect * 2 > direct * 3 &&
-                    *errors < DP->max_errors.read_track &&
-                    /*!TESTF(FD_NEED_TWADDLE) && */
-                    ((!probing
+                    *errors < DP->max_errors.read_track && ((!probing
                       || (DP->read_track & (1 << DRS->probed_format)))))) {
                        max_size = current_req->nr_sectors;
                } else {
@@ -2777,10 +2780,6 @@ static int make_raw_rw_request(void)
                                       indirect, direct, fsector_t);
                                return 0;
                        }
-/*                     check_dma_crossing(raw_cmd->kernel_data, 
-                                          raw_cmd->length, 
-                                          "end of make_raw_request [1]");*/
-
                        virtualdmabug_workaround();
                        return 2;
                }
@@ -2830,8 +2829,6 @@ static int make_raw_rw_request(void)
        raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1;
        raw_cmd->length <<= 9;
 #ifdef FLOPPY_SANITY_CHECK
-       /*check_dma_crossing(raw_cmd->kernel_data, raw_cmd->length, 
-          "end of make_raw_request"); */
        if ((raw_cmd->length < current_count_sectors << 9) ||
            (raw_cmd->kernel_data != current_req->buffer &&
             CT(COMMAND) == FD_WRITE &&
@@ -3011,6 +3008,7 @@ static struct cont_t poll_cont = {
 static int poll_drive(int interruptible, int flag)
 {
        int ret;
+
        /* no auto-sense, just clear dcl */
        raw_cmd = &default_raw_cmd;
        raw_cmd->flags = flag;
@@ -3173,7 +3171,8 @@ static inline int raw_cmd_copyout(int cmd, char __user *param,
 
 static void raw_cmd_free(struct floppy_raw_cmd **ptr)
 {
-       struct floppy_raw_cmd *next, *this;
+       struct floppy_raw_cmd *next;
+       struct floppy_raw_cmd *this;
 
        this = *ptr;
        *ptr = NULL;
@@ -3245,8 +3244,10 @@ static inline int raw_cmd_copyin(int cmd, char __user *param,
 
 static int raw_cmd_ioctl(int cmd, void __user *param)
 {
-       int drive, ret, ret2;
        struct floppy_raw_cmd *my_raw_cmd;
+       int drive;
+       int ret2;
+       int ret;
 
        if (FDCS->rawcmd <= 1)
                FDCS->rawcmd = 1;
@@ -3453,7 +3454,8 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
 #define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0
 
        int drive = (long)inode->i_bdev->bd_disk->private_data;
-       int i, type = ITYPE(UDRS->fd_device);
+       int type = ITYPE(UDRS->fd_device);
+       int i;
        int ret;
        int size;
        union inparam {
@@ -3619,8 +3621,7 @@ static void __init config_types(void)
        if (!UDP->cmos && FLOPPY1_TYPE)
                UDP->cmos = FLOPPY1_TYPE;
 
-       /* XXX */
-       /* additional physical CMOS drive detection should go here */
+       /* FIXME: additional physical CMOS drive detection should go here */
 
        for (drive = 0; drive < N_DRIVE; drive++) {
                unsigned int type = UDP->cmos;
@@ -3903,13 +3904,13 @@ static int floppy_revalidate(struct gendisk *disk)
 }
 
 static struct block_device_operations floppy_fops = {
-       .owner          = THIS_MODULE,
-       .open           = floppy_open,
-       .release        = floppy_release,
-       .ioctl          = fd_ioctl,
-       .getgeo         = fd_getgeo,
-       .media_changed  = check_floppy_change,
-       .revalidate_disk = floppy_revalidate,
+       .owner                  = THIS_MODULE,
+       .open                   = floppy_open,
+       .release                = floppy_release,
+       .ioctl                  = fd_ioctl,
+       .getgeo                 = fd_getgeo,
+       .media_changed          = check_floppy_change,
+       .revalidate_disk        = floppy_revalidate,
 };
 
 /*
@@ -4388,11 +4389,15 @@ static int floppy_grab_irq_and_dma(void)
        if (fd_request_dma()) {
                DPRINT("Unable to grab DMA%d for the floppy driver\n",
                       FLOPPY_DMA);
-               fd_free_irq();
-               spin_lock_irqsave(&floppy_usage_lock, flags);
-               usage_count--;
-               spin_unlock_irqrestore(&floppy_usage_lock, flags);
-               return -1;
+               if (can_use_virtual_dma & 2)
+                       use_virtual_dma = can_use_virtual_dma = 1;
+               if (!(can_use_virtual_dma & 1)) {
+                       fd_free_irq();
+                       spin_lock_irqsave(&floppy_usage_lock, flags);
+                       usage_count--;
+                       spin_unlock_irqrestore(&floppy_usage_lock, flags);
+                       return -1;
+               }
        }
 
        for (fdc = 0; fdc < N_FDC; fdc++) {
@@ -4424,8 +4429,8 @@ static int floppy_grab_irq_and_dma(void)
                if (FDCS->address != -1)
                        fd_outb(FDCS->dor, FD_DOR);
        /*
-        *      The driver will try and free resources and relies on us
-        *      to know if they were allocated or not.
+        * The driver will try and free resources and relies on us
+        * to know if they were allocated or not.
         */
        fdc = 0;
        irqdma_allocated = 1;
index e5a051577a5e617008f263b8cb5c9f914e1fe6a7..589cbbd9cd4f4f54f77338ee9ec09bb2f8af591a 100644 (file)
@@ -1285,7 +1285,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
        struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
        int err;
 
-       lock_kernel();
        switch(cmd) {
        case LOOP_SET_STATUS:
                mutex_lock(&lo->lo_ctl_mutex);
@@ -1311,7 +1310,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
                err = -ENOIOCTLCMD;
                break;
        }
-       unlock_kernel();
        return err;
 }
 #endif
index be5ec3a9b1fc45a58419f0c7a2c1716ffc052a40..cb136a919f2a83f1f97e6936949cebe6e4fd9f72 100644 (file)
@@ -113,12 +113,42 @@ static void nbd_end_request(struct request *req)
        spin_unlock_irqrestore(q->queue_lock, flags);
 }
 
+static void sock_shutdown(struct nbd_device *lo, int lock)
+{
+       /* Forcibly shutdown the socket causing all listeners
+        * to error
+        *
+        * FIXME: This code is duplicated from sys_shutdown, but
+        * there should be a more generic interface rather than
+        * calling socket ops directly here */
+       if (lock)
+               mutex_lock(&lo->tx_lock);
+       if (lo->sock) {
+               printk(KERN_WARNING "%s: shutting down socket\n",
+                       lo->disk->disk_name);
+               lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN);
+               lo->sock = NULL;
+       }
+       if (lock)
+               mutex_unlock(&lo->tx_lock);
+}
+
+static void nbd_xmit_timeout(unsigned long arg)
+{
+       struct task_struct *task = (struct task_struct *)arg;
+
+       printk(KERN_WARNING "nbd: killing hung xmit (%s, pid: %d)\n",
+               task->comm, task->pid);
+       force_sig(SIGKILL, task);
+}
+
 /*
  *  Send or receive packet.
  */
-static int sock_xmit(struct socket *sock, int send, void *buf, int size,
+static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
                int msg_flags)
 {
+       struct socket *sock = lo->sock;
        int result;
        struct msghdr msg;
        struct kvec iov;
@@ -139,9 +169,20 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size,
                msg.msg_controllen = 0;
                msg.msg_flags = msg_flags | MSG_NOSIGNAL;
 
-               if (send)
+               if (send) {
+                       struct timer_list ti;
+
+                       if (lo->xmit_timeout) {
+                               init_timer(&ti);
+                               ti.function = nbd_xmit_timeout;
+                               ti.data = (unsigned long)current;
+                               ti.expires = jiffies + lo->xmit_timeout;
+                               add_timer(&ti);
+                       }
                        result = kernel_sendmsg(sock, &msg, &iov, 1, size);
-               else
+                       if (lo->xmit_timeout)
+                               del_timer_sync(&ti);
+               } else
                        result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0);
 
                if (signal_pending(current)) {
@@ -150,6 +191,7 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size,
                                current->pid, current->comm,
                                dequeue_signal_lock(current, &current->blocked, &info));
                        result = -EINTR;
+                       sock_shutdown(lo, !send);
                        break;
                }
 
@@ -167,23 +209,22 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size,
        return result;
 }
 
-static inline int sock_send_bvec(struct socket *sock, struct bio_vec *bvec,
+static inline int sock_send_bvec(struct nbd_device *lo, struct bio_vec *bvec,
                int flags)
 {
        int result;
        void *kaddr = kmap(bvec->bv_page);
-       result = sock_xmit(sock, 1, kaddr + bvec->bv_offset, bvec->bv_len,
-                       flags);
+       result = sock_xmit(lo, 1, kaddr + bvec->bv_offset, bvec->bv_len, flags);
        kunmap(bvec->bv_page);
        return result;
 }
 
+/* always call with the tx_lock held */
 static int nbd_send_req(struct nbd_device *lo, struct request *req)
 {
        int result, flags;
        struct nbd_request request;
        unsigned long size = req->nr_sectors << 9;
-       struct socket *sock = lo->sock;
 
        request.magic = htonl(NBD_REQUEST_MAGIC);
        request.type = htonl(nbd_cmd(req));
@@ -196,8 +237,8 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
                        nbdcmd_to_ascii(nbd_cmd(req)),
                        (unsigned long long)req->sector << 9,
                        req->nr_sectors << 9);
-       result = sock_xmit(sock, 1, &request, sizeof(request),
-                       (nbd_cmd(req) == NBD_CMD_WRITE)? MSG_MORE: 0);
+       result = sock_xmit(lo, 1, &request, sizeof(request),
+                       (nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0);
        if (result <= 0) {
                printk(KERN_ERR "%s: Send control failed (result %d)\n",
                                lo->disk->disk_name, result);
@@ -217,7 +258,7 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
                                flags = MSG_MORE;
                        dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n",
                                        lo->disk->disk_name, req, bvec->bv_len);
-                       result = sock_send_bvec(sock, bvec, flags);
+                       result = sock_send_bvec(lo, bvec, flags);
                        if (result <= 0) {
                                printk(KERN_ERR "%s: Send data failed (result %d)\n",
                                                lo->disk->disk_name, result);
@@ -231,22 +272,18 @@ error_out:
        return 1;
 }
 
-static struct request *nbd_find_request(struct nbd_device *lo, char *handle)
+static struct request *nbd_find_request(struct nbd_device *lo,
+                                       struct request *xreq)
 {
-       struct request *req;
-       struct list_head *tmp;
-       struct request *xreq;
+       struct request *req, *tmp;
        int err;
 
-       memcpy(&xreq, handle, sizeof(xreq));
-
        err = wait_event_interruptible(lo->active_wq, lo->active_req != xreq);
        if (unlikely(err))
                goto out;
 
        spin_lock(&lo->queue_lock);
-       list_for_each(tmp, &lo->queue_head) {
-               req = list_entry(tmp, struct request, queuelist);
+       list_for_each_entry_safe(req, tmp, &lo->queue_head, queuelist) {
                if (req != xreq)
                        continue;
                list_del_init(&req->queuelist);
@@ -261,11 +298,11 @@ out:
        return ERR_PTR(err);
 }
 
-static inline int sock_recv_bvec(struct socket *sock, struct bio_vec *bvec)
+static inline int sock_recv_bvec(struct nbd_device *lo, struct bio_vec *bvec)
 {
        int result;
        void *kaddr = kmap(bvec->bv_page);
-       result = sock_xmit(sock, 0, kaddr + bvec->bv_offset, bvec->bv_len,
+       result = sock_xmit(lo, 0, kaddr + bvec->bv_offset, bvec->bv_len,
                        MSG_WAITALL);
        kunmap(bvec->bv_page);
        return result;
@@ -277,10 +314,9 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
        int result;
        struct nbd_reply reply;
        struct request *req;
-       struct socket *sock = lo->sock;
 
        reply.magic = 0;
-       result = sock_xmit(sock, 0, &reply, sizeof(reply), MSG_WAITALL);
+       result = sock_xmit(lo, 0, &reply, sizeof(reply), MSG_WAITALL);
        if (result <= 0) {
                printk(KERN_ERR "%s: Receive control failed (result %d)\n",
                                lo->disk->disk_name, result);
@@ -295,7 +331,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
                goto harderror;
        }
 
-       req = nbd_find_request(lo, reply.handle);
+       req = nbd_find_request(lo, *(struct request **)reply.handle);
        if (unlikely(IS_ERR(req))) {
                result = PTR_ERR(req);
                if (result != -ENOENT)
@@ -321,7 +357,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
                struct bio_vec *bvec;
 
                rq_for_each_segment(bvec, req, iter) {
-                       result = sock_recv_bvec(sock, bvec);
+                       result = sock_recv_bvec(lo, bvec);
                        if (result <= 0) {
                                printk(KERN_ERR "%s: Receive data failed (result %d)\n",
                                                lo->disk->disk_name, result);
@@ -396,6 +432,7 @@ static void nbd_clear_que(struct nbd_device *lo)
        }
 }
 
+
 /*
  * We always wait for result of write, for now. It would be nice to make it optional
  * in future
@@ -504,7 +541,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
                sreq.nr_sectors = 0;
                 if (!lo->sock)
                        return -EINVAL;
+               mutex_lock(&lo->tx_lock);
                 nbd_send_req(lo, &sreq);
+               mutex_unlock(&lo->tx_lock);
                 return 0;
  
        case NBD_CLEAR_SOCK:
@@ -548,6 +587,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
                set_blocksize(inode->i_bdev, lo->blksize);
                set_capacity(lo->disk, lo->bytesize >> 9);
                return 0;
+       case NBD_SET_TIMEOUT:
+               lo->xmit_timeout = arg * HZ;
+               return 0;
        case NBD_SET_SIZE_BLOCKS:
                lo->bytesize = ((u64) arg) * lo->blksize;
                inode->i_bdev->bd_inode->i_size = lo->bytesize;
@@ -560,28 +602,16 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
                error = nbd_do_it(lo);
                if (error)
                        return error;
-               /* on return tidy up in case we have a signal */
-               /* Forcibly shutdown the socket causing all listeners
-                * to error
-                *
-                * FIXME: This code is duplicated from sys_shutdown, but
-                * there should be a more generic interface rather than
-                * calling socket ops directly here */
-               mutex_lock(&lo->tx_lock);
-               if (lo->sock) {
-                       printk(KERN_WARNING "%s: shutting down socket\n",
-                               lo->disk->disk_name);
-                       lo->sock->ops->shutdown(lo->sock,
-                               SEND_SHUTDOWN|RCV_SHUTDOWN);
-                       lo->sock = NULL;
-               }
-               mutex_unlock(&lo->tx_lock);
+               sock_shutdown(lo, 1);
                file = lo->file;
                lo->file = NULL;
                nbd_clear_que(lo);
                printk(KERN_WARNING "%s: queue cleared\n", lo->disk->disk_name);
                if (file)
                        fput(file);
+               lo->bytesize = 0;
+               inode->i_bdev->bd_inode->i_size = 0;
+               set_capacity(lo->disk, 0);
                return lo->harderror;
        case NBD_CLEAR_QUE:
                /*
@@ -659,14 +689,14 @@ static int __init nbd_init(void)
                mutex_init(&nbd_dev[i].tx_lock);
                init_waitqueue_head(&nbd_dev[i].active_wq);
                nbd_dev[i].blksize = 1024;
-               nbd_dev[i].bytesize = 0x7ffffc00ULL << 10; /* 2TB */
+               nbd_dev[i].bytesize = 0;
                disk->major = NBD_MAJOR;
                disk->first_minor = i;
                disk->fops = &nbd_fops;
                disk->private_data = &nbd_dev[i];
                disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
                sprintf(disk->disk_name, "nbd%d", i);
-               set_capacity(disk, 0x7ffffc00ULL << 1); /* 2 TB */
+               set_capacity(disk, 0);
                add_disk(disk);
        }
 
index 701ea77f62e9f836d831b41336cfd2f1b40dda92..08176d23a46cd421690aca1d13a2edecf1499b71 100644 (file)
@@ -411,6 +411,9 @@ static void __exit rd_cleanup(void)
                blk_cleanup_queue(rd_queue[i]);
        }
        unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
+
+       bdi_destroy(&rd_file_backing_dev_info);
+       bdi_destroy(&rd_backing_dev_info);
 }
 
 /*
@@ -419,7 +422,19 @@ static void __exit rd_cleanup(void)
 static int __init rd_init(void)
 {
        int i;
-       int err = -ENOMEM;
+       int err;
+
+       err = bdi_init(&rd_backing_dev_info);
+       if (err)
+               goto out2;
+
+       err = bdi_init(&rd_file_backing_dev_info);
+       if (err) {
+               bdi_destroy(&rd_backing_dev_info);
+               goto out2;
+       }
+
+       err = -ENOMEM;
 
        if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 ||
                        (rd_blocksize & (rd_blocksize-1))) {
@@ -473,6 +488,9 @@ out:
                put_disk(rd_disks[i]);
                blk_cleanup_queue(rd_queue[i]);
        }
+       bdi_destroy(&rd_backing_dev_info);
+       bdi_destroy(&rd_file_backing_dev_info);
+out2:
        return err;
 }
 
@@ -486,17 +504,12 @@ static int __init ramdisk_size(char *str)
        rd_size = simple_strtol(str,NULL,0);
        return 1;
 }
-static int __init ramdisk_size2(char *str)     /* kludge */
-{
-       return ramdisk_size(str);
-}
 static int __init ramdisk_blocksize(char *str)
 {
        rd_blocksize = simple_strtol(str,NULL,0);
        return 1;
 }
-__setup("ramdisk=", ramdisk_size);
-__setup("ramdisk_size=", ramdisk_size2);
+__setup("ramdisk_size=", ramdisk_size);
 __setup("ramdisk_blocksize=", ramdisk_blocksize);
 #endif
 
index f6f8c03047fa8b44f0b8aa751c331e6677c820a9..204d53e506de40af3d37d42e2a1030dbdda323d0 100644 (file)
@@ -36,6 +36,23 @@ config VT
          If unsure, say Y, or else you won't be able to do much with your new
          shiny Linux system :-)
 
+config VT_UNICODE
+       bool "Virtual console is Unicode by default"
+       depends on VT
+       default n
+       ---help---
+         If you say Y here, the virtual terminal will be in UTF-8 by default,
+         and the keyboard will run in unicode mode.
+
+         If you say N here, the virtual terminal will not be in UTF-8 by
+         default, and the keyboard will run in XLATE mode.
+
+         This can also be changed by passing 'default_utf8=<0|1>' on the
+         kernel command line.
+
+         Historically, the kernel has defaulted to non-UTF8 and XLATE mode.
+         If unsure, say N here.
+
 config VT_CONSOLE
        bool "Support for console on virtual terminal" if EMBEDDED
        depends on VT
@@ -568,8 +585,8 @@ config TIPAR
 config HVC_DRIVER
        bool
        help
-         Users of pSeries machines that want to utilize the hvc console front-end
-         module for their backend console driver should select this option.
+         Generic "hypervisor virtual console" infrastructure for various
+         hypervisors (pSeries, iSeries, Xen, lguest).
          It will automatically be selected if one of the back-end console drivers
          is selected.
 
index 313a133a1172fac20135a71af05f2e865eddf420..cbb0444467ba413e2ca050a8f2abfe86e4f7af7e 100644 (file)
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/agp_backend.h>
+#include <linux/log2.h>
 
 #include <asm/acpi-ext.h>
 
 #include "agp.h"
 
-#ifndef log2
-#define log2(x)                ffz(~(x))
-#endif
-
 #define HP_ZX1_IOC_OFFSET      0x1000  /* ACPI reports SBA, we want IOC */
 
 /* HP ZX1 IOC registers */
@@ -257,7 +254,7 @@ hp_zx1_configure (void)
                readl(hp->ioc_regs+HP_ZX1_IMASK);
                writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE);
                readl(hp->ioc_regs+HP_ZX1_IBASE);
-               writel(hp->iova_base|log2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM);
+               writel(hp->iova_base|ilog2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM);
                readl(hp->ioc_regs+HP_ZX1_PCOM);
        }
 
@@ -285,7 +282,7 @@ hp_zx1_tlbflush (struct agp_memory *mem)
 {
        struct _hp_private *hp = &hp_private;
 
-       writeq(hp->gart_base | log2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM);
+       writeq(hp->gart_base | ilog2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM);
        readq(hp->ioc_regs+HP_ZX1_PCOM);
 }
 
index 70117df4d06779c490e88db53b1361a752a2d742..e72a83e2bad54bb46c8a426ebb18add2872aa30d 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/agp_backend.h>
+#include <linux/log2.h>
 
 #include "agp.h"
 
@@ -59,8 +60,6 @@
  */
 #define WR_FLUSH_GATT(index)   RD_GATT(index)
 
-#define log2(x)                        ffz(~(x))
-
 static struct {
        void *gatt;                             /* ioremap'd GATT area */
 
@@ -148,7 +147,7 @@ static int i460_fetch_size (void)
                 * values[i].size.
                 */
                values[i].num_entries = (values[i].size << 8) >> (I460_IO_PAGE_SHIFT - 12);
-               values[i].page_order = log2((sizeof(u32)*values[i].num_entries) >> PAGE_SHIFT);
+               values[i].page_order = ilog2((sizeof(u32)*values[i].num_entries) >> PAGE_SHIFT);
        }
 
        for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
index f4562cc22343759b10a280302573f9f26ae0c405..2939e3570f9daa6630172ad9c762ff3650919958 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/init.h>
 #include <linux/klist.h>
 #include <linux/agp_backend.h>
+#include <linux/log2.h>
 
 #include <asm-parisc/parisc-device.h>
 #include <asm-parisc/ropes.h>
 #define DRVNAME        "quicksilver"
 #define DRVPFX DRVNAME ": "
 
-#ifndef log2
-#define log2(x)                ffz(~(x))
-#endif
-
 #define AGP8X_MODE_BIT         3
 #define AGP8X_MODE             (1 << AGP8X_MODE_BIT)
 
@@ -92,7 +89,7 @@ parisc_agp_tlbflush(struct agp_memory *mem)
 {
        struct _parisc_agp_info *info = &parisc_agp_info;
 
-       writeq(info->gart_base | log2(info->gart_size), info->ioc_regs+IOC_PCOM);
+       writeq(info->gart_base | ilog2(info->gart_size), info->ioc_regs+IOC_PCOM);
        readq(info->ioc_regs+IOC_PCOM); /* flush */
 }
 
index 4b3916f549099d16b1a1ed1cb6d280eeafcd02ad..6b104e45a322b3a5bd321a07f12a4c3936441db6 100644 (file)
@@ -494,12 +494,11 @@ int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
        p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
        if (p && p->readonly) return -EIO;
        if (!p || --p->refcount) {
-               q = kmalloc(sizeof(*p), GFP_KERNEL);
+               q = kzalloc(sizeof(*p), GFP_KERNEL);
                if (!q) {
                        if (p) p->refcount++;
                        return -ENOMEM;
                }
-               memset(q, 0, sizeof(*q));
                q->refcount=1;
                *vc->vc_uni_pagedir_loc = (unsigned long)q;
        } else {
@@ -670,19 +669,29 @@ void con_protect_unimap(struct vc_data *vc, int rdonly)
                p->readonly = rdonly;
 }
 
+/*
+ * Always use USER_MAP. These functions are used by the keyboard,
+ * which shouldn't be affected by G0/G1 switching, etc.
+ * If the user map still contains default values, i.e. the
+ * direct-to-font mapping, then assume user is using Latin1.
+ */
 /* may be called during an interrupt */
 u32 conv_8bit_to_uni(unsigned char c)
 {
-       /*
-        * Always use USER_MAP. This function is used by the keyboard,
-        * which shouldn't be affected by G0/G1 switching, etc.
-        * If the user map still contains default values, i.e. the
-        * direct-to-font mapping, then assume user is using Latin1.
-        */
        unsigned short uni = translations[USER_MAP][c];
        return uni == (0xf000 | c) ? c : uni;
 }
 
+int conv_uni_to_8bit(u32 uni)
+{
+       int c;
+       for (c = 0; c < 0x100; c++)
+               if (translations[USER_MAP][c] == uni ||
+                  (translations[USER_MAP][c] == (c | 0xf000) && uni == c))
+                       return c;
+       return -1;
+}
+
 int
 conv_uni_to_pc(struct vc_data *conp, long ucs) 
 {
index 453a2f1ffa157b572d47ce4606da2282f267340e..0aa419a617674dfe20bb6d8dfe09aa706ad5cf18 100644 (file)
@@ -222,7 +222,7 @@ char *func_table[MAX_NR_FUNC] = {
        NULL,
 };
 
-struct kbdiacr accent_table[MAX_DIACR] = {
+struct kbdiacruc accent_table[MAX_DIACR] = {
        {'`', 'A', '\300'},     {'`', 'a', '\340'},
        {'\'', 'A', '\301'},    {'\'', 'a', '\341'},
        {'^', 'A', '\302'},     {'^', 'a', '\342'},
index c6c56fb8ba5098f341692d16c698e39a383abda1..ffcecde9e2a5b317319e605480c5520264c77ee3 100644 (file)
@@ -1,34 +1,30 @@
 /*
-
        Copyright (C) 1996  Digi International.
+
        For technical support please email digiLinux@dgii.com or
        call Digi tech support at (612) 912-3456
 
        ** This driver is no longer supported by Digi **
 
-       Much of this design and code came from epca.c which was 
-       copyright (C) 1994, 1995 Troy De Jongh, and subsquently 
-       modified by David Nugent, Christoph Lameter, Mike McLagan. 
-       This program is free software; you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation; either version 2 of the License, or
-       (at your option) any later version.
-
-       This program is distributed in the hope that it will be useful,
-       but WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       GNU General Public License for more details.
-
-       You should have received a copy of the GNU General Public License
-       along with this program; if not, write to the Free Software
-       Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
---------------------------------------------------------------------------- */
-/* See README.epca for change history --DAT*/
+       Much of this design and code came from epca.c which was
+       copyright (C) 1994, 1995 Troy De Jongh, and subsquently
+       modified by David Nugent, Christoph Lameter, Mike McLagan.
+
+       This program is free software; you can redistribute it and/or modify
+       it under the terms of the GNU General Public License as published by
+       the Free Software Foundation; either version 2 of the License, or
+       (at your option) any later version.
 
+       This program is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       GNU General Public License for more details.
+
+       You should have received a copy of the GNU General Public License
+       along with this program; if not, write to the Free Software
+       Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+/* See README.epca for change history --DAT*/
 
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include "epca.h"
 #include "epcaconfig.h"
 
-/* ---------------------- Begin defines ------------------------ */
-
 #define VERSION            "1.3.0.1-LK2.6"
 
 /* This major needs to be submitted to Linux to join the majors list */
-
-#define DIGIINFOMAJOR       35  /* For Digi specific ioctl */ 
+#define DIGIINFOMAJOR       35  /* For Digi specific ioctl */
 
 
 #define MAXCARDS 7
 
 #define PFX "epca: "
 
-/* ----------------- Begin global definitions ------------------- */
-
 static int nbdevs, num_cards, liloconfig;
 static int digi_poller_inhibited = 1 ;
 
 static int setup_error_code;
 static int invalid_lilo_config;
 
-/* The ISA boards do window flipping into the same spaces so its only sane
-   with a single lock. It's still pretty efficient */
-
+/*
+ * The ISA boards do window flipping into the same spaces so its only sane with
+ * a single lock. It's still pretty efficient.
+ */
 static DEFINE_SPINLOCK(epca_lock);
 
-/* -----------------------------------------------------------------------
-       MAXBOARDS is typically 12, but ISA and EISA cards are restricted to 
-       7 below.
---------------------------------------------------------------------------*/
+/* MAXBOARDS is typically 12, but ISA and EISA cards are restricted to 7 below. */
 static struct board_info boards[MAXBOARDS];
 
-
-/* ------------- Begin structures used for driver registeration ---------- */
-
 static struct tty_driver *pc_driver;
 static struct tty_driver *pc_info;
 
 /* ------------------ Begin Digi specific structures -------------------- */
 
-/* ------------------------------------------------------------------------
-       digi_channels represents an array of structures that keep track of
-       each channel of the Digi product.  Information such as transmit and
-       receive pointers, termio data, and signal definitions (DTR, CTS, etc ...)
-       are stored here.  This structure is NOT used to overlay the cards 
-       physical channel structure.
--------------------------------------------------------------------------- */
-  
+/*
+ * digi_channels represents an array of structures that keep track of each
+ * channel of the Digi product. Information such as transmit and receive
+ * pointers, termio data, and signal definitions (DTR, CTS, etc ...) are stored
+ * here. This structure is NOT used to overlay the cards physical channel
+ * structure.
+ */
 static struct channel digi_channels[MAX_ALLOC];
 
-/* ------------------------------------------------------------------------
      card_ptr is an array used to hold the address of the
      first channel structure of each card.  This array will hold
      the addresses of various channels located in digi_channels.
--------------------------------------------------------------------------- */
+/*
* card_ptr is an array used to hold the address of the first channel structure
* of each card. This array will hold the addresses of various channels located
* in digi_channels.
+ */
 static struct channel *card_ptr[MAXCARDS];
 
 static struct timer_list epca_timer;
 
-/* ---------------------- Begin function prototypes --------------------- */
-
-/* ----------------------------------------------------------------------
-       Begin generic memory functions.  These functions will be alias
-       (point at) more specific functions dependent on the board being
-       configured.
------------------------------------------------------------------------ */
-       
+/*
+ * Begin generic memory functions. These functions will be alias (point at)
+ * more specific functions dependent on the board being configured.
+ */
 static void memwinon(struct board_info *b, unsigned int win);
 static void memwinoff(struct board_info *b, unsigned int win);
 static void globalwinon(struct channel *ch);
@@ -170,8 +151,6 @@ static void dummy_memoff(struct channel *ch);
 static void dummy_assertgwinon(struct channel *ch);
 static void dummy_assertmemoff(struct channel *ch);
 
-/* ------------------- Begin declare functions ----------------------- */
-
 static struct channel *verifyChannel(struct tty_struct *);
 static void pc_sched_event(struct channel *, int);
 static void epca_error(int, char *);
@@ -213,62 +192,55 @@ static int pc_write(struct tty_struct *, const unsigned char *, int);
 static int pc_init(void);
 static int init_PCI(void);
 
-
-/* ------------------------------------------------------------------
-       Table of functions for each board to handle memory.  Mantaining 
-       parallelism is a *very* good idea here.  The idea is for the 
-       runtime code to blindly call these functions, not knowing/caring    
-       about the underlying hardware.  This stuff should contain no
-       conditionals; if more functionality is needed a different entry
-       should be established.  These calls are the interface calls and 
-       are the only functions that should be accessed.  Anyone caught
-       making direct calls deserves what they get.
--------------------------------------------------------------------- */
-
+/*
+ * Table of functions for each board to handle memory. Mantaining parallelism
+ * is a *very* good idea here. The idea is for the runtime code to blindly call
+ * these functions, not knowing/caring about the underlying hardware. This
+ * stuff should contain no conditionals; if more functionality is needed a
+ * different entry should be established. These calls are the interface calls
+ * and are the only functions that should be accessed. Anyone caught making
+ * direct calls deserves what they get.
+ */
 static void memwinon(struct board_info *b, unsigned int win)
 {
-       (b->memwinon)(b, win);
+       b->memwinon(b, win);
 }
 
 static void memwinoff(struct board_info *b, unsigned int win)
 {
-       (b->memwinoff)(b, win);
+       b->memwinoff(b, win);
 }
 
 static void globalwinon(struct channel *ch)
 {
-       (ch->board->globalwinon)(ch);
+       ch->board->globalwinon(ch);
 }
 
 static void rxwinon(struct channel *ch)
 {
-       (ch->board->rxwinon)(ch);
+       ch->board->rxwinon(ch);
 }
 
 static void txwinon(struct channel *ch)
 {
-       (ch->board->txwinon)(ch);
+       ch->board->txwinon(ch);
 }
 
 static void memoff(struct channel *ch)
 {
-       (ch->board->memoff)(ch);
+       ch->board->memoff(ch);
 }
 static void assertgwinon(struct channel *ch)
 {
-       (ch->board->assertgwinon)(ch);
+       ch->board->assertgwinon(ch);
 }
 
 static void assertmemoff(struct channel *ch)
 {
-       (ch->board->assertmemoff)(ch);
+       ch->board->assertmemoff(ch);
 }
 
-/* ---------------------------------------------------------
-       PCXEM windowing is the same as that used in the PCXR 
-       and CX series cards.
------------------------------------------------------------- */
-
+/* PCXEM windowing is the same as that used in the PCXR and CX series cards. */
 static void pcxem_memwinon(struct board_info *b, unsigned int win)
 {
         outb_p(FEPWIN|win, b->port + 1);
@@ -300,32 +272,30 @@ static void pcxem_memoff(struct channel *ch)
 }
 
 /* ----------------- Begin pcxe memory window stuff ------------------ */
-
 static void pcxe_memwinon(struct board_info *b, unsigned int win)
 {
-               outb_p(FEPWIN | win, b->port + 1);
+       outb_p(FEPWIN | win, b->port + 1);
 }
 
 static void pcxe_memwinoff(struct board_info *b, unsigned int win)
 {
-       outb_p(inb(b->port) & ~FEPMEM,
-                  b->port + 1);
+       outb_p(inb(b->port) & ~FEPMEM, b->port + 1);
        outb_p(0, b->port + 1);
 }
 
 static void pcxe_globalwinon(struct channel *ch)
 {
-       outb_p( FEPWIN, (int)ch->board->port + 1);
+       outb_p(FEPWIN, (int)ch->board->port + 1);
 }
 
 static void pcxe_rxwinon(struct channel *ch)
 {
-               outb_p(ch->rxwin, (int)ch->board->port + 1);
+       outb_p(ch->rxwin, (int)ch->board->port + 1);
 }
 
 static void pcxe_txwinon(struct channel *ch)
 {
-               outb_p(ch->txwin, (int)ch->board->port + 1);
+       outb_p(ch->txwin, (int)ch->board->port + 1);
 }
 
 static void pcxe_memoff(struct channel *ch)
@@ -335,10 +305,9 @@ static void pcxe_memoff(struct channel *ch)
 }
 
 /* ------------- Begin pc64xe and pcxi memory window stuff -------------- */
-
 static void pcxi_memwinon(struct board_info *b, unsigned int win)
 {
-               outb_p(inb(b->port) | FEPMEM, b->port);
+       outb_p(inb(b->port) | FEPMEM, b->port);
 }
 
 static void pcxi_memwinoff(struct board_info *b, unsigned int win)
@@ -353,12 +322,12 @@ static void pcxi_globalwinon(struct channel *ch)
 
 static void pcxi_rxwinon(struct channel *ch)
 {
-               outb_p(FEPMEM, ch->board->port);
+       outb_p(FEPMEM, ch->board->port);
 }
 
 static void pcxi_txwinon(struct channel *ch)
 {
-               outb_p(FEPMEM, ch->board->port);
+       outb_p(FEPMEM, ch->board->port);
 }
 
 static void pcxi_memoff(struct channel *ch)
@@ -376,16 +345,13 @@ static void pcxi_assertmemoff(struct channel *ch)
        epcaassert(!(inb(ch->board->port) & FEPMEM), "Memory on");
 }
 
-
-/* ----------------------------------------------------------------------
-       Not all of the cards need specific memory windowing routines.  Some
-       cards (Such as PCI) needs no windowing routines at all.  We provide
-       these do nothing routines so that the same code base can be used.
-       The driver will ALWAYS call a windowing routine if it thinks it needs
-       to; regardless of the card.  However, dependent on the card the routine
-       may or may not do anything.
----------------------------------------------------------------------------*/
-
+/*
+ * Not all of the cards need specific memory windowing routines. Some cards
+ * (Such as PCI) needs no windowing routines at all. We provide these do
+ * nothing routines so that the same code base can be used. The driver will
+ * ALWAYS call a windowing routine if it thinks it needs to; regardless of the
+ * card. However, dependent on the card the routine may or may not do anything.
+ */
 static void dummy_memwinon(struct board_info *b, unsigned int win)
 {
 }
@@ -418,15 +384,14 @@ static void dummy_assertmemoff(struct channel *ch)
 {
 }
 
-/* ----------------- Begin verifyChannel function ----------------------- */
 static struct channel *verifyChannel(struct tty_struct *tty)
-{ /* Begin verifyChannel */
-       /* --------------------------------------------------------------------
-               This routine basically provides a sanity check.  It insures that
-               the channel returned is within the proper range of addresses as
-               well as properly initialized.  If some bogus info gets passed in
-               through tty->driver_data this should catch it.
-               --------------------------------------------------------------------- */
+{
+       /*
+        * This routine basically provides a sanity check. It insures that the
+        * channel returned is within the proper range of addresses as well as
+        * properly initialized. If some bogus info gets passed in
+        * through tty->driver_data this should catch it.
+        */
        if (tty) {
                struct channel *ch = (struct channel *)tty->driver_data;
                if ((ch >= &digi_channels[0]) && (ch < &digi_channels[nbdevs])) {
@@ -435,62 +400,55 @@ static struct channel *verifyChannel(struct tty_struct *tty)
                }
        }
        return NULL;
-
-} /* End verifyChannel */
-
-/* ------------------ Begin pc_sched_event ------------------------- */
+}
 
 static void pc_sched_event(struct channel *ch, int event)
 {
-       /* ----------------------------------------------------------------------
-               We call this to schedule interrupt processing on some event.  The 
-               kernel sees our request and calls the related routine in OUR driver.
-       -------------------------------------------------------------------------*/
+       /*
+        * We call this to schedule interrupt processing on some event. The
+        * kernel sees our request and calls the related routine in OUR driver.
+        */
        ch->event |= 1 << event;
        schedule_work(&ch->tqueue);
-} /* End pc_sched_event */
-
-/* ------------------ Begin epca_error ------------------------- */
+}
 
 static void epca_error(int line, char *msg)
 {
        printk(KERN_ERR "epca_error (Digi): line = %d %s\n",line,msg);
 }
 
-/* ------------------ Begin pc_close ------------------------- */
-static void pc_close(struct tty_struct * tty, struct file * filp)
+static void pc_close(struct tty_struct *tty, struct file *filp)
 {
        struct channel *ch;
        unsigned long flags;
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
-       if ((ch = verifyChannel(tty)) != NULL)  { /* Begin if ch != NULL */
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
+       if ((ch = verifyChannel(tty)) != NULL) {
                spin_lock_irqsave(&epca_lock, flags);
                if (tty_hung_up_p(filp)) {
                        spin_unlock_irqrestore(&epca_lock, flags);
                        return;
                }
-               /* Check to see if the channel is open more than once */
                if (ch->count-- > 1)  {
                        /* Begin channel is open more than once */
-                       /* -------------------------------------------------------------
-                               Return without doing anything.  Someone might still be using
-                               the channel.
-                       ---------------------------------------------------------------- */
+                       /*
+                        * Return without doing anything. Someone might still
+                        * be using the channel.
+                        */
                        spin_unlock_irqrestore(&epca_lock, flags);
                        return;
-               } /* End channel is open more than once */
+               }
 
                /* Port open only once go ahead with shutdown & reset */
                BUG_ON(ch->count < 0);
 
-               /* ---------------------------------------------------------------
-                       Let the rest of the driver know the channel is being closed.
-                       This becomes important if an open is attempted before close 
-                       is finished.
-               ------------------------------------------------------------------ */
+               /*
+                * Let the rest of the driver know the channel is being closed.
+                * This becomes important if an open is attempted before close
+                * is finished.
+                */
                ch->asyncflags |= ASYNC_CLOSING;
                tty->closing = 1;
 
@@ -498,7 +456,7 @@ static void pc_close(struct tty_struct * tty, struct file * filp)
 
                if (ch->asyncflags & ASYNC_INITIALIZED)  {
                        /* Setup an event to indicate when the transmit buffer empties */
-                       setup_empty_event(tty, ch);             
+                       setup_empty_event(tty, ch);
                        tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */
                }
                if (tty->driver->flush_buffer)
@@ -513,27 +471,24 @@ static void pc_close(struct tty_struct * tty, struct file * filp)
                ch->tty = NULL;
                spin_unlock_irqrestore(&epca_lock, flags);
 
-               if (ch->blocked_open)  { /* Begin if blocked_open */
-                       if (ch->close_delay) 
+               if (ch->blocked_open) {
+                       if (ch->close_delay)
                                msleep_interruptible(jiffies_to_msecs(ch->close_delay));
                        wake_up_interruptible(&ch->open_wait);
-               } /* End if blocked_open */
-               ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | 
+               }
+               ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED |
                                      ASYNC_CLOSING);
                wake_up_interruptible(&ch->close_wait);
-       } /* End if ch != NULL */
-} /* End pc_close */ 
-
-/* ------------------ Begin shutdown  ------------------------- */
+       }
+}
 
 static void shutdown(struct channel *ch)
-{ /* Begin shutdown */
-
+{
        unsigned long flags;
        struct tty_struct *tty;
        struct board_chan __iomem *bc;
 
-       if (!(ch->asyncflags & ASYNC_INITIALIZED)) 
+       if (!(ch->asyncflags & ASYNC_INITIALIZED))
                return;
 
        spin_lock_irqsave(&epca_lock, flags);
@@ -541,50 +496,40 @@ static void shutdown(struct channel *ch)
        globalwinon(ch);
        bc = ch->brdchan;
 
-       /* ------------------------------------------------------------------
-               In order for an event to be generated on the receipt of data the
-               idata flag must be set. Since we are shutting down, this is not 
-               necessary clear this flag.
-       --------------------------------------------------------------------- */ 
-
+       /*
+        * In order for an event to be generated on the receipt of data the
+        * idata flag must be set. Since we are shutting down, this is not
+        * necessary clear this flag.
+        */
        if (bc)
                writeb(0, &bc->idata);
        tty = ch->tty;
 
-       /* ----------------------------------------------------------------
-          If we're a modem control device and HUPCL is on, drop RTS & DTR.
-       ------------------------------------------------------------------ */
-
+       /* If we're a modem control device and HUPCL is on, drop RTS & DTR. */
        if (tty->termios->c_cflag & HUPCL)  {
                ch->omodem &= ~(ch->m_rts | ch->m_dtr);
                fepcmd(ch, SETMODEM, 0, ch->m_dtr | ch->m_rts, 10, 1);
        }
        memoff(ch);
 
-       /* ------------------------------------------------------------------
-               The channel has officialy been closed.  The next time it is opened
-               it will have to reinitialized.  Set a flag to indicate this.
-       ---------------------------------------------------------------------- */
-
+       /*
+        * The channel has officialy been closed. The next time it is opened it
+        * will have to reinitialized. Set a flag to indicate this.
+        */
        /* Prevent future Digi programmed interrupts from coming active */
-
        ch->asyncflags &= ~ASYNC_INITIALIZED;
        spin_unlock_irqrestore(&epca_lock, flags);
-
-} /* End shutdown */
-
-/* ------------------ Begin pc_hangup  ------------------------- */
+}
 
 static void pc_hangup(struct tty_struct *tty)
-{ /* Begin pc_hangup */
+{
        struct channel *ch;
-       
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
 
-       if ((ch = verifyChannel(tty)) != NULL)  { /* Begin if ch != NULL */
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
+       if ((ch = verifyChannel(tty)) != NULL) {
                unsigned long flags;
 
                if (tty->driver->flush_buffer)
@@ -599,15 +544,12 @@ static void pc_hangup(struct tty_struct *tty)
                ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED);
                spin_unlock_irqrestore(&epca_lock, flags);
                wake_up_interruptible(&ch->open_wait);
-       } /* End if ch != NULL */
-
-} /* End pc_hangup */
-
-/* ------------------ Begin pc_write  ------------------------- */
+       }
+}
 
-static int pc_write(struct tty_struct * tty,
+static int pc_write(struct tty_struct *tty,
                     const unsigned char *buf, int bytesAvailable)
-{ /* Begin pc_write */
+{
        unsigned int head, tail;
        int dataLen;
        int size;
@@ -617,25 +559,23 @@ static int pc_write(struct tty_struct * tty,
        int remain;
        struct board_chan __iomem *bc;
 
-       /* ----------------------------------------------------------------
-               pc_write is primarily called directly by the kernel routine
-               tty_write (Though it can also be called by put_char) found in
-               tty_io.c.  pc_write is passed a line discipline buffer where 
-               the data to be written out is stored.  The line discipline 
-               implementation itself is done at the kernel level and is not 
-               brought into the driver.  
-       ------------------------------------------------------------------- */
-
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
+       /*
+        * pc_write is primarily called directly by the kernel routine
+        * tty_write (Though it can also be called by put_char) found in
+        * tty_io.c. pc_write is passed a line discipline buffer where the data
+        * to be written out is stored. The line discipline implementation
+        * itself is done at the kernel level and is not brought into the
+        * driver.
+        */
 
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
        if ((ch = verifyChannel(tty)) == NULL)
                return 0;
 
        /* Make a pointer to the channel data structure found on the board. */
-
        bc   = ch->brdchan;
        size = ch->txbufsize;
        amountCopied = 0;
@@ -650,37 +590,36 @@ static int pc_write(struct tty_struct * tty,
                tail = readw(&bc->tout);
        tail &= (size - 1);
 
-       /*      If head >= tail, head has not wrapped around. */ 
-       if (head >= tail)  { /* Begin head has not wrapped */
-               /* ---------------------------------------------------------------
-                       remain (much like dataLen above) represents the total amount of
-                       space available on the card for data.  Here dataLen represents
-                       the space existing between the head pointer and the end of 
-                       buffer.  This is important because a memcpy cannot be told to
-                       automatically wrap around when it hits the buffer end.
-               ------------------------------------------------------------------ */ 
+       if (head >= tail) {
+               /* head has not wrapped */
+               /*
+                * remain (much like dataLen above) represents the total amount
+                * of space available on the card for data. Here dataLen
+                * represents the space existing between the head pointer and
+                * the end of buffer. This is important because a memcpy cannot
+                * be told to automatically wrap around when it hits the buffer
+                * end.
+                */
                dataLen = size - head;
                remain = size - (head - tail) - 1;
-       } else { /* Begin head has wrapped around */
-
+       } else {
+               /* head has wrapped around */
                remain = tail - head - 1;
                dataLen = remain;
-
-       } /* End head has wrapped around */
-       /* -------------------------------------------------------------------
-                       Check the space on the card.  If we have more data than 
-                       space; reduce the amount of data to fit the space.
-       ---------------------------------------------------------------------- */
+       }
+       /*
+        * Check the space on the card. If we have more data than space; reduce
+        * the amount of data to fit the space.
+        */
        bytesAvailable = min(remain, bytesAvailable);
        txwinon(ch);
-       while (bytesAvailable > 0) 
-       { /* Begin while there is data to copy onto card */
-
-               /* -----------------------------------------------------------------
-                       If head is not wrapped, the below will make sure the first 
-                       data copy fills to the end of card buffer.
-               ------------------------------------------------------------------- */
+       while (bytesAvailable > 0) {
+               /* there is data to copy onto card */
 
+               /*
+                * If head is not wrapped, the below will make sure the first
+                * data copy fills to the end of card buffer.
+                */
                dataLen = min(bytesAvailable, dataLen);
                memcpy_toio(ch->txptr + head, buf, dataLen);
                buf += dataLen;
@@ -692,7 +631,7 @@ static int pc_write(struct tty_struct * tty,
                        head = 0;
                        dataLen = tail;
                }
-       } /* End while there is data to copy onto card */
+       }
        ch->statusflags |= TXBUSY;
        globalwinon(ch);
        writew(head, &bc->tin);
@@ -703,22 +642,16 @@ static int pc_write(struct tty_struct * tty,
        }
        memoff(ch);
        spin_unlock_irqrestore(&epca_lock, flags);
-       return(amountCopied);
-
-} /* End pc_write */
-
-/* ------------------ Begin pc_put_char  ------------------------- */
+       return amountCopied;
+}
 
 static void pc_put_char(struct tty_struct *tty, unsigned char c)
-{ /* Begin pc_put_char */
+{
        pc_write(tty, &c, 1);
-} /* End pc_put_char */
-
-/* ------------------ Begin pc_write_room  ------------------------- */
+}
 
 static int pc_write_room(struct tty_struct *tty)
-{ /* Begin pc_write_room */
-
+{
        int remain;
        struct channel *ch;
        unsigned long flags;
@@ -727,11 +660,10 @@ static int pc_write_room(struct tty_struct *tty)
 
        remain = 0;
 
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
-
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
        if ((ch = verifyChannel(tty)) != NULL)  {
                spin_lock_irqsave(&epca_lock, flags);
                globalwinon(ch);
@@ -757,14 +689,10 @@ static int pc_write_room(struct tty_struct *tty)
        }
        /* Return how much room is left on card */
        return remain;
-
-} /* End pc_write_room */
-
-/* ------------------ Begin pc_chars_in_buffer  ---------------------- */
+}
 
 static int pc_chars_in_buffer(struct tty_struct *tty)
-{ /* Begin pc_chars_in_buffer */
-
+{
        int chars;
        unsigned int ctail, head, tail;
        int remain;
@@ -772,13 +700,12 @@ static int pc_chars_in_buffer(struct tty_struct *tty)
        struct channel *ch;
        struct board_chan __iomem *bc;
 
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
-
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
        if ((ch = verifyChannel(tty)) == NULL)
-               return(0);
+               return 0;
 
        spin_lock_irqsave(&epca_lock, flags);
        globalwinon(ch);
@@ -793,45 +720,40 @@ static int pc_chars_in_buffer(struct tty_struct *tty)
        else  { /* Begin if some space on the card has been used */
                head = readw(&bc->tin) & (ch->txbufsize - 1);
                tail &= (ch->txbufsize - 1);
-               /*  --------------------------------------------------------------
-                       The logic here is basically opposite of the above pc_write_room
-                       here we are finding the amount of bytes in the buffer filled.
-                       Not the amount of bytes empty.
-               ------------------------------------------------------------------- */
+               /*
+                * The logic here is basically opposite of the above
+                * pc_write_room here we are finding the amount of bytes in the
+                * buffer filled. Not the amount of bytes empty.
+                */
                if ((remain = tail - head - 1) < 0 )
                        remain += ch->txbufsize;
                chars = (int)(ch->txbufsize - remain);
-               /* -------------------------------------------------------------  
-                       Make it possible to wakeup anything waiting for output
-                       in tty_ioctl.c, etc.
-
-                       If not already set.  Setup an event to indicate when the
-                       transmit buffer empties 
-               ----------------------------------------------------------------- */
+               /*
+                * Make it possible to wakeup anything waiting for output in
+                * tty_ioctl.c, etc.
+                *
+                * If not already set. Setup an event to indicate when the
+                * transmit buffer empties.
+                */
                if (!(ch->statusflags & EMPTYWAIT))
                        setup_empty_event(tty,ch);
-
        } /* End if some space on the card has been used */
        memoff(ch);
        spin_unlock_irqrestore(&epca_lock, flags);
        /* Return number of characters residing on card. */
-       return(chars);
-
-} /* End pc_chars_in_buffer */
-
-/* ------------------ Begin pc_flush_buffer  ---------------------- */
+       return chars;
+}
 
 static void pc_flush_buffer(struct tty_struct *tty)
-{ /* Begin pc_flush_buffer */
-
+{
        unsigned int tail;
        unsigned long flags;
        struct channel *ch;
        struct board_chan __iomem *bc;
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
        if ((ch = verifyChannel(tty)) == NULL)
                return;
 
@@ -844,51 +766,47 @@ static void pc_flush_buffer(struct tty_struct *tty)
        memoff(ch);
        spin_unlock_irqrestore(&epca_lock, flags);
        tty_wakeup(tty);
-} /* End pc_flush_buffer */
-
-/* ------------------ Begin pc_flush_chars  ---------------------- */
+}
 
 static void pc_flush_chars(struct tty_struct *tty)
-{ /* Begin pc_flush_chars */
-       struct channel * ch;
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
+{
+       struct channel *ch;
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
        if ((ch = verifyChannel(tty)) != NULL) {
                unsigned long flags;
                spin_lock_irqsave(&epca_lock, flags);
-               /* ----------------------------------------------------------------
-                       If not already set and the transmitter is busy setup an event
-                       to indicate when the transmit empties.
-               ------------------------------------------------------------------- */
+               /*
+                * If not already set and the transmitter is busy setup an
+                * event to indicate when the transmit empties.
+                */
                if ((ch->statusflags & TXBUSY) && !(ch->statusflags & EMPTYWAIT))
                        setup_empty_event(tty,ch);
                spin_unlock_irqrestore(&epca_lock, flags);
        }
-} /* End pc_flush_chars */
-
-/* ------------------ Begin block_til_ready  ---------------------- */
+}
 
-static int block_til_ready(struct tty_struct *tty, 
+static int block_til_ready(struct tty_struct *tty,
                            struct file *filp, struct channel *ch)
-{ /* Begin block_til_ready */
+{
        DECLARE_WAITQUEUE(wait,current);
-       int     retval, do_clocal = 0;
+       int retval, do_clocal = 0;
        unsigned long flags;
 
        if (tty_hung_up_p(filp)) {
                if (ch->asyncflags & ASYNC_HUP_NOTIFY)
                        retval = -EAGAIN;
                else
-                       retval = -ERESTARTSYS;  
-               return(retval);
+                       retval = -ERESTARTSYS;
+               return retval;
        }
 
-       /* ----------------------------------------------------------------- 
-               If the device is in the middle of being closed, then block
-               until it's done, and then try again.
-       -------------------------------------------------------------------- */
+       /*
+        * If the device is in the middle of being closed, then block until
+        * it's done, and then try again.
+        */
        if (ch->asyncflags & ASYNC_CLOSING) {
                interruptible_sleep_on(&ch->close_wait);
 
@@ -899,17 +817,17 @@ static int block_til_ready(struct tty_struct *tty,
        }
 
        if (filp->f_flags & O_NONBLOCK)  {
-               /* ----------------------------------------------------------------- 
-                If non-blocking mode is set, then make the check up front
-                and then exit.
-               -------------------------------------------------------------------- */
+               /*
+                If non-blocking mode is set, then make the check up front
+                and then exit.
+                */
                ch->asyncflags |= ASYNC_NORMAL_ACTIVE;
                return 0;
        }
        if (tty->termios->c_cflag & CLOCAL)
                do_clocal = 1;
        /* Block waiting for the carrier detect and the line to become free */
-       
+
        retval = 0;
        add_wait_queue(&ch->open_wait, &wait);
 
@@ -918,19 +836,18 @@ static int block_til_ready(struct tty_struct *tty,
        if (!tty_hung_up_p(filp))
                ch->count--;
        ch->blocked_open++;
-       while(1) 
-       { /* Begin forever while  */
+       while (1) {
                set_current_state(TASK_INTERRUPTIBLE);
                if (tty_hung_up_p(filp) ||
-                   !(ch->asyncflags & ASYNC_INITIALIZED)) 
+                   !(ch->asyncflags & ASYNC_INITIALIZED))
                {
                        if (ch->asyncflags & ASYNC_HUP_NOTIFY)
                                retval = -EAGAIN;
                        else
-                               retval = -ERESTARTSYS;  
+                               retval = -ERESTARTSYS;
                        break;
                }
-               if (!(ch->asyncflags & ASYNC_CLOSING) && 
+               if (!(ch->asyncflags & ASYNC_CLOSING) &&
                          (do_clocal || (ch->imodem & ch->dcd)))
                        break;
                if (signal_pending(current)) {
@@ -938,16 +855,15 @@ static int block_til_ready(struct tty_struct *tty,
                        break;
                }
                spin_unlock_irqrestore(&epca_lock, flags);
-               /* ---------------------------------------------------------------
-                       Allow someone else to be scheduled.  We will occasionally go
-                       through this loop until one of the above conditions change.
-                       The below schedule call will allow other processes to enter and
-                       prevent this loop from hogging the cpu.
-               ------------------------------------------------------------------ */
+               /*
+                * Allow someone else to be scheduled. We will occasionally go
+                * through this loop until one of the above conditions change.
+                * The below schedule call will allow other processes to enter
+                * and prevent this loop from hogging the cpu.
+                */
                schedule();
                spin_lock_irqsave(&epca_lock, flags);
-
-       } /* End forever while  */
+       }
 
        __set_current_state(TASK_RUNNING);
        remove_wait_queue(&ch->open_wait, &wait);
@@ -962,13 +878,10 @@ static int block_til_ready(struct tty_struct *tty,
 
        ch->asyncflags |= ASYNC_NORMAL_ACTIVE;
        return 0;
-} /* End block_til_ready */    
-
-/* ------------------ Begin pc_open  ---------------------- */
+}
 
 static int pc_open(struct tty_struct *tty, struct file * filp)
-{ /* Begin pc_open */
-
+{
        struct channel *ch;
        unsigned long flags;
        int line, retval, boardnum;
@@ -984,12 +897,11 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
 
        /* Check status of board configured in system.  */
 
-       /* -----------------------------------------------------------------
-               I check to see if the epca_setup routine detected an user error.  
-               It might be better to put this in pc_init, but for the moment it
-               goes here.
-       ---------------------------------------------------------------------- */
-
+       /*
+        * I check to see if the epca_setup routine detected an user error. It
+        * might be better to put this in pc_init, but for the moment it goes
+        * here.
+        */
        if (invalid_lilo_config) {
                if (setup_error_code & INVALID_BOARD_TYPE)
                        printk(KERN_ERR "epca: pc_open: Invalid board type specified in kernel options.\n");
@@ -1010,49 +922,48 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
                tty->driver_data = NULL;   /* Mark this device as 'down' */
                return(-ENODEV);
        }
-       
+
        if ((bc = ch->brdchan) == 0) {
                tty->driver_data = NULL;
                return -ENODEV;
        }
 
        spin_lock_irqsave(&epca_lock, flags);
-       /* ------------------------------------------------------------------
-               Every time a channel is opened, increment a counter.  This is 
-               necessary because we do not wish to flush and shutdown the channel
-               until the last app holding the channel open, closes it.         
-       --------------------------------------------------------------------- */
+       /*
+        * Every time a channel is opened, increment a counter. This is
+        * necessary because we do not wish to flush and shutdown the channel
+        * until the last app holding the channel open, closes it.
+        */
        ch->count++;
-       /* ----------------------------------------------------------------
-               Set a kernel structures pointer to our local channel 
-               structure.  This way we can get to it when passed only
-               a tty struct.
-       ------------------------------------------------------------------ */
+       /*
+        * Set a kernel structures pointer to our local channel structure. This
+        * way we can get to it when passed only a tty struct.
+        */
        tty->driver_data = ch;
-       /* ----------------------------------------------------------------
-               If this is the first time the channel has been opened, initialize
-               the tty->termios struct otherwise let pc_close handle it.
-       -------------------------------------------------------------------- */
+       /*
+        * If this is the first time the channel has been opened, initialize
+        * the tty->termios struct otherwise let pc_close handle it.
+        */
        globalwinon(ch);
        ch->statusflags = 0;
 
        /* Save boards current modem status */
        ch->imodem = readb(&bc->mstat);
 
-       /* ----------------------------------------------------------------
-          Set receive head and tail ptrs to each other.  This indicates
-          no data available to read.
-       ----------------------------------------------------------------- */
+       /*
+        * Set receive head and tail ptrs to each other. This indicates no data
+        * available to read.
+        */
        head = readw(&bc->rin);
        writew(head, &bc->rout);
 
        /* Set the channels associated tty structure */
        ch->tty = tty;
 
-       /* -----------------------------------------------------------------
-               The below routine generally sets up parity, baud, flow control 
-               issues, etc.... It effect both control flags and input flags.
-       -------------------------------------------------------------------- */
+       /*
+        * The below routine generally sets up parity, baud, flow control
+        * issues, etc.... It effect both control flags and input flags.
+        */
        epcaparam(tty,ch);
        ch->asyncflags |= ASYNC_INITIALIZED;
        memoff(ch);
@@ -1061,10 +972,10 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
        retval = block_til_ready(tty, filp, ch);
        if (retval)
                return retval;
-       /* -------------------------------------------------------------
-               Set this again in case a hangup set it to zero while this 
-               open() was waiting for the line...
-       --------------------------------------------------------------- */
+       /*
+        * Set this again in case a hangup set it to zero while this open() was
+        * waiting for the line...
+        */
        spin_lock_irqsave(&epca_lock, flags);
        ch->tty = tty;
        globalwinon(ch);
@@ -1073,13 +984,12 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
        memoff(ch);
        spin_unlock_irqrestore(&epca_lock, flags);
        return 0;
-} /* End pc_open */
+}
 
 static int __init epca_module_init(void)
-{ /* Begin init_module */
+{
        return pc_init();
 }
-
 module_init(epca_module_init);
 
 static struct pci_driver epca_driver;
@@ -1092,8 +1002,7 @@ static void __exit epca_module_exit(void)
 
        del_timer_sync(&epca_timer);
 
-       if ((tty_unregister_driver(pc_driver)) ||  
-           (tty_unregister_driver(pc_info)))
+       if (tty_unregister_driver(pc_driver) || tty_unregister_driver(pc_info))
        {
                printk(KERN_WARNING "epca: cleanup_module failed to un-register tty driver\n");
                return;
@@ -1101,23 +1010,20 @@ static void __exit epca_module_exit(void)
        put_tty_driver(pc_driver);
        put_tty_driver(pc_info);
 
-       for (crd = 0; crd < num_cards; crd++)  { /* Begin for each card */
+       for (crd = 0; crd < num_cards; crd++) {
                bd = &boards[crd];
-               if (!bd)
-               { /* Begin sanity check */
+               if (!bd) { /* sanity check */
                        printk(KERN_ERR "<Error> - Digi : cleanup_module failed\n");
                        return;
-               } /* End sanity check */
+               }
                ch = card_ptr[crd];
-               for (count = 0; count < bd->numports; count++, ch++) 
-               { /* Begin for each port */
+               for (count = 0; count < bd->numports; count++, ch++) {
                        if (ch && ch->tty)
                                tty_hangup(ch->tty);
-               } /* End for each port */
-       } /* End for each card */
-       pci_unregister_driver (&epca_driver);
+               }
+       }
+       pci_unregister_driver(&epca_driver);
 }
-
 module_exit(epca_module_exit);
 
 static const struct tty_operations pc_ops = {
@@ -1148,10 +1054,8 @@ static struct tty_operations info_ops = {
        .ioctl = info_ioctl,
 };
 
-/* ------------------ Begin pc_init  ---------------------- */
-
 static int __init pc_init(void)
-{ /* Begin pc_init */
+{
        int crd;
        struct board_info *bd;
        unsigned char board_id = 0;
@@ -1169,63 +1073,57 @@ static int __init pc_init(void)
        if (!pc_info)
                goto out2;
 
-       /* -----------------------------------------------------------------------
-               If epca_setup has not been ran by LILO set num_cards to defaults; copy
-               board structure defined by digiConfig into drivers board structure.
-               Note : If LILO has ran epca_setup then epca_setup will handle defining
-               num_cards as well as copying the data into the board structure.
-       -------------------------------------------------------------------------- */
-       if (!liloconfig) { /* Begin driver has been configured via. epcaconfig */
-
+       /*
+        * If epca_setup has not been ran by LILO set num_cards to defaults;
+        * copy board structure defined by digiConfig into drivers board
+        * structure. Note : If LILO has ran epca_setup then epca_setup will
+        * handle defining num_cards as well as copying the data into the board
+        * structure.
+        */
+       if (!liloconfig) {
+               /* driver has been configured via. epcaconfig */
                nbdevs = NBDEVS;
                num_cards = NUMCARDS;
-               memcpy((void *)&boards, (void *)&static_boards,
-                      (sizeof(struct board_info) * NUMCARDS));
-       } /* End driver has been configured via. epcaconfig */
-
-       /* -----------------------------------------------------------------
-               Note : If lilo was used to configure the driver and the 
-               ignore epcaconfig option was choosen (digiepca=2) then 
-               nbdevs and num_cards will equal 0 at this point.  This is
-               okay; PCI cards will still be picked up if detected.
-       --------------------------------------------------------------------- */
-
-       /*  -----------------------------------------------------------
-               Set up interrupt, we will worry about memory allocation in
-               post_fep_init. 
-       --------------------------------------------------------------- */
+               memcpy(&boards, &static_boards,
+                      sizeof(struct board_info) * NUMCARDS);
+       }
 
+       /*
+        * Note : If lilo was used to configure the driver and the ignore
+        * epcaconfig option was choosen (digiepca=2) then nbdevs and num_cards
+        * will equal 0 at this point. This is okay; PCI cards will still be
+        * picked up if detected.
+        */
 
+       /*
+        * Set up interrupt, we will worry about memory allocation in
+        * post_fep_init.
+        */
        printk(KERN_INFO "DIGI epca driver version %s loaded.\n",VERSION);
 
-       /* ------------------------------------------------------------------
-               NOTE : This code assumes that the number of ports found in 
-                      the boards array is correct.  This could be wrong if
-                      the card in question is PCI (And therefore has no ports 
-                      entry in the boards structure.)  The rest of the 
-                      information will be valid for PCI because the beginning
-                      of pc_init scans for PCI and determines i/o and base
-                      memory addresses.  I am not sure if it is possible to 
-                      read the number of ports supported by the card prior to
-                      it being booted (Since that is the state it is in when 
-                      pc_init is run).  Because it is not possible to query the
-                      number of supported ports until after the card has booted;
-                      we are required to calculate the card_ptrs as the card is         
-                      is initialized (Inside post_fep_init).  The negative thing
-                      about this approach is that digiDload's call to GET_INFO
-                      will have a bad port value.  (Since this is called prior
-                      to post_fep_init.)
-
-       --------------------------------------------------------------------- */
-  
+       /*
+        * NOTE : This code assumes that the number of ports found in the
+        * boards array is correct. This could be wrong if the card in question
+        * is PCI (And therefore has no ports entry in the boards structure.)
+        * The rest of the information will be valid for PCI because the
+        * beginning of pc_init scans for PCI and determines i/o and base
+        * memory addresses. I am not sure if it is possible to read the number
+        * of ports supported by the card prior to it being booted (Since that
+        * is the state it is in when pc_init is run). Because it is not
+        * possible to query the number of supported ports until after the card
+        * has booted; we are required to calculate the card_ptrs as the card
+        * is initialized (Inside post_fep_init). The negative thing about this
+        * approach is that digiDload's call to GET_INFO will have a bad port
+        * value. (Since this is called prior to post_fep_init.)
+        */
        pci_boards_found = 0;
-       if(num_cards < MAXBOARDS)
+       if (num_cards < MAXBOARDS)
                pci_boards_found += init_PCI();
        num_cards += pci_boards_found;
 
        pc_driver->owner = THIS_MODULE;
-       pc_driver->name = "ttyD"; 
-       pc_driver->major = DIGI_MAJOR; 
+       pc_driver->name = "ttyD";
+       pc_driver->major = DIGI_MAJOR;
        pc_driver->minor_start = 0;
        pc_driver->type = TTY_DRIVER_TYPE_SERIAL;
        pc_driver->subtype = SERIAL_TYPE_NORMAL;
@@ -1256,120 +1154,108 @@ static int __init pc_init(void)
        tty_set_operations(pc_info, &info_ops);
 
 
-       for (crd = 0; crd < num_cards; crd++) 
-       { /* Begin for each card */
-
-               /*  ------------------------------------------------------------------
-                       This is where the appropriate memory handlers for the hardware is
-                       set.  Everything at runtime blindly jumps through these vectors.
-               ---------------------------------------------------------------------- */
+       for (crd = 0; crd < num_cards; crd++) {
+               /*
+                * This is where the appropriate memory handlers for the
+                * hardware is set. Everything at runtime blindly jumps through
+                * these vectors.
+                */
 
                /* defined in epcaconfig.h */
                bd = &boards[crd];
 
-               switch (bd->type)
-               { /* Begin switch on bd->type {board type} */
-                       case PCXEM:
-                       case EISAXEM:
-                               bd->memwinon     = pcxem_memwinon ;
-                               bd->memwinoff    = pcxem_memwinoff ;
-                               bd->globalwinon  = pcxem_globalwinon ;
-                               bd->txwinon      = pcxem_txwinon ;
-                               bd->rxwinon      = pcxem_rxwinon ;
-                               bd->memoff       = pcxem_memoff ;
-                               bd->assertgwinon = dummy_assertgwinon;
-                               bd->assertmemoff = dummy_assertmemoff;
-                               break;
-
-                       case PCIXEM:
-                       case PCIXRJ:
-                       case PCIXR:
-                               bd->memwinon     = dummy_memwinon;
-                               bd->memwinoff    = dummy_memwinoff;
-                               bd->globalwinon  = dummy_globalwinon;
-                               bd->txwinon      = dummy_txwinon;
-                               bd->rxwinon      = dummy_rxwinon;
-                               bd->memoff       = dummy_memoff;
-                               bd->assertgwinon = dummy_assertgwinon;
-                               bd->assertmemoff = dummy_assertmemoff;
-                               break;
-
-                       case PCXE:
-                       case PCXEVE:
-
-                               bd->memwinon     = pcxe_memwinon;
-                               bd->memwinoff    = pcxe_memwinoff;
-                               bd->globalwinon  = pcxe_globalwinon;
-                               bd->txwinon      = pcxe_txwinon;
-                               bd->rxwinon      = pcxe_rxwinon;
-                               bd->memoff       = pcxe_memoff;
-                               bd->assertgwinon = dummy_assertgwinon;
-                               bd->assertmemoff = dummy_assertmemoff;
-                               break;
-
-                       case PCXI:
-                       case PC64XE:
-
-                               bd->memwinon     = pcxi_memwinon;
-                               bd->memwinoff    = pcxi_memwinoff;
-                               bd->globalwinon  = pcxi_globalwinon;
-                               bd->txwinon      = pcxi_txwinon;
-                               bd->rxwinon      = pcxi_rxwinon;
-                               bd->memoff       = pcxi_memoff;
-                               bd->assertgwinon = pcxi_assertgwinon;
-                               bd->assertmemoff = pcxi_assertmemoff;
-                               break;
-
-                       default:
-                               break;
-
-               } /* End switch on bd->type */
-
-               /* ---------------------------------------------------------------
-                       Some cards need a memory segment to be defined for use in 
-                       transmit and receive windowing operations.  These boards
-                       are listed in the below switch.  In the case of the XI the
-                       amount of memory on the board is variable so the memory_seg
-                       is also variable.  This code determines what they segment 
-                       should be.
-               ----------------------------------------------------------------- */
-
-               switch (bd->type)
-               { /* Begin switch on bd->type {board type} */
-
-                       case PCXE:
-                       case PCXEVE:
-                       case PC64XE:
-                               bd->memory_seg = 0xf000;
+               switch (bd->type) {
+               case PCXEM:
+               case EISAXEM:
+                       bd->memwinon     = pcxem_memwinon;
+                       bd->memwinoff    = pcxem_memwinoff;
+                       bd->globalwinon  = pcxem_globalwinon;
+                       bd->txwinon      = pcxem_txwinon;
+                       bd->rxwinon      = pcxem_rxwinon;
+                       bd->memoff       = pcxem_memoff;
+                       bd->assertgwinon = dummy_assertgwinon;
+                       bd->assertmemoff = dummy_assertmemoff;
                        break;
 
-                       case PCXI:
-                               board_id = inb((int)bd->port);
-                               if ((board_id & 0x1) == 0x1) 
-                               { /* Begin it's an XI card */ 
-
-                                       /* Is it a 64K board */
-                                       if ((board_id & 0x30) == 0) 
-                                               bd->memory_seg = 0xf000;
-
-                                       /* Is it a 128K board */
-                                       if ((board_id & 0x30) == 0x10) 
-                                               bd->memory_seg = 0xe000;
+               case PCIXEM:
+               case PCIXRJ:
+               case PCIXR:
+                       bd->memwinon     = dummy_memwinon;
+                       bd->memwinoff    = dummy_memwinoff;
+                       bd->globalwinon  = dummy_globalwinon;
+                       bd->txwinon      = dummy_txwinon;
+                       bd->rxwinon      = dummy_rxwinon;
+                       bd->memoff       = dummy_memoff;
+                       bd->assertgwinon = dummy_assertgwinon;
+                       bd->assertmemoff = dummy_assertmemoff;
+                       break;
 
-                                       /* Is is a 256K board */        
-                                       if ((board_id & 0x30) == 0x20) 
-                                               bd->memory_seg = 0xc000;
+               case PCXE:
+               case PCXEVE:
+                       bd->memwinon     = pcxe_memwinon;
+                       bd->memwinoff    = pcxe_memwinoff;
+                       bd->globalwinon  = pcxe_globalwinon;
+                       bd->txwinon      = pcxe_txwinon;
+                       bd->rxwinon      = pcxe_rxwinon;
+                       bd->memoff       = pcxe_memoff;
+                       bd->assertgwinon = dummy_assertgwinon;
+                       bd->assertmemoff = dummy_assertmemoff;
+                       break;
 
-                                       /* Is it a 512K board */
-                                       if ((board_id & 0x30) == 0x30) 
-                                               bd->memory_seg = 0x8000;
+               case PCXI:
+               case PC64XE:
+                       bd->memwinon     = pcxi_memwinon;
+                       bd->memwinoff    = pcxi_memwinoff;
+                       bd->globalwinon  = pcxi_globalwinon;
+                       bd->txwinon      = pcxi_txwinon;
+                       bd->rxwinon      = pcxi_rxwinon;
+                       bd->memoff       = pcxi_memoff;
+                       bd->assertgwinon = pcxi_assertgwinon;
+                       bd->assertmemoff = pcxi_assertmemoff;
+                       break;
 
-                               } else printk(KERN_ERR "epca: Board at 0x%x doesn't appear to be an XI\n",(int)bd->port);
+               default:
                        break;
+               }
 
-               } /* End switch on bd->type */
+               /*
+                * Some cards need a memory segment to be defined for use in
+                * transmit and receive windowing operations. These boards are
+                * listed in the below switch. In the case of the XI the amount
+                * of memory on the board is variable so the memory_seg is also
+                * variable. This code determines what they segment should be.
+                */
+               switch (bd->type) {
+               case PCXE:
+               case PCXEVE:
+               case PC64XE:
+                       bd->memory_seg = 0xf000;
+                       break;
 
-       } /* End for each card */
+               case PCXI:
+                       board_id = inb((int)bd->port);
+                       if ((board_id & 0x1) == 0x1) {
+                               /* it's an XI card */
+                               /* Is it a 64K board */
+                               if ((board_id & 0x30) == 0)
+                                       bd->memory_seg = 0xf000;
+
+                               /* Is it a 128K board */
+                               if ((board_id & 0x30) == 0x10)
+                                       bd->memory_seg = 0xe000;
+
+                               /* Is is a 256K board */
+                               if ((board_id & 0x30) == 0x20)
+                                       bd->memory_seg = 0xc000;
+
+                               /* Is it a 512K board */
+                               if ((board_id & 0x30) == 0x30)
+                                       bd->memory_seg = 0x8000;
+                       } else
+                               printk(KERN_ERR "epca: Board at 0x%x doesn't appear to be an XI\n",(int)bd->port);
+                       break;
+               }
+       }
 
        err = tty_register_driver(pc_driver);
        if (err) {
@@ -1383,10 +1269,7 @@ static int __init pc_init(void)
                goto out4;
        }
 
-       /* -------------------------------------------------------------------
-          Start up the poller to check for events on all enabled boards
-       ---------------------------------------------------------------------- */
-
+       /* Start up the poller to check for events on all enabled boards */
        init_timer(&epca_timer);
        epca_timer.function = epcapoll;
        mod_timer(&epca_timer, jiffies + HZ/25);
@@ -1400,51 +1283,47 @@ out2:
        put_tty_driver(pc_driver);
 out1:
        return err;
-
-} /* End pc_init */
-
-/* ------------------ Begin post_fep_init  ---------------------- */
+}
 
 static void post_fep_init(unsigned int crd)
-{ /* Begin post_fep_init */
-
+{
        int i;
        void __iomem *memaddr;
        struct global_data __iomem *gd;
        struct board_info *bd;
        struct board_chan __iomem *bc;
-       struct channel *ch; 
-       int shrinkmem = 0, lowwater ; 
-       /*  -------------------------------------------------------------
-               This call is made by the user via. the ioctl call DIGI_INIT.
-               It is responsible for setting up all the card specific stuff.
-       ---------------------------------------------------------------- */
-       bd = &boards[crd];
+       struct channel *ch;
+       int shrinkmem = 0, lowwater;
 
-       /* -----------------------------------------------------------------
-               If this is a PCI board, get the port info.  Remember PCI cards
-               do not have entries into the epcaconfig.h file, so we can't get 
-               the number of ports from it.  Unfortunetly, this means that anyone
-               doing a DIGI_GETINFO before the board has booted will get an invalid
-               number of ports returned (It should return 0).  Calls to DIGI_GETINFO
-               after DIGI_INIT has been called will return the proper values. 
-       ------------------------------------------------------------------- */
+       /*
+        * This call is made by the user via. the ioctl call DIGI_INIT. It is
+        * responsible for setting up all the card specific stuff.
+        */
+       bd = &boards[crd];
 
+       /*
+        * If this is a PCI board, get the port info. Remember PCI cards do not
+        * have entries into the epcaconfig.h file, so we can't get the number
+        * of ports from it. Unfortunetly, this means that anyone doing a
+        * DIGI_GETINFO before the board has booted will get an invalid number
+        * of ports returned (It should return 0). Calls to DIGI_GETINFO after
+        * DIGI_INIT has been called will return the proper values.
+        */
        if (bd->type >= PCIXEM) { /* Begin get PCI number of ports */
-               /* --------------------------------------------------------------------
-                       Below we use XEMPORTS as a memory offset regardless of which PCI
-                       card it is.  This is because all of the supported PCI cards have
-                       the same memory offset for the channel data.  This will have to be
-                       changed if we ever develop a PCI/XE card.  NOTE : The FEP manual
-                       states that the port offset is 0xC22 as opposed to 0xC02.  This is
-                       only true for PC/XE, and PC/XI cards; not for the XEM, or CX series.
-                       On the PCI cards the number of ports is determined by reading a 
-                       ID PROM located in the box attached to the card.  The card can then
-                       determine the index the id to determine the number of ports available.
-                       (FYI - The id should be located at 0x1ac (And may use up to 4 bytes
-                       if the box in question is a XEM or CX)).  
-               ------------------------------------------------------------------------ */ 
+               /*
+                * Below we use XEMPORTS as a memory offset regardless of which
+                * PCI card it is. This is because all of the supported PCI
+                * cards have the same memory offset for the channel data. This
+                * will have to be changed if we ever develop a PCI/XE card.
+                * NOTE : The FEP manual states that the port offset is 0xC22
+                * as opposed to 0xC02. This is only true for PC/XE, and PC/XI
+                * cards; not for the XEM, or CX series. On the PCI cards the
+                * number of ports is determined by reading a ID PROM located
+                * in the box attached to the card. The card can then determine
+                * the index the id to determine the number of ports available.
+                * (FYI - The id should be located at 0x1ac (And may use up to
+                * 4 bytes if the box in question is a XEM or CX)).
+                */
                /* PCI cards are already remapped at this point ISA are not */
                bd->numports = readw(bd->re_map_membase + XEMPORTS);
                epcaassert(bd->numports <= 64,"PCI returned a invalid number of ports");
@@ -1465,95 +1344,87 @@ static void post_fep_init(unsigned int crd)
 
        memaddr = bd->re_map_membase;
 
-       /* -----------------------------------------------------------------
-               The below assignment will set bc to point at the BEGINING of
-               the cards channel structures.  For 1 card there will be between
-               8 and 64 of these structures.
-       -------------------------------------------------------------------- */
-
+       /*
+        * The below assignment will set bc to point at the BEGINING of the
+        * cards channel structures. For 1 card there will be between 8 and 64
+        * of these structures.
+        */
        bc = memaddr + CHANSTRUCT;
 
-       /* -------------------------------------------------------------------
-               The below assignment will set gd to point at the BEGINING of
-               global memory address 0xc00.  The first data in that global
-               memory actually starts at address 0xc1a.  The command in 
-               pointer begins at 0xd10.
-       ---------------------------------------------------------------------- */
-
+       /*
+        * The below assignment will set gd to point at the BEGINING of global
+        * memory address 0xc00. The first data in that global memory actually
+        * starts at address 0xc1a. The command in pointer begins at 0xd10.
+        */
        gd = memaddr + GLOBAL;
 
-       /* --------------------------------------------------------------------
-               XEPORTS (address 0xc22) points at the number of channels the
-               card supports. (For 64XE, XI, XEM, and XR use 0xc02)
-       ----------------------------------------------------------------------- */
-
+       /*
+        * XEPORTS (address 0xc22) points at the number of channels the card
+        * supports. (For 64XE, XI, XEM, and XR use 0xc02)
+        */
        if ((bd->type == PCXEVE || bd->type == PCXE) && (readw(memaddr + XEPORTS) < 3))
                shrinkmem = 1;
        if (bd->type < PCIXEM)
                if (!request_region((int)bd->port, 4, board_desc[bd->type]))
-                       return;         
+                       return;
        memwinon(bd, 0);
 
-       /*  --------------------------------------------------------------------
-               Remember ch is the main drivers channels structure, while bc is 
-          the cards channel structure.
-       ------------------------------------------------------------------------ */
-
-       /* For every port on the card do ..... */
-
-       for (i = 0; i < bd->numports; i++, ch++, bc++)  { /* Begin for each port */
+       /*
+        * Remember ch is the main drivers channels structure, while bc is the
+        * cards channel structure.
+        */
+       for (i = 0; i < bd->numports; i++, ch++, bc++) {
                unsigned long flags;
                u16 tseg, rseg;
 
-               ch->brdchan        = bc;
-               ch->mailbox        = gd; 
+               ch->brdchan = bc;
+               ch->mailbox = gd;
                INIT_WORK(&ch->tqueue, do_softint);
-               ch->board          = &boards[crd];
+               ch->board = &boards[crd];
 
                spin_lock_irqsave(&epca_lock, flags);
                switch (bd->type) {
-                       /* ----------------------------------------------------------------
-                               Since some of the boards use different bitmaps for their
-                               control signals we cannot hard code these values and retain
-                               portability.  We virtualize this data here.
-                       ------------------------------------------------------------------- */
-                       case EISAXEM:
-                       case PCXEM:
-                       case PCIXEM:
-                       case PCIXRJ:
-                       case PCIXR:
-                               ch->m_rts = 0x02 ;
-                               ch->m_dcd = 0x80 ; 
-                               ch->m_dsr = 0x20 ;
-                               ch->m_cts = 0x10 ;
-                               ch->m_ri  = 0x40 ;
-                               ch->m_dtr = 0x01 ;
-                               break;
-
-                       case PCXE:
-                       case PCXEVE:
-                       case PCXI:
-                       case PC64XE:
-                               ch->m_rts = 0x02 ;
-                               ch->m_dcd = 0x08 ; 
-                               ch->m_dsr = 0x10 ;
-                               ch->m_cts = 0x20 ;
-                               ch->m_ri  = 0x40 ;
-                               ch->m_dtr = 0x80 ;
-                               break;
-       
-               } /* End switch bd->type */
+               /*
+                * Since some of the boards use different bitmaps for
+                * their control signals we cannot hard code these
+                * values and retain portability. We virtualize this
+                * data here.
+                */
+               case EISAXEM:
+               case PCXEM:
+               case PCIXEM:
+               case PCIXRJ:
+               case PCIXR:
+                       ch->m_rts = 0x02;
+                       ch->m_dcd = 0x80;
+                       ch->m_dsr = 0x20;
+                       ch->m_cts = 0x10;
+                       ch->m_ri  = 0x40;
+                       ch->m_dtr = 0x01;
+                       break;
+
+               case PCXE:
+               case PCXEVE:
+               case PCXI:
+               case PC64XE:
+                       ch->m_rts = 0x02;
+                       ch->m_dcd = 0x08;
+                       ch->m_dsr = 0x10;
+                       ch->m_cts = 0x20;
+                       ch->m_ri  = 0x40;
+                       ch->m_dtr = 0x80;
+                       break;
+               }
 
                if (boards[crd].altpin) {
                        ch->dsr = ch->m_dcd;
                        ch->dcd = ch->m_dsr;
                        ch->digiext.digi_flags |= DIGI_ALTPIN;
-               }
-               else {
+               } else {
                        ch->dcd = ch->m_dcd;
                        ch->dsr = ch->m_dsr;
                }
-       
+
                ch->boardnum   = crd;
                ch->channelnum = i;
                ch->magic      = EPCA_MAGIC;
@@ -1568,71 +1439,67 @@ static void post_fep_init(unsigned int crd)
                rseg = readw(&bc->rseg);
 
                switch (bd->type) {
+               case PCIXEM:
+               case PCIXRJ:
+               case PCIXR:
+                       /* Cover all the 2MEG cards */
+                       ch->txptr = memaddr + ((tseg << 4) & 0x1fffff);
+                       ch->rxptr = memaddr + ((rseg << 4) & 0x1fffff);
+                       ch->txwin = FEPWIN | (tseg >> 11);
+                       ch->rxwin = FEPWIN | (rseg >> 11);
+                       break;
+
+               case PCXEM:
+               case EISAXEM:
+                       /* Cover all the 32K windowed cards */
+                       /* Mask equal to window size - 1 */
+                       ch->txptr = memaddr + ((tseg << 4) & 0x7fff);
+                       ch->rxptr = memaddr + ((rseg << 4) & 0x7fff);
+                       ch->txwin = FEPWIN | (tseg >> 11);
+                       ch->rxwin = FEPWIN | (rseg >> 11);
+                       break;
 
-                       case PCIXEM:
-                       case PCIXRJ:
-                       case PCIXR:
-                               /* Cover all the 2MEG cards */
-                               ch->txptr = memaddr + ((tseg << 4) & 0x1fffff);
-                               ch->rxptr = memaddr + ((rseg << 4) & 0x1fffff);
-                               ch->txwin = FEPWIN | (tseg >> 11);
-                               ch->rxwin = FEPWIN | (rseg >> 11);
-                               break;
-
-                       case PCXEM:
-                       case EISAXEM:
-                               /* Cover all the 32K windowed cards */
-                               /* Mask equal to window size - 1 */
-                               ch->txptr = memaddr + ((tseg << 4) & 0x7fff);
-                               ch->rxptr = memaddr + ((rseg << 4) & 0x7fff);
-                               ch->txwin = FEPWIN | (tseg >> 11);
-                               ch->rxwin = FEPWIN | (rseg >> 11);
-                               break;
-
-                       case PCXEVE:
-                       case PCXE:
-                               ch->txptr = memaddr + (((tseg - bd->memory_seg) << 4) & 0x1fff);
-                               ch->txwin = FEPWIN | ((tseg - bd->memory_seg) >> 9);
-                               ch->rxptr = memaddr + (((rseg - bd->memory_seg) << 4) & 0x1fff);
-                               ch->rxwin = FEPWIN | ((rseg - bd->memory_seg) >>9 );
-                               break;
-
-                       case PCXI:
-                       case PC64XE:
-                               ch->txptr = memaddr + ((tseg - bd->memory_seg) << 4);
-                               ch->rxptr = memaddr + ((rseg - bd->memory_seg) << 4);
-                               ch->txwin = ch->rxwin = 0;
-                               break;
-
-               } /* End switch bd->type */
+               case PCXEVE:
+               case PCXE:
+                       ch->txptr = memaddr + (((tseg - bd->memory_seg) << 4) & 0x1fff);
+                       ch->txwin = FEPWIN | ((tseg - bd->memory_seg) >> 9);
+                       ch->rxptr = memaddr + (((rseg - bd->memory_seg) << 4) & 0x1fff);
+                       ch->rxwin = FEPWIN | ((rseg - bd->memory_seg) >>9 );
+                       break;
+
+               case PCXI:
+               case PC64XE:
+                       ch->txptr = memaddr + ((tseg - bd->memory_seg) << 4);
+                       ch->rxptr = memaddr + ((rseg - bd->memory_seg) << 4);
+                       ch->txwin = ch->rxwin = 0;
+                       break;
+               }
 
                ch->txbufhead = 0;
                ch->txbufsize = readw(&bc->tmax) + 1;
-       
+
                ch->rxbufhead = 0;
                ch->rxbufsize = readw(&bc->rmax) + 1;
-       
+
                lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2);
 
                /* Set transmitter low water mark */
                fepcmd(ch, STXLWATER, lowwater, 0, 10, 0);
 
                /* Set receiver low water mark */
-
                fepcmd(ch, SRXLWATER, (ch->rxbufsize / 4), 0, 10, 0);
 
                /* Set receiver high water mark */
-
                fepcmd(ch, SRXHWATER, (3 * ch->rxbufsize / 4), 0, 10, 0);
 
                writew(100, &bc->edelay);
                writeb(1, &bc->idata);
-       
+
                ch->startc  = readb(&bc->startc);
                ch->stopc   = readb(&bc->stopc);
                ch->startca = readb(&bc->startca);
                ch->stopca  = readb(&bc->stopca);
-       
+
                ch->fepcflag = 0;
                ch->fepiflag = 0;
                ch->fepoflag = 0;
@@ -1640,7 +1507,7 @@ static void post_fep_init(unsigned int crd)
                ch->fepstopc = 0;
                ch->fepstartca = 0;
                ch->fepstopca = 0;
-       
+
                ch->close_delay = 50;
                ch->count = 0;
                ch->blocked_open = 0;
@@ -1648,80 +1515,66 @@ static void post_fep_init(unsigned int crd)
                init_waitqueue_head(&ch->close_wait);
 
                spin_unlock_irqrestore(&epca_lock, flags);
-       } /* End for each port */
+       }
 
-       printk(KERN_INFO 
-               "Digi PC/Xx Driver V%s:  %s I/O = 0x%lx Mem = 0x%lx Ports = %d\n", 
+       printk(KERN_INFO
+               "Digi PC/Xx Driver V%s:  %s I/O = 0x%lx Mem = 0x%lx Ports = %d\n",
                VERSION, board_desc[bd->type], (long)bd->port, (long)bd->membase, bd->numports);
        memwinoff(bd, 0);
-
-} /* End post_fep_init */
-
-/* --------------------- Begin epcapoll  ------------------------ */
+}
 
 static void epcapoll(unsigned long ignored)
-{ /* Begin epcapoll */
-
+{
        unsigned long flags;
        int crd;
        volatile unsigned int head, tail;
        struct channel *ch;
        struct board_info *bd;
 
-       /* -------------------------------------------------------------------
-               This routine is called upon every timer interrupt.  Even though
-               the Digi series cards are capable of generating interrupts this 
-               method of non-looping polling is more efficient.  This routine
-               checks for card generated events (Such as receive data, are transmit
-               buffer empty) and acts on those events.
-       ----------------------------------------------------------------------- */
-       
-       for (crd = 0; crd < num_cards; crd++) 
-       { /* Begin for each card */
-
+       /*
+        * This routine is called upon every timer interrupt. Even though the
+        * Digi series cards are capable of generating interrupts this method
+        * of non-looping polling is more efficient. This routine checks for
+        * card generated events (Such as receive data, are transmit buffer
+        * empty) and acts on those events.
+        */
+       for (crd = 0; crd < num_cards; crd++) {
                bd = &boards[crd];
                ch = card_ptr[crd];
 
                if ((bd->status == DISABLED) || digi_poller_inhibited)
-                       continue; /* Begin loop next interation */
-
-               /* -----------------------------------------------------------
-                       assertmemoff is not needed here; indeed it is an empty subroutine.
-                       It is being kept because future boards may need this as well as
-                       some legacy boards.
-               ---------------------------------------------------------------- */
+                       continue;
 
+               /*
+                * assertmemoff is not needed here; indeed it is an empty
+                * subroutine. It is being kept because future boards may need
+                * this as well as some legacy boards.
+                */
                spin_lock_irqsave(&epca_lock, flags);
 
                assertmemoff(ch);
 
                globalwinon(ch);
 
-               /* ---------------------------------------------------------------
-                       In this case head and tail actually refer to the event queue not
-                       the transmit or receive queue.
-               ------------------------------------------------------------------- */
-
+               /*
+                * In this case head and tail actually refer to the event queue
+                * not the transmit or receive queue.
+                */
                head = readw(&ch->mailbox->ein);
                tail = readw(&ch->mailbox->eout);
-               
-               /* If head isn't equal to tail we have an event */
 
+               /* If head isn't equal to tail we have an event */
                if (head != tail)
                        doevent(crd);
                memoff(ch);
 
                spin_unlock_irqrestore(&epca_lock, flags);
-
        } /* End for each card */
        mod_timer(&epca_timer, jiffies + (HZ / 25));
-} /* End epcapoll */
-
-/* --------------------- Begin doevent  ------------------------ */
+}
 
 static void doevent(int crd)
-{ /* Begin doevent */
-
+{
        void __iomem *eventbuf;
        struct channel *ch, *chan0;
        static struct tty_struct *tty;
@@ -1731,28 +1584,28 @@ static void doevent(int crd)
        int event, channel;
        int mstat, lstat;
 
-       /* -------------------------------------------------------------------
-               This subroutine is called by epcapoll when an event is detected 
-               in the event queue.  This routine responds to those events.
-       --------------------------------------------------------------------- */
+       /*
+        * This subroutine is called by epcapoll when an event is detected
+        * in the event queue. This routine responds to those events.
+        */
        bd = &boards[crd];
 
        chan0 = card_ptr[crd];
        epcaassert(chan0 <= &digi_channels[nbdevs - 1], "ch out of range");
        assertgwinon(chan0);
-       while ((tail = readw(&chan0->mailbox->eout)) != (head = readw(&chan0->mailbox->ein)))
-       { /* Begin while something in event queue */
+       while ((tail = readw(&chan0->mailbox->eout)) != (head = readw(&chan0->mailbox->ein))) { /* Begin while something in event queue */
                assertgwinon(chan0);
                eventbuf = bd->re_map_membase + tail + ISTART;
                /* Get the channel the event occurred on */
                channel = readb(eventbuf);
                /* Get the actual event code that occurred */
                event = readb(eventbuf + 1);
-               /*  ----------------------------------------------------------------
-                       The two assignments below get the current modem status (mstat)
-                       and the previous modem status (lstat).  These are useful becuase
-                       an event could signal a change in modem signals itself.
-               ------------------------------------------------------------------- */
+               /*
+                * The two assignments below get the current modem status
+                * (mstat) and the previous modem status (lstat). These are
+                * useful becuase an event could signal a change in modem
+                * signals itself.
+                */
                mstat = readb(eventbuf + 2);
                lstat = readb(eventbuf + 3);
 
@@ -1772,37 +1625,36 @@ static void doevent(int crd)
                        assertgwinon(ch);
                } /* End DATA_IND */
                /* else *//* Fix for DCD transition missed bug */
-               if (event & MODEMCHG_IND)  { /* Begin MODEMCHG_IND */
+               if (event & MODEMCHG_IND) {
                        /* A modem signal change has been indicated */
                        ch->imodem = mstat;
-                       if (ch->asyncflags & ASYNC_CHECK_CD)  {
+                       if (ch->asyncflags & ASYNC_CHECK_CD) {
                                if (mstat & ch->dcd)  /* We are now receiving dcd */
                                        wake_up_interruptible(&ch->open_wait);
                                else
                                        pc_sched_event(ch, EPCA_EVENT_HANGUP); /* No dcd; hangup */
                        }
-               } /* End MODEMCHG_IND */
+               }
                tty = ch->tty;
-               if (tty)  { /* Begin if valid tty */
-                       if (event & BREAK_IND)  { /* Begin if BREAK_IND */
+               if (tty) {
+                       if (event & BREAK_IND) {
                                /* A break has been indicated */
                                tty_insert_flip_char(tty, 0, TTY_BREAK);
-                               tty_schedule_flip(tty); 
-                       } else if (event & LOWTX_IND)  { /* Begin LOWTX_IND */
-                               if (ch->statusflags & LOWWAIT) 
-                               { /* Begin if LOWWAIT */
+                               tty_schedule_flip(tty);
+                       } else if (event & LOWTX_IND)  {
+                               if (ch->statusflags & LOWWAIT) {
                                        ch->statusflags &= ~LOWWAIT;
                                        tty_wakeup(tty);
-                               } /* End if LOWWAIT */
-                       } else if (event & EMPTYTX_IND)  { /* Begin EMPTYTX_IND */
+                               }
+                       } else if (event & EMPTYTX_IND) {
                                /* This event is generated by setup_empty_event */
                                ch->statusflags &= ~TXBUSY;
-                               if (ch->statusflags & EMPTYWAIT)  { /* Begin if EMPTYWAIT */
+                               if (ch->statusflags & EMPTYWAIT) {
                                        ch->statusflags &= ~EMPTYWAIT;
                                        tty_wakeup(tty);
-                               } /* End if EMPTYWAIT */
-                       } /* End EMPTYTX_IND */
-               } /* End if valid tty */
+                               }
+                       }
+               }
        next:
                globalwinon(ch);
                BUG_ON(!bc);
@@ -1810,13 +1662,11 @@ static void doevent(int crd)
                writew((tail + 4) & (IMAX - ISTART - 4), &chan0->mailbox->eout);
                globalwinon(chan0);
        } /* End while something in event queue */
-} /* End doevent */
-
-/* --------------------- Begin fepcmd  ------------------------ */
+}
 
 static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
                    int byte2, int ncmds, int bytecmd)
-{ /* Begin fepcmd */
+{
        unchar __iomem *memaddr;
        unsigned int head, cmdTail, cmdStart, cmdMax;
        long count;
@@ -1831,11 +1681,11 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
        head = readw(&ch->mailbox->cin);
        /* cmdStart is a base address */
        cmdStart = readw(&ch->mailbox->cstart);
-       /* ------------------------------------------------------------------
-               We do the addition below because we do not want a max pointer 
-               relative to cmdStart.  We want a max pointer that points at the 
-               physical end of the command queue.
-       -------------------------------------------------------------------- */
+       /*
+        * We do the addition below because we do not want a max pointer
+        * relative to cmdStart. We want a max pointer that points at the
+        * physical end of the command queue.
+        */
        cmdMax = (cmdStart + 4 + readw(&ch->mailbox->cmax));
        memaddr = ch->board->re_map_membase;
 
@@ -1860,7 +1710,7 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
        writew(head, &ch->mailbox->cin);
        count = FEPTIMEOUT;
 
-       for (;;)  { /* Begin forever loop */
+       for (;;) {
                count--;
                if (count == 0)  {
                        printk(KERN_ERR "<Error> - Fep not responding in fepcmd()\n");
@@ -1869,26 +1719,23 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
                head = readw(&ch->mailbox->cin);
                cmdTail = readw(&ch->mailbox->cout);
                n = (head - cmdTail) & (cmdMax - cmdStart - 4);
-               /* ----------------------------------------------------------
-                       Basically this will break when the FEP acknowledges the 
-                       command by incrementing cmdTail (Making it equal to head).
-               ------------------------------------------------------------- */
+               /*
+                * Basically this will break when the FEP acknowledges the
+                * command by incrementing cmdTail (Making it equal to head).
+                */
                if (n <= ncmds * (sizeof(short) * 4))
-                       break; /* Well nearly forever :-) */
-       } /* End forever loop */
-} /* End fepcmd */
-
-/* ---------------------------------------------------------------------
-       Digi products use fields in their channels structures that are very
-       similar to the c_cflag and c_iflag fields typically found in UNIX
-       termios structures.  The below three routines allow mappings 
-       between these hardware "flags" and their respective Linux flags.
-------------------------------------------------------------------------- */
-/* --------------------- Begin termios2digi_h -------------------- */
+                       break;
+       }
+}
 
+/*
+ * Digi products use fields in their channels structures that are very similar
+ * to the c_cflag and c_iflag fields typically found in UNIX termios
+ * structures. The below three routines allow mappings between these hardware
+ * "flags" and their respective Linux flags.
+ */
 static unsigned termios2digi_h(struct channel *ch, unsigned cflag)
-{ /* Begin termios2digi_h */
+{
        unsigned res = 0;
 
        if (cflag & CRTSCTS) {
@@ -1918,86 +1765,73 @@ static unsigned termios2digi_h(struct channel *ch, unsigned cflag)
                ch->digiext.digi_flags |= CTSPACE;
 
        return res;
+}
 
-} /* End termios2digi_h */
-
-/* --------------------- Begin termios2digi_i -------------------- */
 static unsigned termios2digi_i(struct channel *ch, unsigned iflag)
-{ /* Begin termios2digi_i */
-
-       unsigned res = iflag & (IGNBRK | BRKINT | IGNPAR | PARMRK | 
+{
+       unsigned res = iflag & (IGNBRK | BRKINT | IGNPAR | PARMRK |
                                INPCK | ISTRIP|IXON|IXANY|IXOFF);
        if (ch->digiext.digi_flags & DIGI_AIXON)
                res |= IAIXON;
        return res;
-
-} /* End termios2digi_i */
-
-/* --------------------- Begin termios2digi_c -------------------- */
+}
 
 static unsigned termios2digi_c(struct channel *ch, unsigned cflag)
-{ /* Begin termios2digi_c */
-
+{
        unsigned res = 0;
-       if (cflag & CBAUDEX) { /* Begin detected CBAUDEX */
+       if (cflag & CBAUDEX) {
                ch->digiext.digi_flags |= DIGI_FAST;
-               /* -------------------------------------------------------------
-                  HUPCL bit is used by FEP to indicate fast baud
-                  table is to be used.
-               ----------------------------------------------------------------- */
+               /*
+                * HUPCL bit is used by FEP to indicate fast baud table is to
+                * be used.
+                */
                res |= FEP_HUPCL;
-       } /* End detected CBAUDEX */
-       else ch->digiext.digi_flags &= ~DIGI_FAST; 
-       /* -------------------------------------------------------------------
-               CBAUD has bit position 0x1000 set these days to indicate Linux
-               baud rate remap.  Digi hardware can't handle the bit assignment.
-               (We use a different bit assignment for high speed.).  Clear this
-               bit out.
-       ---------------------------------------------------------------------- */
+       } else
+               ch->digiext.digi_flags &= ~DIGI_FAST;
+       /*
+        * CBAUD has bit position 0x1000 set these days to indicate Linux
+        * baud rate remap. Digi hardware can't handle the bit assignment.
+        * (We use a different bit assignment for high speed.). Clear this
+        * bit out.
+        */
        res |= cflag & ((CBAUD ^ CBAUDEX) | PARODD | PARENB | CSTOPB | CSIZE);
-       /* -------------------------------------------------------------
-               This gets a little confusing.  The Digi cards have their own
-               representation of c_cflags controling baud rate.  For the most
-               part this is identical to the Linux implementation.  However;
-               Digi supports one rate (76800) that Linux doesn't.  This means 
-               that the c_cflag entry that would normally mean 76800 for Digi
-               actually means 115200 under Linux.  Without the below mapping,
-               a stty 115200 would only drive the board at 76800.  Since 
-               the rate 230400 is also found after 76800, the same problem afflicts    
-               us when we choose a rate of 230400.  Without the below modificiation
-               stty 230400 would actually give us 115200.
-
-               There are two additional differences.  The Linux value for CLOCAL
-               (0x800; 0004000) has no meaning to the Digi hardware.  Also in 
-               later releases of Linux; the CBAUD define has CBAUDEX (0x1000;
-               0010000) ored into it (CBAUD = 0x100f as opposed to 0xf). CBAUDEX
-               should be checked for a screened out prior to termios2digi_c 
-               returning.  Since CLOCAL isn't used by the board this can be
-               ignored as long as the returned value is used only by Digi hardware. 
-               ----------------------------------------------------------------- */
+       /*
+        * This gets a little confusing. The Digi cards have their own
+        * representation of c_cflags controling baud rate. For the most part
+        * this is identical to the Linux implementation. However; Digi
+        * supports one rate (76800) that Linux doesn't. This means that the
+        * c_cflag entry that would normally mean 76800 for Digi actually means
+        * 115200 under Linux. Without the below mapping, a stty 115200 would
+        * only drive the board at 76800. Since the rate 230400 is also found
+        * after 76800, the same problem afflicts us when we choose a rate of
+        * 230400. Without the below modificiation stty 230400 would actually
+        * give us 115200.
+        *
+        * There are two additional differences. The Linux value for CLOCAL
+        * (0x800; 0004000) has no meaning to the Digi hardware. Also in later
+        * releases of Linux; the CBAUD define has CBAUDEX (0x1000; 0010000)
+        * ored into it (CBAUD = 0x100f as opposed to 0xf). CBAUDEX should be
+        * checked for a screened out prior to termios2digi_c returning. Since
+        * CLOCAL isn't used by the board this can be ignored as long as the
+        * returned value is used only by Digi hardware.
+        */
        if (cflag & CBAUDEX) {
-               /* -------------------------------------------------------------
-                       The below code is trying to guarantee that only baud rates
-                       115200 and 230400 are remapped.  We use exclusive or because
-                       the various baud rates share common bit positions and therefore
-                       can't be tested for easily.
-               ----------------------------------------------------------------- */
-
-                               
-               if ((!((cflag & 0x7) ^ (B115200 & ~CBAUDEX))) || 
+               /*
+                * The below code is trying to guarantee that only baud rates
+                * 115200 and 230400 are remapped. We use exclusive or because
+                * the various baud rates share common bit positions and
+                * therefore can't be tested for easily.
+                */
+               if ((!((cflag & 0x7) ^ (B115200 & ~CBAUDEX))) ||
                    (!((cflag & 0x7) ^ (B230400 & ~CBAUDEX))))
                        res += 1;
        }
        return res;
-
-} /* End termios2digi_c */
-
-/* --------------------- Begin epcaparam  ----------------------- */
+}
 
 /* Caller must hold the locks */
 static void epcaparam(struct tty_struct *tty, struct channel *ch)
-{ /* Begin epcaparam */
-
+{
        unsigned int cmdHead;
        struct ktermios *ts;
        struct board_chan __iomem *bc;
@@ -2013,28 +1847,29 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
                writew(cmdHead, &bc->rout);
                cmdHead = readw(&bc->tin);
                /* Changing baud in mid-stream transmission can be wonderful */
-               /* ---------------------------------------------------------------
-                       Flush current transmit buffer by setting cmdTail pointer (tout)
-                       to cmdHead pointer (tin).  Hopefully the transmit buffer is empty.
-               ----------------------------------------------------------------- */
+               /*
+                * Flush current transmit buffer by setting cmdTail pointer
+                * (tout) to cmdHead pointer (tin). Hopefully the transmit
+                * buffer is empty.
+                */
                fepcmd(ch, STOUT, (unsigned) cmdHead, 0, 0, 0);
                mval = 0;
-       } else  { /* Begin CBAUD not detected */
-               /* -------------------------------------------------------------------
-                       c_cflags have changed but that change had nothing to do with BAUD.
-                       Propagate the change to the card.
-               ---------------------------------------------------------------------- */ 
+       } else { /* Begin CBAUD not detected */
+               /*
+                * c_cflags have changed but that change had nothing to do with
+                * BAUD. Propagate the change to the card.
+                */
                cflag = termios2digi_c(ch, ts->c_cflag);
                if (cflag != ch->fepcflag)  {
                        ch->fepcflag = cflag;
                        /* Set baud rate, char size, stop bits, parity */
                        fepcmd(ch, SETCTRLFLAGS, (unsigned) cflag, 0, 0, 0);
                }
-               /* ----------------------------------------------------------------
-                       If the user has not forced CLOCAL and if the device is not a 
-                       CALLOUT device (Which is always CLOCAL) we set flags such that
-                       the driver will wait on carrier detect.
-               ------------------------------------------------------------------- */
+               /*
+                * If the user has not forced CLOCAL and if the device is not a
+                * CALLOUT device (Which is always CLOCAL) we set flags such
+                * that the driver will wait on carrier detect.
+                */
                if (ts->c_cflag & CLOCAL)
                        ch->asyncflags &= ~ASYNC_CHECK_CD;
                else
@@ -2045,19 +1880,19 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
        /* Check input mode flags */
        if (iflag != ch->fepiflag)  {
                ch->fepiflag = iflag;
-               /* ---------------------------------------------------------------
-                       Command sets channels iflag structure on the board. Such things 
-                       as input soft flow control, handling of parity errors, and
-                       break handling are all set here.
-               ------------------------------------------------------------------- */
+               /*
+                * Command sets channels iflag structure on the board. Such
+                * things as input soft flow control, handling of parity
+                * errors, and break handling are all set here.
+                */
                /* break handling, parity handling, input stripping, flow control chars */
                fepcmd(ch, SETIFLAGS, (unsigned int) ch->fepiflag, 0, 0, 0);
        }
-       /* ---------------------------------------------------------------
-               Set the board mint value for this channel.  This will cause hardware
-               events to be generated each time the DCD signal (Described in mint) 
-               changes.        
-       ------------------------------------------------------------------- */
+       /*
+        * Set the board mint value for this channel. This will cause hardware
+        * events to be generated each time the DCD signal (Described in mint)
+        * changes.
+        */
        writeb(ch->dcd, &bc->mint);
        if ((ts->c_cflag & CLOCAL) || (ch->digiext.digi_flags & DIGI_FORCEDCD))
                if (ch->digiext.digi_flags & DIGI_FORCEDCD)
@@ -2066,23 +1901,23 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
        hflow = termios2digi_h(ch, ts->c_cflag);
        if (hflow != ch->hflow)  {
                ch->hflow = hflow;
-               /* --------------------------------------------------------------
-                       Hard flow control has been selected but the board is not
-                       using it.  Activate hard flow control now.
-               ----------------------------------------------------------------- */
+               /*
+                * Hard flow control has been selected but the board is not
+                * using it. Activate hard flow control now.
+                */
                fepcmd(ch, SETHFLOW, hflow, 0xff, 0, 1);
        }
        mval ^= ch->modemfake & (mval ^ ch->modem);
 
        if (ch->omodem ^ mval)  {
                ch->omodem = mval;
-               /* --------------------------------------------------------------
-                       The below command sets the DTR and RTS mstat structure.  If
-                       hard flow control is NOT active these changes will drive the
-                       output of the actual DTR and RTS lines.  If hard flow control 
-                       is active, the changes will be saved in the mstat structure and
-                       only asserted when hard flow control is turned off. 
-               ----------------------------------------------------------------- */
+               /*
+                * The below command sets the DTR and RTS mstat structure. If
+                * hard flow control is NOT active these changes will drive the
+                * output of the actual DTR and RTS lines. If hard flow control
+                * is active, the changes will be saved in the mstat structure
+                * and only asserted when hard flow control is turned off.
+                */
 
                /* First reset DTR & RTS; then set them */
                fepcmd(ch, SETMODEM, 0, ((ch->m_dtr)|(ch->m_rts)), 0, 1);
@@ -2091,28 +1926,26 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
        if (ch->startc != ch->fepstartc || ch->stopc != ch->fepstopc)  {
                ch->fepstartc = ch->startc;
                ch->fepstopc = ch->stopc;
-               /* ------------------------------------------------------------
-                       The XON / XOFF characters have changed; propagate these
-                       changes to the card.    
-               --------------------------------------------------------------- */
+               /*
+                * The XON / XOFF characters have changed; propagate these
+                * changes to the card.
+                */
                fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1);
        }
        if (ch->startca != ch->fepstartca || ch->stopca != ch->fepstopca)  {
                ch->fepstartca = ch->startca;
                ch->fepstopca = ch->stopca;
-               /* ---------------------------------------------------------------
-                       Similar to the above, this time the auxilarly XON / XOFF 
-                       characters have changed; propagate these changes to the card.
-               ------------------------------------------------------------------ */
+               /*
+                * Similar to the above, this time the auxilarly XON / XOFF
+                * characters have changed; propagate these changes to the card.
+                */
                fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1);
        }
-} /* End epcaparam */
+}
 
-/* --------------------- Begin receive_data  ----------------------- */
 /* Caller holds lock */
 static void receive_data(struct channel *ch)
-{ /* Begin receive_data */
-
+{
        unchar *rptr;
        struct ktermios *ts = NULL;
        struct tty_struct *tty;
@@ -2121,11 +1954,10 @@ static void receive_data(struct channel *ch)
        unsigned int tail, head;
        unsigned int wrapmask;
 
-       /* ---------------------------------------------------------------
-               This routine is called by doint when a receive data event 
-               has taken place.
-       ------------------------------------------------------------------- */
-
+       /*
+        * This routine is called by doint when a receive data event has taken
+        * place.
+        */
        globalwinon(ch);
        if (ch->statusflags & RXSTOPPED)
                return;
@@ -2136,10 +1968,10 @@ static void receive_data(struct channel *ch)
        BUG_ON(!bc);
        wrapmask = ch->rxbufsize - 1;
 
-       /* --------------------------------------------------------------------- 
-               Get the head and tail pointers to the receiver queue.  Wrap the 
-               head pointer if it has reached the end of the buffer.
-       ------------------------------------------------------------------------ */
+       /*
+        * Get the head and tail pointers to the receiver queue. Wrap the head
+        * pointer if it has reached the end of the buffer.
+        */
        head = readw(&bc->rin);
        head &= wrapmask;
        tail = readw(&bc->rout) & wrapmask;
@@ -2148,10 +1980,7 @@ static void receive_data(struct channel *ch)
        if (bytesAvailable == 0)
                return;
 
-       /* ------------------------------------------------------------------
-          If CREAD bit is off or device not open, set TX tail to head
-       --------------------------------------------------------------------- */
-
+       /* If CREAD bit is off or device not open, set TX tail to head */
        if (!tty || !ts || !(ts->c_cflag & CREAD))  {
                writew(head, &bc->rout);
                return;
@@ -2168,22 +1997,20 @@ static void receive_data(struct channel *ch)
        rxwinon(ch);
        while (bytesAvailable > 0)  { /* Begin while there is data on the card */
                wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail;
-               /* ---------------------------------------------------------------
-                       Even if head has wrapped around only report the amount of
-                       data to be equal to the size - tail.  Remember memcpy can't
-                       automaticly wrap around the receive buffer.
-               ----------------------------------------------------------------- */
+               /*
+                * Even if head has wrapped around only report the amount of
+                * data to be equal to the size - tail. Remember memcpy can't
+                * automaticly wrap around the receive buffer.
+                */
                dataToRead = (wrapgap < bytesAvailable) ? wrapgap : bytesAvailable;
-               /* --------------------------------------------------------------
-                  Make sure we don't overflow the buffer
-               ----------------------------------------------------------------- */
+               /* Make sure we don't overflow the buffer */
                dataToRead = tty_prepare_flip_string(tty, &rptr, dataToRead);
                if (dataToRead == 0)
                        break;
-               /* ---------------------------------------------------------------
-                       Move data read from our card into the line disciplines buffer
-                       for translation if necessary.
-               ------------------------------------------------------------------ */
+               /*
+                * Move data read from our card into the line disciplines
+                * buffer for translation if necessary.
+                */
                memcpy_fromio(rptr, ch->rxptr + tail, dataToRead);
                tail = (tail + dataToRead) & wrapmask;
                bytesAvailable -= dataToRead;
@@ -2191,28 +2018,26 @@ static void receive_data(struct channel *ch)
        globalwinon(ch);
        writew(tail, &bc->rout);
        /* Must be called with global data */
-       tty_schedule_flip(ch->tty); 
-       return;
-} /* End receive_data */
+       tty_schedule_flip(ch->tty);
+}
 
-static int info_ioctl(struct tty_struct *tty, struct file * file,
+static int info_ioctl(struct tty_struct *tty, struct file *file,
                    unsigned int cmd, unsigned long arg)
 {
-       switch (cmd) 
-       { /* Begin switch cmd */
-               case DIGI_GETINFO:
-               { /* Begin case DIGI_GETINFO */
-                       struct digi_info di ;
+       switch (cmd) {
+       case DIGI_GETINFO:
+               {
+                       struct digi_info di;
                        int brd;
 
-                       if(get_user(brd, (unsigned int __user *)arg))
+                       if (get_user(brd, (unsigned int __user *)arg))
                                return -EFAULT;
                        if (brd < 0 || brd >= num_cards || num_cards == 0)
                                return -ENODEV;
 
                        memset(&di, 0, sizeof(di));
 
-                       di.board = brd ; 
+                       di.board = brd;
                        di.status = boards[brd].status;
                        di.type = boards[brd].type ;
                        di.numports = boards[brd].numports ;
@@ -2220,45 +2045,44 @@ static int info_ioctl(struct tty_struct *tty, struct file * file,
                        di.port = (unsigned char *)boards[brd].port ;
                        di.membase = (unsigned char *)boards[brd].membase ;
 
-                       if (copy_to_user((void __user *)arg, &di, sizeof (di)))
+                       if (copy_to_user((void __user *)arg, &di, sizeof(di)))
                                return -EFAULT;
                        break;
 
-               } /* End case DIGI_GETINFO */
-
-               case DIGI_POLLER:
-               { /* Begin case DIGI_POLLER */
+               }
 
-                       int brd = arg & 0xff000000 >> 16 ; 
-                       unsigned char state = arg & 0xff ; 
+       case DIGI_POLLER:
+               {
+                       int brd = arg & 0xff000000 >> 16;
+                       unsigned char state = arg & 0xff;
 
                        if (brd < 0 || brd >= num_cards) {
                                printk(KERN_ERR "epca: DIGI POLLER : brd not valid!\n");
-                               return (-ENODEV);
+                               return -ENODEV;
                        }
-                       digi_poller_inhibited = state ;
-                       break ; 
-               } /* End case DIGI_POLLER */
-
-               case DIGI_INIT:
-               { /* Begin case DIGI_INIT */
-                       /* ------------------------------------------------------------
-                               This call is made by the apps to complete the initilization
-                               of the board(s).  This routine is responsible for setting
-                               the card to its initial state and setting the drivers control
-                               fields to the sutianle settings for the card in question.
-                       ---------------------------------------------------------------- */
-                       int crd ; 
-                       for (crd = 0; crd < num_cards; crd++) 
-                               post_fep_init (crd);
-                       break ; 
-               } /* End case DIGI_INIT */
-               default:
-                       return -ENOTTY;
-       } /* End switch cmd */
-       return (0) ;
+                       digi_poller_inhibited = state;
+                       break;
+               }
+
+       case DIGI_INIT:
+               {
+                       /*
+                        * This call is made by the apps to complete the
+                        * initilization of the board(s). This routine is
+                        * responsible for setting the card to its initial
+                        * state and setting the drivers control fields to the
+                        * sutianle settings for the card in question.
+                        */
+                       int crd;
+                       for (crd = 0; crd < num_cards; crd++)
+                               post_fep_init(crd);
+                       break;
+               }
+       default:
+               return -ENOTTY;
+       }
+       return 0;
 }
-/* --------------------- Begin pc_ioctl  ----------------------- */
 
 static int pc_tiocmget(struct tty_struct *tty, struct file *file)
 {
@@ -2304,9 +2128,9 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file,
 
        spin_lock_irqsave(&epca_lock, flags);
        /*
-        * I think this modemfake stuff is broken.  It doesn't
-        * correctly reflect the behaviour desired by the TIOCM*
-        * ioctls.  Therefore this is probably broken.
+        * I think this modemfake stuff is broken. It doesn't correctly reflect
+        * the behaviour desired by the TIOCM* ioctls. Therefore this is
+        * probably broken.
         */
        if (set & TIOCM_RTS) {
                ch->modemfake |= ch->m_rts;
@@ -2325,10 +2149,10 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file,
                ch->modem &= ~ch->m_dtr;
        }
        globalwinon(ch);
-       /*  --------------------------------------------------------------
-               The below routine generally sets up parity, baud, flow control
-               issues, etc.... It effect both control flags and input flags.
-       ------------------------------------------------------------------ */
+       /*
+        * The below routine generally sets up parity, baud, flow control
+        * issues, etc.... It effect both control flags and input flags.
+        */
        epcaparam(tty,ch);
        memoff(ch);
        spin_unlock_irqrestore(&epca_lock, flags);
@@ -2337,8 +2161,7 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file,
 
 static int pc_ioctl(struct tty_struct *tty, struct file * file,
                    unsigned int cmd, unsigned long arg)
-{ /* Begin pc_ioctl */
-
+{
        digiflow_t dflow;
        int retval;
        unsigned long flags;
@@ -2347,49 +2170,47 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,
        struct board_chan __iomem *bc;
        struct channel *ch = (struct channel *) tty->driver_data;
        void __user *argp = (void __user *)arg;
-       
+
        if (ch)
                bc = ch->brdchan;
-       else 
+       else
                return -EINVAL;
 
-       /* -------------------------------------------------------------------
-               For POSIX compliance we need to add more ioctls.  See tty_ioctl.c
-               in /usr/src/linux/drivers/char for a good example.  In particular 
-               think about adding TCSETAF, TCSETAW, TCSETA, TCSETSF, TCSETSW, TCSETS.
-       ---------------------------------------------------------------------- */
-
-       switch (cmd) 
-       { /* Begin switch cmd */
-               case TCSBRK:    /* SVID version: non-zero arg --> no break */
-                       retval = tty_check_change(tty);
-                       if (retval)
-                               return retval;
-                       /* Setup an event to indicate when the transmit buffer empties */
-                       spin_lock_irqsave(&epca_lock, flags);
-                       setup_empty_event(tty,ch);              
-                       spin_unlock_irqrestore(&epca_lock, flags);
-                       tty_wait_until_sent(tty, 0);
-                       if (!arg)
-                               digi_send_break(ch, HZ/4);    /* 1/4 second */
-                       return 0;
-               case TCSBRKP:   /* support for POSIX tcsendbreak() */
-                       retval = tty_check_change(tty);
-                       if (retval)
-                               return retval;
+       /*
+        * For POSIX compliance we need to add more ioctls. See tty_ioctl.c in
+        * /usr/src/linux/drivers/char for a good example. In particular think
+        * about adding TCSETAF, TCSETAW, TCSETA, TCSETSF, TCSETSW, TCSETS.
+        */
+       switch (cmd) {
+       case TCSBRK:    /* SVID version: non-zero arg --> no break */
+               retval = tty_check_change(tty);
+               if (retval)
+                       return retval;
+               /* Setup an event to indicate when the transmit buffer empties */
+               spin_lock_irqsave(&epca_lock, flags);
+               setup_empty_event(tty,ch);
+               spin_unlock_irqrestore(&epca_lock, flags);
+               tty_wait_until_sent(tty, 0);
+               if (!arg)
+                       digi_send_break(ch, HZ / 4);    /* 1/4 second */
+               return 0;
+       case TCSBRKP:   /* support for POSIX tcsendbreak() */
+               retval = tty_check_change(tty);
+               if (retval)
+                       return retval;
 
-                       /* Setup an event to indicate when the transmit buffer empties */
-                       spin_lock_irqsave(&epca_lock, flags);
-                       setup_empty_event(tty,ch);              
-                       spin_unlock_irqrestore(&epca_lock, flags);
-                       tty_wait_until_sent(tty, 0);
-                       digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4);
-                       return 0;
-               case TIOCGSOFTCAR:
-                       if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)arg))
-                               return -EFAULT;
-                       return 0;
-               case TIOCSSOFTCAR:
+               /* Setup an event to indicate when the transmit buffer empties */
+               spin_lock_irqsave(&epca_lock, flags);
+               setup_empty_event(tty,ch);
+               spin_unlock_irqrestore(&epca_lock, flags);
+               tty_wait_until_sent(tty, 0);
+               digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4);
+               return 0;
+       case TIOCGSOFTCAR:
+               if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)arg))
+                       return -EFAULT;
+               return 0;
+       case TIOCSSOFTCAR:
                {
                        unsigned int value;
 
@@ -2400,144 +2221,141 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,
                                 (value ? CLOCAL : 0));
                        return 0;
                }
-               case TIOCMODG:
-                       mflag = pc_tiocmget(tty, file);
-                       if (put_user(mflag, (unsigned long __user *)argp))
-                               return -EFAULT;
-                       break;
-               case TIOCMODS:
-                       if (get_user(mstat, (unsigned __user *)argp))
-                               return -EFAULT;
-                       return pc_tiocmset(tty, file, mstat, ~mstat);
-               case TIOCSDTR:
-                       spin_lock_irqsave(&epca_lock, flags);
-                       ch->omodem |= ch->m_dtr;
-                       globalwinon(ch);
-                       fepcmd(ch, SETMODEM, ch->m_dtr, 0, 10, 1);
-                       memoff(ch);
-                       spin_unlock_irqrestore(&epca_lock, flags);
-                       break;
+       case TIOCMODG:
+               mflag = pc_tiocmget(tty, file);
+               if (put_user(mflag, (unsigned long __user *)argp))
+                       return -EFAULT;
+               break;
+       case TIOCMODS:
+               if (get_user(mstat, (unsigned __user *)argp))
+                       return -EFAULT;
+               return pc_tiocmset(tty, file, mstat, ~mstat);
+       case TIOCSDTR:
+               spin_lock_irqsave(&epca_lock, flags);
+               ch->omodem |= ch->m_dtr;
+               globalwinon(ch);
+               fepcmd(ch, SETMODEM, ch->m_dtr, 0, 10, 1);
+               memoff(ch);
+               spin_unlock_irqrestore(&epca_lock, flags);
+               break;
 
-               case TIOCCDTR:
+       case TIOCCDTR:
+               spin_lock_irqsave(&epca_lock, flags);
+               ch->omodem &= ~ch->m_dtr;
+               globalwinon(ch);
+               fepcmd(ch, SETMODEM, 0, ch->m_dtr, 10, 1);
+               memoff(ch);
+               spin_unlock_irqrestore(&epca_lock, flags);
+               break;
+       case DIGI_GETA:
+               if (copy_to_user(argp, &ch->digiext, sizeof(digi_t)))
+                       return -EFAULT;
+               break;
+       case DIGI_SETAW:
+       case DIGI_SETAF:
+               if (cmd == DIGI_SETAW) {
+                       /* Setup an event to indicate when the transmit buffer empties */
                        spin_lock_irqsave(&epca_lock, flags);
-                       ch->omodem &= ~ch->m_dtr;
-                       globalwinon(ch);
-                       fepcmd(ch, SETMODEM, 0, ch->m_dtr, 10, 1);
-                       memoff(ch);
+                       setup_empty_event(tty,ch);
                        spin_unlock_irqrestore(&epca_lock, flags);
-                       break;
-               case DIGI_GETA:
-                       if (copy_to_user(argp, &ch->digiext, sizeof(digi_t)))
-                               return -EFAULT;
-                       break;
-               case DIGI_SETAW:
-               case DIGI_SETAF:
-                       if (cmd == DIGI_SETAW) {
-                               /* Setup an event to indicate when the transmit buffer empties */
-                               spin_lock_irqsave(&epca_lock, flags);
-                               setup_empty_event(tty,ch);              
-                               spin_unlock_irqrestore(&epca_lock, flags);
-                               tty_wait_until_sent(tty, 0);
-                       } else  {
-                               /* ldisc lock already held in ioctl */
-                               if (tty->ldisc.flush_buffer)
-                                       tty->ldisc.flush_buffer(tty);
-                       }
-                       /* Fall Thru */
-               case DIGI_SETA:
-                       if (copy_from_user(&ch->digiext, argp, sizeof(digi_t)))
-                               return -EFAULT;
-                       
-                       if (ch->digiext.digi_flags & DIGI_ALTPIN)  {
-                               ch->dcd = ch->m_dsr;
-                               ch->dsr = ch->m_dcd;
-                       } else {
-                               ch->dcd = ch->m_dcd;
-                               ch->dsr = ch->m_dsr;
+                       tty_wait_until_sent(tty, 0);
+               } else {
+                       /* ldisc lock already held in ioctl */
+                       if (tty->ldisc.flush_buffer)
+                               tty->ldisc.flush_buffer(tty);
+               }
+               /* Fall Thru */
+       case DIGI_SETA:
+               if (copy_from_user(&ch->digiext, argp, sizeof(digi_t)))
+                       return -EFAULT;
+
+               if (ch->digiext.digi_flags & DIGI_ALTPIN)  {
+                       ch->dcd = ch->m_dsr;
+                       ch->dsr = ch->m_dcd;
+               } else {
+                       ch->dcd = ch->m_dcd;
+                       ch->dsr = ch->m_dsr;
                        }
-               
-                       spin_lock_irqsave(&epca_lock, flags);
-                       globalwinon(ch);
 
-                       /* -----------------------------------------------------------------
-                               The below routine generally sets up parity, baud, flow control 
-                               issues, etc.... It effect both control flags and input flags.
-                       ------------------------------------------------------------------- */
+               spin_lock_irqsave(&epca_lock, flags);
+               globalwinon(ch);
 
-                       epcaparam(tty,ch);
-                       memoff(ch);
-                       spin_unlock_irqrestore(&epca_lock, flags);
-                       break;
+               /*
+                * The below routine generally sets up parity, baud, flow
+                * control issues, etc.... It effect both control flags and
+                * input flags.
+                */
+               epcaparam(tty,ch);
+               memoff(ch);
+               spin_unlock_irqrestore(&epca_lock, flags);
+               break;
+
+       case DIGI_GETFLOW:
+       case DIGI_GETAFLOW:
+               spin_lock_irqsave(&epca_lock, flags);
+               globalwinon(ch);
+               if (cmd == DIGI_GETFLOW) {
+                       dflow.startc = readb(&bc->startc);
+                       dflow.stopc = readb(&bc->stopc);
+               } else {
+                       dflow.startc = readb(&bc->startca);
+                       dflow.stopc = readb(&bc->stopca);
+               }
+               memoff(ch);
+               spin_unlock_irqrestore(&epca_lock, flags);
+
+               if (copy_to_user(argp, &dflow, sizeof(dflow)))
+                       return -EFAULT;
+               break;
+
+       case DIGI_SETAFLOW:
+       case DIGI_SETFLOW:
+               if (cmd == DIGI_SETFLOW) {
+                       startc = ch->startc;
+                       stopc = ch->stopc;
+               } else {
+                       startc = ch->startca;
+                       stopc = ch->stopca;
+               }
 
-               case DIGI_GETFLOW:
-               case DIGI_GETAFLOW:
+               if (copy_from_user(&dflow, argp, sizeof(dflow)))
+                       return -EFAULT;
+
+               if (dflow.startc != startc || dflow.stopc != stopc) { /* Begin  if setflow toggled */
                        spin_lock_irqsave(&epca_lock, flags);
                        globalwinon(ch);
-                       if (cmd == DIGI_GETFLOW) {
-                               dflow.startc = readb(&bc->startc);
-                               dflow.stopc = readb(&bc->stopc);
-                       } else {
-                               dflow.startc = readb(&bc->startca);
-                               dflow.stopc = readb(&bc->stopca);
-                       }
-                       memoff(ch);
-                       spin_unlock_irqrestore(&epca_lock, flags);
 
-                       if (copy_to_user(argp, &dflow, sizeof(dflow)))
-                               return -EFAULT;
-                       break;
-
-               case DIGI_SETAFLOW:
-               case DIGI_SETFLOW:
                        if (cmd == DIGI_SETFLOW) {
-                               startc = ch->startc;
-                               stopc = ch->stopc;
+                               ch->fepstartc = ch->startc = dflow.startc;
+                               ch->fepstopc = ch->stopc = dflow.stopc;
+                               fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1);
                        } else {
-                               startc = ch->startca;
-                               stopc = ch->stopca;
+                               ch->fepstartca = ch->startca = dflow.startc;
+                               ch->fepstopca  = ch->stopca = dflow.stopc;
+                               fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1);
                        }
 
-                       if (copy_from_user(&dflow, argp, sizeof(dflow)))
-                               return -EFAULT;
-
-                       if (dflow.startc != startc || dflow.stopc != stopc) { /* Begin  if setflow toggled */
-                               spin_lock_irqsave(&epca_lock, flags);
-                               globalwinon(ch);
-
-                               if (cmd == DIGI_SETFLOW) {
-                                       ch->fepstartc = ch->startc = dflow.startc;
-                                       ch->fepstopc = ch->stopc = dflow.stopc;
-                                       fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1);
-                               } else {
-                                       ch->fepstartca = ch->startca = dflow.startc;
-                                       ch->fepstopca  = ch->stopca = dflow.stopc;
-                                       fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1);
-                               }
-
-                               if (ch->statusflags & TXSTOPPED)
-                                       pc_start(tty);
+                       if (ch->statusflags & TXSTOPPED)
+                               pc_start(tty);
 
-                               memoff(ch);
-                               spin_unlock_irqrestore(&epca_lock, flags);
-                       } /* End if setflow toggled */
-                       break;
-               default:
-                       return -ENOIOCTLCMD;
-       } /* End switch cmd */
+                       memoff(ch);
+                       spin_unlock_irqrestore(&epca_lock, flags);
+               } /* End if setflow toggled */
+               break;
+       default:
+               return -ENOIOCTLCMD;
+       }
        return 0;
-} /* End pc_ioctl */
-
-/* --------------------- Begin pc_set_termios  ----------------------- */
+}
 
 static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
-{ /* Begin pc_set_termios */
-
+{
        struct channel *ch;
        unsigned long flags;
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
        if ((ch = verifyChannel(tty)) != NULL)  { /* Begin if channel valid */
                spin_lock_irqsave(&epca_lock, flags);
                globalwinon(ch);
@@ -2554,47 +2372,40 @@ static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
                        wake_up_interruptible(&ch->open_wait);
 
        } /* End if channel valid */
-
-} /* End pc_set_termios */
-
-/* --------------------- Begin do_softint  ----------------------- */
+}
 
 static void do_softint(struct work_struct *work)
-{ /* Begin do_softint */
+{
        struct channel *ch = container_of(work, struct channel, tqueue);
        /* Called in response to a modem change event */
-       if (ch && ch->magic == EPCA_MAGIC)  { /* Begin EPCA_MAGIC */
+       if (ch && ch->magic == EPCA_MAGIC) {
                struct tty_struct *tty = ch->tty;
 
                if (tty && tty->driver_data) {
-                       if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) { /* Begin if clear_bit */
+                       if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) {
                                tty_hangup(tty);        /* FIXME: module removal race here - AKPM */
                                wake_up_interruptible(&ch->open_wait);
                                ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE;
-                       } /* End if clear_bit */
+                       }
                }
-       } /* End EPCA_MAGIC */
-} /* End do_softint */
-
-/* ------------------------------------------------------------
-       pc_stop and pc_start provide software flow control to the 
-       routine and the pc_ioctl routine.
----------------------------------------------------------------- */
-
-/* --------------------- Begin pc_stop  ----------------------- */
+       }
+}
 
+/*
+ * pc_stop and pc_start provide software flow control to the routine and the
+ * pc_ioctl routine.
+ */
 static void pc_stop(struct tty_struct *tty)
-{ /* Begin pc_stop */
-
+{
        struct channel *ch;
        unsigned long flags;
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
-       if ((ch = verifyChannel(tty)) != NULL)  { /* Begin if valid channel */
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
+       if ((ch = verifyChannel(tty)) != NULL) {
                spin_lock_irqsave(&epca_lock, flags);
-               if ((ch->statusflags & TXSTOPPED) == 0)  { /* Begin if transmit stop requested */
+               if ((ch->statusflags & TXSTOPPED) == 0) { /* Begin if transmit stop requested */
                        globalwinon(ch);
                        /* STOP transmitting now !! */
                        fepcmd(ch, PAUSETX, 0, 0, 0, 0);
@@ -2602,19 +2413,17 @@ static void pc_stop(struct tty_struct *tty)
                        memoff(ch);
                } /* End if transmit stop requested */
                spin_unlock_irqrestore(&epca_lock, flags);
-       } /* End if valid channel */
-} /* End pc_stop */
-
-/* --------------------- Begin pc_start  ----------------------- */
+       }
+}
 
 static void pc_start(struct tty_struct *tty)
-{ /* Begin pc_start */
+{
        struct channel *ch;
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
-       if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
+       if ((ch = verifyChannel(tty)) != NULL) {
                unsigned long flags;
                spin_lock_irqsave(&epca_lock, flags);
                /* Just in case output was resumed because of a change in Digi-flow */
@@ -2630,28 +2439,25 @@ static void pc_start(struct tty_struct *tty)
                        memoff(ch);
                } /* End transmit resume requested */
                spin_unlock_irqrestore(&epca_lock, flags);
-       } /* End if channel valid */
-} /* End pc_start */
-
-/* ------------------------------------------------------------------
-       The below routines pc_throttle and pc_unthrottle are used 
-       to slow (And resume) the receipt of data into the kernels
-       receive buffers.  The exact occurrence of this depends on the
-       size of the kernels receive buffer and what the 'watermarks'
-       are set to for that buffer.  See the n_ttys.c file for more
-       details. 
-______________________________________________________________________ */
-/* --------------------- Begin throttle  ----------------------- */
-
-static void pc_throttle(struct tty_struct * tty)
-{ /* Begin pc_throttle */
+       }
+}
+
+/*
+ * The below routines pc_throttle and pc_unthrottle are used to slow (And
+ * resume) the receipt of data into the kernels receive buffers. The exact
+ * occurrence of this depends on the size of the kernels receive buffer and
+ * what the 'watermarks' are set to for that buffer. See the n_ttys.c file for
+ * more details.
+ */
+static void pc_throttle(struct tty_struct *tty)
+{
        struct channel *ch;
        unsigned long flags;
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
-       if ((ch = verifyChannel(tty)) != NULL)  { /* Begin if channel valid */
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
+       if ((ch = verifyChannel(tty)) != NULL) {
                spin_lock_irqsave(&epca_lock, flags);
                if ((ch->statusflags & RXSTOPPED) == 0) {
                        globalwinon(ch);
@@ -2660,20 +2466,18 @@ static void pc_throttle(struct tty_struct * tty)
                        memoff(ch);
                }
                spin_unlock_irqrestore(&epca_lock, flags);
-       } /* End if channel valid */
-} /* End pc_throttle */
-
-/* --------------------- Begin unthrottle  ----------------------- */
+       }
+}
 
 static void pc_unthrottle(struct tty_struct *tty)
-{ /* Begin pc_unthrottle */
+{
        struct channel *ch;
        unsigned long flags;
-       /* ---------------------------------------------------------
-               verifyChannel returns the channel from the tty struct
-               if it is valid.  This serves as a sanity check.
-       ------------------------------------------------------------- */
-       if ((ch = verifyChannel(tty)) != NULL)  { /* Begin if channel valid */
+       /*
+        * verifyChannel returns the channel from the tty struct if it is
+        * valid. This serves as a sanity check.
+        */
+       if ((ch = verifyChannel(tty)) != NULL) {
                /* Just in case output was resumed because of a change in Digi-flow */
                spin_lock_irqsave(&epca_lock, flags);
                if (ch->statusflags & RXSTOPPED) {
@@ -2683,151 +2487,143 @@ static void pc_unthrottle(struct tty_struct *tty)
                        memoff(ch);
                }
                spin_unlock_irqrestore(&epca_lock, flags);
-       } /* End if channel valid */
-} /* End pc_unthrottle */
-
-/* --------------------- Begin digi_send_break  ----------------------- */
+       }
+}
 
 void digi_send_break(struct channel *ch, int msec)
-{ /* Begin digi_send_break */
+{
        unsigned long flags;
 
        spin_lock_irqsave(&epca_lock, flags);
        globalwinon(ch);
-       /* -------------------------------------------------------------------- 
-          Maybe I should send an infinite break here, schedule() for
-          msec amount of time, and then stop the break.  This way,
-          the user can't screw up the FEP by causing digi_send_break()
-          to be called (i.e. via an ioctl()) more than once in msec amount 
-          of time.  Try this for now...
-       ------------------------------------------------------------------------ */
+       /*
+        * Maybe I should send an infinite break here, schedule() for msec
+        * amount of time, and then stop the break. This way, the user can't
+        * screw up the FEP by causing digi_send_break() to be called (i.e. via
+        * an ioctl()) more than once in msec amount of time.
+        * Try this for now...
+        */
        fepcmd(ch, SENDBREAK, msec, 0, 10, 0);
        memoff(ch);
        spin_unlock_irqrestore(&epca_lock, flags);
-} /* End digi_send_break */
-
-/* --------------------- Begin setup_empty_event  ----------------------- */
+}
 
 /* Caller MUST hold the lock */
-
 static void setup_empty_event(struct tty_struct *tty, struct channel *ch)
-{ /* Begin setup_empty_event */
-
+{
        struct board_chan __iomem *bc = ch->brdchan;
 
        globalwinon(ch);
        ch->statusflags |= EMPTYWAIT;
-       /* ------------------------------------------------------------------
-               When set the iempty flag request a event to be generated when the 
-               transmit buffer is empty (If there is no BREAK in progress).
-       --------------------------------------------------------------------- */
+       /*
+        * When set the iempty flag request a event to be generated when the
+        * transmit buffer is empty (If there is no BREAK in progress).
+        */
        writeb(1, &bc->iempty);
        memoff(ch);
-} /* End setup_empty_event */
+}
 
-/* ---------------------- Begin epca_setup  -------------------------- */
 void epca_setup(char *str, int *ints)
-{ /* Begin epca_setup */
+{
        struct board_info board;
        int               index, loop, last;
        char              *temp, *t2;
        unsigned          len;
 
-       /* ----------------------------------------------------------------------
-               If this routine looks a little strange it is because it is only called
-               if a LILO append command is given to boot the kernel with parameters.  
-               In this way, we can provide the user a method of changing his board
-               configuration without rebuilding the kernel.
-       ----------------------------------------------------------------------- */
-       if (!liloconfig) 
-               liloconfig = 1; 
+       /*
+        * If this routine looks a little strange it is because it is only
+        * called if a LILO append command is given to boot the kernel with
+        * parameters. In this way, we can provide the user a method of
+        * changing his board configuration without rebuilding the kernel.
+        */
+       if (!liloconfig)
+               liloconfig = 1;
 
        memset(&board, 0, sizeof(board));
 
        /* Assume the data is int first, later we can change it */
        /* I think that array position 0 of ints holds the number of args */
        for (last = 0, index = 1; index <= ints[0]; index++)
-               switch(index)
-               { /* Begin parse switch */
-                       case 1:
-                               board.status = ints[index];
-                               /* ---------------------------------------------------------
-                                       We check for 2 (As opposed to 1; because 2 is a flag
-                                       instructing the driver to ignore epcaconfig.)  For this
-                                       reason we check for 2.
-                               ------------------------------------------------------------ */ 
-                               if (board.status == 2) { /* Begin ignore epcaconfig as well as lilo cmd line */
-                                       nbdevs = 0;
-                                       num_cards = 0;
-                                       return;
-                               } /* End ignore epcaconfig as well as lilo cmd line */
-       
-                               if (board.status > 2) {
-                                       printk(KERN_ERR "epca_setup: Invalid board status 0x%x\n", board.status);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_BOARD_STATUS;
-                                       return;
-                               }
-                               last = index;
-                               break;
-                       case 2:
-                               board.type = ints[index];
-                               if (board.type >= PCIXEM)  {
-                                       printk(KERN_ERR "epca_setup: Invalid board type 0x%x\n", board.type);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_BOARD_TYPE;
-                                       return;
-                               }
-                               last = index;
-                               break;
-                       case 3:
-                               board.altpin = ints[index];
-                               if (board.altpin > 1) {
-                                       printk(KERN_ERR "epca_setup: Invalid board altpin 0x%x\n", board.altpin);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_ALTPIN;
-                                       return;
-                               }
-                               last = index;
-                               break;
-
-                       case 4:
-                               board.numports = ints[index];
-                               if (board.numports < 2 || board.numports > 256) {
-                                       printk(KERN_ERR "epca_setup: Invalid board numports 0x%x\n", board.numports);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_NUM_PORTS;
-                                       return;
-                               }
-                               nbdevs += board.numports;
-                               last = index;
-                               break;
-
-                       case 5:
-                               board.port = ints[index];
-                               if (ints[index] <= 0) {
-                                       printk(KERN_ERR "epca_setup: Invalid io port 0x%x\n", (unsigned int)board.port);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_PORT_BASE;
-                                       return;
-                               }
-                               last = index;
-                               break;
-
-                       case 6:
-                               board.membase = ints[index];
-                               if (ints[index] <= 0) {
-                                       printk(KERN_ERR "epca_setup: Invalid memory base 0x%x\n",(unsigned int)board.membase);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_MEM_BASE;
-                                       return;
-                               }
-                               last = index;
-                               break;
+               switch (index) { /* Begin parse switch */
+               case 1:
+                       board.status = ints[index];
+                       /*
+                        * We check for 2 (As opposed to 1; because 2 is a flag
+                        * instructing the driver to ignore epcaconfig.) For
+                        * this reason we check for 2.
+                        */
+                       if (board.status == 2) { /* Begin ignore epcaconfig as well as lilo cmd line */
+                               nbdevs = 0;
+                               num_cards = 0;
+                               return;
+                       } /* End ignore epcaconfig as well as lilo cmd line */
+
+                       if (board.status > 2) {
+                               printk(KERN_ERR "epca_setup: Invalid board status 0x%x\n", board.status);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_BOARD_STATUS;
+                               return;
+                       }
+                       last = index;
+                       break;
+               case 2:
+                       board.type = ints[index];
+                       if (board.type >= PCIXEM)  {
+                               printk(KERN_ERR "epca_setup: Invalid board type 0x%x\n", board.type);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_BOARD_TYPE;
+                               return;
+                       }
+                       last = index;
+                       break;
+               case 3:
+                       board.altpin = ints[index];
+                       if (board.altpin > 1) {
+                               printk(KERN_ERR "epca_setup: Invalid board altpin 0x%x\n", board.altpin);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_ALTPIN;
+                               return;
+                       }
+                       last = index;
+                       break;
+
+               case 4:
+                       board.numports = ints[index];
+                       if (board.numports < 2 || board.numports > 256) {
+                               printk(KERN_ERR "epca_setup: Invalid board numports 0x%x\n", board.numports);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_NUM_PORTS;
+                               return;
+                       }
+                       nbdevs += board.numports;
+                       last = index;
+                       break;
 
-                       default:
-                               printk(KERN_ERR "<Error> - epca_setup: Too many integer parms\n");
+               case 5:
+                       board.port = ints[index];
+                       if (ints[index] <= 0) {
+                               printk(KERN_ERR "epca_setup: Invalid io port 0x%x\n", (unsigned int)board.port);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_PORT_BASE;
                                return;
+                       }
+                       last = index;
+                       break;
+
+               case 6:
+                       board.membase = ints[index];
+                       if (ints[index] <= 0) {
+                               printk(KERN_ERR "epca_setup: Invalid memory base 0x%x\n",(unsigned int)board.membase);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_MEM_BASE;
+                               return;
+                       }
+                       last = index;
+                       break;
+
+               default:
+                       printk(KERN_ERR "<Error> - epca_setup: Too many integer parms\n");
+                       return;
 
                } /* End parse switch */
 
@@ -2844,120 +2640,121 @@ void epca_setup(char *str, int *ints)
                /* Set index to the number of args + 1 */
                index = last + 1;
 
-               switch(index)
-               {
-                       case 1:
-                               len = strlen(str);
-                               if (strncmp("Disable", str, len) == 0) 
-                                       board.status = 0;
-                               else if (strncmp("Enable", str, len) == 0)
-                                       board.status = 1;
-                               else {
-                                       printk(KERN_ERR "epca_setup: Invalid status %s\n", str);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_BOARD_STATUS;
-                                       return;
-                               }
-                               last = index;
-                               break;
-
-                       case 2:
-                               for(loop = 0; loop < EPCA_NUM_TYPES; loop++)
-                                       if (strcmp(board_desc[loop], str) == 0)
-                                               break;
-                               /* ---------------------------------------------------------------
-                                       If the index incremented above refers to a legitamate board 
-                                       type set it here. 
-                               ------------------------------------------------------------------*/
-                               if (index < EPCA_NUM_TYPES) 
-                                       board.type = loop;
-                               else {
-                                       printk(KERN_ERR "epca_setup: Invalid board type: %s\n", str);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_BOARD_TYPE;
-                                       return;
-                               }
-                               last = index;
-                               break;
-
-                       case 3:
-                               len = strlen(str);
-                               if (strncmp("Disable", str, len) == 0) 
-                                       board.altpin = 0;
-                               else if (strncmp("Enable", str, len) == 0)
-                                       board.altpin = 1;
-                               else {
-                                       printk(KERN_ERR "epca_setup: Invalid altpin %s\n", str);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_ALTPIN;
-                                       return;
-                               }
-                               last = index;
-                               break;
-
-                       case 4:
-                               t2 = str;
-                               while (isdigit(*t2))
-                                       t2++;
-
-                               if (*t2) {
-                                       printk(KERN_ERR "epca_setup: Invalid port count %s\n", str);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_NUM_PORTS;
-                                       return;
-                               }
+               switch (index) {
+               case 1:
+                       len = strlen(str);
+                       if (strncmp("Disable", str, len) == 0)
+                               board.status = 0;
+                       else if (strncmp("Enable", str, len) == 0)
+                               board.status = 1;
+                       else {
+                               printk(KERN_ERR "epca_setup: Invalid status %s\n", str);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_BOARD_STATUS;
+                               return;
+                       }
+                       last = index;
+                       break;
 
-                               /* ------------------------------------------------------------
-                                       There is not a man page for simple_strtoul but the code can be 
-                                       found in vsprintf.c.  The first argument is the string to 
-                                       translate (To an unsigned long obviously),  the second argument
-                                       can be the address of any character variable or a NULL.  If a
-                                       variable is given, the end pointer of the string will be stored 
-                                       in that variable; if a NULL is given the end pointer will 
-                                       not be returned.  The last argument is the base to use.  If 
-                                       a 0 is indicated, the routine will attempt to determine the 
-                                       proper base by looking at the values prefix (A '0' for octal,
-                                       a 'x' for hex, etc ...  If a value is given it will use that 
-                                       value as the base. 
-                               ---------------------------------------------------------------- */ 
-                               board.numports = simple_strtoul(str, NULL, 0);
-                               nbdevs += board.numports;
-                               last = index;
-                               break;
-
-                       case 5:
-                               t2 = str;
-                               while (isxdigit(*t2))
-                                       t2++;
-
-                               if (*t2) {
-                                       printk(KERN_ERR "epca_setup: Invalid i/o address %s\n", str);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_PORT_BASE;
-                                       return;
-                               }
+               case 2:
+                       for (loop = 0; loop < EPCA_NUM_TYPES; loop++)
+                               if (strcmp(board_desc[loop], str) == 0)
+                                       break;
+                       /*
+                        * If the index incremented above refers to a
+                        * legitamate board type set it here.
+                        */
+                       if (index < EPCA_NUM_TYPES)
+                               board.type = loop;
+                       else {
+                               printk(KERN_ERR "epca_setup: Invalid board type: %s\n", str);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_BOARD_TYPE;
+                               return;
+                       }
+                       last = index;
+                       break;
+
+               case 3:
+                       len = strlen(str);
+                       if (strncmp("Disable", str, len) == 0)
+                               board.altpin = 0;
+                       else if (strncmp("Enable", str, len) == 0)
+                               board.altpin = 1;
+                       else {
+                               printk(KERN_ERR "epca_setup: Invalid altpin %s\n", str);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_ALTPIN;
+                               return;
+                       }
+                       last = index;
+                       break;
 
-                               board.port = simple_strtoul(str, NULL, 16);
-                               last = index;
-                               break;
+               case 4:
+                       t2 = str;
+                       while (isdigit(*t2))
+                               t2++;
 
-                       case 6:
-                               t2 = str;
-                               while (isxdigit(*t2))
-                                       t2++;
+                       if (*t2) {
+                               printk(KERN_ERR "epca_setup: Invalid port count %s\n", str);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_NUM_PORTS;
+                               return;
+                       }
 
-                               if (*t2) {
-                                       printk(KERN_ERR "epca_setup: Invalid memory base %s\n",str);
-                                       invalid_lilo_config = 1;
-                                       setup_error_code |= INVALID_MEM_BASE;
-                                       return;
-                               }
-                               board.membase = simple_strtoul(str, NULL, 16);
-                               last = index;
-                               break;
-                       default:
-                               printk(KERN_ERR "epca: Too many string parms\n");
+                       /*
+                        * There is not a man page for simple_strtoul but the
+                        * code can be found in vsprintf.c. The first argument
+                        * is the string to translate (To an unsigned long
+                        * obviously), the second argument can be the address
+                        * of any character variable or a NULL. If a variable
+                        * is given, the end pointer of the string will be
+                        * stored in that variable; if a NULL is given the end
+                        * pointer will not be returned. The last argument is
+                        * the base to use. If a 0 is indicated, the routine
+                        * will attempt to determine the proper base by looking
+                        * at the values prefix (A '0' for octal, a 'x' for
+                        * hex, etc ... If a value is given it will use that
+                        * value as the base.
+                        */
+                       board.numports = simple_strtoul(str, NULL, 0);
+                       nbdevs += board.numports;
+                       last = index;
+                       break;
+
+               case 5:
+                       t2 = str;
+                       while (isxdigit(*t2))
+                               t2++;
+
+                       if (*t2) {
+                               printk(KERN_ERR "epca_setup: Invalid i/o address %s\n", str);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_PORT_BASE;
+                               return;
+                       }
+
+                       board.port = simple_strtoul(str, NULL, 16);
+                       last = index;
+                       break;
+
+               case 6:
+                       t2 = str;
+                       while (isxdigit(*t2))
+                               t2++;
+
+                       if (*t2) {
+                               printk(KERN_ERR "epca_setup: Invalid memory base %s\n",str);
+                               invalid_lilo_config = 1;
+                               setup_error_code |= INVALID_MEM_BASE;
                                return;
+                       }
+                       board.membase = simple_strtoul(str, NULL, 16);
+                       last = index;
+                       break;
+               default:
+                       printk(KERN_ERR "epca: Too many string parms\n");
+                       return;
                }
                str = temp;
        } /* End while there is a string arg */
@@ -2966,19 +2763,16 @@ void epca_setup(char *str, int *ints)
                printk(KERN_ERR "epca: Insufficient parms specified\n");
                return;
        }
+
        /* I should REALLY validate the stuff here */
        /* Copies our local copy of board into boards */
        memcpy((void *)&boards[num_cards],(void *)&board, sizeof(board));
        /* Does this get called once per lilo arg are what ? */
-       printk(KERN_INFO "PC/Xx: Added board %i, %s %i ports at 0x%4.4X base 0x%6.6X\n", 
-               num_cards, board_desc[board.type], 
+       printk(KERN_INFO "PC/Xx: Added board %i, %s %i ports at 0x%4.4X base 0x%6.6X\n",
+               num_cards, board_desc[board.type],
                board.numports, (int)board.port, (unsigned int) board.membase);
        num_cards++;
-} /* End epca_setup */
-
-
-/* ------------------------ Begin init_PCI  --------------------------- */
+}
 
 enum epic_board_types {
        brd_xr = 0,
@@ -2987,7 +2781,6 @@ enum epic_board_types {
        brd_xrj,
 };
 
-
 /* indexed directly by epic_board_types enum */
 static struct {
        unsigned char board_type;
@@ -2999,7 +2792,7 @@ static struct {
        { PCIXRJ, 2, },
 };
 
-static int __devinit epca_init_one (struct pci_dev *pdev,
+static int __devinit epca_init_one(struct pci_dev *pdev,
                                 const struct pci_device_id *ent)
 {
        static int board_num = -1;
@@ -3013,7 +2806,7 @@ static int __devinit epca_init_one (struct pci_dev *pdev,
        board_idx = board_num + num_cards;
        if (board_idx >= MAXBOARDS)
                goto err_out;
-       
+
        addr = pci_resource_start (pdev, epca_info_tbl[info_idx].bar_idx);
        if (!addr) {
                printk (KERN_ERR PFX "PCI region #%d not available (size 0)\n",
@@ -3053,15 +2846,15 @@ static int __devinit epca_init_one (struct pci_dev *pdev,
                goto err_out_free_memregion;
        }
 
-       /* --------------------------------------------------------------
-               I don't know what the below does, but the hardware guys say
-               its required on everything except PLX (In this case XRJ).
-       ---------------------------------------------------------------- */
+       /*
+        * I don't know what the below does, but the hardware guys say its
+        * required on everything except PLX (In this case XRJ).
+        */
        if (info_idx != brd_xrj) {
-               pci_write_config_byte(pdev, 0x40, 0);  
+               pci_write_config_byte(pdev, 0x40, 0);
                pci_write_config_byte(pdev, 0x46, 0);
        }
-       
+
        return 0;
 
 err_out_free_memregion:
@@ -3086,7 +2879,7 @@ static struct pci_device_id epca_pci_tbl[] = {
 MODULE_DEVICE_TABLE(pci, epca_pci_tbl);
 
 int __init init_PCI (void)
-{      /* Begin init_PCI */
+{
        memset (&epca_driver, 0, sizeof (epca_driver));
        epca_driver.name = "epca";
        epca_driver.id_table = epca_pci_tbl;
index 83c1151ec7a21559257f3663a59d0f59e4d92abc..8252f86685385f341aa6f34797d52581264ed543 100644 (file)
@@ -69,6 +69,8 @@ static struct task_struct *hvc_task;
 /* Picks up late kicks after list walk but before schedule() */
 static int hvc_kicked;
 
+static int hvc_init(void);
+
 #ifdef CONFIG_MAGIC_SYSRQ
 static int sysrq_pressed;
 #endif
@@ -754,6 +756,13 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq,
        struct hvc_struct *hp;
        int i;
 
+       /* We wait until a driver actually comes along */
+       if (!hvc_driver) {
+               int err = hvc_init();
+               if (err)
+                       return ERR_PTR(err);
+       }
+
        hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size,
                        GFP_KERNEL);
        if (!hp)
@@ -829,16 +838,18 @@ int __devexit hvc_remove(struct hvc_struct *hp)
        return 0;
 }
 
-/* Driver initialization.  Follow console initialization.  This is where the TTY
- * interfaces start to become available. */
-static int __init hvc_init(void)
+/* Driver initialization: called as soon as someone uses hvc_alloc(). */
+static int hvc_init(void)
 {
        struct tty_driver *drv;
+       int err;
 
        /* We need more than hvc_count adapters due to hotplug additions. */
        drv = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS);
-       if (!drv)
-               return -ENOMEM;
+       if (!drv) {
+               err = -ENOMEM;
+               goto out;
+       }
 
        drv->owner = THIS_MODULE;
        drv->driver_name = "hvc";
@@ -854,30 +865,43 @@ static int __init hvc_init(void)
         * added later. */
        hvc_task = kthread_run(khvcd, NULL, "khvcd");
        if (IS_ERR(hvc_task)) {
-               panic("Couldn't create kthread for console.\n");
-               put_tty_driver(drv);
-               return -EIO;
+               printk(KERN_ERR "Couldn't create kthread for console.\n");
+               err = PTR_ERR(hvc_task);
+               goto put_tty;
        }
 
-       if (tty_register_driver(drv))
-               panic("Couldn't register hvc console driver\n");
+       err = tty_register_driver(drv);
+       if (err) {
+               printk(KERN_ERR "Couldn't register hvc console driver\n");
+               goto stop_thread;
+       }
 
+       /* FIXME: This mb() seems completely random.  Remove it. */
        mb();
        hvc_driver = drv;
        return 0;
+
+put_tty:
+       put_tty_driver(hvc_driver);
+stop_thread:
+       kthread_stop(hvc_task);
+       hvc_task = NULL;
+out:
+       return err;
 }
-module_init(hvc_init);
 
 /* This isn't particularly necessary due to this being a console driver
  * but it is nice to be thorough.
  */
 static void __exit hvc_exit(void)
 {
-       kthread_stop(hvc_task);
+       if (hvc_driver) {
+               kthread_stop(hvc_task);
 
-       tty_unregister_driver(hvc_driver);
-       /* return tty_struct instances allocated in hvc_init(). */
-       put_tty_driver(hvc_driver);
-       unregister_console(&hvc_con_driver);
+               tty_unregister_driver(hvc_driver);
+               /* return tty_struct instances allocated in hvc_init(). */
+               put_tty_driver(hvc_driver);
+               unregister_console(&hvc_con_driver);
+       }
 }
 module_exit(hvc_exit);
index bd94d5f9e62b62191b10f3525c43819d1ff2882f..2124dce38f2be95aeeabacfa3966ee1fc96991fc 100644 (file)
@@ -619,11 +619,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
                                        ip2config.irq[i] = pci_dev_i->irq;
                                } else {        // ann error
                                        ip2config.addr[i] = 0;
-                                       if (status == PCIBIOS_DEVICE_NOT_FOUND) {
-                                               printk( KERN_ERR "IP2: PCI board %d not found\n", i );
-                                       } else {
-                                               printk( KERN_ERR "IP2: PCI error 0x%x \n", status );
-                                       }
+                                       printk(KERN_ERR "IP2: PCI board %d not found\n", i);
                                } 
                        }
 #else
@@ -646,10 +642,9 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
 
        for ( i = 0; i < IP2_MAX_BOARDS; ++i ) {
                if ( ip2config.addr[i] ) {
-                       pB = kmalloc( sizeof(i2eBordStr), GFP_KERNEL);
-                       if ( pB != NULL ) {
+                       pB = kzalloc(sizeof(i2eBordStr), GFP_KERNEL);
+                       if (pB) {
                                i2BoardPtrTable[i] = pB;
-                               memset( pB, 0, sizeof(i2eBordStr) );
                                iiSetAddress( pB, ip2config.addr[i], ii2DelayTimer );
                                iiReset( pB );
                        } else {
index 6a01dd9e43f865726928553fe51671db7adbb6dc..8435fba73dafdcd8e847403e25dee71d2feee90c 100644 (file)
@@ -4136,7 +4136,7 @@ static __exit void cleanup_ipmi(void)
        del_timer_sync(&ipmi_timer);
 
 #ifdef CONFIG_PROC_FS
-       remove_proc_entry(proc_ipmi_root->name, &proc_root);
+       remove_proc_entry(proc_ipmi_root->name, NULL);
 #endif /* CONFIG_PROC_FS */
 
        driver_unregister(&ipmidriver);
index d95f316afb5a9d1c3328046c8d9f4f8ab7743981..212276affa1f5c887233cdd3c14e987a6941fd22 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/kbd_kern.h>
 #include <linux/kbd_diacr.h>
 #include <linux/vt_kern.h>
+#include <linux/consolemap.h>
 #include <linux/sysrq.h>
 #include <linux/input.h>
 #include <linux/reboot.h>
@@ -403,9 +404,12 @@ static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch)
                return d;
 
        if (kbd->kbdmode == VC_UNICODE)
-               to_utf8(vc, conv_8bit_to_uni(d));
-       else if (d < 0x100)
-               put_queue(vc, d);
+               to_utf8(vc, d);
+       else {
+               int c = conv_uni_to_8bit(d);
+               if (c != -1)
+                       put_queue(vc, c);
+       }
 
        return ch;
 }
@@ -417,9 +421,12 @@ static void fn_enter(struct vc_data *vc)
 {
        if (diacr) {
                if (kbd->kbdmode == VC_UNICODE)
-                       to_utf8(vc, conv_8bit_to_uni(diacr));
-               else if (diacr < 0x100)
-                       put_queue(vc, diacr);
+                       to_utf8(vc, diacr);
+               else {
+                       int c = conv_uni_to_8bit(diacr);
+                       if (c != -1)
+                               put_queue(vc, c);
+               }
                diacr = 0;
        }
        put_queue(vc, 13);
@@ -627,9 +634,12 @@ static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag)
                return;
        }
        if (kbd->kbdmode == VC_UNICODE)
-               to_utf8(vc, conv_8bit_to_uni(value));
-       else if (value < 0x100)
-               put_queue(vc, value);
+               to_utf8(vc, value);
+       else {
+               int c = conv_uni_to_8bit(value);
+               if (c != -1)
+                       put_queue(vc, c);
+       }
 }
 
 /*
@@ -646,7 +656,12 @@ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag)
 
 static void k_self(struct vc_data *vc, unsigned char value, char up_flag)
 {
-       k_unicode(vc, value, up_flag);
+       unsigned int uni;
+       if (kbd->kbdmode == VC_UNICODE)
+               uni = value;
+       else
+               uni = conv_8bit_to_uni(value);
+       k_unicode(vc, uni, up_flag);
 }
 
 static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag)
@@ -1366,7 +1381,7 @@ int __init kbd_init(void)
                kbd_table[i].lockstate = KBD_DEFLOCK;
                kbd_table[i].slockstate = 0;
                kbd_table[i].modeflags = KBD_DEFMODE;
-               kbd_table[i].kbdmode = VC_XLATE;
+               kbd_table[i].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
        }
 
        error = input_register_handler(&kbd_handler);
index c59e2a0996cc9a11c87447b0e34bbd41412f9340..81674d7c56c7e74c655e62bb86f2d20cc350aae3 100644 (file)
@@ -144,7 +144,7 @@ static unsigned int lp_count = 0;
 static struct class *lp_class;
 
 #ifdef CONFIG_LP_CONSOLE
-static struct parport *console_registered; // initially NULL
+static struct parport *console_registered;
 #endif /* CONFIG_LP_CONSOLE */
 
 #undef LP_DEBUG
@@ -749,8 +749,8 @@ static struct console lpcons = {
 /* --- initialisation code ------------------------------------- */
 
 static int parport_nr[LP_NO] = { [0 ... LP_NO-1] = LP_PARPORT_UNSPEC };
-static char *parport[LP_NO] = { NULL,  };
-static int reset = 0;
+static char *parport[LP_NO];
+static int reset;
 
 module_param_array(parport, charp, NULL, 0);
 module_param(reset, bool, 0);
@@ -758,10 +758,10 @@ module_param(reset, bool, 0);
 #ifndef MODULE
 static int __init lp_setup (char *str)
 {
-       static int parport_ptr; // initially zero
+       static int parport_ptr;
        int x;
 
-       if (get_option (&str, &x)) {
+       if (get_option(&str, &x)) {
                if (x == 0) {
                        /* disable driver on "lp=" or "lp=0" */
                        parport_nr[0] = LP_PARPORT_OFF;
@@ -807,7 +807,7 @@ static int lp_register(int nr, struct parport *port)
 #ifdef CONFIG_LP_CONSOLE
        if (!nr) {
                if (port->modes & PARPORT_MODE_SAFEININT) {
-                       register_console (&lpcons);
+                       register_console(&lpcons);
                        console_registered = port;
                        printk (KERN_INFO "lp%d: console ready\n", CONSOLE_LP);
                } else
@@ -823,8 +823,7 @@ static void lp_attach (struct parport *port)
 {
        unsigned int i;
 
-       switch (parport_nr[0])
-       {
+       switch (parport_nr[0]) {
        case LP_PARPORT_UNSPEC:
        case LP_PARPORT_AUTO:
                if (parport_nr[0] == LP_PARPORT_AUTO &&
@@ -855,7 +854,7 @@ static void lp_detach (struct parport *port)
        /* Write this some day. */
 #ifdef CONFIG_LP_CONSOLE
        if (console_registered == port) {
-               unregister_console (&lpcons);
+               unregister_console(&lpcons);
                console_registered = NULL;
        }
 #endif /* CONFIG_LP_CONSOLE */
index 7ee5d9444926f2d11b5b0e5d2393a184aeaa6b3b..3c5802ae17164c5f8d2335454afd9ad1b46de0eb 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/mm.h>
-#include <linux/fs.h>
 #include <linux/uio.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
index 64551ab6be03d76f873c6646575b216bbc6a5ca5..0e937f64a789f8cafe985236e1164f632de1589a 100644 (file)
@@ -893,6 +893,11 @@ static struct class *mem_class;
 static int __init chr_dev_init(void)
 {
        int i;
+       int err;
+
+       err = bdi_init(&zero_bdi);
+       if (err)
+               return err;
 
        if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
                printk("unable to get major %d for memory devs\n", MEM_MAJOR);
index 9fe28497eae9ed51b8780673cd111456b1ff8aec..1f4aa45ec004436aac1e80b03eb46dac02876741 100644 (file)
@@ -30,8 +30,7 @@
 
 #define TTY_THRESHOLD_THROTTLE  128
 
-#define LO_WATER               (TTY_FLIPBUF_SIZE)
-#define HI_WATER               (TTY_FLIPBUF_SIZE*2*3/4)
+#define HI_WATER               768
 
 // added by James. 03-11-2004.
 #define MOXA_SDS_GETICOUNTER   (MOXA + 68)
index e8332f305d72a77b9e8d0579b8b222d5e66ea0ea..82bcfb9c839adb62a4cca24c10c55c20c8c72cf4 100644 (file)
@@ -229,7 +229,7 @@ static void n_hdlc_release(struct n_hdlc *n_hdlc)
        wake_up_interruptible (&tty->read_wait);
        wake_up_interruptible (&tty->write_wait);
 
-       if (tty != NULL && tty->disc_data == n_hdlc)
+       if (tty->disc_data == n_hdlc)
                tty->disc_data = NULL;  /* Break the tty->n_hdlc link */
 
        /* Release transmit and receive buffers */
index 84ac64fc48a1a72f4d3aebbf5fffac70e2200ae1..efe2f5c55b912b77508e38af2b2c45d0f0df55a7 100644 (file)
@@ -66,7 +66,6 @@
 #include <linux/poll.h>
 #include <linux/major.h>
 #include <linux/ppdev.h>
-#include <linux/device.h>
 #include <asm/uaccess.h>
 
 #define PP_VERSION "ppdev: user-space parallel port driver"
index fdc256b380b8231581d17612ff91587eb5cc17a0..905d1f51a7bfd7db75f90b9de128f13fd5142ac8 100644 (file)
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
-
 #include <linux/netdevice.h>
-
 #include <linux/vmalloc.h>
 #include <linux/init.h>
-
-#include <linux/delay.h>
 #include <linux/ioctl.h>
 
 #include <asm/system.h>
index 39cc318011ea69330744b42b0df4477e0d87d55a..78d14935f2b8c4b1dbb4678f0d918858c6a15832 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/kexec.h>
 #include <linux/irq.h>
 #include <linux/hrtimer.h>
+#include <linux/oom.h>
 
 #include <asm/ptrace.h>
 #include <asm/irq_regs.h>
@@ -107,12 +108,12 @@ static void sysrq_handle_unraw(int key, struct tty_struct *tty)
        struct kbd_struct *kbd = &kbd_table[fg_console];
 
        if (kbd)
-               kbd->kbdmode = VC_XLATE;
+               kbd->kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
 }
 static struct sysrq_key_op sysrq_unraw_op = {
        .handler        = sysrq_handle_unraw,
        .help_msg       = "unRaw",
-       .action_msg     = "Keyboard mode set to XLATE",
+       .action_msg     = "Keyboard mode set to system default",
        .enable_mask    = SYSRQ_ENABLE_KEYBOARD,
 };
 #else
index 23fa18a6654c3c53d30aaffb0eef51a4b8ff5249..a8e808461377cfd91d18cfbb2ef17c723c4ef822 100644 (file)
@@ -435,17 +435,12 @@ module_param(interrupts, bool, 0444);
 MODULE_PARM_DESC(interrupts, "Enable interrupts");
 
 static int tpm_tis_init(struct device *dev, resource_size_t start,
-                       resource_size_t len)
+                       resource_size_t len, unsigned int irq)
 {
        u32 vendor, intfcaps, intmask;
        int rc, i;
        struct tpm_chip *chip;
 
-       if (!start)
-               start = TIS_MEM_BASE;
-       if (!len)
-               len = TIS_MEM_LEN;
-
        if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
                return -ENODEV;
 
@@ -512,7 +507,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
        iowrite32(intmask,
                  chip->vendor.iobase +
                  TPM_INT_ENABLE(chip->vendor.locality));
-       if (interrupts) {
+       if (interrupts)
+               chip->vendor.irq = irq;
+       if (interrupts && !chip->vendor.irq) {
                chip->vendor.irq =
                    ioread8(chip->vendor.iobase +
                            TPM_INT_VECTOR(chip->vendor.locality));
@@ -597,10 +594,17 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
                                      const struct pnp_device_id *pnp_id)
 {
        resource_size_t start, len;
+       unsigned int irq = 0;
+
        start = pnp_mem_start(pnp_dev, 0);
        len = pnp_mem_len(pnp_dev, 0);
 
-       return tpm_tis_init(&pnp_dev->dev, start, len);
+       if (pnp_irq_valid(pnp_dev, 0))
+               irq = pnp_irq(pnp_dev, 0);
+       else
+               interrupts = 0;
+
+       return tpm_tis_init(&pnp_dev->dev, start, len, irq);
 }
 
 static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
@@ -660,7 +664,7 @@ static int __init init_tis(void)
                        return rc;
                if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
                        return PTR_ERR(pdev);
-               if((rc=tpm_tis_init(&pdev->dev, 0, 0)) != 0) {
+               if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
                        platform_device_unregister(pdev);
                        driver_unregister(&tis_drv);
                }
index 3ee73cf64bd215b2c95bff74790349e86af76708..745d552620bfc21229d286a8bc40827fd7811d3b 100644 (file)
@@ -206,8 +206,6 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
 
 EXPORT_SYMBOL(tty_termios_input_baud_rate);
 
-#ifdef BOTHER
-
 /**
  *     tty_termios_encode_baud_rate
  *     @termios: ktermios structure holding user requested state
@@ -225,6 +223,9 @@ EXPORT_SYMBOL(tty_termios_input_baud_rate);
  *
  *     Locking: Caller should hold termios lock. This is already held
  *     when calling this function from the driver termios handler.
+ *
+ *     The ifdefs deal with platforms whose owners have yet to update them
+ *     and will all go away once this is done.
  */
 
 void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud)
@@ -234,9 +235,13 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed
        int iclose = ibaud/50, oclose = obaud/50;
        int ibinput = 0;
 
+       if (obaud == 0)                 /* CD dropped             */
+               ibaud = 0;              /* Clear ibaud to be sure */
+
        termios->c_ispeed = ibaud;
        termios->c_ospeed = obaud;
 
+#ifdef BOTHER
        /* If the user asked for a precise weird speed give a precise weird
           answer. If they asked for a Bfoo speed they many have problems
           digesting non-exact replies so fuzz a bit */
@@ -247,32 +252,60 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed
                iclose = 0;
        if ((termios->c_cflag >> IBSHIFT) & CBAUD)
                ibinput = 1;    /* An input speed was specified */
-
+#endif
        termios->c_cflag &= ~CBAUD;
 
+       /*
+        *      Our goal is to find a close match to the standard baud rate
+        *      returned. Walk the baud rate table and if we get a very close
+        *      match then report back the speed as a POSIX Bxxxx value by
+        *      preference
+        */
+
        do {
                if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) {
                        termios->c_cflag |= baud_bits[i];
                        ofound = i;
                }
                if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) {
-                       /* For the case input == output don't set IBAUD bits if the user didn't do so */
-                       if (ofound != i || ibinput)
+                       if (ofound == i && !ibinput)
+                               ifound  = i;
+#ifdef IBSHIFT
+                       else {
+                               ifound = i;
                                termios->c_cflag |= (baud_bits[i] << IBSHIFT);
-                       ifound = i;
+                       }
+#endif
                }
        } while (++i < n_baud_table);
+
+       /*
+        *      If we found no match then use BOTHER if provided or warn
+        *      the user their platform maintainer needs to wake up if not.
+        */
+#ifdef BOTHER
        if (ofound == -1)
                termios->c_cflag |= BOTHER;
        /* Set exact input bits only if the input and output differ or the
           user already did */
        if (ifound == -1 && (ibaud != obaud || ibinput))
                termios->c_cflag |= (BOTHER << IBSHIFT);
+#else
+       if (ifound == -1 || ofound == -1) {
+               static int warned;
+               if (!warned++)
+                       printk(KERN_WARNING "tty: Unable to return correct "
+                         "speed data as your architecture needs updating.\n");
+       }
+#endif
 }
-
 EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate);
 
-#endif
+void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud)
+{
+       tty_termios_encode_baud_rate(tty->termios, ibaud, obaud);
+}
+EXPORT_SYMBOL_GPL(tty_encode_baud_rate);
 
 /**
  *     tty_get_baud_rate       -       get tty bit rates
@@ -303,6 +336,29 @@ speed_t tty_get_baud_rate(struct tty_struct *tty)
 
 EXPORT_SYMBOL(tty_get_baud_rate);
 
+/**
+ *     tty_termios_copy_hw     -       copy hardware settings
+ *     @new: New termios
+ *     @old: Old termios
+ *
+ *     Propogate the hardware specific terminal setting bits from
+ *     the old termios structure to the new one. This is used in cases
+ *     where the hardware does not support reconfiguration or as a helper
+ *     in some cases where only minimal reconfiguration is supported
+ */
+
+void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old)
+{
+       /* The bits a dumb device handles in software. Smart devices need
+          to always provide a set_termios method */
+       new->c_cflag &= HUPCL | CREAD | CLOCAL;
+       new->c_cflag |= old->c_cflag & ~(HUPCL | CREAD | CLOCAL);
+       new->c_ispeed = old->c_ispeed;
+       new->c_ospeed = old->c_ospeed;
+}
+
+EXPORT_SYMBOL(tty_termios_copy_hw);
+
 /**
  *     change_termios          -       update termios values
  *     @tty: tty to update
@@ -340,13 +396,12 @@ static void change_termios(struct tty_struct * tty, struct ktermios * new_termio
                tty->erasing = 0;
        }
        
-       
+       /* This bit should be in the ldisc code */
        if (canon_change && !L_ICANON(tty) && tty->read_cnt)
                /* Get characters left over from canonical mode. */
                wake_up_interruptible(&tty->read_wait);
 
        /* See if packet mode change of state. */
-
        if (tty->link && tty->link->packet) {
                int old_flow = ((old_termios.c_iflag & IXON) &&
                                (old_termios.c_cc[VSTOP] == '\023') &&
@@ -366,6 +421,8 @@ static void change_termios(struct tty_struct * tty, struct ktermios * new_termio
           
        if (tty->driver->set_termios)
                (*tty->driver->set_termios)(tty, &old_termios);
+       else
+               tty_termios_copy_hw(tty->termios, &old_termios);
 
        ld = tty_ldisc_ref(tty);
        if (ld != NULL) {
@@ -440,6 +497,11 @@ static int set_termios(struct tty_struct * tty, void __user *arg, int opt)
        }
 
        change_termios(tty, &tmp_termios);
+
+       /* FIXME: Arguably if tmp_termios == tty->termios AND the
+          actual requested termios was not tmp_termios then we may
+          want to return an error as no user requested change has
+          succeeded */
        return 0;
 }
 
index 0d56f8fc105c9314fb9b9e73b539d8acbb7ddfe1..645ad9808982526cf8f7ae4fdf682e2a433ed72e 100644 (file)
@@ -158,7 +158,11 @@ static void blank_screen_t(unsigned long dummy);
 static void set_palette(struct vc_data *vc);
 
 static int printable;          /* Is console ready for printing? */
-static int default_utf8;
+#ifdef CONFIG_VT_UNICODE
+int default_utf8 = 1;
+#else
+int default_utf8;
+#endif
 module_param(default_utf8, int, S_IRUGO | S_IWUSR);
 
 /*
index f69a8258095cf6de5129f0ba9190f060ae5e5628..e6f89e8b9258429fc99754ec492918d94089bcfd 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/major.h>
 #include <linux/fs.h>
 #include <linux/console.h>
+#include <linux/consolemap.h>
 #include <linux/signal.h>
 #include <linux/timex.h>
 
@@ -582,10 +583,27 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
        case KDGKBDIACR:
        {
                struct kbdiacrs __user *a = up;
+               struct kbdiacr diacr;
+               int i;
 
                if (put_user(accent_table_size, &a->kb_cnt))
                        return -EFAULT;
-               if (copy_to_user(a->kbdiacr, accent_table, accent_table_size*sizeof(struct kbdiacr)))
+               for (i = 0; i < accent_table_size; i++) {
+                       diacr.diacr = conv_uni_to_8bit(accent_table[i].diacr);
+                       diacr.base = conv_uni_to_8bit(accent_table[i].base);
+                       diacr.result = conv_uni_to_8bit(accent_table[i].result);
+                       if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr)))
+                               return -EFAULT;
+               }
+               return 0;
+       }
+       case KDGKBDIACRUC:
+       {
+               struct kbdiacrsuc __user *a = up;
+
+               if (put_user(accent_table_size, &a->kb_cnt))
+                       return -EFAULT;
+               if (copy_to_user(a->kbdiacruc, accent_table, accent_table_size*sizeof(struct kbdiacruc)))
                        return -EFAULT;
                return 0;
        }
@@ -593,6 +611,30 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
        case KDSKBDIACR:
        {
                struct kbdiacrs __user *a = up;
+               struct kbdiacr diacr;
+               unsigned int ct;
+               int i;
+
+               if (!perm)
+                       return -EPERM;
+               if (get_user(ct,&a->kb_cnt))
+                       return -EFAULT;
+               if (ct >= MAX_DIACR)
+                       return -EINVAL;
+               accent_table_size = ct;
+               for (i = 0; i < ct; i++) {
+                       if (copy_from_user(&diacr, a->kbdiacr + i, sizeof(struct kbdiacr)))
+                               return -EFAULT;
+                       accent_table[i].diacr = conv_8bit_to_uni(diacr.diacr);
+                       accent_table[i].base = conv_8bit_to_uni(diacr.base);
+                       accent_table[i].result = conv_8bit_to_uni(diacr.result);
+               }
+               return 0;
+       }
+
+       case KDSKBDIACRUC:
+       {
+               struct kbdiacrsuc __user *a = up;
                unsigned int ct;
 
                if (!perm)
@@ -602,7 +644,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                if (ct >= MAX_DIACR)
                        return -EINVAL;
                accent_table_size = ct;
-               if (copy_from_user(accent_table, a->kbdiacr, ct*sizeof(struct kbdiacr)))
+               if (copy_from_user(accent_table, a->kbdiacruc, ct*sizeof(struct kbdiacruc)))
                        return -EFAULT;
                return 0;
        }
@@ -1083,7 +1125,7 @@ int vt_waitactive(int vt)
 void reset_vc(struct vc_data *vc)
 {
        vc->vc_mode = KD_TEXT;
-       kbd_table[vc->vc_num].kbdmode = VC_XLATE;
+       kbd_table[vc->vc_num].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
        vc->vt_mode.mode = VT_AUTO;
        vc->vt_mode.waitv = 0;
        vc->vt_mode.relsig = 0;
index 5a1d426744d69751e4cd4cf77556675d4c6dae09..e5c62b75f36f1adefe418e28d6089fc83dc4f6f9 100644 (file)
@@ -1446,21 +1446,20 @@ static struct platform_driver iop_adma_driver = {
 
 static int __init iop_adma_init (void)
 {
-       /* it's currently unsafe to unload this module */
-       /* if forced, worst case is that rmmod hangs */
-       __unsafe(THIS_MODULE);
-
        return platform_driver_register(&iop_adma_driver);
 }
 
+/* it's currently unsafe to unload this module */
+#if 0
 static void __exit iop_adma_exit (void)
 {
        platform_driver_unregister(&iop_adma_driver);
        return;
 }
+module_exit(iop_adma_exit);
+#endif
 
 module_init(iop_adma_init);
-module_exit(iop_adma_exit);
 
 MODULE_AUTHOR("Intel Corporation");
 MODULE_DESCRIPTION("IOP ADMA Engine Driver");
index d9c92c5e007730ac62f7140ef51f5edb9d5eafb3..66436bae11acbcde6aa1074ea4ba3513073e5376 100644 (file)
@@ -49,8 +49,6 @@
 
 #define DRIVER_NAME                    "menelaus"
 
-#define pr_err(fmt, arg...)    printk(KERN_ERR DRIVER_NAME ": ", ## arg);
-
 #define MENELAUS_I2C_ADDRESS           0x72
 
 #define MENELAUS_REV                   0x01
@@ -155,7 +153,7 @@ static int menelaus_write_reg(int reg, u8 value)
        int val = i2c_smbus_write_byte_data(the_menelaus->client, reg, value);
 
        if (val < 0) {
-               pr_err("write error");
+               pr_err(DRIVER_NAME ": write error");
                return val;
        }
 
@@ -167,7 +165,7 @@ static int menelaus_read_reg(int reg)
        int val = i2c_smbus_read_byte_data(the_menelaus->client, reg);
 
        if (val < 0)
-               pr_err("read error");
+               pr_err(DRIVER_NAME ": read error");
 
        return val;
 }
@@ -1177,7 +1175,7 @@ static int menelaus_probe(struct i2c_client *client)
        /* If a true probe check the device */
        rev = menelaus_read_reg(MENELAUS_REV);
        if (rev < 0) {
-               pr_err("device not found");
+               pr_err(DRIVER_NAME ": device not found");
                err = -ENODEV;
                goto fail1;
        }
@@ -1258,7 +1256,7 @@ static int __init menelaus_init(void)
 
        res = i2c_add_driver(&menelaus_i2c_driver);
        if (res < 0) {
-               pr_err("driver registration failed\n");
+               pr_err(DRIVER_NAME ": driver registration failed\n");
                return res;
        }
 
index 8cce016b3d0936ce2cbdb2c2e7a348c137f7cfab..2766e4fc4ea82e36cfa7ce205076ad7f1c3cae44 100644 (file)
@@ -282,7 +282,7 @@ static void
 adbhid_input_keycode(int id, int scancode, int repeat)
 {
        struct adbhid *ahid = adbhid[id];
-       int keycode, up_flag;
+       int keycode, up_flag, key;
 
        keycode = scancode & 0x7f;
        up_flag = scancode & 0x80;
index 0dc563d76b393208465e8209470ec982b88c4cbd..c059ae6f37e5ae1fe789e3fad66ad0a91da3a264 100644 (file)
@@ -2714,7 +2714,7 @@ action_show(mddev_t *mddev, char *page)
 {
        char *type = "idle";
        if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
-           test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) {
+           (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) {
                if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
                        type = "reshape";
                else if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
@@ -2833,6 +2833,12 @@ sync_max_store(mddev_t *mddev, const char *buf, size_t len)
 static struct md_sysfs_entry md_sync_max =
 __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store);
 
+static ssize_t
+degraded_show(mddev_t *mddev, char *page)
+{
+       return sprintf(page, "%d\n", mddev->degraded);
+}
+static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);
 
 static ssize_t
 sync_speed_show(mddev_t *mddev, char *page)
@@ -2976,6 +2982,7 @@ static struct attribute *md_redundancy_attrs[] = {
        &md_suspend_lo.attr,
        &md_suspend_hi.attr,
        &md_bitmap.attr,
+       &md_degraded.attr,
        NULL,
 };
 static struct attribute_group md_redundancy_group = {
@@ -5770,26 +5777,47 @@ static int __init md_init(void)
  * Searches all registered partitions for autorun RAID arrays
  * at boot time.
  */
-static dev_t detected_devices[128];
-static int dev_cnt;
+
+static LIST_HEAD(all_detected_devices);
+struct detected_devices_node {
+       struct list_head list;
+       dev_t dev;
+};
 
 void md_autodetect_dev(dev_t dev)
 {
-       if (dev_cnt >= 0 && dev_cnt < 127)
-               detected_devices[dev_cnt++] = dev;
+       struct detected_devices_node *node_detected_dev;
+
+       node_detected_dev = kzalloc(sizeof(*node_detected_dev), GFP_KERNEL);
+       if (node_detected_dev) {
+               node_detected_dev->dev = dev;
+               list_add_tail(&node_detected_dev->list, &all_detected_devices);
+       } else {
+               printk(KERN_CRIT "md: md_autodetect_dev: kzalloc failed"
+                       ", skipping dev(%d,%d)\n", MAJOR(dev), MINOR(dev));
+       }
 }
 
 
 static void autostart_arrays(int part)
 {
        mdk_rdev_t *rdev;
-       int i;
+       struct detected_devices_node *node_detected_dev;
+       dev_t dev;
+       int i_scanned, i_passed;
 
-       printk(KERN_INFO "md: Autodetecting RAID arrays.\n");
+       i_scanned = 0;
+       i_passed = 0;
 
-       for (i = 0; i < dev_cnt; i++) {
-               dev_t dev = detected_devices[i];
+       printk(KERN_INFO "md: Autodetecting RAID arrays.\n");
 
+       while (!list_empty(&all_detected_devices) && i_scanned < INT_MAX) {
+               i_scanned++;
+               node_detected_dev = list_entry(all_detected_devices.next,
+                                       struct detected_devices_node, list);
+               list_del(&node_detected_dev->list);
+               dev = node_detected_dev->dev;
+               kfree(node_detected_dev);
                rdev = md_import_device(dev,0, 90);
                if (IS_ERR(rdev))
                        continue;
@@ -5799,8 +5827,11 @@ static void autostart_arrays(int part)
                        continue;
                }
                list_add(&rdev->same_set, &pending_raid_disks);
+               i_passed++;
        }
-       dev_cnt = 0;
+
+       printk(KERN_INFO "md: Scanned %d and added %d devices.\n",
+                                               i_scanned, i_passed);
 
        autorun_devices(part);
 }
index e79e1a538d44cda459f00dffa89e4c93bc15b421..c111105fc2dc66ae162cb44039b27ccd100ad352 100644 (file)
@@ -472,7 +472,7 @@ bad_map:
        bio_io_error(bio);
        return 0;
 }
-                          
+
 static void raid0_status (struct seq_file *seq, mddev_t *mddev)
 {
 #undef MD_DEBUG
@@ -480,18 +480,18 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
        int j, k, h;
        char b[BDEVNAME_SIZE];
        raid0_conf_t *conf = mddev_to_conf(mddev);
-  
+
        h = 0;
        for (j = 0; j < conf->nr_strip_zones; j++) {
                seq_printf(seq, "      z%d", j);
                if (conf->hash_table[h] == conf->strip_zone+j)
-                       seq_printf("(h%d)", h++);
+                       seq_printf(seq, "(h%d)", h++);
                seq_printf(seq, "=[");
                for (k = 0; k < conf->strip_zone[j].nb_dev; k++)
-                       seq_printf (seq, "%s/", bdevname(
+                       seq_printf(seq, "%s/", bdevname(
                                conf->strip_zone[j].dev[k]->bdev,b));
 
-               seq_printf (seq, "] zo=%d do=%d s=%d\n",
+               seq_printf(seq, "] zo=%d do=%d s=%d\n",
                                conf->strip_zone[j].zone_offset,
                                conf->strip_zone[j].dev_offset,
                                conf->strip_zone[j].size);
index 0bcefad8241334bcd7a83358ccdd1901cca04254..16775a0df7f6dbedb1648fc45793521557be3b5b 100644 (file)
@@ -1214,7 +1214,8 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
                                        j = 0;
                                if (j >= 0)
                                        mddev->resync_mismatches += r1_bio->sectors;
-                               if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
+                               if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)
+                                             && test_bit(BIO_UPTODATE, &sbio->bi_flags))) {
                                        sbio->bi_end_io = NULL;
                                        rdev_dec_pending(conf->mirrors[i].rdev, mddev);
                                } else {
index 8c83ee3b0920e34991c00f4783a7e8ca8bf6c37c..ce8f1a34ed2130fbcb7eae0dc6c53c81d689f0c5 100644 (file)
@@ -41,8 +41,6 @@
 
 struct i2o_driver i2o_exec_driver;
 
-static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind);
-
 /* global wait list for POST WAIT */
 static LIST_HEAD(i2o_exec_wait_list);
 
@@ -369,6 +367,53 @@ static int i2o_exec_remove(struct device *dev)
        return 0;
 };
 
+#ifdef CONFIG_I2O_LCT_NOTIFY_ON_CHANGES
+/**
+ *     i2o_exec_lct_notify - Send a asynchronus LCT NOTIFY request
+ *     @c: I2O controller to which the request should be send
+ *     @change_ind: change indicator
+ *
+ *     This function sends a LCT NOTIFY request to the I2O controller with
+ *     the change indicator change_ind. If the change_ind == 0 the controller
+ *     replies immediately after the request. If change_ind > 0 the reply is
+ *     send after change indicator of the LCT is > change_ind.
+ */
+static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
+{
+       i2o_status_block *sb = c->status_block.virt;
+       struct device *dev;
+       struct i2o_message *msg;
+
+       mutex_lock(&c->lct_lock);
+
+       dev = &c->pdev->dev;
+
+       if (i2o_dma_realloc
+           (dev, &c->dlct, le32_to_cpu(sb->expected_lct_size), GFP_KERNEL))
+               return -ENOMEM;
+
+       msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
+       if (IS_ERR(msg))
+               return PTR_ERR(msg);
+
+       msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
+       msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 |
+                                    ADAPTER_TID);
+       msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
+       msg->u.s.tcntxt = cpu_to_le32(0x00000000);
+       msg->body[0] = cpu_to_le32(0xffffffff);
+       msg->body[1] = cpu_to_le32(change_ind);
+       msg->body[2] = cpu_to_le32(0xd0000000 | c->dlct.len);
+       msg->body[3] = cpu_to_le32(c->dlct.phys);
+
+       i2o_msg_post(c, msg);
+
+       mutex_unlock(&c->lct_lock);
+
+       return 0;
+}
+#endif
+
 /**
  *     i2o_exec_lct_modified - Called on LCT NOTIFY reply
  *     @_work: work struct for a specific controller
@@ -525,51 +570,6 @@ int i2o_exec_lct_get(struct i2o_controller *c)
        return rc;
 }
 
-/**
- *     i2o_exec_lct_notify - Send a asynchronus LCT NOTIFY request
- *     @c: I2O controller to which the request should be send
- *     @change_ind: change indicator
- *
- *     This function sends a LCT NOTIFY request to the I2O controller with
- *     the change indicator change_ind. If the change_ind == 0 the controller
- *     replies immediately after the request. If change_ind > 0 the reply is
- *     send after change indicator of the LCT is > change_ind.
- */
-static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
-{
-       i2o_status_block *sb = c->status_block.virt;
-       struct device *dev;
-       struct i2o_message *msg;
-
-       mutex_lock(&c->lct_lock);
-
-       dev = &c->pdev->dev;
-
-       if (i2o_dma_realloc
-           (dev, &c->dlct, le32_to_cpu(sb->expected_lct_size), GFP_KERNEL))
-               return -ENOMEM;
-
-       msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
-       if (IS_ERR(msg))
-               return PTR_ERR(msg);
-
-       msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
-       msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 |
-                                    ADAPTER_TID);
-       msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context);
-       msg->u.s.tcntxt = cpu_to_le32(0x00000000);
-       msg->body[0] = cpu_to_le32(0xffffffff);
-       msg->body[1] = cpu_to_le32(change_ind);
-       msg->body[2] = cpu_to_le32(0xd0000000 | c->dlct.len);
-       msg->body[3] = cpu_to_le32(c->dlct.phys);
-
-       i2o_msg_post(c, msg);
-
-       mutex_unlock(&c->lct_lock);
-
-       return 0;
-};
-
 /* Exec OSM driver struct */
 struct i2o_driver i2o_exec_driver = {
        .name = OSM_NAME,
index 73e248fb2ff190ba0ecac84e3ac849d531c08bb1..346c44eff95eb91370fc832664c2632956473d4d 100644 (file)
@@ -203,4 +203,16 @@ config THINKPAD_ACPI_BAY
          If you are not sure, say Y here.
 
 
+config ATMEL_SSC
+       tristate "Device driver for Atmel SSC peripheral"
+       depends on AVR32 || ARCH_AT91
+       ---help---
+         This option enables device driver support for Atmel Syncronized
+         Serial Communication peripheral (SSC).
+
+         The SSC peripheral supports a wide variety of serial frame based
+         communications, i.e. I2S, SPI, etc.
+
+         If unsure, say N.
+
 endif # MISC_DEVICES
index b5ce0e3dba861ea037e78a939ecdc60ab758c8c6..a24c61475c2f8afcd3490a89055bab3587e9b39d 100644 (file)
@@ -7,6 +7,7 @@ obj-$(CONFIG_IBM_ASM)           += ibmasm/
 obj-$(CONFIG_HDPU_FEATURES)    += hdpuftrs/
 obj-$(CONFIG_MSI_LAPTOP)     += msi-laptop.o
 obj-$(CONFIG_ASUS_LAPTOP)     += asus-laptop.o
+obj-$(CONFIG_ATMEL_SSC)                += atmel-ssc.o
 obj-$(CONFIG_LKDTM)            += lkdtm.o
 obj-$(CONFIG_TIFM_CORE)        += tifm_core.o
 obj-$(CONFIG_TIFM_7XX1)        += tifm_7xx1.o
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
new file mode 100644 (file)
index 0000000..058ccac
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Atmel SSC driver
+ *
+ * Copyright (C) 2007 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/list.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+#include <linux/atmel-ssc.h>
+
+/* Serialize access to ssc_list and user count */
+static DEFINE_SPINLOCK(user_lock);
+static LIST_HEAD(ssc_list);
+
+struct ssc_device *ssc_request(unsigned int ssc_num)
+{
+       int ssc_valid = 0;
+       struct ssc_device *ssc;
+
+       spin_lock(&user_lock);
+       list_for_each_entry(ssc, &ssc_list, list) {
+               if (ssc->pdev->id == ssc_num) {
+                       ssc_valid = 1;
+                       break;
+               }
+       }
+
+       if (!ssc_valid) {
+               spin_unlock(&user_lock);
+               dev_dbg(&ssc->pdev->dev, "could not find requested device\n");
+               return ERR_PTR(-ENODEV);
+       }
+
+       if (ssc->user) {
+               spin_unlock(&user_lock);
+               dev_dbg(&ssc->pdev->dev, "module busy\n");
+               return ERR_PTR(-EBUSY);
+       }
+       ssc->user++;
+       spin_unlock(&user_lock);
+
+       clk_enable(ssc->clk);
+
+       return ssc;
+}
+EXPORT_SYMBOL(ssc_request);
+
+void ssc_free(struct ssc_device *ssc)
+{
+       spin_lock(&user_lock);
+       if (ssc->user) {
+               ssc->user--;
+               clk_disable(ssc->clk);
+       } else {
+               dev_dbg(&ssc->pdev->dev, "device already free\n");
+       }
+       spin_unlock(&user_lock);
+}
+EXPORT_SYMBOL(ssc_free);
+
+static int __init ssc_probe(struct platform_device *pdev)
+{
+       int retval = 0;
+       struct resource *regs;
+       struct ssc_device *ssc;
+
+       ssc = kzalloc(sizeof(struct ssc_device), GFP_KERNEL);
+       if (!ssc) {
+               dev_dbg(&pdev->dev, "out of memory\n");
+               retval = -ENOMEM;
+               goto out;
+       }
+
+       regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!regs) {
+               dev_dbg(&pdev->dev, "no mmio resource defined\n");
+               retval = -ENXIO;
+               goto out_free;
+       }
+
+       ssc->clk = clk_get(&pdev->dev, "pclk");
+       if (IS_ERR(ssc->clk)) {
+               dev_dbg(&pdev->dev, "no pclk clock defined\n");
+               retval = -ENXIO;
+               goto out_free;
+       }
+
+       ssc->pdev = pdev;
+       ssc->regs = ioremap(regs->start, regs->end - regs->start + 1);
+       if (!ssc->regs) {
+               dev_dbg(&pdev->dev, "ioremap failed\n");
+               retval = -EINVAL;
+               goto out_clk;
+       }
+
+       /* disable all interrupts */
+       clk_enable(ssc->clk);
+       ssc_writel(ssc->regs, IDR, ~0UL);
+       ssc_readl(ssc->regs, SR);
+       clk_disable(ssc->clk);
+
+       ssc->irq = platform_get_irq(pdev, 0);
+       if (!ssc->irq) {
+               dev_dbg(&pdev->dev, "could not get irq\n");
+               retval = -ENXIO;
+               goto out_unmap;
+       }
+
+       spin_lock(&user_lock);
+       list_add_tail(&ssc->list, &ssc_list);
+       spin_unlock(&user_lock);
+
+       platform_set_drvdata(pdev, ssc);
+
+       dev_info(&pdev->dev, "Atmel SSC device at 0x%p (irq %d)\n",
+                       ssc->regs, ssc->irq);
+
+       goto out;
+
+out_unmap:
+       iounmap(ssc->regs);
+out_clk:
+       clk_put(ssc->clk);
+out_free:
+       kfree(ssc);
+out:
+       return retval;
+}
+
+static int __devexit ssc_remove(struct platform_device *pdev)
+{
+       struct ssc_device *ssc = platform_get_drvdata(pdev);
+
+       spin_lock(&user_lock);
+       iounmap(ssc->regs);
+       clk_put(ssc->clk);
+       list_del(&ssc->list);
+       kfree(ssc);
+       spin_unlock(&user_lock);
+
+       return 0;
+}
+
+static struct platform_driver ssc_driver = {
+       .remove         = __devexit_p(ssc_remove),
+       .driver         = {
+               .name           = "ssc",
+       },
+};
+
+static int __init ssc_init(void)
+{
+       return platform_driver_probe(&ssc_driver, ssc_probe);
+}
+module_init(ssc_init);
+
+static void __exit ssc_exit(void)
+{
+       platform_driver_unregister(&ssc_driver);
+}
+module_exit(ssc_exit);
+
+MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>");
+MODULE_DESCRIPTION("SSC driver for Atmel AVR32 and AT91");
+MODULE_LICENSE("GPL");
index 71b986b38c55e1d5d57edc64cfc26b2b58408314..7ae18eaed6c5d869d3e7d89bffd484bbe9798147 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/crc7.h>
 #include <linux/crc-itu-t.h>
+#include <linux/scatterlist.h>
 
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>             /* for R1_SPI_* bit values */
index 1297732f4db95c4275e9f3f78b81345d48787572..880fa369035296bbd85e5f8027249a78f59d42f3 100644 (file)
@@ -933,8 +933,7 @@ write_error:
  * @cache: the lock tree entry slab cache
  * @flags: constructor flags
  */
-static void ltree_entry_ctor(void *obj, struct kmem_cache *cache,
-                            unsigned long flags)
+static void ltree_entry_ctor(struct kmem_cache *cache, void *obj)
 {
        struct ltree_entry *le = obj;
 
index 8d3893da06f539da701c45b29cb158f2705543d5..862f47223fdc9e26e18df0babf94c5ca5eaefed5 100644 (file)
@@ -3118,7 +3118,13 @@ static void acpi_set_WOL(struct net_device *dev)
                iowrite16(SetRxFilter|RxStation|RxMulticast|RxBroadcast, ioaddr + EL3_CMD);
                iowrite16(RxEnable, ioaddr + EL3_CMD);
 
-               pci_enable_wake(VORTEX_PCI(vp), 0, 1);
+               if (pci_enable_wake(VORTEX_PCI(vp), PCI_D3hot, 1)) {
+                       printk(KERN_INFO "%s: WOL not supported.\n",
+                                       pci_name(VORTEX_PCI(vp)));
+
+                       vp->enable_wol = 0;
+                       return;
+               }
 
                /* Change the power state to D3; RxEnable doesn't take effect. */
                pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot);
index 8f99a062661608d39c59eb8dc9d3afb1c21c71c2..83d52c8acab0399ea82c71b259181b8e0573523f 100644 (file)
@@ -2173,6 +2173,16 @@ config SKGE
          To compile this driver as a module, choose M here: the module
          will be called skge.  This is recommended.
 
+config SKGE_DEBUG
+       bool "Debugging interface"
+       depends on SKGE && DEBUG_FS
+       help
+        This option adds the ability to dump driver state for debugging.
+        The file debugfs/skge/ethX displays the state of the internal
+        transmit and receive rings.
+
+        If unsure, say N.
+
 config SKY2
        tristate "SysKonnect Yukon2 support"
        depends on PCI
index db80f243dd37e9d6f968cc3ab58b652e69f35c2b..6f85cc31f8a2f8090c23e1a1e98c00ff0762dfc1 100644 (file)
@@ -1263,6 +1263,7 @@ static void bond_setup_by_slave(struct net_device *bond_dev,
        struct bonding *bond = bond_dev->priv;
 
        bond_dev->neigh_setup           = slave_dev->neigh_setup;
+       bond_dev->header_ops            = slave_dev->header_ops;
 
        bond_dev->type              = slave_dev->type;
        bond_dev->hard_header_len   = slave_dev->hard_header_len;
@@ -3351,7 +3352,10 @@ static int bond_slave_netdev_event(unsigned long event, struct net_device *slave
        switch (event) {
        case NETDEV_UNREGISTER:
                if (bond_dev) {
-                       bond_release(bond_dev, slave_dev);
+                       if (bond->setup_by_slave)
+                               bond_release_and_destroy(bond_dev, slave_dev);
+                       else
+                               bond_release(bond_dev, slave_dev);
                }
                break;
        case NETDEV_CHANGE:
@@ -3366,11 +3370,6 @@ static int bond_slave_netdev_event(unsigned long event, struct net_device *slave
                 * ... Or is it this?
                 */
                break;
-       case NETDEV_GOING_DOWN:
-               dprintk("slave %s is going down\n", slave_dev->name);
-               if (bond->setup_by_slave)
-                       bond_release_and_destroy(bond_dev, slave_dev);
-               break;
        case NETDEV_CHANGEMTU:
                /*
                 * TODO: Should slaves be allowed to
index a8bbd563265cbdde92ae0e0f89a96d0e7a6e0409..b8180600a309545f720800bf68708969450564cb 100644 (file)
@@ -22,8 +22,8 @@
 #include "bond_3ad.h"
 #include "bond_alb.h"
 
-#define DRV_VERSION    "3.2.0"
-#define DRV_RELDATE    "September 13, 2007"
+#define DRV_VERSION    "3.2.1"
+#define DRV_RELDATE    "October 15, 2007"
 #define DRV_NAME       "bonding"
 #define DRV_DESCRIPTION        "Ethernet Channel Bonding Driver"
 
index b7a7e2ae5e139c6f37bb5021220d943cb0f5573a..0666e62e9ad29fb0fcbcd34043ac0178ed3325b3 100644 (file)
@@ -110,6 +110,7 @@ static int e1000_get_settings(struct net_device *netdev,
 {
        struct e1000_adapter *adapter = netdev_priv(netdev);
        struct e1000_hw *hw = &adapter->hw;
+       u32 status;
 
        if (hw->media_type == e1000_media_type_copper) {
 
@@ -147,16 +148,16 @@ static int e1000_get_settings(struct net_device *netdev,
                ecmd->transceiver = XCVR_EXTERNAL;
        }
 
-       if (er32(STATUS) & E1000_STATUS_LU) {
-
-               adapter->hw.mac.ops.get_link_up_info(hw, &adapter->link_speed,
-                                                 &adapter->link_duplex);
-               ecmd->speed = adapter->link_speed;
-
-               /* unfortunately FULL_DUPLEX != DUPLEX_FULL
-                *        and HALF_DUPLEX != DUPLEX_HALF */
+       status = er32(STATUS);
+       if (status & E1000_STATUS_LU) {
+               if (status & E1000_STATUS_SPEED_1000)
+                       ecmd->speed = 1000;
+               else if (status & E1000_STATUS_SPEED_100)
+                       ecmd->speed = 100;
+               else
+                       ecmd->speed = 10;
 
-               if (adapter->link_duplex == FULL_DUPLEX)
+               if (status & E1000_STATUS_FD)
                        ecmd->duplex = DUPLEX_FULL;
                else
                        ecmd->duplex = DUPLEX_HALF;
@@ -170,6 +171,16 @@ static int e1000_get_settings(struct net_device *netdev,
        return 0;
 }
 
+static u32 e1000_get_link(struct net_device *netdev)
+{
+       struct e1000_adapter *adapter = netdev_priv(netdev);
+       struct e1000_hw *hw = &adapter->hw;
+       u32 status;
+       
+       status = er32(STATUS);
+       return (status & E1000_STATUS_LU);
+}
+
 static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
 {
        struct e1000_mac_info *mac = &adapter->hw.mac;
@@ -1451,11 +1462,11 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)
        }
 
        *data = e1000_setup_desc_rings(adapter);
-       if (data)
+       if (*data)
                goto out;
 
        *data = e1000_setup_loopback_test(adapter);
-       if (data)
+       if (*data)
                goto err_loopback;
 
        *data = e1000_run_loopback_test(adapter);
@@ -1751,7 +1762,7 @@ static const struct ethtool_ops e1000_ethtool_ops = {
        .get_msglevel           = e1000_get_msglevel,
        .set_msglevel           = e1000_set_msglevel,
        .nway_reset             = e1000_nway_reset,
-       .get_link               = ethtool_op_get_link,
+       .get_link               = e1000_get_link,
        .get_eeprom_len         = e1000_get_eeprom_len,
        .get_eeprom             = e1000_get_eeprom,
        .set_eeprom             = e1000_set_eeprom,
index aa82f1afb7fb7d8fc0dc9b36c24ffa1e1e21681a..64515789fd4d51fb82c9fa3268c7b19a70a58368 100644 (file)
@@ -852,7 +852,7 @@ struct e1000_hw {
 
 #ifdef DEBUG
 #define hw_dbg(hw, format, arg...) \
-       printk(KERN_DEBUG, "%s: " format, e1000e_get_hw_dev_name(hw), ##arg);
+       printk(KERN_DEBUG "%s: " format, e1000e_get_hw_dev_name(hw), ##arg)
 #else
 static inline int __attribute__ ((format (printf, 2, 3)))
 hw_dbg(struct e1000_hw *hw, const char *format, ...)
index dae30b731342ef5e25e98318018984893b687665..cfbb7aacfe94bc5f46a1d0da4fbdb7349a1633a5 100644 (file)
 #else
 #define DRIVERNAPI
 #endif
-#define FORCEDETH_VERSION              "0.60"
+#define FORCEDETH_VERSION              "0.61"
 #define DRV_NAME                       "forcedeth"
 
 #include <linux/module.h>
@@ -752,7 +752,6 @@ struct fe_priv {
 
        /* General data:
         * Locking: spin_lock(&np->lock); */
-       struct net_device_stats stats;
        struct nv_ethtool_stats estats;
        int in_shutdown;
        u32 linkspeed;
@@ -1505,15 +1504,16 @@ static struct net_device_stats *nv_get_stats(struct net_device *dev)
                nv_get_hw_stats(dev);
 
                /* copy to net_device stats */
-               np->stats.tx_bytes = np->estats.tx_bytes;
-               np->stats.tx_fifo_errors = np->estats.tx_fifo_errors;
-               np->stats.tx_carrier_errors = np->estats.tx_carrier_errors;
-               np->stats.rx_crc_errors = np->estats.rx_crc_errors;
-               np->stats.rx_over_errors = np->estats.rx_over_errors;
-               np->stats.rx_errors = np->estats.rx_errors_total;
-               np->stats.tx_errors = np->estats.tx_errors_total;
-       }
-       return &np->stats;
+               dev->stats.tx_bytes = np->estats.tx_bytes;
+               dev->stats.tx_fifo_errors = np->estats.tx_fifo_errors;
+               dev->stats.tx_carrier_errors = np->estats.tx_carrier_errors;
+               dev->stats.rx_crc_errors = np->estats.rx_crc_errors;
+               dev->stats.rx_over_errors = np->estats.rx_over_errors;
+               dev->stats.rx_errors = np->estats.rx_errors_total;
+               dev->stats.tx_errors = np->estats.tx_errors_total;
+       }
+
+       return &dev->stats;
 }
 
 /*
@@ -1733,7 +1733,7 @@ static void nv_drain_tx(struct net_device *dev)
                        np->tx_ring.ex[i].buflow = 0;
                }
                if (nv_release_txskb(dev, &np->tx_skb[i]))
-                       np->stats.tx_dropped++;
+                       dev->stats.tx_dropped++;
        }
 }
 
@@ -2049,13 +2049,13 @@ static void nv_tx_done(struct net_device *dev)
                        if (flags & NV_TX_LASTPACKET) {
                                if (flags & NV_TX_ERROR) {
                                        if (flags & NV_TX_UNDERFLOW)
-                                               np->stats.tx_fifo_errors++;
+                                               dev->stats.tx_fifo_errors++;
                                        if (flags & NV_TX_CARRIERLOST)
-                                               np->stats.tx_carrier_errors++;
-                                       np->stats.tx_errors++;
+                                               dev->stats.tx_carrier_errors++;
+                                       dev->stats.tx_errors++;
                                } else {
-                                       np->stats.tx_packets++;
-                                       np->stats.tx_bytes += np->get_tx_ctx->skb->len;
+                                       dev->stats.tx_packets++;
+                                       dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
                                }
                                dev_kfree_skb_any(np->get_tx_ctx->skb);
                                np->get_tx_ctx->skb = NULL;
@@ -2064,13 +2064,13 @@ static void nv_tx_done(struct net_device *dev)
                        if (flags & NV_TX2_LASTPACKET) {
                                if (flags & NV_TX2_ERROR) {
                                        if (flags & NV_TX2_UNDERFLOW)
-                                               np->stats.tx_fifo_errors++;
+                                               dev->stats.tx_fifo_errors++;
                                        if (flags & NV_TX2_CARRIERLOST)
-                                               np->stats.tx_carrier_errors++;
-                                       np->stats.tx_errors++;
+                                               dev->stats.tx_carrier_errors++;
+                                       dev->stats.tx_errors++;
                                } else {
-                                       np->stats.tx_packets++;
-                                       np->stats.tx_bytes += np->get_tx_ctx->skb->len;
+                                       dev->stats.tx_packets++;
+                                       dev->stats.tx_bytes += np->get_tx_ctx->skb->len;
                                }
                                dev_kfree_skb_any(np->get_tx_ctx->skb);
                                np->get_tx_ctx->skb = NULL;
@@ -2107,7 +2107,7 @@ static void nv_tx_done_optimized(struct net_device *dev, int limit)
 
                if (flags & NV_TX2_LASTPACKET) {
                        if (!(flags & NV_TX2_ERROR))
-                               np->stats.tx_packets++;
+                               dev->stats.tx_packets++;
                        dev_kfree_skb_any(np->get_tx_ctx->skb);
                        np->get_tx_ctx->skb = NULL;
                }
@@ -2268,13 +2268,13 @@ static int nv_rx_process(struct net_device *dev, int limit)
 {
        struct fe_priv *np = netdev_priv(dev);
        u32 flags;
-       u32 rx_processed_cnt = 0;
+       int rx_work = 0;
        struct sk_buff *skb;
        int len;
 
        while((np->get_rx.orig != np->put_rx.orig) &&
              !((flags = le32_to_cpu(np->get_rx.orig->flaglen)) & NV_RX_AVAIL) &&
-               (rx_processed_cnt++ < limit)) {
+               (rx_work < limit)) {
 
                dprintk(KERN_DEBUG "%s: nv_rx_process: flags 0x%x.\n",
                                        dev->name, flags);
@@ -2308,7 +2308,7 @@ static int nv_rx_process(struct net_device *dev, int limit)
                                        if (flags & NV_RX_ERROR4) {
                                                len = nv_getlen(dev, skb->data, len);
                                                if (len < 0) {
-                                                       np->stats.rx_errors++;
+                                                       dev->stats.rx_errors++;
                                                        dev_kfree_skb(skb);
                                                        goto next_pkt;
                                                }
@@ -2322,12 +2322,12 @@ static int nv_rx_process(struct net_device *dev, int limit)
                                        /* the rest are hard errors */
                                        else {
                                                if (flags & NV_RX_MISSEDFRAME)
-                                                       np->stats.rx_missed_errors++;
+                                                       dev->stats.rx_missed_errors++;
                                                if (flags & NV_RX_CRCERR)
-                                                       np->stats.rx_crc_errors++;
+                                                       dev->stats.rx_crc_errors++;
                                                if (flags & NV_RX_OVERFLOW)
-                                                       np->stats.rx_over_errors++;
-                                               np->stats.rx_errors++;
+                                                       dev->stats.rx_over_errors++;
+                                               dev->stats.rx_errors++;
                                                dev_kfree_skb(skb);
                                                goto next_pkt;
                                        }
@@ -2343,7 +2343,7 @@ static int nv_rx_process(struct net_device *dev, int limit)
                                        if (flags & NV_RX2_ERROR4) {
                                                len = nv_getlen(dev, skb->data, len);
                                                if (len < 0) {
-                                                       np->stats.rx_errors++;
+                                                       dev->stats.rx_errors++;
                                                        dev_kfree_skb(skb);
                                                        goto next_pkt;
                                                }
@@ -2357,10 +2357,10 @@ static int nv_rx_process(struct net_device *dev, int limit)
                                        /* the rest are hard errors */
                                        else {
                                                if (flags & NV_RX2_CRCERR)
-                                                       np->stats.rx_crc_errors++;
+                                                       dev->stats.rx_crc_errors++;
                                                if (flags & NV_RX2_OVERFLOW)
-                                                       np->stats.rx_over_errors++;
-                                               np->stats.rx_errors++;
+                                                       dev->stats.rx_over_errors++;
+                                               dev->stats.rx_errors++;
                                                dev_kfree_skb(skb);
                                                goto next_pkt;
                                        }
@@ -2389,16 +2389,18 @@ static int nv_rx_process(struct net_device *dev, int limit)
                netif_rx(skb);
 #endif
                dev->last_rx = jiffies;
-               np->stats.rx_packets++;
-               np->stats.rx_bytes += len;
+               dev->stats.rx_packets++;
+               dev->stats.rx_bytes += len;
 next_pkt:
                if (unlikely(np->get_rx.orig++ == np->last_rx.orig))
                        np->get_rx.orig = np->first_rx.orig;
                if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx))
                        np->get_rx_ctx = np->first_rx_ctx;
+
+               rx_work++;
        }
 
-       return rx_processed_cnt;
+       return rx_work;
 }
 
 static int nv_rx_process_optimized(struct net_device *dev, int limit)
@@ -2505,8 +2507,8 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
                        }
 
                        dev->last_rx = jiffies;
-                       np->stats.rx_packets++;
-                       np->stats.rx_bytes += len;
+                       dev->stats.rx_packets++;
+                       dev->stats.rx_bytes += len;
                } else {
                        dev_kfree_skb(skb);
                }
@@ -3727,7 +3729,7 @@ static void nv_do_stats_poll(unsigned long data)
 static void nv_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        struct fe_priv *np = netdev_priv(dev);
-       strcpy(info->driver, "forcedeth");
+       strcpy(info->driver, DRV_NAME);
        strcpy(info->version, FORCEDETH_VERSION);
        strcpy(info->bus_info, pci_name(np->pci_dev));
 }
@@ -4991,6 +4993,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
        u32 phystate_orig = 0, phystate;
        int phyinitialized = 0;
        DECLARE_MAC_BUF(mac);
+       static int printed_version;
+
+       if (!printed_version++)
+               printk(KERN_INFO "%s: Reverse Engineered nForce ethernet"
+                      " driver. Version %s.\n", DRV_NAME, FORCEDETH_VERSION);
 
        dev = alloc_etherdev(sizeof(struct fe_priv));
        err = -ENOMEM;
@@ -5014,11 +5021,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
        np->stats_poll.function = &nv_do_stats_poll;    /* timer handler */
 
        err = pci_enable_device(pci_dev);
-       if (err) {
-               printk(KERN_INFO "forcedeth: pci_enable_dev failed (%d) for device %s\n",
-                               err, pci_name(pci_dev));
+       if (err)
                goto out_free;
-       }
 
        pci_set_master(pci_dev);
 
@@ -5047,8 +5051,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
                }
        }
        if (i == DEVICE_COUNT_RESOURCE) {
-               printk(KERN_INFO "forcedeth: Couldn't find register window for device %s.\n",
-                                       pci_name(pci_dev));
+               dev_printk(KERN_INFO, &pci_dev->dev,
+                          "Couldn't find register window\n");
                goto out_relreg;
        }
 
@@ -5061,16 +5065,14 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
                np->desc_ver = DESC_VER_3;
                np->txrxctl_bits = NVREG_TXRXCTL_DESC_3;
                if (dma_64bit) {
-                       if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) {
-                               printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n",
-                                      pci_name(pci_dev));
-                       } else {
+                       if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK))
+                               dev_printk(KERN_INFO, &pci_dev->dev,
+                                       "64-bit DMA failed, using 32-bit addressing\n");
+                       else
                                dev->features |= NETIF_F_HIGHDMA;
-                               printk(KERN_INFO "forcedeth: using HIGHDMA\n");
-                       }
                        if (pci_set_consistent_dma_mask(pci_dev, DMA_39BIT_MASK)) {
-                               printk(KERN_INFO "forcedeth: 64-bit DMA (consistent) failed, using 32-bit ring buffers for device %s.\n",
-                                      pci_name(pci_dev));
+                               dev_printk(KERN_INFO, &pci_dev->dev,
+                                       "64-bit DMA (consistent) failed, using 32-bit ring buffers\n");
                        }
                }
        } else if (id->driver_data & DEV_HAS_LARGEDESC) {
@@ -5205,9 +5207,11 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
                 * Bad mac address. At least one bios sets the mac address
                 * to 01:23:45:67:89:ab
                 */
-               printk(KERN_ERR "%s: Invalid Mac address detected: %s\n",
-                      pci_name(pci_dev), print_mac(mac, dev->dev_addr));
-               printk(KERN_ERR "Please complain to your hardware vendor. Switching to a random MAC.\n");
+               dev_printk(KERN_ERR, &pci_dev->dev,
+                       "Invalid Mac address detected: %s\n",
+                       print_mac(mac, dev->dev_addr));
+               dev_printk(KERN_ERR, &pci_dev->dev,
+                       "Please complain to your hardware vendor. Switching to a random MAC.\n");
                dev->dev_addr[0] = 0x00;
                dev->dev_addr[1] = 0x00;
                dev->dev_addr[2] = 0x6c;
@@ -5321,8 +5325,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
                break;
        }
        if (i == 33) {
-               printk(KERN_INFO "%s: open: Could not find a valid PHY.\n",
-                      pci_name(pci_dev));
+               dev_printk(KERN_INFO, &pci_dev->dev,
+                       "open: Could not find a valid PHY.\n");
                goto out_error;
        }
 
@@ -5344,12 +5348,37 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
 
        err = register_netdev(dev);
        if (err) {
-               printk(KERN_INFO "forcedeth: unable to register netdev: %d\n", err);
+               dev_printk(KERN_INFO, &pci_dev->dev,
+                          "unable to register netdev: %d\n", err);
                goto out_error;
        }
-       printk(KERN_INFO "%s: forcedeth.c: subsystem: %05x:%04x bound to %s\n",
-                       dev->name, pci_dev->subsystem_vendor, pci_dev->subsystem_device,
-                       pci_name(pci_dev));
+
+       dev_printk(KERN_INFO, &pci_dev->dev, "ifname %s, PHY OUI 0x%x @ %d, "
+                  "addr %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
+                  dev->name,
+                  np->phy_oui,
+                  np->phyaddr,
+                  dev->dev_addr[0],
+                  dev->dev_addr[1],
+                  dev->dev_addr[2],
+                  dev->dev_addr[3],
+                  dev->dev_addr[4],
+                  dev->dev_addr[5]);
+
+       dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n",
+                  dev->features & NETIF_F_HIGHDMA ? "highdma " : "",
+                  dev->features & (NETIF_F_HW_CSUM | NETIF_F_SG) ?
+                       "csum " : "",
+                  dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ?
+                       "vlan " : "",
+                  id->driver_data & DEV_HAS_POWER_CNTRL ? "pwrctl " : "",
+                  id->driver_data & DEV_HAS_MGMT_UNIT ? "mgmt " : "",
+                  id->driver_data & DEV_NEED_TIMERIRQ ? "timirq " : "",
+                  np->gigabit == PHY_GIGABIT ? "gbit " : "",
+                  np->need_linktimer ? "lnktim " : "",
+                  np->msi_flags & NV_MSI_CAPABLE ? "msi " : "",
+                  np->msi_flags & NV_MSI_X_CAPABLE ? "msi-x " : "",
+                  np->desc_ver);
 
        return 0;
 
@@ -5567,17 +5596,16 @@ static struct pci_device_id pci_tbl[] = {
 };
 
 static struct pci_driver driver = {
-       .name = "forcedeth",
-       .id_table = pci_tbl,
-       .probe = nv_probe,
-       .remove = __devexit_p(nv_remove),
-       .suspend = nv_suspend,
-       .resume = nv_resume,
+       .name           = DRV_NAME,
+       .id_table       = pci_tbl,
+       .probe          = nv_probe,
+       .remove         = __devexit_p(nv_remove),
+       .suspend        = nv_suspend,
+       .resume         = nv_resume,
 };
 
 static int __init init_nic(void)
 {
-       printk(KERN_INFO "forcedeth.c: Reverse Engineered nForce ethernet driver. Version %s.\n", FORCEDETH_VERSION);
        return pci_register_driver(&driver);
 }
 
index 558440c15b6c47c183bc4d86bf6d87ef2984f5dd..cc288d8f6a53cc936882c49c19920cc4590ba1c2 100644 (file)
@@ -1237,8 +1237,6 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
  * starting over will fix the problem. */
 static void gfar_timeout(struct net_device *dev)
 {
-       struct gfar_private *priv = netdev_priv(dev);
-
        dev->stats.tx_errors++;
 
        if (dev->flags & IFF_UP) {
@@ -1344,8 +1342,9 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp)
        return skb;
 }
 
-static inline void count_errors(unsigned short status, struct gfar_private *priv)
+static inline void count_errors(unsigned short status, struct net_device *dev)
 {
+       struct gfar_private *priv = netdev_priv(dev);
        struct net_device_stats *stats = &dev->stats;
        struct gfar_extra_stats *estats = &priv->extra_stats;
 
@@ -1539,7 +1538,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
 
                        dev->stats.rx_bytes += pkt_len;
                } else {
-                       count_errors(bdp->status, priv);
+                       count_errors(bdp->status, dev);
 
                        if (skb)
                                dev_kfree_skb_any(skb);
index 39f4cb6b0cf385f4aad928c99eb5984f79e2b8dc..a680eb05ba60149fe7fa7dc870d16885758abddf 100644 (file)
@@ -45,6 +45,8 @@ int __devinit mal_register_commac(struct mal_instance *mal,
                return -EBUSY;
        }
 
+       if (list_empty(&mal->list))
+               napi_enable(&mal->napi);
        mal->tx_chan_mask |= commac->tx_chan_mask;
        mal->rx_chan_mask |= commac->rx_chan_mask;
        list_add(&commac->list, &mal->list);
@@ -67,6 +69,8 @@ void __devexit mal_unregister_commac(struct mal_instance      *mal,
        mal->tx_chan_mask &= ~commac->tx_chan_mask;
        mal->rx_chan_mask &= ~commac->rx_chan_mask;
        list_del_init(&commac->list);
+       if (list_empty(&mal->list))
+               napi_disable(&mal->napi);
 
        spin_unlock_irqrestore(&mal->lock, flags);
 }
@@ -182,7 +186,7 @@ static inline void mal_enable_eob_irq(struct mal_instance *mal)
        set_mal_dcrn(mal, MAL_CFG, get_mal_dcrn(mal, MAL_CFG) | MAL_CFG_EOPIE);
 }
 
-/* synchronized by __LINK_STATE_RX_SCHED bit in ndev->state */
+/* synchronized by NAPI state */
 static inline void mal_disable_eob_irq(struct mal_instance *mal)
 {
        // XXX might want to cache MAL_CFG as the DCR read can be slooooow
@@ -317,8 +321,8 @@ void mal_poll_disable(struct mal_instance *mal, struct mal_commac *commac)
        while (test_and_set_bit(MAL_COMMAC_POLL_DISABLED, &commac->flags))
                msleep(1);
 
-       /* Synchronize with the MAL NAPI poller. */
-       napi_disable(&mal->napi);
+       /* Synchronize with the MAL NAPI poller */
+       __napi_synchronize(&mal->napi);
 }
 
 void mal_poll_enable(struct mal_instance *mal, struct mal_commac *commac)
@@ -326,7 +330,12 @@ void mal_poll_enable(struct mal_instance *mal, struct mal_commac *commac)
        smp_wmb();
        clear_bit(MAL_COMMAC_POLL_DISABLED, &commac->flags);
 
-       // XXX might want to kick a poll now...
+       /* Feels better to trigger a poll here to catch up with events that
+        * may have happened on this channel while disabled. It will most
+        * probably be delayed until the next interrupt but that's mostly a
+        * non-issue in the context where this is called.
+        */
+       napi_schedule(&mal->napi);
 }
 
 static int mal_poll(struct napi_struct *napi, int budget)
@@ -336,8 +345,7 @@ static int mal_poll(struct napi_struct *napi, int budget)
        int received = 0;
        unsigned long flags;
 
-       MAL_DBG2(mal, "poll(%d) %d ->" NL, *budget,
-                rx_work_limit);
+       MAL_DBG2(mal, "poll(%d)" NL, budget);
  again:
        /* Process TX skbs */
        list_for_each(l, &mal->poll_list) {
@@ -528,11 +536,12 @@ static int __devinit mal_probe(struct of_device *ofdev,
        }
 
        INIT_LIST_HEAD(&mal->poll_list);
-       mal->napi.weight = CONFIG_IBM_NEW_EMAC_POLL_WEIGHT;
-       mal->napi.poll = mal_poll;
        INIT_LIST_HEAD(&mal->list);
        spin_lock_init(&mal->lock);
 
+       netif_napi_add(NULL, &mal->napi, mal_poll,
+                      CONFIG_IBM_NEW_EMAC_POLL_WEIGHT);
+
        /* Load power-on reset defaults */
        mal_reset(mal);
 
index 2aae9fe38c5a9c250ae79f648ef081645cddf9e4..b9961dc47606bb28b9528c8764e95e488ff1ca36 100644 (file)
 #include <linux/delay.h>
 #include <linux/crc32.h>
 #include <linux/dma-mapping.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
 #include <linux/mii.h>
 #include <asm/irq.h>
 
 #include "skge.h"
 
 #define DRV_NAME               "skge"
-#define DRV_VERSION            "1.11"
+#define DRV_VERSION            "1.12"
 #define PFX                    DRV_NAME " "
 
 #define DEFAULT_TX_RING_SIZE   128
 #define TX_WATCHDOG            (5 * HZ)
 #define NAPI_WEIGHT            64
 #define BLINK_MS               250
-#define LINK_HZ                        (HZ/2)
+#define LINK_HZ                        HZ
+
+#define SKGE_EEPROM_MAGIC      0x9933aabb
+
 
 MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver");
 MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>");
@@ -445,15 +450,15 @@ static struct net_device_stats *skge_get_stats(struct net_device *dev)
        else
                yukon_get_stats(skge, data);
 
-       skge->net_stats.tx_bytes = data[0];
-       skge->net_stats.rx_bytes = data[1];
-       skge->net_stats.tx_packets = data[2] + data[4] + data[6];
-       skge->net_stats.rx_packets = data[3] + data[5] + data[7];
-       skge->net_stats.multicast = data[3] + data[5];
-       skge->net_stats.collisions = data[10];
-       skge->net_stats.tx_aborted_errors = data[12];
+       dev->stats.tx_bytes = data[0];
+       dev->stats.rx_bytes = data[1];
+       dev->stats.tx_packets = data[2] + data[4] + data[6];
+       dev->stats.rx_packets = data[3] + data[5] + data[7];
+       dev->stats.multicast = data[3] + data[5];
+       dev->stats.collisions = data[10];
+       dev->stats.tx_aborted_errors = data[12];
 
-       return &skge->net_stats;
+       return &dev->stats;
 }
 
 static void skge_get_strings(struct net_device *dev, u32 stringset, u8 *data)
@@ -798,6 +803,98 @@ static int skge_phys_id(struct net_device *dev, u32 data)
        return 0;
 }
 
+static int skge_get_eeprom_len(struct net_device *dev)
+{
+       struct skge_port *skge = netdev_priv(dev);
+       u32 reg2;
+
+       pci_read_config_dword(skge->hw->pdev, PCI_DEV_REG2, &reg2);
+       return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
+}
+
+static u32 skge_vpd_read(struct pci_dev *pdev, int cap, u16 offset)
+{
+       u32 val;
+
+       pci_write_config_word(pdev, cap + PCI_VPD_ADDR, offset);
+
+       do {
+               pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset);
+       } while (!(offset & PCI_VPD_ADDR_F));
+
+       pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &val);
+       return val;
+}
+
+static void skge_vpd_write(struct pci_dev *pdev, int cap, u16 offset, u32 val)
+{
+       pci_write_config_dword(pdev, cap + PCI_VPD_DATA, val);
+       pci_write_config_word(pdev, cap + PCI_VPD_ADDR,
+                             offset | PCI_VPD_ADDR_F);
+
+       do {
+               pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset);
+       } while (offset & PCI_VPD_ADDR_F);
+}
+
+static int skge_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
+                          u8 *data)
+{
+       struct skge_port *skge = netdev_priv(dev);
+       struct pci_dev *pdev = skge->hw->pdev;
+       int cap = pci_find_capability(pdev, PCI_CAP_ID_VPD);
+       int length = eeprom->len;
+       u16 offset = eeprom->offset;
+
+       if (!cap)
+               return -EINVAL;
+
+       eeprom->magic = SKGE_EEPROM_MAGIC;
+
+       while (length > 0) {
+               u32 val = skge_vpd_read(pdev, cap, offset);
+               int n = min_t(int, length, sizeof(val));
+
+               memcpy(data, &val, n);
+               length -= n;
+               data += n;
+               offset += n;
+       }
+       return 0;
+}
+
+static int skge_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
+                          u8 *data)
+{
+       struct skge_port *skge = netdev_priv(dev);
+       struct pci_dev *pdev = skge->hw->pdev;
+       int cap = pci_find_capability(pdev, PCI_CAP_ID_VPD);
+       int length = eeprom->len;
+       u16 offset = eeprom->offset;
+
+       if (!cap)
+               return -EINVAL;
+
+       if (eeprom->magic != SKGE_EEPROM_MAGIC)
+               return -EINVAL;
+
+       while (length > 0) {
+               u32 val;
+               int n = min_t(int, length, sizeof(val));
+
+               if (n < sizeof(val))
+                       val = skge_vpd_read(pdev, cap, offset);
+               memcpy(&val, data, n);
+
+               skge_vpd_write(pdev, cap, offset, val);
+
+               length -= n;
+               data += n;
+               offset += n;
+       }
+       return 0;
+}
+
 static const struct ethtool_ops skge_ethtool_ops = {
        .get_settings   = skge_get_settings,
        .set_settings   = skge_set_settings,
@@ -810,6 +907,9 @@ static const struct ethtool_ops skge_ethtool_ops = {
        .set_msglevel   = skge_set_msglevel,
        .nway_reset     = skge_nway_reset,
        .get_link       = ethtool_op_get_link,
+       .get_eeprom_len = skge_get_eeprom_len,
+       .get_eeprom     = skge_get_eeprom,
+       .set_eeprom     = skge_set_eeprom,
        .get_ringparam  = skge_get_ring_param,
        .set_ringparam  = skge_set_ring_param,
        .get_pauseparam = skge_get_pauseparam,
@@ -995,19 +1095,15 @@ static void xm_link_down(struct skge_hw *hw, int port)
 {
        struct net_device *dev = hw->dev[port];
        struct skge_port *skge = netdev_priv(dev);
-       u16 cmd, msk;
+       u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
 
-       if (hw->phy_type == SK_PHY_XMAC) {
-               msk = xm_read16(hw, port, XM_IMSK);
-               msk |= XM_IS_INP_ASS | XM_IS_LIPA_RC | XM_IS_RX_PAGE | XM_IS_AND;
-               xm_write16(hw, port, XM_IMSK, msk);
-       }
+       xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);
 
-       cmd = xm_read16(hw, port, XM_MMU_CMD);
        cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
        xm_write16(hw, port, XM_MMU_CMD, cmd);
+
        /* dummy read to ensure writing */
-       (void) xm_read16(hw, port, XM_MMU_CMD);
+       xm_read16(hw, port, XM_MMU_CMD);
 
        if (netif_carrier_ok(dev))
                skge_link_down(skge);
@@ -1103,7 +1199,7 @@ static void genesis_reset(struct skge_hw *hw, int port)
 
        /* reset the statistics module */
        xm_write32(hw, port, XM_GP_PORT, XM_GP_RES_STAT);
-       xm_write16(hw, port, XM_IMSK, 0xffff);  /* disable XMAC IRQs */
+       xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);
        xm_write32(hw, port, XM_MODE, 0);               /* clear Mode Reg */
        xm_write16(hw, port, XM_TX_CMD, 0);     /* reset TX CMD Reg */
        xm_write16(hw, port, XM_RX_CMD, 0);     /* reset RX CMD Reg */
@@ -1141,7 +1237,7 @@ static void bcom_check_link(struct skge_hw *hw, int port)
        u16 status;
 
        /* read twice because of latch */
-       (void) xm_phy_read(hw, port, PHY_BCOM_STAT);
+       xm_phy_read(hw, port, PHY_BCOM_STAT);
        status = xm_phy_read(hw, port, PHY_BCOM_STAT);
 
        if ((status & PHY_ST_LSYNC) == 0) {
@@ -1342,7 +1438,7 @@ static void xm_phy_init(struct skge_port *skge)
        mod_timer(&skge->link_timer, jiffies + LINK_HZ);
 }
 
-static void xm_check_link(struct net_device *dev)
+static int xm_check_link(struct net_device *dev)
 {
        struct skge_port *skge = netdev_priv(dev);
        struct skge_hw *hw = skge->hw;
@@ -1350,25 +1446,25 @@ static void xm_check_link(struct net_device *dev)
        u16 status;
 
        /* read twice because of latch */
-       (void) xm_phy_read(hw, port, PHY_XMAC_STAT);
+       xm_phy_read(hw, port, PHY_XMAC_STAT);
        status = xm_phy_read(hw, port, PHY_XMAC_STAT);
 
        if ((status & PHY_ST_LSYNC) == 0) {
                xm_link_down(hw, port);
-               return;
+               return 0;
        }
 
        if (skge->autoneg == AUTONEG_ENABLE) {
                u16 lpa, res;
 
                if (!(status & PHY_ST_AN_OVER))
-                       return;
+                       return 0;
 
                lpa = xm_phy_read(hw, port, PHY_XMAC_AUNE_LP);
                if (lpa & PHY_B_AN_RF) {
                        printk(KERN_NOTICE PFX "%s: remote fault\n",
                               dev->name);
-                       return;
+                       return 0;
                }
 
                res = xm_phy_read(hw, port, PHY_XMAC_RES_ABI);
@@ -1384,7 +1480,7 @@ static void xm_check_link(struct net_device *dev)
                default:
                        printk(KERN_NOTICE PFX "%s: duplex mismatch\n",
                               dev->name);
-                       return;
+                       return 0;
                }
 
                /* We are using IEEE 802.3z/D5.0 Table 37-4 */
@@ -1408,11 +1504,14 @@ static void xm_check_link(struct net_device *dev)
 
        if (!netif_carrier_ok(dev))
                genesis_link_up(skge);
+       return 1;
 }
 
 /* Poll to check for link coming up.
+ *
  * Since internal PHY is wired to a level triggered pin, can't
- * get an interrupt when carrier is detected.
+ * get an interrupt when carrier is detected, need to poll for
+ * link coming up.
  */
 static void xm_link_timer(unsigned long arg)
 {
@@ -1420,29 +1519,35 @@ static void xm_link_timer(unsigned long arg)
        struct net_device *dev = skge->netdev;
        struct skge_hw *hw = skge->hw;
        int port = skge->port;
+       int i;
+       unsigned long flags;
 
        if (!netif_running(dev))
                return;
 
-       if (netif_carrier_ok(dev)) {
+       spin_lock_irqsave(&hw->phy_lock, flags);
+
+       /*
+        * Verify that the link by checking GPIO register three times.
+        * This pin has the signal from the link_sync pin connected to it.
+        */
+       for (i = 0; i < 3; i++) {
+               if (xm_read16(hw, port, XM_GP_PORT) & XM_GP_INP_ASS)
+                       goto link_down;
+       }
+
+        /* Re-enable interrupt to detect link down */
+       if (xm_check_link(dev)) {
+               u16 msk = xm_read16(hw, port, XM_IMSK);
+               msk &= ~XM_IS_INP_ASS;
+               xm_write16(hw, port, XM_IMSK, msk);
                xm_read16(hw, port, XM_ISRC);
-               if (!(xm_read16(hw, port, XM_ISRC) & XM_IS_INP_ASS))
-                       goto nochange;
        } else {
-               if (xm_read32(hw, port, XM_GP_PORT) & XM_GP_INP_ASS)
-                       goto nochange;
-               xm_read16(hw, port, XM_ISRC);
-               if (xm_read16(hw, port, XM_ISRC) & XM_IS_INP_ASS)
-                       goto nochange;
+link_down:
+               mod_timer(&skge->link_timer,
+                         round_jiffies(jiffies + LINK_HZ));
        }
-
-       spin_lock(&hw->phy_lock);
-       xm_check_link(dev);
-       spin_unlock(&hw->phy_lock);
-
-nochange:
-       if (netif_running(dev))
-               mod_timer(&skge->link_timer, jiffies + LINK_HZ);
+       spin_unlock_irqrestore(&hw->phy_lock, flags);
 }
 
 static void genesis_mac_init(struct skge_hw *hw, int port)
@@ -1679,24 +1784,27 @@ static void genesis_get_stats(struct skge_port *skge, u64 *data)
 
 static void genesis_mac_intr(struct skge_hw *hw, int port)
 {
-       struct skge_port *skge = netdev_priv(hw->dev[port]);
+       struct net_device *dev = hw->dev[port];
+       struct skge_port *skge = netdev_priv(dev);
        u16 status = xm_read16(hw, port, XM_ISRC);
 
        if (netif_msg_intr(skge))
                printk(KERN_DEBUG PFX "%s: mac interrupt status 0x%x\n",
-                      skge->netdev->name, status);
+                      dev->name, status);
 
-       if (hw->phy_type == SK_PHY_XMAC &&
-           (status & (XM_IS_INP_ASS | XM_IS_LIPA_RC)))
-               xm_link_down(hw, port);
+       if (hw->phy_type == SK_PHY_XMAC && (status & XM_IS_INP_ASS)) {
+               xm_link_down(hw, port);
+               mod_timer(&skge->link_timer, jiffies + 1);
+       }
 
        if (status & XM_IS_TXF_UR) {
                xm_write32(hw, port, XM_MODE, XM_MD_FTF);
-               ++skge->net_stats.tx_fifo_errors;
+               ++dev->stats.tx_fifo_errors;
        }
+
        if (status & XM_IS_RXF_OV) {
                xm_write32(hw, port, XM_MODE, XM_MD_FRF);
-               ++skge->net_stats.rx_fifo_errors;
+               ++dev->stats.rx_fifo_errors;
        }
 }
 
@@ -1753,11 +1861,12 @@ static void genesis_link_up(struct skge_port *skge)
        }
 
        xm_write32(hw, port, XM_MODE, mode);
-       msk = XM_DEF_MSK;
-       if (hw->phy_type != SK_PHY_XMAC)
-               msk |= XM_IS_INP_ASS;   /* disable GP0 interrupt bit */
 
+       /* Turn on detection of Tx underrun, Rx overrun */
+       msk = xm_read16(hw, port, XM_IMSK);
+       msk &= ~(XM_IS_RXF_OV | XM_IS_TXF_UR);
        xm_write16(hw, port, XM_IMSK, msk);
+
        xm_read16(hw, port, XM_ISRC);
 
        /* get MMU Command Reg. */
@@ -2192,12 +2301,12 @@ static void yukon_mac_intr(struct skge_hw *hw, int port)
                       dev->name, status);
 
        if (status & GM_IS_RX_FF_OR) {
-               ++skge->net_stats.rx_fifo_errors;
+               ++dev->stats.rx_fifo_errors;
                skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO);
        }
 
        if (status & GM_IS_TX_FF_UR) {
-               ++skge->net_stats.tx_fifo_errors;
+               ++dev->stats.tx_fifo_errors;
                skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU);
        }
 
@@ -2403,32 +2512,31 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        return err;
 }
 
-static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len)
+/* Assign Ram Buffer allocation to queue */
+static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, u32 space)
 {
        u32 end;
 
-       start /= 8;
-       len /= 8;
-       end = start + len - 1;
+       /* convert from K bytes to qwords used for hw register */
+       start *= 1024/8;
+       space *= 1024/8;
+       end = start + space - 1;
 
        skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
        skge_write32(hw, RB_ADDR(q, RB_START), start);
+       skge_write32(hw, RB_ADDR(q, RB_END), end);
        skge_write32(hw, RB_ADDR(q, RB_WP), start);
        skge_write32(hw, RB_ADDR(q, RB_RP), start);
-       skge_write32(hw, RB_ADDR(q, RB_END), end);
 
        if (q == Q_R1 || q == Q_R2) {
+               u32 tp = space - space/4;
+
                /* Set thresholds on receive queue's */
-               skge_write32(hw, RB_ADDR(q, RB_RX_UTPP),
-                            start + (2*len)/3);
-               skge_write32(hw, RB_ADDR(q, RB_RX_LTPP),
-                            start + (len/3));
-       } else {
-               /* Enable store & forward on Tx queue's because
-                * Tx FIFO is only 4K on Genesis and 1K on Yukon
-                */
+               skge_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp);
+               skge_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4);
+       } else if (hw->chip_id != CHIP_ID_GENESIS)
+               /* Genesis Tx Fifo is too small for normal store/forward */
                skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_STFWD);
-       }
 
        skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_OP_MD);
 }
@@ -2456,7 +2564,7 @@ static int skge_up(struct net_device *dev)
        struct skge_port *skge = netdev_priv(dev);
        struct skge_hw *hw = skge->hw;
        int port = skge->port;
-       u32 chunk, ram_addr;
+       u32 ramaddr, ramsize, rxspace;
        size_t rx_size, tx_size;
        int err;
 
@@ -2511,14 +2619,15 @@ static int skge_up(struct net_device *dev)
        spin_unlock_bh(&hw->phy_lock);
 
        /* Configure RAMbuffers */
-       chunk = hw->ram_size / ((hw->ports + 1)*2);
-       ram_addr = hw->ram_offset + 2 * chunk * port;
+       ramsize = (hw->ram_size - hw->ram_offset) / hw->ports;
+       ramaddr = hw->ram_offset + port * ramsize;
+       rxspace = 8 + (2*(ramsize - 16))/3;
 
-       skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
-       skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean);
+       skge_ramset(hw, rxqaddr[port], ramaddr, rxspace);
+       skge_ramset(hw, txqaddr[port], ramaddr + rxspace, ramsize - rxspace);
 
+       skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean);
        BUG_ON(skge->tx_ring.to_use != skge->tx_ring.to_clean);
-       skge_ramset(hw, txqaddr[port], ram_addr+chunk, chunk);
        skge_qset(skge, txqaddr[port], skge->tx_ring.to_use);
 
        /* Start receiver BMU */
@@ -2544,6 +2653,15 @@ static int skge_up(struct net_device *dev)
        return err;
 }
 
+/* stop receiver */
+static void skge_rx_stop(struct skge_hw *hw, int port)
+{
+       skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_STOP);
+       skge_write32(hw, RB_ADDR(port ? Q_R2 : Q_R1, RB_CTRL),
+                    RB_RST_SET|RB_DIS_OP_MD);
+       skge_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_SET_RESET);
+}
+
 static int skge_down(struct net_device *dev)
 {
        struct skge_port *skge = netdev_priv(dev);
@@ -2595,11 +2713,8 @@ static int skge_down(struct net_device *dev)
 
        /* Reset the RAM Buffer async Tx queue */
        skge_write8(hw, RB_ADDR(port == 0 ? Q_XA1 : Q_XA2, RB_CTRL), RB_RST_SET);
-       /* stop receiver */
-       skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_STOP);
-       skge_write32(hw, RB_ADDR(port ? Q_R2 : Q_R1, RB_CTRL),
-                    RB_RST_SET|RB_DIS_OP_MD);
-       skge_write32(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_SET_RESET);
+
+       skge_rx_stop(hw, port);
 
        if (hw->chip_id == CHIP_ID_GENESIS) {
                skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_SET);
@@ -2782,7 +2897,11 @@ static void skge_tx_timeout(struct net_device *dev)
 
 static int skge_change_mtu(struct net_device *dev, int new_mtu)
 {
+       struct skge_port *skge = netdev_priv(dev);
+       struct skge_hw *hw = skge->hw;
+       int port = skge->port;
        int err;
+       u16 ctl, reg;
 
        if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
                return -EINVAL;
@@ -2792,13 +2911,40 @@ static int skge_change_mtu(struct net_device *dev, int new_mtu)
                return 0;
        }
 
-       skge_down(dev);
+       skge_write32(hw, B0_IMSK, 0);
+       dev->trans_start = jiffies;     /* prevent tx timeout */
+       netif_stop_queue(dev);
+       napi_disable(&skge->napi);
+
+       ctl = gma_read16(hw, port, GM_GP_CTRL);
+       gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
+
+       skge_rx_clean(skge);
+       skge_rx_stop(hw, port);
 
        dev->mtu = new_mtu;
 
-       err = skge_up(dev);
+       reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF);
+       if (new_mtu > 1500)
+               reg |= GM_SMOD_JUMBO_ENA;
+       gma_write16(hw, port, GM_SERIAL_MODE, reg);
+
+       skge_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD);
+
+       err = skge_rx_fill(dev);
+       wmb();
+       if (!err)
+               skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
+       skge_write32(hw, B0_IMSK, hw->intr_mask);
+
        if (err)
                dev_close(dev);
+       else {
+               gma_write16(hw, port, GM_GP_CTRL, ctl);
+
+               napi_enable(&skge->napi);
+               netif_wake_queue(dev);
+       }
 
        return err;
 }
@@ -2994,18 +3140,18 @@ error:
 
        if (skge->hw->chip_id == CHIP_ID_GENESIS) {
                if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR))
-                       skge->net_stats.rx_length_errors++;
+                       dev->stats.rx_length_errors++;
                if (status & XMR_FS_FRA_ERR)
-                       skge->net_stats.rx_frame_errors++;
+                       dev->stats.rx_frame_errors++;
                if (status & XMR_FS_FCS_ERR)
-                       skge->net_stats.rx_crc_errors++;
+                       dev->stats.rx_crc_errors++;
        } else {
                if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE))
-                       skge->net_stats.rx_length_errors++;
+                       dev->stats.rx_length_errors++;
                if (status & GMR_FS_FRAGMENT)
-                       skge->net_stats.rx_frame_errors++;
+                       dev->stats.rx_frame_errors++;
                if (status & GMR_FS_CRC_ERR)
-                       skge->net_stats.rx_crc_errors++;
+                       dev->stats.rx_crc_errors++;
        }
 
 resubmit:
@@ -3103,10 +3249,7 @@ static void skge_mac_parity(struct skge_hw *hw, int port)
 {
        struct net_device *dev = hw->dev[port];
 
-       if (dev) {
-               struct skge_port *skge = netdev_priv(dev);
-               ++skge->net_stats.tx_heartbeat_errors;
-       }
+       ++dev->stats.tx_heartbeat_errors;
 
        if (hw->chip_id == CHIP_ID_GENESIS)
                skge_write16(hw, SK_REG(port, TX_MFF_CTRL1),
@@ -3259,9 +3402,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
                skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_TX1);
 
        if (status & IS_PA_TO_RX1) {
-               struct skge_port *skge = netdev_priv(hw->dev[0]);
-
-               ++skge->net_stats.rx_over_errors;
+               ++hw->dev[0]->stats.rx_over_errors;
                skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX1);
        }
 
@@ -3278,7 +3419,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
                }
 
                if (status & IS_PA_TO_RX2) {
-                       ++skge->net_stats.rx_over_errors;
+                       ++hw->dev[1]->stats.rx_over_errors;
                        skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX2);
                }
 
@@ -3450,15 +3591,12 @@ static int skge_reset(struct skge_hw *hw)
        if (hw->chip_id == CHIP_ID_GENESIS) {
                if (t8 == 3) {
                        /* special case: 4 x 64k x 36, offset = 0x80000 */
-                       hw->ram_size = 0x100000;
-                       hw->ram_offset = 0x80000;
+                       hw->ram_size = 1024;
+                       hw->ram_offset = 512;
                } else
                        hw->ram_size = t8 * 512;
-       }
-       else if (t8 == 0)
-               hw->ram_size = 0x20000;
-       else
-               hw->ram_size = t8 * 4096;
+       } else /* Yukon */
+               hw->ram_size = t8 ? t8 * 4 : 128;
 
        hw->intr_mask = IS_HW_ERR;
 
@@ -3540,6 +3678,145 @@ static int skge_reset(struct skge_hw *hw)
        return 0;
 }
 
+
+#ifdef CONFIG_SKGE_DEBUG
+
+static struct dentry *skge_debug;
+
+static int skge_debug_show(struct seq_file *seq, void *v)
+{
+       struct net_device *dev = seq->private;
+       const struct skge_port *skge = netdev_priv(dev);
+       const struct skge_hw *hw = skge->hw;
+       const struct skge_element *e;
+
+       if (!netif_running(dev))
+               return -ENETDOWN;
+
+       seq_printf(seq, "IRQ src=%x mask=%x\n", skge_read32(hw, B0_ISRC),
+                  skge_read32(hw, B0_IMSK));
+
+       seq_printf(seq, "Tx Ring: (%d)\n", skge_avail(&skge->tx_ring));
+       for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) {
+               const struct skge_tx_desc *t = e->desc;
+               seq_printf(seq, "%#x dma=%#x%08x %#x csum=%#x/%x/%x\n",
+                          t->control, t->dma_hi, t->dma_lo, t->status,
+                          t->csum_offs, t->csum_write, t->csum_start);
+       }
+
+       seq_printf(seq, "\nRx Ring: \n");
+       for (e = skge->rx_ring.to_clean; ; e = e->next) {
+               const struct skge_rx_desc *r = e->desc;
+
+               if (r->control & BMU_OWN)
+                       break;
+
+               seq_printf(seq, "%#x dma=%#x%08x %#x %#x csum=%#x/%x\n",
+                          r->control, r->dma_hi, r->dma_lo, r->status,
+                          r->timestamp, r->csum1, r->csum1_start);
+       }
+
+       return 0;
+}
+
+static int skge_debug_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, skge_debug_show, inode->i_private);
+}
+
+static const struct file_operations skge_debug_fops = {
+       .owner          = THIS_MODULE,
+       .open           = skge_debug_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
+/*
+ * Use network device events to create/remove/rename
+ * debugfs file entries
+ */
+static int skge_device_event(struct notifier_block *unused,
+                            unsigned long event, void *ptr)
+{
+       struct net_device *dev = ptr;
+       struct skge_port *skge;
+       struct dentry *d;
+
+       if (dev->open != &skge_up || !skge_debug)
+               goto done;
+
+       skge = netdev_priv(dev);
+       switch(event) {
+       case NETDEV_CHANGENAME:
+               if (skge->debugfs) {
+                       d = debugfs_rename(skge_debug, skge->debugfs,
+                                          skge_debug, dev->name);
+                       if (d)
+                               skge->debugfs = d;
+                       else {
+                               pr_info(PFX "%s: rename failed\n", dev->name);
+                               debugfs_remove(skge->debugfs);
+                       }
+               }
+               break;
+
+       case NETDEV_GOING_DOWN:
+               if (skge->debugfs) {
+                       debugfs_remove(skge->debugfs);
+                       skge->debugfs = NULL;
+               }
+               break;
+
+       case NETDEV_UP:
+               d = debugfs_create_file(dev->name, S_IRUGO,
+                                       skge_debug, dev,
+                                       &skge_debug_fops);
+               if (!d || IS_ERR(d))
+                       pr_info(PFX "%s: debugfs create failed\n",
+                              dev->name);
+               else
+                       skge->debugfs = d;
+               break;
+       }
+
+done:
+       return NOTIFY_DONE;
+}
+
+static struct notifier_block skge_notifier = {
+       .notifier_call = skge_device_event,
+};
+
+
+static __init void skge_debug_init(void)
+{
+       struct dentry *ent;
+
+       ent = debugfs_create_dir("skge", NULL);
+       if (!ent || IS_ERR(ent)) {
+               pr_info(PFX "debugfs create directory failed\n");
+               return;
+       }
+
+       skge_debug = ent;
+       register_netdevice_notifier(&skge_notifier);
+}
+
+static __exit void skge_debug_cleanup(void)
+{
+       if (skge_debug) {
+               unregister_netdevice_notifier(&skge_notifier);
+               debugfs_remove(skge_debug);
+               skge_debug = NULL;
+       }
+}
+
+#else
+#define skge_debug_init()
+#define skge_debug_cleanup()
+#endif
+
 /* Initialize network device */
 static struct net_device *skge_devinit(struct skge_hw *hw, int port,
                                       int highmem)
@@ -3904,12 +4181,14 @@ static struct pci_driver skge_driver = {
 
 static int __init skge_init_module(void)
 {
+       skge_debug_init();
        return pci_register_driver(&skge_driver);
 }
 
 static void __exit skge_cleanup_module(void)
 {
        pci_unregister_driver(&skge_driver);
+       skge_debug_cleanup();
 }
 
 module_init(skge_init_module);
index 1a57bdd1ddf158323a39905a73058ac3c214b944..17caccbb768577f44ea259f672b53cfe7a73407d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Definitions for the new Marvell Yukon / SysKonenct driver.
+ * Definitions for the new Marvell Yukon / SysKonnect driver.
  */
 #ifndef _SKGE_H
 #define _SKGE_H
@@ -8,8 +8,10 @@
 #define PCI_DEV_REG1   0x40
 #define  PCI_PHY_COMA  0x8000000
 #define  PCI_VIO       0x2000000
+
 #define PCI_DEV_REG2   0x44
-#define  PCI_REV_DESC   0x4
+#define  PCI_VPD_ROM_SZ        7L<<14  /* VPD ROM size 0=256, 1=512, ... */
+#define  PCI_REV_DESC  1<<2    /* Reverse Descriptor bytes */
 
 #define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \
                               PCI_STATUS_SIG_SYSTEM_ERROR | \
@@ -2191,11 +2193,9 @@ enum {
        XM_IS_TXF_UR    = 1<<2, /* Bit  2:      Transmit FIFO Underrun */
        XM_IS_TX_COMP   = 1<<1, /* Bit  1:      Frame Tx Complete */
        XM_IS_RX_COMP   = 1<<0, /* Bit  0:      Frame Rx Complete */
-};
-
-#define XM_DEF_MSK     (~(XM_IS_INP_ASS | XM_IS_LIPA_RC | \
-                          XM_IS_RXF_OV | XM_IS_TXF_UR))
 
+       XM_IMSK_DISABLE = 0xffff,
+};
 
 /*     XM_HW_CFG       16 bit r/w      Hardware Config Register */
 enum {
@@ -2469,8 +2469,9 @@ struct skge_port {
        void                 *mem;      /* PCI memory for rings */
        dma_addr_t           dma;
        unsigned long        mem_size;
-
-       struct net_device_stats net_stats;
+#ifdef CONFIG_SKGE_DEBUG
+       struct dentry        *debugfs;
+#endif
 };
 
 
index a897beee7d5dce748ece6f8e055b413c91828844..e1d05c0f47ebce3e6078d996f10fd4c9b06eab1f 100644 (file)
@@ -494,7 +494,4 @@ struct spider_net_card {
        struct spider_net_descr darray[0];
 };
 
-#define pr_err(fmt,arg...) \
-       printk(KERN_ERR fmt ,##arg)
-
 #endif
index 7224d368b2a71ed2b4f986a434ff8eb52a75223b..5d31519a6c67a3c68f2bdbe4ee220f3fa303c33b 100644 (file)
@@ -760,7 +760,7 @@ static int xl_open_hw(struct net_device *dev)
        if (xl_priv->xl_laa[0]) {  /* If using a LAA address */
                for (i=10;i<16;i++) { 
                        writel( (MEM_BYTE_WRITE | 0xD0000 | xl_priv->srb) + i, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-                       writeb(xl_priv->xl_laa[i],xl_mmio + MMIO_MACDATA) ; 
+                       writeb(xl_priv->xl_laa[i-10],xl_mmio + MMIO_MACDATA) ;
                }
                memcpy(dev->dev_addr,xl_priv->xl_laa,dev->addr_len) ; 
        } else { /* Regular hardware address */ 
index f201bd6731373471bdf14a01bd4a222ed99ce18c..519b4ff79f7f9edd073ef829ed1cb3f17be2aa5c 100644 (file)
@@ -269,6 +269,13 @@ config AT91_CF
          Say Y here to support the CompactFlash controller on AT91 chips.
          Or choose M to compile the driver as a module named "at91_cf".
 
+config ELECTRA_CF
+       tristate "Electra CompactFlash Controller"
+       depends on PCMCIA && PPC_PASEMI
+       help
+         Say Y here to support the CompactFlash controller on the
+         PA Semi Electra eval board.
+
 config PCCARD_NONSTATIC
        tristate
 
index dc7a4cb5d2705a8f08d170812685e2e9012d1cfb..6f6478ba7174fa8291eee50bb8a671ff913672bc 100644 (file)
@@ -37,6 +37,7 @@ obj-$(CONFIG_PCMCIA_VRC4171)                  += vrc4171_card.o
 obj-$(CONFIG_PCMCIA_VRC4173)                   += vrc4173_cardu.o
 obj-$(CONFIG_OMAP_CF)                          += omap_cf.o
 obj-$(CONFIG_AT91_CF)                          += at91_cf.o
+obj-$(CONFIG_ELECTRA_CF)                       += electra_cf.o
 
 sa11xx_core-y                                  += soc_common.o sa11xx_base.o
 pxa2xx_core-y                                  += soc_common.o pxa2xx_base.o
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
new file mode 100644 (file)
index 0000000..0a6cea1
--- /dev/null
@@ -0,0 +1,377 @@
+/*
+ * Copyright (C) 2007 PA Semi, Inc
+ *
+ * Maintained by: Olof Johansson <olof@lixom.net>
+ *
+ * Based on drivers/pcmcia/omap_cf.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/platform_device.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/vmalloc.h>
+
+#include <pcmcia/ss.h>
+#include <asm/of_platform.h>
+
+static const char driver_name[] = "electra-cf";
+
+struct electra_cf_socket {
+       struct pcmcia_socket    socket;
+
+       struct timer_list       timer;
+       unsigned                present:1;
+       unsigned                active:1;
+
+       struct of_device        *ofdev;
+       unsigned long           mem_phys;
+       void __iomem *          mem_base;
+       unsigned long           mem_size;
+       void __iomem *          io_virt;
+       unsigned int            io_base;
+       unsigned int            io_size;
+       u_int                   irq;
+       struct resource         iomem;
+       void __iomem *          gpio_base;
+       int                     gpio_detect;
+       int                     gpio_vsense;
+       int                     gpio_3v;
+       int                     gpio_5v;
+};
+
+#define        POLL_INTERVAL           (2 * HZ)
+
+
+static int electra_cf_present(struct electra_cf_socket *cf)
+{
+       unsigned int gpio;
+
+       gpio = in_le32(cf->gpio_base+0x40);
+       return !(gpio & (1 << cf->gpio_detect));
+}
+
+static int electra_cf_ss_init(struct pcmcia_socket *s)
+{
+       return 0;
+}
+
+/* the timer is primarily to kick this socket's pccardd */
+static void electra_cf_timer(unsigned long _cf)
+{
+       struct electra_cf_socket *cf = (void *) _cf;
+       int present = electra_cf_present(cf);
+
+       if (present != cf->present) {
+               cf->present = present;
+               pcmcia_parse_events(&cf->socket, SS_DETECT);
+       }
+
+       if (cf->active)
+               mod_timer(&cf->timer, jiffies + POLL_INTERVAL);
+}
+
+static irqreturn_t electra_cf_irq(int irq, void *_cf)
+{
+       electra_cf_timer((unsigned long)_cf);
+       return IRQ_HANDLED;
+}
+
+static int electra_cf_get_status(struct pcmcia_socket *s, u_int *sp)
+{
+       struct electra_cf_socket *cf;
+
+       if (!sp)
+               return -EINVAL;
+
+       cf = container_of(s, struct electra_cf_socket, socket);
+
+       /* NOTE CF is always 3VCARD */
+       if (electra_cf_present(cf)) {
+               *sp = SS_READY | SS_DETECT | SS_POWERON | SS_3VCARD;
+
+               s->pci_irq = cf->irq;
+       } else
+               *sp = 0;
+       return 0;
+}
+
+static int electra_cf_set_socket(struct pcmcia_socket *sock,
+                                struct socket_state_t *s)
+{
+       unsigned int gpio;
+       unsigned int vcc;
+       struct electra_cf_socket *cf;
+
+       cf = container_of(sock, struct electra_cf_socket, socket);
+
+       /* "reset" means no power in our case */
+       vcc = (s->flags & SS_RESET) ? 0 : s->Vcc;
+
+       switch (vcc) {
+       case 0:
+               gpio = 0;
+               break;
+       case 33:
+               gpio = (1 << cf->gpio_3v);
+               break;
+       case 5:
+               gpio = (1 << cf->gpio_5v);
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       gpio |= 1 << (cf->gpio_3v + 16); /* enwr */
+       gpio |= 1 << (cf->gpio_5v + 16); /* enwr */
+       out_le32(cf->gpio_base+0x90, gpio);
+
+       pr_debug("%s: Vcc %d, io_irq %d, flags %04x csc %04x\n",
+               driver_name, s->Vcc, s->io_irq, s->flags, s->csc_mask);
+
+       return 0;
+}
+
+static int electra_cf_set_io_map(struct pcmcia_socket *s,
+                                struct pccard_io_map *io)
+{
+       return 0;
+}
+
+static int electra_cf_set_mem_map(struct pcmcia_socket *s,
+                                 struct pccard_mem_map *map)
+{
+       struct electra_cf_socket *cf;
+
+       if (map->card_start)
+               return -EINVAL;
+       cf = container_of(s, struct electra_cf_socket, socket);
+       map->static_start = cf->mem_phys;
+       map->flags &= MAP_ACTIVE|MAP_ATTRIB;
+       if (!(map->flags & MAP_ATTRIB))
+               map->static_start += 0x800;
+       return 0;
+}
+
+static struct pccard_operations electra_cf_ops = {
+       .init                   = electra_cf_ss_init,
+       .get_status             = electra_cf_get_status,
+       .set_socket             = electra_cf_set_socket,
+       .set_io_map             = electra_cf_set_io_map,
+       .set_mem_map            = electra_cf_set_mem_map,
+};
+
+static int __devinit electra_cf_probe(struct of_device *ofdev,
+                                     const struct of_device_id *match)
+{
+       struct device *device = &ofdev->dev;
+       struct device_node *np = ofdev->node;
+       struct electra_cf_socket   *cf;
+       struct resource mem, io;
+       int status;
+       const unsigned int *prop;
+       int err;
+       struct vm_struct *area;
+
+       err = of_address_to_resource(np, 0, &mem);
+       if (err)
+               return -EINVAL;
+
+       err = of_address_to_resource(np, 1, &io);
+       if (err)
+               return -EINVAL;
+
+       cf = kzalloc(sizeof *cf, GFP_KERNEL);
+       if (!cf)
+               return -ENOMEM;
+
+       setup_timer(&cf->timer, electra_cf_timer, (unsigned long)cf);
+       cf->irq = NO_IRQ;
+
+       cf->ofdev = ofdev;
+       cf->mem_phys = mem.start;
+       cf->mem_size = PAGE_ALIGN(mem.end - mem.start);
+       cf->mem_base = ioremap(cf->mem_phys, cf->mem_size);
+       cf->io_size = PAGE_ALIGN(io.end - io.start);
+
+       area = __get_vm_area(cf->io_size, 0, PHB_IO_BASE, PHB_IO_END);
+       if (area == NULL)
+               return -ENOMEM;
+
+       cf->io_virt = (void __iomem *)(area->addr);
+
+       cf->gpio_base = ioremap(0xfc103000, 0x1000);
+       dev_set_drvdata(device, cf);
+
+       if (!cf->mem_base || !cf->io_virt || !cf->gpio_base ||
+           (__ioremap_at(io.start, cf->io_virt, cf->io_size,
+               _PAGE_NO_CACHE | _PAGE_GUARDED) == NULL)) {
+               dev_err(device, "can't ioremap ranges\n");
+               status = -ENOMEM;
+               goto fail1;
+       }
+
+
+       cf->io_base = (unsigned long)cf->io_virt - VMALLOC_END;
+
+       cf->iomem.start = (unsigned long)cf->mem_base;
+       cf->iomem.end = (unsigned long)cf->mem_base + (mem.end - mem.start);
+       cf->iomem.flags = IORESOURCE_MEM;
+
+       cf->irq = irq_of_parse_and_map(np, 0);
+
+       status = request_irq(cf->irq, electra_cf_irq, IRQF_SHARED,
+                            driver_name, cf);
+       if (status < 0) {
+               dev_err(device, "request_irq failed\n");
+               goto fail1;
+       }
+
+       cf->socket.pci_irq = cf->irq;
+
+       prop = of_get_property(np, "card-detect-gpio", NULL);
+       if (!prop)
+               goto fail1;
+       cf->gpio_detect = *prop;
+
+       prop = of_get_property(np, "card-vsense-gpio", NULL);
+       if (!prop)
+               goto fail1;
+       cf->gpio_vsense = *prop;
+
+       prop = of_get_property(np, "card-3v-gpio", NULL);
+       if (!prop)
+               goto fail1;
+       cf->gpio_3v = *prop;
+
+       prop = of_get_property(np, "card-5v-gpio", NULL);
+       if (!prop)
+               goto fail1;
+       cf->gpio_5v = *prop;
+
+       cf->socket.io_offset = cf->io_base;
+
+       /* reserve chip-select regions */
+       if (!request_mem_region(cf->mem_phys, cf->mem_size, driver_name)) {
+               status = -ENXIO;
+               dev_err(device, "Can't claim memory region\n");
+               goto fail1;
+       }
+
+       if (!request_region(cf->io_base, cf->io_size, driver_name)) {
+               status = -ENXIO;
+               dev_err(device, "Can't claim I/O region\n");
+               goto fail2;
+       }
+
+       cf->socket.owner = THIS_MODULE;
+       cf->socket.dev.parent = &ofdev->dev;
+       cf->socket.ops = &electra_cf_ops;
+       cf->socket.resource_ops = &pccard_static_ops;
+       cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP |
+                               SS_CAP_MEM_ALIGN;
+       cf->socket.map_size = 0x800;
+
+       status = pcmcia_register_socket(&cf->socket);
+       if (status < 0) {
+               dev_err(device, "pcmcia_register_socket failed\n");
+               goto fail3;
+       }
+
+       dev_info(device, "at mem 0x%lx io 0x%lx irq %d\n",
+                cf->mem_phys, io.start, cf->irq);
+
+       cf->active = 1;
+       electra_cf_timer((unsigned long)cf);
+       return 0;
+
+fail3:
+       release_region(cf->io_base, cf->io_size);
+fail2:
+       release_mem_region(cf->mem_phys, cf->mem_size);
+fail1:
+       if (cf->irq != NO_IRQ)
+               free_irq(cf->irq, cf);
+
+       if (cf->io_virt)
+               __iounmap_at(cf->io_virt, cf->io_size);
+       if (cf->mem_base)
+               iounmap(cf->mem_base);
+       if (cf->gpio_base)
+               iounmap(cf->gpio_base);
+       device_init_wakeup(&ofdev->dev, 0);
+       kfree(cf);
+       return status;
+
+}
+
+static int __devexit electra_cf_remove(struct of_device *ofdev)
+{
+       struct device *device = &ofdev->dev;
+       struct electra_cf_socket *cf;
+
+       cf = dev_get_drvdata(device);
+
+       cf->active = 0;
+       pcmcia_unregister_socket(&cf->socket);
+       free_irq(cf->irq, cf);
+       del_timer_sync(&cf->timer);
+
+       __iounmap_at(cf->io_virt, cf->io_size);
+       iounmap(cf->mem_base);
+       iounmap(cf->gpio_base);
+       release_mem_region(cf->mem_phys, cf->mem_size);
+       release_region(cf->io_base, cf->io_size);
+
+       kfree(cf);
+
+       return 0;
+}
+
+static struct of_device_id electra_cf_match[] = {
+       {
+               .compatible   = "electra-cf",
+       },
+       {},
+};
+
+static struct of_platform_driver electra_cf_driver = {
+       .name      = (char *)driver_name,
+       .match_table    = electra_cf_match,
+       .probe    = electra_cf_probe,
+       .remove   = electra_cf_remove,
+};
+
+static int __init electra_cf_init(void)
+{
+       return of_register_platform_driver(&electra_cf_driver);
+}
+module_init(electra_cf_init);
+
+static void __exit electra_cf_exit(void)
+{
+       of_unregister_platform_driver(&electra_cf_driver);
+}
+module_exit(electra_cf_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>");
+MODULE_DESCRIPTION("PA Semi Electra CF driver");
index a381a92fd1b65dc0ef593d9b722747c9ee54b0f0..26f5abc9c3f7d604d926ec32e77570d4fd1a8363 100644 (file)
@@ -7,3 +7,7 @@ obj-y           := core.o card.o driver.o resource.o manager.o support.o interface.o quir
 obj-$(CONFIG_PNPACPI)          += pnpacpi/
 obj-$(CONFIG_PNPBIOS)          += pnpbios/
 obj-$(CONFIG_ISAPNP)           += isapnp/
+
+ifeq ($(CONFIG_PNP_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
index 6c0440c20e3199a0a51f2f567b7ffb73379f18f7..da1c9909eb44abbd5ed59602e3be4faf9fe99718 100644 (file)
@@ -104,10 +104,6 @@ int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
 {
        struct pnp_id *ptr;
 
-       if (!id)
-               return -EINVAL;
-       if (!card)
-               return -EINVAL;
        id->next = NULL;
        ptr = card->id;
        while (ptr && ptr->next)
@@ -124,8 +120,6 @@ static void pnp_free_card_ids(struct pnp_card *card)
        struct pnp_id *id;
        struct pnp_id *next;
 
-       if (!card)
-               return;
        id = card->id;
        while (id) {
                next = id->next;
@@ -197,42 +191,39 @@ int pnp_add_card(struct pnp_card *card)
        int error;
        struct list_head *pos, *temp;
 
-       if (!card || !card->protocol)
-               return -EINVAL;
-
        sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number,
                card->number);
        card->dev.parent = &card->protocol->dev;
        card->dev.bus = NULL;
        card->dev.release = &pnp_release_card;
        error = device_register(&card->dev);
+       if (error) {
+               dev_err(&card->dev, "could not register (err=%d)\n", error);
+               return error;
+       }
 
-       if (error == 0) {
-               pnp_interface_attach_card(card);
-               spin_lock(&pnp_lock);
-               list_add_tail(&card->global_list, &pnp_cards);
-               list_add_tail(&card->protocol_list, &card->protocol->cards);
-               spin_unlock(&pnp_lock);
-
-               /* we wait until now to add devices in order to ensure the drivers
-                * will be able to use all of the related devices on the card
-                * without waiting any unresonable length of time */
-               list_for_each(pos, &card->devices) {
-                       struct pnp_dev *dev = card_to_pnp_dev(pos);
-                       __pnp_add_device(dev);
-               }
+       pnp_interface_attach_card(card);
+       spin_lock(&pnp_lock);
+       list_add_tail(&card->global_list, &pnp_cards);
+       list_add_tail(&card->protocol_list, &card->protocol->cards);
+       spin_unlock(&pnp_lock);
 
-               /* match with card drivers */
-               list_for_each_safe(pos, temp, &pnp_card_drivers) {
-                       struct pnp_card_driver *drv =
-                           list_entry(pos, struct pnp_card_driver,
-                                      global_list);
-                       card_probe(card, drv);
-               }
-       } else
-               pnp_err("sysfs failure, card '%s' will be unavailable",
-                       card->dev.bus_id);
-       return error;
+       /* we wait until now to add devices in order to ensure the drivers
+        * will be able to use all of the related devices on the card
+        * without waiting an unreasonable length of time */
+       list_for_each(pos, &card->devices) {
+               struct pnp_dev *dev = card_to_pnp_dev(pos);
+               __pnp_add_device(dev);
+       }
+
+       /* match with card drivers */
+       list_for_each_safe(pos, temp, &pnp_card_drivers) {
+               struct pnp_card_driver *drv =
+                   list_entry(pos, struct pnp_card_driver,
+                              global_list);
+               card_probe(card, drv);
+       }
+       return 0;
 }
 
 /**
@@ -243,8 +234,6 @@ void pnp_remove_card(struct pnp_card *card)
 {
        struct list_head *pos, *temp;
 
-       if (!card)
-               return;
        device_unregister(&card->dev);
        spin_lock(&pnp_lock);
        list_del(&card->global_list);
@@ -263,8 +252,6 @@ void pnp_remove_card(struct pnp_card *card)
  */
 int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
 {
-       if (!card || !dev || !dev->protocol)
-               return -EINVAL;
        dev->dev.parent = &card->dev;
        dev->card_link = NULL;
        snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x",
@@ -304,14 +291,15 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
        struct pnp_card *card;
 
        if (!clink || !id)
-               goto done;
+               return NULL;
+
        card = clink->card;
        drv = clink->driver;
        if (!from) {
                pos = card->devices.next;
        } else {
                if (from->card != card)
-                       goto done;
+                       return NULL;
                pos = from->card_list.next;
        }
        while (pos != &card->devices) {
@@ -321,7 +309,6 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
                pos = pos->next;
        }
 
-done:
        return NULL;
 
 found:
@@ -348,8 +335,6 @@ void pnp_release_card_device(struct pnp_dev *dev)
 {
        struct pnp_card_driver *drv = dev->card_link->driver;
 
-       if (!drv)
-               return;
        drv->link.remove = &card_remove;
        device_release_driver(&dev->dev);
        drv->link.remove = &card_remove_first;
index d5964feb14de56d5c1dc5b7c9c1df1e8f9f447d0..7d366ca672d34ea7b6d07afa04fbcfbec849ad10 100644 (file)
@@ -125,9 +125,11 @@ int __pnp_add_device(struct pnp_dev *dev)
        spin_unlock(&pnp_lock);
 
        ret = device_register(&dev->dev);
-       if (ret == 0)
-               pnp_interface_attach_device(dev);
-       return ret;
+       if (ret)
+               return ret;
+
+       pnp_interface_attach_device(dev);
+       return 0;
 }
 
 /*
@@ -138,12 +140,30 @@ int __pnp_add_device(struct pnp_dev *dev)
  */
 int pnp_add_device(struct pnp_dev *dev)
 {
+       int ret;
+
        if (dev->card)
                return -EINVAL;
+
        dev->dev.parent = &dev->protocol->dev;
        sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
                dev->number);
-       return __pnp_add_device(dev);
+       ret = __pnp_add_device(dev);
+       if (ret)
+               return ret;
+
+#ifdef CONFIG_PNP_DEBUG
+       {
+               struct pnp_id *id;
+
+               dev_printk(KERN_DEBUG, &dev->dev, "%s device, IDs",
+                       dev->protocol->name);
+               for (id = dev->id; id; id = id->next)
+                       printk(" %s", id->id);
+               printk(" (%s)\n", dev->active ? "active" : "disabled");
+       }
+#endif
+       return 0;
 }
 
 void __pnp_remove_device(struct pnp_dev *dev)
index 2fa64a6b25c86d7c69fc053999463c0b6ff3cda0..a262762c5b8836e0dc5091317e43359b67443fc9 100644 (file)
@@ -86,9 +86,6 @@ static int pnp_device_probe(struct device *dev)
        pnp_dev = to_pnp_dev(dev);
        pnp_drv = to_pnp_driver(dev->driver);
 
-       pnp_dbg("match found with the PnP device '%s' and the driver '%s'",
-               dev->bus_id, pnp_drv->name);
-
        error = pnp_device_attach(pnp_dev);
        if (error < 0)
                return error;
@@ -116,6 +113,8 @@ static int pnp_device_probe(struct device *dev)
                error = 0;
        } else
                goto fail;
+
+       dev_dbg(dev, "driver attached\n");
        return error;
 
 fail:
index e0ee28a88da3f90a1712c082e410d1a9ff42c8bc..31548044fdde9a7ef63d1b154c882b83b034397f 100644 (file)
@@ -327,8 +327,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
 
        if (dev->status & PNP_ATTACHED) {
                retval = -EBUSY;
-               pnp_info("Device %s cannot be configured because it is in use.",
-                        dev->dev.bus_id);
+               dev_info(&dev->dev, "in use; can't configure\n");
                goto done;
        }
 
index ea3eac2404cad0236b58df1f77be7866cbe0a074..c6b3d4e63ccc62a9ae6e4df684c016eb598fe184 100644 (file)
@@ -22,8 +22,7 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
        unsigned long *flags;
 
        if (idx >= PNP_MAX_PORT) {
-               pnp_err
-                   ("More than 4 ports is incompatible with pnp specifications.");
+               dev_err(&dev->dev, "too many I/O port resources\n");
                /* pretend we were successful so at least the manager won't try again */
                return 1;
        }
@@ -64,8 +63,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
        unsigned long *flags;
 
        if (idx >= PNP_MAX_MEM) {
-               pnp_err
-                   ("More than 8 mems is incompatible with pnp specifications.");
+               dev_err(&dev->dev, "too many memory resources\n");
                /* pretend we were successful so at least the manager won't try again */
                return 1;
        }
@@ -122,8 +120,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
        };
 
        if (idx >= PNP_MAX_IRQ) {
-               pnp_err
-                   ("More than 2 irqs is incompatible with pnp specifications.");
+               dev_err(&dev->dev, "too many IRQ resources\n");
                /* pretend we were successful so at least the manager won't try again */
                return 1;
        }
@@ -161,7 +158,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
        return 0;
 }
 
-static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
+static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
 {
        resource_size_t *start, *end;
        unsigned long *flags;
@@ -173,15 +170,13 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
        };
 
        if (idx >= PNP_MAX_DMA) {
-               pnp_err
-                   ("More than 2 dmas is incompatible with pnp specifications.");
-               /* pretend we were successful so at least the manager won't try again */
-               return 1;
+               dev_err(&dev->dev, "too many DMA resources\n");
+               return;
        }
 
        /* check if this resource has been manually set, if so skip */
        if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO))
-               return 1;
+               return;
 
        start = &dev->res.dma_resource[idx].start;
        end = &dev->res.dma_resource[idx].end;
@@ -191,19 +186,17 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
        *flags |= rule->flags | IORESOURCE_DMA;
        *flags &= ~IORESOURCE_UNSET;
 
-       if (!rule->map) {
-               *flags |= IORESOURCE_DISABLED;
-               return 1;       /* skip disabled resource requests */
-       }
-
        for (i = 0; i < 8; i++) {
                if (rule->map & (1 << xtab[i])) {
                        *start = *end = xtab[i];
                        if (pnp_check_dma(dev, idx))
-                               return 1;
+                               return;
                }
        }
-       return 0;
+#ifdef MAX_DMA_CHANNELS
+       *start = *end = MAX_DMA_CHANNELS;
+#endif
+       *flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED;
 }
 
 /**
@@ -330,8 +323,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
                        irq = irq->next;
                }
                while (dma) {
-                       if (!pnp_assign_dma(dev, dma, ndma))
-                               goto fail;
+                       pnp_assign_dma(dev, dma, ndma);
                        ndma++;
                        dma = dma->next;
                }
@@ -367,8 +359,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
                        irq = irq->next;
                }
                while (dma) {
-                       if (!pnp_assign_dma(dev, dma, ndma))
-                               goto fail;
+                       pnp_assign_dma(dev, dma, ndma);
                        ndma++;
                        dma = dma->next;
                }
@@ -447,8 +438,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
        int i = 1;
 
        if (!pnp_can_configure(dev)) {
-               pnp_dbg("Device %s does not support resource configuration.",
-                       dev->dev.bus_id);
+               dev_dbg(&dev->dev, "configuration not supported\n");
                return -ENODEV;
        }
 
@@ -465,7 +455,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
                } while (dep);
        }
 
-       pnp_err("Unable to assign resources to device %s.", dev->dev.bus_id);
+       dev_err(&dev->dev, "unable to assign resources\n");
        return -EBUSY;
 }
 
@@ -478,17 +468,16 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
 int pnp_start_dev(struct pnp_dev *dev)
 {
        if (!pnp_can_write(dev)) {
-               pnp_dbg("Device %s does not support activation.",
-                       dev->dev.bus_id);
+               dev_dbg(&dev->dev, "activation not supported\n");
                return -EINVAL;
        }
 
        if (dev->protocol->set(dev, &dev->res) < 0) {
-               pnp_err("Failed to activate device %s.", dev->dev.bus_id);
+               dev_err(&dev->dev, "activation failed\n");
                return -EIO;
        }
 
-       pnp_info("Device %s activated.", dev->dev.bus_id);
+       dev_info(&dev->dev, "activated\n");
        return 0;
 }
 
@@ -501,16 +490,15 @@ int pnp_start_dev(struct pnp_dev *dev)
 int pnp_stop_dev(struct pnp_dev *dev)
 {
        if (!pnp_can_disable(dev)) {
-               pnp_dbg("Device %s does not support disabling.",
-                       dev->dev.bus_id);
+               dev_dbg(&dev->dev, "disabling not supported\n");
                return -EINVAL;
        }
        if (dev->protocol->disable(dev) < 0) {
-               pnp_err("Failed to disable device %s.", dev->dev.bus_id);
+               dev_err(&dev->dev, "disable failed\n");
                return -EIO;
        }
 
-       pnp_info("Device %s disabled.", dev->dev.bus_id);
+       dev_info(&dev->dev, "disabled\n");
        return 0;
 }
 
index a5a372222d69eec3350b25674fad1223c5a6ad66..dada89906314c7103b89b6e96a071afe3900d74d 100644 (file)
@@ -130,11 +130,16 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
 #ifdef CONFIG_ACPI_SLEEP
 static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
 {
-       return acpi_bus_set_power((acpi_handle) dev->data,
-                                 acpi_pm_device_sleep_state(&dev->dev,
-                                                            device_may_wakeup
-                                                            (&dev->dev),
-                                                            NULL));
+       int power_state;
+
+       power_state = acpi_pm_device_sleep_state(&dev->dev,
+                                               device_may_wakeup(&dev->dev),
+                                               NULL);
+       if (power_state < 0)
+               power_state = (state.event == PM_EVENT_ON) ?
+                               ACPI_STATE_D0 : ACPI_STATE_D3;
+
+       return acpi_bus_set_power((acpi_handle) dev->data, power_state);
 }
 
 static int pnpacpi_resume(struct pnp_dev *dev)
@@ -166,7 +171,6 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
            is_exclusive_device(device))
                return 0;
 
-       pnp_dbg("ACPI device : hid %s", acpi_device_hid(device));
        dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
        if (!dev) {
                pnp_err("Out of memory");
index 0e3b8d0ff06b78a3432d9846a904e2c29a1f2e75..cd0a204d96d14e9ffdc7d19e5597f47e89fe6b8a 100644 (file)
@@ -85,6 +85,16 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
        if (i >= PNP_MAX_IRQ)
                return;
 
+#ifdef CONFIG_X86
+       if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE ||
+                               polarity != ACPI_ACTIVE_HIGH)) {
+               pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, "
+                               "active high", gsi);
+               triggering = ACPI_EDGE_SENSITIVE;
+               polarity = ACPI_ACTIVE_HIGH;
+       }
+#endif
+
        res->irq_resource[i].flags = IORESOURCE_IRQ;    // Also clears _UNSET flag
        res->irq_resource[i].flags |= irq_flags(triggering, polarity);
        irq = acpi_register_gsi(gsi, triggering, polarity);
index 4e9fd37cff35ca3f8ad925d069a32f5aa72518d6..e33e03f710841998591b0b8c649f3fb2e2db189e 100644 (file)
@@ -315,25 +315,31 @@ struct pnp_protocol pnpbios_protocol = {
        .disable = pnpbios_disable_resources,
 };
 
-static int insert_device(struct pnp_dev *dev, struct pnp_bios_node *node)
+static int insert_device(struct pnp_bios_node *node)
 {
        struct list_head *pos;
-       struct pnp_dev *pnp_dev;
+       struct pnp_dev *dev;
        struct pnp_id *dev_id;
        char id[8];
 
        /* check if the device is already added */
-       dev->number = node->handle;
        list_for_each(pos, &pnpbios_protocol.devices) {
-               pnp_dev = list_entry(pos, struct pnp_dev, protocol_list);
-               if (dev->number == pnp_dev->number)
+               dev = list_entry(pos, struct pnp_dev, protocol_list);
+               if (dev->number == node->handle)
                        return -1;
        }
 
-       /* set the initial values for the PnP device */
+       dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
+       if (!dev)
+               return -1;
+
        dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
-       if (!dev_id)
+       if (!dev_id) {
+               kfree(dev);
                return -1;
+       }
+
+       dev->number = node->handle;
        pnpid32_to_pnpid(node->eisa_id, id);
        memcpy(dev_id->id, id, 7);
        pnp_add_id(dev_id, dev);
@@ -367,7 +373,6 @@ static void __init build_devlist(void)
        unsigned int nodes_got = 0;
        unsigned int devs = 0;
        struct pnp_bios_node *node;
-       struct pnp_dev *dev;
 
        node = kzalloc(node_info.max_node_size, GFP_KERNEL);
        if (!node)
@@ -388,12 +393,7 @@ static void __init build_devlist(void)
                                break;
                }
                nodes_got++;
-               dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
-               if (!dev)
-                       break;
-               if (insert_device(dev, node) < 0)
-                       kfree(dev);
-               else
+               if (insert_device(node) == 0)
                        devs++;
                if (nodenum <= thisnodenum) {
                        printk(KERN_ERR
index 9d9841f24a85d28999e9b060589da88c9a4ff31e..bb19bc957bad9274457930b8b75b7753e62a7ac4 100644 (file)
@@ -94,8 +94,9 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
 
        /* sanity check */
        if (escd_size > MAX_SANE_ESCD_SIZE) {
-               printk(KERN_ERR
-                      "PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great\n");
+               printk(KERN_ERR "PnPBIOS: proc_read_escd: ESCD size reported by"
+                               " BIOS read_escd call is too great\n");
+               kfree(tmpbuf);
                return -EFBIG;
        }
 
index 6b0cf0c2a0888483cbc220c54e2528ba2337c791..e903b8c2b1fa5e200e2140d609deb643ea49d195 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/slab.h>
 #include <linux/pnp.h>
 #include <linux/io.h>
+#include <linux/kallsyms.h>
 #include "base.h"
 
 static void quirk_awe32_resources(struct pnp_dev *dev)
@@ -133,11 +134,18 @@ static struct pnp_fixup pnp_fixups[] = {
 void pnp_fixup_device(struct pnp_dev *dev)
 {
        int i = 0;
+       void (*quirk)(struct pnp_dev *);
 
        while (*pnp_fixups[i].id) {
                if (compare_pnp_id(dev->id, pnp_fixups[i].id)) {
-                       pnp_dbg("Calling quirk for %s", dev->dev.bus_id);
-                       pnp_fixups[i].quirk_function(dev);
+                       quirk = pnp_fixups[i].quirk_function;
+
+#ifdef DEBUG
+                       dev_dbg(&dev->dev, "calling quirk 0x%p", quirk);
+                       print_fn_descriptor_symbol(": %s()\n",
+                               (unsigned long) *quirk);
+#endif
+                       (*quirk)(dev);
                }
                i++;
        }
index 087fed18628fd95fc146527883fd4deca67e0a8f..41d73a5e9312f16d87f751f2116036d11b8bef7c 100644 (file)
@@ -51,7 +51,7 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
 
        /* this should never happen but if it does we'll try to continue */
        if (dev->independent)
-               pnp_err("independent resource already registered");
+               dev_err(&dev->dev, "independent resource already registered\n");
        dev->independent = option;
        return option;
 }
index a06f980b3ac9b596ef886b08a908602c79ec270f..55c4563986b38aebc36b158eb7c9a649d7105d5c 100644 (file)
@@ -22,36 +22,39 @@ static const struct pnp_device_id pnp_dev_table[] = {
        {"", 0}
 };
 
-static void reserve_range(const char *pnpid, resource_size_t start,
+static void reserve_range(struct pnp_dev *dev, resource_size_t start,
                          resource_size_t end, int port)
 {
-       struct resource *res;
        char *regionid;
+       const char *pnpid = dev->dev.bus_id;
+       struct resource *res;
 
        regionid = kmalloc(16, GFP_KERNEL);
-       if (regionid == NULL)
+       if (!regionid)
                return;
+
        snprintf(regionid, 16, "pnp %s", pnpid);
        if (port)
                res = request_region(start, end - start + 1, regionid);
        else
                res = request_mem_region(start, end - start + 1, regionid);
-       if (res == NULL)
-               kfree(regionid);
-       else
+       if (res)
                res->flags &= ~IORESOURCE_BUSY;
+       else
+               kfree(regionid);
+
        /*
         * Failures at this point are usually harmless. pci quirks for
         * example do reserve stuff they know about too, so we may well
         * have double reservations.
         */
-       printk(KERN_INFO "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
-              pnpid, port ? "ioport" : "iomem",
-              (unsigned long long)start, (unsigned long long)end,
-              NULL != res ? "has been" : "could not be");
+       dev_info(&dev->dev, "%s range 0x%llx-0x%llx %s reserved\n",
+               port ? "ioport" : "iomem",
+               (unsigned long long) start, (unsigned long long) end,
+               res ? "has been" : "could not be");
 }
 
-static void reserve_resources_of_dev(const struct pnp_dev *dev)
+static void reserve_resources_of_dev(struct pnp_dev *dev)
 {
        int i;
 
@@ -73,7 +76,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev)
                if (pnp_port_end(dev, i) < pnp_port_start(dev, i))
                        continue;       /* invalid */
 
-               reserve_range(dev->dev.bus_id, pnp_port_start(dev, i),
+               reserve_range(dev, pnp_port_start(dev, i),
                              pnp_port_end(dev, i), 1);
        }
 
@@ -81,7 +84,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev)
                if (!pnp_mem_valid(dev, i))
                        continue;
 
-               reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i),
+               reserve_range(dev, pnp_mem_start(dev, i),
                              pnp_mem_end(dev, i), 0);
        }
 }
index 564baca01b7c001635f9b6e4495f07468358c6e9..389346cda6c826fdecfb7d8663a7950ddd2fab43 100644 (file)
@@ -150,7 +150,7 @@ char *func_table[MAX_NR_FUNC] = {
        NULL,
 };
 
-struct kbdiacr accent_table[MAX_DIACR] = {
+struct kbdiacruc accent_table[MAX_DIACR] = {
        {'^', 'c', '\003'},     {'^', 'd', '\004'},
        {'^', 'z', '\032'},     {'^', '\012', '\000'},
 };
index f62f9a4e89504005f8d45fe0aa0e96df5d513645..cee4d4e4242907bb7a917070b0e3ac7b706cb794 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/sched.h>
 #include <linux/sysrq.h>
 
+#include <linux/consolemap.h>
 #include <linux/kbd_kern.h>
 #include <linux/kbd_diacr.h>
 #include <asm/uaccess.h>
@@ -82,11 +83,11 @@ kbd_alloc(void) {
        if (!kbd->fn_handler)
                goto out_func;
        kbd->accent_table =
-               kmalloc(sizeof(struct kbdiacr)*MAX_DIACR, GFP_KERNEL);
+               kmalloc(sizeof(struct kbdiacruc)*MAX_DIACR, GFP_KERNEL);
        if (!kbd->accent_table)
                goto out_fn_handler;
        memcpy(kbd->accent_table, accent_table,
-              sizeof(struct kbdiacr)*MAX_DIACR);
+              sizeof(struct kbdiacruc)*MAX_DIACR);
        kbd->accent_table_size = accent_table_size;
        return kbd;
 
@@ -183,8 +184,8 @@ kbd_ebcasc(struct kbd_data *kbd, unsigned char *ebcasc)
  * Otherwise, conclude that DIACR was not combining after all,
  * queue it and return CH.
  */
-static unsigned char
-handle_diacr(struct kbd_data *kbd, unsigned char ch)
+static unsigned int
+handle_diacr(struct kbd_data *kbd, unsigned int ch)
 {
        int i, d;
 
@@ -460,7 +461,6 @@ int
 kbd_ioctl(struct kbd_data *kbd, struct file *file,
          unsigned int cmd, unsigned long arg)
 {
-       struct kbdiacrs __user *a;
        void __user *argp;
        int ct, perm;
 
@@ -481,17 +481,40 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file,
        case KDSKBSENT:
                return do_kdgkb_ioctl(kbd, argp, cmd, perm);
        case KDGKBDIACR:
-               a = argp;
+       {
+               struct kbdiacrs __user *a = argp;
+               struct kbdiacr diacr;
+               int i;
 
                if (put_user(kbd->accent_table_size, &a->kb_cnt))
                        return -EFAULT;
+               for (i = 0; i < kbd->accent_table_size; i++) {
+                       diacr.diacr = kbd->accent_table[i].diacr;
+                       diacr.base = kbd->accent_table[i].base;
+                       diacr.result = kbd->accent_table[i].result;
+                       if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr)))
+                       return -EFAULT;
+               }
+               return 0;
+       }
+       case KDGKBDIACRUC:
+       {
+               struct kbdiacrsuc __user *a = argp;
+
                ct = kbd->accent_table_size;
-               if (copy_to_user(a->kbdiacr, kbd->accent_table,
-                                ct * sizeof(struct kbdiacr)))
+               if (put_user(ct, &a->kb_cnt))
+                       return -EFAULT;
+               if (copy_to_user(a->kbdiacruc, kbd->accent_table,
+                                ct * sizeof(struct kbdiacruc)))
                        return -EFAULT;
                return 0;
+       }
        case KDSKBDIACR:
-               a = argp;
+       {
+               struct kbdiacrs __user *a = argp;
+               struct kbdiacr diacr;
+               int i;
+
                if (!perm)
                        return -EPERM;
                if (get_user(ct, &a->kb_cnt))
@@ -499,10 +522,31 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file,
                if (ct >= MAX_DIACR)
                        return -EINVAL;
                kbd->accent_table_size = ct;
-               if (copy_from_user(kbd->accent_table, a->kbdiacr,
-                                  ct * sizeof(struct kbdiacr)))
+               for (i = 0; i < ct; i++) {
+                       if (copy_from_user(&diacr, a->kbdiacr + i, sizeof(struct kbdiacr)))
+                               return -EFAULT;
+                       kbd->accent_table[i].diacr = diacr.diacr;
+                       kbd->accent_table[i].base = diacr.base;
+                       kbd->accent_table[i].result = diacr.result;
+               }
+               return 0;
+       }
+       case KDSKBDIACRUC:
+       {
+               struct kbdiacrsuc __user *a = argp;
+
+               if (!perm)
+                       return -EPERM;
+               if (get_user(ct, &a->kb_cnt))
+                       return -EFAULT;
+               if (ct >= MAX_DIACR)
+                       return -EINVAL;
+               kbd->accent_table_size = ct;
+               if (copy_from_user(kbd->accent_table, a->kbdiacruc,
+                                  ct * sizeof(struct kbdiacruc)))
                        return -EFAULT;
                return 0;
+       }
        default:
                return -ENOIOCTLCMD;
        }
index f7bf45c6bf0de23899fb1ff7136fef865aa3d0f8..5ccfe9cf126d1c9f6b7ebb4f5cabccd075f0d524 100644 (file)
@@ -25,9 +25,9 @@ struct kbd_data {
        unsigned short **key_maps;
        char **func_table;
        fn_handler_fn **fn_handler;
-       struct kbdiacr *accent_table;
+       struct kbdiacruc *accent_table;
        unsigned int accent_table_size;
-       unsigned char diacr;
+       unsigned int diacr;
        unsigned short sysrq;
 };
 
index 281f23a371b2db831ea3e7d50b4a16a111e04d46..94ec66372508016eab8fd3fad286f3f8017fe47c 100644 (file)
@@ -500,13 +500,11 @@ void jsm_input(struct jsm_channel *ch)
 {
        struct jsm_board *bd;
        struct tty_struct *tp;
-       struct tty_ldisc *ld;
        u32 rmask;
        u16 head;
        u16 tail;
        int data_len;
        unsigned long lock_flags;
-       int flip_len = 0;
        int len = 0;
        int n = 0;
        int s = 0;
@@ -574,45 +572,13 @@ void jsm_input(struct jsm_channel *ch)
 
        jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "start 2\n");
 
-       /*
-        * If the rxbuf is empty and we are not throttled, put as much
-        * as we can directly into the linux TTY buffer.
-        *
-        */
-       flip_len = TTY_FLIPBUF_SIZE;
-
-       len = min(data_len, flip_len);
-       len = min(len, (N_TTY_BUF_SIZE - 1) - tp->read_cnt);
-       ld = tty_ldisc_ref(tp);
-
-       /*
-        * If we were unable to get a reference to the ld,
-        * don't flush our buffer, and act like the ld doesn't
-        * have any space to put the data right now.
-        */
-       if (!ld) {
-               len = 0;
-       } else {
-               /*
-                * If ld doesn't have a pointer to a receive_buf function,
-                * flush the data, then act like the ld doesn't have any
-                * space to put the data right now.
-                */
-               if (!ld->receive_buf) {
-                               ch->ch_r_head = ch->ch_r_tail;
-                               len = 0;
-               }
-       }
-
-       if (len <= 0) {
+       if (data_len <= 0) {
                spin_unlock_irqrestore(&ch->ch_lock, lock_flags);
                jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "jsm_input 1\n");
-               if (ld)
-                       tty_ldisc_deref(ld);
                return;
        }
 
-       len = tty_buffer_request_room(tp, len);
+       len = tty_buffer_request_room(tp, data_len);
        n = len;
 
        /*
@@ -647,7 +613,7 @@ void jsm_input(struct jsm_channel *ch)
                                else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE)
                                        tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_FRAME);
                                else
-                               tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL);
+                                       tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL);
                        }
                } else {
                        tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ;
@@ -666,9 +632,6 @@ void jsm_input(struct jsm_channel *ch)
        /* Tell the tty layer its okay to "eat" the data now */
        tty_flip_buffer_push(tp);
 
-       if (ld)
-               tty_ldisc_deref(ld);
-
        jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n");
 }
 
diff --git a/drivers/tc/.gitignore b/drivers/tc/.gitignore
deleted file mode 100644 (file)
index acc0e1e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-lk201-map.c
index c899246bd3627ffc991f28e9ff1e2aa90f720c65..623b21063228467c85808fada2124326a6f7e3b5 100644 (file)
@@ -5,18 +5,3 @@
 # Object file lists.
 
 obj-$(CONFIG_TC) += tc.o tc-driver.o
-obj-$(CONFIG_VT) += lk201.o lk201-map.o lk201-remap.o
-
-$(obj)/lk201-map.o: $(obj)/lk201-map.c
-
-# Uncomment if you're changing the keymap and have an appropriate
-# loadkeys version for the map. By default, we'll use the shipped
-# versions.
-# GENERATE_KEYMAP := 1
-
-ifdef GENERATE_KEYMAP
-
-$(obj)/lk201-map.c: $(obj)/%.c: $(src)/%.map
-       loadkeys --mktable $< > $@
-
-endif
diff --git a/drivers/tc/lk201-map.c_shipped b/drivers/tc/lk201-map.c_shipped
deleted file mode 100644 (file)
index a9df8f5..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-
-/* Do not edit this file! It was automatically generated by   */
-/*    loadkeys --mktable defkeymap.map > defkeymap.c          */
-
-#include <linux/types.h>
-#include <linux/keyboard.h>
-#include <linux/kd.h>
-
-u_short plain_map[NR_KEYS] = {
-       0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
-       0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf11b,
-       0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf060, 0xf031, 0xf032,
-       0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030,
-       0xf02d, 0xf03d, 0xf07f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74,
-       0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201,
-       0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
-       0xf207, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a,
-       0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf05c, 0xf603, 0xf304, 0xf305,
-       0xf306, 0xf200, 0xf700, 0xf03e, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
-       0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf200, 0xf601,
-       0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
-       0xf020, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-};
-
-static u_short shift_map[NR_KEYS] = {
-       0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
-       0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf203,
-       0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf07e, 0xf021, 0xf040,
-       0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029,
-       0xf05f, 0xf02b, 0xf07f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54,
-       0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201,
-       0xf117, 0xf20b, 0xf20a, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
-       0xf207, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a,
-       0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07c, 0xf603, 0xf304, 0xf305,
-       0xf306, 0xf200, 0xf700, 0xf03c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
-       0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf200, 0xf601,
-       0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
-       0xf020, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-};
-
-static u_short altgr_map[NR_KEYS] = {
-       0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
-       0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf202,
-       0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf040,
-       0xf200, 0xf024, 0xf200, 0xf200, 0xf07b, 0xf05b, 0xf05d, 0xf07d,
-       0xf05c, 0xf200, 0xf200, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xfb71, 0xfb77, 0xf918, 0xfb72, 0xfb74,
-       0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf200, 0xf07e, 0xf201,
-       0xf117, 0xf118, 0xf119, 0xf911, 0xf912, 0xf913, 0xf30b, 0xf702,
-       0xf207, 0xf914, 0xfb73, 0xf917, 0xf919, 0xfb67, 0xfb68, 0xfb6a,
-       0xfb6b, 0xfb6c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf90e, 0xf90f,
-       0xf910, 0xf200, 0xf700, 0xf200, 0xfb7a, 0xfb78, 0xf916, 0xfb76,
-       0xf915, 0xfb6e, 0xfb6d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
-       0xf600, 0xf602, 0xf90b, 0xf90c, 0xf90d, 0xf30e, 0xf200, 0xf703,
-       0xf200, 0xf200, 0xf200, 0xf90a, 0xf310, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-};
-
-static u_short ctrl_map[NR_KEYS] = {
-       0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
-       0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf204,
-       0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf81b, 0xf200, 0xf000,
-       0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf07f, 0xf200, 0xf200,
-       0xf01f, 0xf200, 0xf008, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014,
-       0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf201,
-       0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
-       0xf207, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a,
-       0xf00b, 0xf00c, 0xf200, 0xf007, 0xf01c, 0xf603, 0xf304, 0xf305,
-       0xf306, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016,
-       0xf002, 0xf00e, 0xf00d, 0xf200, 0xf20e, 0xf07f, 0xf200, 0xf601,
-       0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
-       0xf000, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-};
-
-static u_short shift_ctrl_map[NR_KEYS] = {
-       0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106,
-       0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf200,
-       0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf000,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf01f, 0xf200, 0xf200, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014,
-       0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf200, 0xf200, 0xf201,
-       0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
-       0xf207, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a,
-       0xf00b, 0xf00c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf304, 0xf305,
-       0xf306, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016,
-       0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
-       0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
-       0xf200, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-};
-
-static u_short alt_map[NR_KEYS] = {
-       0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506,
-       0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf200,
-       0xf11c, 0xf510, 0xf511, 0xf512, 0xf513, 0xf01b, 0xf831, 0xf832,
-       0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830,
-       0xf82d, 0xf83d, 0xf87f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874,
-       0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d,
-       0xf117, 0xf118, 0xf119, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf702,
-       0xf207, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a,
-       0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf85c, 0xf603, 0xf904, 0xf905,
-       0xf906, 0xf200, 0xf700, 0xf200, 0xf87a, 0xf878, 0xf863, 0xf876,
-       0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf200, 0xf210,
-       0xf600, 0xf211, 0xf901, 0xf902, 0xf903, 0xf30e, 0xf200, 0xf703,
-       0xf820, 0xf200, 0xf200, 0xf900, 0xf310, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-};
-
-static u_short ctrl_alt_map[NR_KEYS] = {
-       0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506,
-       0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf200,
-       0xf11c, 0xf510, 0xf511, 0xf512, 0xf513, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf114, 0xf115, 0xf20c, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814,
-       0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf200, 0xf200, 0xf201,
-       0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702,
-       0xf207, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a,
-       0xf80b, 0xf80c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf304, 0xf305,
-       0xf306, 0xf200, 0xf700, 0xf200, 0xf81a, 0xf818, 0xf803, 0xf816,
-       0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601,
-       0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703,
-       0xf200, 0xf200, 0xf200, 0xf300, 0xf20c, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-       0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
-};
-
-ushort *key_maps[MAX_NR_KEYMAPS] = {
-       plain_map, shift_map, altgr_map, 0,
-       ctrl_map, shift_ctrl_map, 0, 0,
-       alt_map, 0, 0, 0,
-       ctrl_alt_map,   0
-};
-
-unsigned int keymap_count = 7;
-
-
-/*
- * Philosophy: most people do not define more strings, but they who do
- * often want quite a lot of string space. So, we statically allocate
- * the default and allocate dynamically in chunks of 512 bytes.
- */
-
-char func_buf[] = {
-       '\033', '[', '[', 'A', 0, 
-       '\033', '[', '[', 'B', 0, 
-       '\033', '[', '[', 'C', 0, 
-       '\033', '[', '[', 'D', 0, 
-       '\033', '[', '[', 'E', 0, 
-       '\033', '[', '1', '7', '~', 0, 
-       '\033', '[', '1', '8', '~', 0, 
-       '\033', '[', '1', '9', '~', 0, 
-       '\033', '[', '2', '0', '~', 0, 
-       '\033', '[', '2', '1', '~', 0, 
-       '\033', '[', '2', '3', '~', 0, 
-       '\033', '[', '2', '4', '~', 0, 
-       '\033', '[', '2', '5', '~', 0, 
-       '\033', '[', '2', '6', '~', 0, 
-       '\033', '[', '2', '8', '~', 0, 
-       '\033', '[', '2', '9', '~', 0, 
-       '\033', '[', '3', '1', '~', 0, 
-       '\033', '[', '3', '2', '~', 0, 
-       '\033', '[', '3', '3', '~', 0, 
-       '\033', '[', '3', '4', '~', 0, 
-       '\033', '[', '1', '~', 0, 
-       '\033', '[', '2', '~', 0, 
-       '\033', '[', '3', '~', 0, 
-       '\033', '[', '4', '~', 0, 
-       '\033', '[', '5', '~', 0, 
-       '\033', '[', '6', '~', 0, 
-       '\033', '[', 'M', 0, 
-       '\033', '[', 'P', 0, 
-};
-
-
-char *funcbufptr = func_buf;
-int funcbufsize = sizeof(func_buf);
-int funcbufleft = 0;          /* space left */
-
-char *func_table[MAX_NR_FUNC] = {
-       func_buf + 0,
-       func_buf + 5,
-       func_buf + 10,
-       func_buf + 15,
-       func_buf + 20,
-       func_buf + 25,
-       func_buf + 31,
-       func_buf + 37,
-       func_buf + 43,
-       func_buf + 49,
-       func_buf + 55,
-       func_buf + 61,
-       func_buf + 67,
-       func_buf + 73,
-       func_buf + 79,
-       func_buf + 85,
-       func_buf + 91,
-       func_buf + 97,
-       func_buf + 103,
-       func_buf + 109,
-       func_buf + 115,
-       func_buf + 120,
-       func_buf + 125,
-       func_buf + 130,
-       func_buf + 135,
-       func_buf + 140,
-       func_buf + 145,
-       0,
-       0,
-       func_buf + 149,
-       0,
-};
-
-struct kbdiacr accent_table[MAX_DIACR] = {
-       {'`', 'A', 'À'},        {'`', 'a', 'à'},
-       {'\'', 'A', 'Á'},       {'\'', 'a', 'á'},
-       {'^', 'A', 'Â'},        {'^', 'a', 'â'},
-       {'~', 'A', 'Ã'},        {'~', 'a', 'ã'},
-       {'"', 'A', 'Ä'},        {'"', 'a', 'ä'},
-       {'O', 'A', 'Å'},        {'o', 'a', 'å'},
-       {'0', 'A', 'Å'},        {'0', 'a', 'å'},
-       {'A', 'A', 'Å'},        {'a', 'a', 'å'},
-       {'A', 'E', 'Æ'},        {'a', 'e', 'æ'},
-       {',', 'C', 'Ç'},        {',', 'c', 'ç'},
-       {'`', 'E', 'È'},        {'`', 'e', 'è'},
-       {'\'', 'E', 'É'},       {'\'', 'e', 'é'},
-       {'^', 'E', 'Ê'},        {'^', 'e', 'ê'},
-       {'"', 'E', 'Ë'},        {'"', 'e', 'ë'},
-       {'`', 'I', 'Ì'},        {'`', 'i', 'ì'},
-       {'\'', 'I', 'Í'},       {'\'', 'i', 'í'},
-       {'^', 'I', 'Î'},        {'^', 'i', 'î'},
-       {'"', 'I', 'Ï'},        {'"', 'i', 'ï'},
-       {'-', 'D', 'Ð'},        {'-', 'd', 'ð'},
-       {'~', 'N', 'Ñ'},        {'~', 'n', 'ñ'},
-       {'`', 'O', 'Ò'},        {'`', 'o', 'ò'},
-       {'\'', 'O', 'Ó'},       {'\'', 'o', 'ó'},
-       {'^', 'O', 'Ô'},        {'^', 'o', 'ô'},
-       {'~', 'O', 'Õ'},        {'~', 'o', 'õ'},
-       {'"', 'O', 'Ö'},        {'"', 'o', 'ö'},
-       {'/', 'O', 'Ø'},        {'/', 'o', 'ø'},
-       {'`', 'U', 'Ù'},        {'`', 'u', 'ù'},
-       {'\'', 'U', 'Ú'},       {'\'', 'u', 'ú'},
-       {'^', 'U', 'Û'},        {'^', 'u', 'û'},
-       {'"', 'U', 'Ü'},        {'"', 'u', 'ü'},
-       {'\'', 'Y', 'Ý'},       {'\'', 'y', 'ý'},
-       {'T', 'H', 'Þ'},        {'t', 'h', 'þ'},
-       {'s', 's', 'ß'},        {'"', 'y', 'ÿ'},
-       {'s', 'z', 'ß'},        {'i', 'j', 'ÿ'},
-};
-
-unsigned int accent_table_size = 68;
diff --git a/drivers/tc/lk201-map.map b/drivers/tc/lk201-map.map
deleted file mode 100644 (file)
index 2c636b4..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-# Default kernel keymap. This uses 7 modifier combinations.
-keymaps 0-2,4-5,8,12
-# Change the above line into
-#      keymaps 0-2,4-6,8,12
-# in case you want the entries
-#      altgr   control keycode  83 = Boot
-#      altgr   control keycode 111 = Boot
-# below.
-#
-# In fact AltGr is used very little, and one more keymap can
-# be saved by mapping AltGr to Alt (and adapting a few entries):
-# keycode 100 = Alt
-#
-keycode   0x15 = grave         tilde
-       alt     keycode   0x15 = Escape
-       control keycode   0x15 = Meta_Escape
-keycode   0x16 = one              exclam
-       alt     keycode   0x16 = Meta_one
-keycode   0x17 = two              at               at
-       control keycode   0x17 = nul
-       shift   control keycode   0x17 = nul
-       alt     keycode   0x17 = Meta_two
-keycode   0x18 = three            numbersign
-       control keycode   0x18 = Escape
-       alt     keycode   0x18 = Meta_three
-keycode   0x19 = four             dollar           dollar
-       control keycode   0x19 = Control_backslash
-       alt     keycode   0x19 = Meta_four
-keycode   0x1a = five             percent
-       control keycode   0x1a = Control_bracketright
-       alt     keycode   0x1a = Meta_five
-keycode   0x1b = six              asciicircum
-       control keycode   0x1b = Control_asciicircum
-       alt     keycode   0x1b = Meta_six
-keycode   0x1c = seven            ampersand        braceleft
-       control keycode   0x1c = Control_underscore
-       alt     keycode   0x1c = Meta_seven
-keycode   0x1d = eight            asterisk         bracketleft
-       control keycode   0x1d = Delete
-       alt     keycode   0x1d = Meta_eight
-keycode  0x1e = nine             parenleft        bracketright
-       alt     keycode  0x1e = Meta_nine
-keycode  0x1f = zero             parenright       braceright
-       alt     keycode  0x1f = Meta_zero
-keycode  0x20 = minus            underscore       backslash
-       control keycode  0x20 = Control_underscore
-       shift   control keycode  0x20 = Control_underscore
-       alt     keycode  0x20 = Meta_minus
-keycode  0x21 = equal            plus
-       alt     keycode  0x21 = Meta_equal
-keycode  0x22 = Delete           Delete
-       control keycode  0x22 = BackSpace
-       alt     keycode  0x22 = Meta_Delete
-keycode  0x2a = Tab              Tab
-       alt     keycode  0x2a = Meta_Tab
-keycode  0x2b = q
-keycode  0x2c = w
-keycode  0x2d = e
-       altgr   keycode  0x2d = Hex_E
-keycode  0x2e = r
-keycode  0x2f = t
-keycode  0x30 = y
-keycode  0x31 = u
-keycode  0x32 = i
-keycode  0x33 = o
-keycode  0x34 = p
-keycode  0x35 = bracketleft      braceleft
-       control keycode  0x35 = Escape
-       alt     keycode  0x35 = Meta_bracketleft
-keycode  0x36 = bracketright     braceright       asciitilde
-       control keycode  0x36 = Control_bracketright
-       alt     keycode  0x36 = Meta_bracketright
-keycode  0x37 = Return
-       alt     keycode  0x37 = Meta_Control_m
-keycode  0x3f = Control
-keycode  0x41 = a
-       altgr   keycode  0x41 = Hex_A
-keycode  0x42 = s
-keycode  0x43 = d
-       altgr   keycode  0x43 = Hex_D
-keycode  0x44 = f
-       altgr   keycode  0x44 = Hex_F
-keycode  0x45 = g
-keycode  0x46 = h
-keycode  0x47 = j
-keycode  0x48 = k
-keycode  0x49 = l
-keycode  0x4a = semicolon        colon
-       alt     keycode  0x4a = Meta_semicolon
-keycode  0x4b = apostrophe       quotedbl
-       control keycode  0x4b = Control_g
-       alt     keycode  0x4b = Meta_apostrophe
-# keycode  41 = grave            asciitilde
-#      control keycode  41 = nul
-#      alt     keycode  41 = Meta_grave
-keycode  0x52 = Shift
-keycode  0x4c = backslash        bar
-       control keycode  0x4c = Control_backslash
-       alt     keycode  0x4c = Meta_backslash
-keycode  0x53 = greater        less
-keycode  0x54 = z
-keycode  0x55 = x
-keycode  0x56 = c
-       altgr   keycode  0x56 = Hex_C
-keycode  0x57 = v
-keycode  0x58 = b
-       altgr   keycode  0x58 = Hex_B
-keycode  0x59 = n
-keycode  0x5a = m
-keycode  0x5b = comma            less
-       alt     keycode  0x5b = Meta_comma
-keycode  0x5c = period           greater
-       control keycode  0x5c = Compose
-       alt     keycode  0x5c = Meta_period
-keycode  0x5d = slash            question
-       control keycode  0x5d = Delete
-       alt     keycode  0x5d = Meta_slash
-
-keycode  0x67 = Alt
-keycode  0x68 = space            space
-       control keycode  0x68 = nul
-       alt     keycode  0x68 = Meta_space
-keycode  0x40 = Caps_Lock
-keycode  0x01 = F1
-       control keycode  0x01 = F1
-       alt     keycode  0x01 = Console_1
-       control alt     keycode  0x01 = Console_1
-keycode  0x02 = F2
-       control keycode  0x02 = F2
-       alt     keycode  0x02 = Console_2
-       control alt     keycode  0x02 = Console_2
-keycode  0x03 = F3
-       control keycode  0x03 = F3
-       alt     keycode  0x03 = Console_3
-       control alt     keycode  0x03 = Console_3
-keycode  0x04 = F4
-       control keycode  0x04 = F4
-       alt     keycode  0x04 = Console_4
-       control alt     keycode  0x04 = Console_4
-keycode  0x05 = F5
-       control keycode  0x05 = F5
-       alt     keycode  0x05 = Console_5
-       control alt     keycode  0x05 = Console_5
-keycode  0x06 = F6
-       control keycode  0x06 = F6
-       alt     keycode  0x06 = Console_6
-       control alt     keycode  0x06 = Console_6
-keycode  0x07 = F7
-       control keycode  0x07 = F7
-       alt     keycode  0x07 = Console_7
-       control alt     keycode  0x07 = Console_7
-keycode  0x08 = F8
-       control keycode  0x08 = F8
-       alt     keycode  0x08 = Console_8
-       control alt     keycode  0x08 = Console_8
-keycode  0x09 = F9
-       control keycode  0x09 = F9
-       alt     keycode  0x09 = Console_9
-       control alt     keycode  0x09 = Console_9
-keycode  0x0a = F10
-       control keycode  0x0a = F10
-       alt     keycode  0x0a = Console_10
-       control alt     keycode  0x0a = Console_10
-keycode  0x0b = F11
-       control keycode  0x0b = F11
-       alt     keycode  0x0b = Console_11
-       control alt     keycode  0x0b = Console_11
-keycode  0x0c = F12
-       control keycode  0x0c = F12
-       alt     keycode  0x0c = Console_12
-       control alt     keycode  0x0c = Console_12
-keycode  0x0d = F13
-       control keycode  0x0d = F13
-       alt     keycode  0x0d = Console_13
-       control alt     keycode  0x0d = Console_13
-keycode  0x0e = F14
-       control keycode  0x0e = F14
-       alt     keycode  0x0e = Console_14
-       control alt     keycode  0x0e = Console_14
-
-keycode  0x11 = F17
-       control keycode  0x11 = F17
-       alt     keycode  0x11 = Console_17
-       control alt     keycode  0x11 = Console_17
-keycode  0x12 = F18
-       control keycode  0x12 = F18
-       alt     keycode  0x12 = Console_18
-       control alt     keycode  0x12 = Console_18
-keycode  0x13 = F19
-       control keycode  0x13 = F19
-       alt     keycode  0x13 = Console_19
-       control alt     keycode  0x13 = Console_19
-keycode  0x14 = F20
-       control keycode  0x14 = F20
-       alt     keycode  0x14 = Console_20
-       control alt     keycode  0x14 = Console_20
-
-
-keycode  0x3b = KP_7
-       alt     keycode  0x3b = Ascii_7
-       altgr   keycode  0x3b = Hex_7
-keycode  0x3c = KP_8
-       alt     keycode  0x3c = Ascii_8
-       altgr   keycode  0x3c = Hex_8
-keycode  0x3d = KP_9
-       alt     keycode  0x3d = Ascii_9
-       altgr   keycode  0x3d = Hex_9
-keycode  0x3e = KP_Subtract
-keycode  0x4e = KP_4
-       alt     keycode  0x4e = Ascii_4
-       altgr   keycode  0x4e = Hex_4
-keycode  0x4f = KP_5
-       alt     keycode  0x4f = Ascii_5
-       altgr   keycode  0x4f = Hex_5
-keycode  0x50 = KP_6
-       alt     keycode  0x50 = Ascii_6
-       altgr   keycode  0x50 = Hex_6
-keycode  0x62 = KP_1
-       alt     keycode  0x62 = Ascii_1
-       altgr   keycode  0x62 = Hex_1
-keycode  0x63 = KP_2
-       alt     keycode  0x63 = Ascii_2
-       altgr   keycode  0x63 = Hex_2
-keycode  0x64 = KP_3
-       alt     keycode  0x64 = Ascii_3
-       altgr   keycode  0x64 = Hex_3
-keycode  0x6b = KP_0
-       alt     keycode  0x6b = Ascii_0
-       altgr   keycode  0x6b = Hex_0
-keycode  0x6c = KP_Period
-#      altgr   control keycode  0x6c = Boot
-       control alt     keycode  0x6c = Boot
-keycode  0x65 = KP_Enter
-
-keycode  0x3f = Control
-
-# keycode 100 = AltGr
-
-keycode 0x23 = Find
-keycode 0x4d = Up
-keycode 0x39 = Prior
-       shift   keycode 0x39 = Scroll_Backward
-keycode 0x5f = Left
-       alt     keycode 0x5f = Decr_Console
-keycode 0x61 = Right
-       alt     keycode 0x61 = Incr_Console
-keycode 0x38 = Select
-keycode 0x60 = Down
-keycode 0x3a = Next
-       shift   keycode 0x3a = Scroll_Forward
-keycode 0x24 = Insert
-keycode 0x25 = Remove
-#      altgr   control keycode 0x25 = Boot
-       control alt     keycode 0x25 = Boot
-
-keycode 0x0f = Help      Show_Memory      Show_Registers
-       control keycode  0x0f = Show_State
-
-keycode 0x10 = Do
-
-string F1 = "\033[[A"
-string F2 = "\033[[B"
-string F3 = "\033[[C"
-string F4 = "\033[[D"
-string F5 = "\033[[E"
-string F6 = "\033[17~"
-string F7 = "\033[18~"
-string F8 = "\033[19~"
-string F9 = "\033[20~"
-string F10 = "\033[21~"
-string F11 = "\033[23~"
-string F12 = "\033[24~"
-string F13 = "\033[25~"
-string F14 = "\033[26~"
-string F15 = "\033[28~"
-string F16 = "\033[29~"
-string F17 = "\033[31~"
-string F18 = "\033[32~"
-string F19 = "\033[33~"
-string F20 = "\033[34~"
-string Find = "\033[1~"
-string Insert = "\033[2~"
-string Remove = "\033[3~"
-string Select = "\033[4~"
-string Prior = "\033[5~"
-string Next = "\033[6~"
-string Macro = "\033[M"
-string Pause = "\033[P"
-compose '`' 'A' to 'À'
-compose '`' 'a' to 'à'
-compose '\'' 'A' to 'Á'
-compose '\'' 'a' to 'á'
-compose '^' 'A' to 'Â'
-compose '^' 'a' to 'â'
-compose '~' 'A' to 'Ã'
-compose '~' 'a' to 'ã'
-compose '"' 'A' to 'Ä'
-compose '"' 'a' to 'ä'
-compose 'O' 'A' to 'Å'
-compose 'o' 'a' to 'å'
-compose '0' 'A' to 'Å'
-compose '0' 'a' to 'å'
-compose 'A' 'A' to 'Å'
-compose 'a' 'a' to 'å'
-compose 'A' 'E' to 'Æ'
-compose 'a' 'e' to 'æ'
-compose ',' 'C' to 'Ç'
-compose ',' 'c' to 'ç'
-compose '`' 'E' to 'È'
-compose '`' 'e' to 'è'
-compose '\'' 'E' to 'É'
-compose '\'' 'e' to 'é'
-compose '^' 'E' to 'Ê'
-compose '^' 'e' to 'ê'
-compose '"' 'E' to 'Ë'
-compose '"' 'e' to 'ë'
-compose '`' 'I' to 'Ì'
-compose '`' 'i' to 'ì'
-compose '\'' 'I' to 'Í'
-compose '\'' 'i' to 'í'
-compose '^' 'I' to 'Î'
-compose '^' 'i' to 'î'
-compose '"' 'I' to 'Ï'
-compose '"' 'i' to 'ï'
-compose '-' 'D' to 'Ð'
-compose '-' 'd' to 'ð'
-compose '~' 'N' to 'Ñ'
-compose '~' 'n' to 'ñ'
-compose '`' 'O' to 'Ò'
-compose '`' 'o' to 'ò'
-compose '\'' 'O' to 'Ó'
-compose '\'' 'o' to 'ó'
-compose '^' 'O' to 'Ô'
-compose '^' 'o' to 'ô'
-compose '~' 'O' to 'Õ'
-compose '~' 'o' to 'õ'
-compose '"' 'O' to 'Ö'
-compose '"' 'o' to 'ö'
-compose '/' 'O' to 'Ø'
-compose '/' 'o' to 'ø'
-compose '`' 'U' to 'Ù'
-compose '`' 'u' to 'ù'
-compose '\'' 'U' to 'Ú'
-compose '\'' 'u' to 'ú'
-compose '^' 'U' to 'Û'
-compose '^' 'u' to 'û'
-compose '"' 'U' to 'Ü'
-compose '"' 'u' to 'ü'
-compose '\'' 'Y' to 'Ý'
-compose '\'' 'y' to 'ý'
-compose 'T' 'H' to 'Þ'
-compose 't' 'h' to 'þ'
-compose 's' 's' to 'ß'
-compose '"' 'y' to 'ÿ'
-compose 's' 'z' to 'ß'
-compose 'i' 'j' to 'ÿ'
diff --git a/drivers/tc/lk201-remap.c b/drivers/tc/lk201-remap.c
deleted file mode 100644 (file)
index d39098c..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Keyboard mappings for DEC LK201/401/501 keyboards
- *
- * 17.05.99 Michael Engel (engel@unix-ag.org)
- *
- * DEC US keyboards generate keycodes in the range 0x55 - 0xfb
- *
- * This conflicts with Linux scancode conventions which define
- * 0x00-0x7f as "normal" and 0x80-0xff as "shifted" scancodes, so we
- * have to remap the keycodes to 0x00-0x7f with the scancodeRemap
- * array. The generated scancode is simply the number of the key counted
- * from the left upper to the right lower corner of the keyboard ...
- *
- * These scancodes are then being remapped (I hope ;-)) with the
- * lk501*map[] arrays which define scancode -> Linux code mapping
- *
- * Oh man is this horrible ;-)
- *
- * Scancodes with dual labels exist for keyboards as follows:
- *
- * code:  left label          / right label
- *
- * 0x73:  LKx01, LK421        / LK443, LK444
- * 0x74:  LKx01, LK421        / LK443, LK444
- * 0x7c:  LKx01, LK421        / LK443, LK444
- * 0x8a:  LKx01, LK421        / LK443, LK444
- * 0x8b:  LKx01, LK421        / LK443, LK444
- * 0x8c:  LKx01, LK421        / LK443, LK444
- * 0x8d:  LKx01, LK421        / LK443, LK444
- * 0x8e:  LKx01, LK421        / LK443, LK444
- * 0x8f:  LKx01, LK421        / LK443, LK444
- * 0x9c:  LKx01, LK421        / LK443, LK444
- * 0xa1:  LKx01, LK421        / LK443, LK444
- * 0xa2:  LKx01, LK421        / LK443, LK444
- * 0xa3:  LKx01, LK421        / LK443, LK444
- * 0xa4:  LKx01, LK421        / LK443, LK444
- * 0xad:         LK421        / LK443, LK444
- * 0xc9:  LKx01, LK421, LK443 /        LK444
- * 0xf7:  LKx01,        LK443 /        LK444
- */
-
-unsigned char scancodeRemap[256] = {
-/* -----                                                               */
-/*  0 */ 0,            0,              0,              0,
-/* -----                                                               */
-/*  4 */ 0,            0,              0,              0,
-/* -----                                                               */
-/*  8 */ 0,            0,              0,              0,
-/* -----                                                               */
-/*  c */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 10 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 14 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 18 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 1c */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 20 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 24 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 28 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 2c */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 30 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 34 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 38 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 3c */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 40 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 44 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 48 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 4c */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 50 */ 0,            0,              0,              0,
-/* -----               ESC             F1              F2              */
-/* 54 */ 0,            0,              0x01,           0x02,
-/* ----- F3            F4              F5                              */
-/* 58 */ 0x03,         0x04,           0x05,           0,
-/* -----                                                               */
-/* 5c */ 0,            0,              0,              0,
-/* -----                                                               */
-/* 60 */ 0,            0,              0,              0,
-/* ----- F6            F7              F8              F9              */
-/* 64 */ 0x06,         0x07,           0x08,           0x09,
-/* ----- F10                                                           */
-/* 68 */ 0x0a,         0,              0,              0,
-/* -----                                                               */
-/* 6c */ 0,            0,              0,              0,
-/* -----               F11             F12             F13/PRNT SCRN   */
-/* 70 */ 0,            0x0b,           0x0c,           0x0d,
-/* ----- F14/SCRL LCK                                                  */
-/* 74 */ 0x0e,         0,              0,              0,
-/* -----                                                               */
-/* 78 */ 0,            0,              0,              0,
-/* ----- HELP/PAUSE    DO                                              */
-/* 7c */ 0x0f,         0x10,           0,              0,
-/* ----- F17           F18             F19             F20             */
-/* 80 */ 0x11,         0x12,           0x13,           0x14,
-/* -----                                                               */
-/* 84 */ 0,            0,              0,              0,
-/* -----                               FIND/INSERT     INSERT/HOME     */
-/* 88 */ 0,            0,              0x23,           0x24,
-/* ----- REMOVE/PG UP  SELECT/DELETE   PREVIOUS/END    NEXT/PG DN      */
-/* 8c */ 0x25,         0x38,           0x39,           0x3a,
-/* -----                               KP 0                            */
-/* 90 */ 0,            0,              0x6b,           0,
-/* ----- KP .          KP ENTER        KP 1            KP 2            */
-/* 94 */ 0x6c,         0x65,           0x62,           0x63,
-/* ----- KP 3          KP 4            KP 5            KP 6            */
-/* 98 */ 0x64,         0x4e,           0x4f,           0x50,
-/* ----- KP ,/KP +     KP 7            KP 8            KP 9            */
-/* 9c */ 0x51,         0x3b,           0x3c,           0x3d,
-/* ----- KP -          KP F1/NUM LCK   KP F2/KP /      KP F3/KP *      */
-/* a0 */ 0x3e,         0x26,           0x27,           0x28,
-/* ----- KP F4/KP -                                    LEFT            */
-/* a4 */ 0x29,         0,              0,              0x5f,
-/* ----- RIGHT         DOWN            UP              SHIFT Rt        */
-/* a8 */ 0x61,         0x60,           0x4d,           0x5e,
-/* ----- ALT           COMP Rt/CTRL Rt SHIFT           CONTROL         */
-/* ac */ 0,            0,              0x52,           0x3f,
-/* ----- CAPS          COMPOSE         ALT Rt                          */
-/* b0 */ 0x40,         0x67,           0,              0,
-/* -----                                                               */
-/* b4 */ 0,            0,              0,              0,
-/* -----                                                               */
-/* b8 */ 0,            0,              0,              0,
-/* ----- BKSP          RET             TAB             `               */
-/* bc */ 0x22,         0x37,           0x2a,           0x15,
-/* ----- 1             q               a               z               */
-/* c0 */ 0x16,         0x2b,           0x41,           0x54,
-/* -----               2               w               s               */
-/* c4 */ 0,            0x17,           0x2c,           0x42,
-/* ----- x             </\\                            3               */
-/* c8 */ 0x55,         0x53,           0,              0x18,
-/* ----- e             d               c                               */
-/* cc */ 0x2d,         0x43,           0x56,           0,
-/* ----- 4             r               f               v               */
-/* d0 */ 0x19,         0x2e,           0x44,           0x57,
-/* ----- SPACE                         5               t               */
-/* d4 */ 0x68,         0,              0x1a,           0x2f,
-/* ----- g             b                               6               */
-/* d8 */ 0x45,         0x58,           0,              0x1b,
-/* ----- y             h               n                               */
-/* dc */ 0x30,         0x46,           0x59,           0,
-/* ----- 7             u               j               m               */
-/* e0 */ 0x1c,         0x31,           0x47,           0x5a,
-/* -----               8               i               k               */
-/* e4 */ 0,            0x1d,           0x32,           0x48,
-/* ----- ,                             9               o               */
-/* e8 */ 0x5b,         0,              0x1e,           0x33,
-/* ----- l             .                               0               */
-/* ec */ 0x49,         0x5c,           0,              0x1f,
-/* ----- p                             ;               /               */
-/* f0 */ 0x34,         0,              0x4a,           0x5d,
-/* -----               =               ]               \\/\'           */
-/* f4 */ 0,            0x21,           0x36,           0x4c,
-/* -----               -               [               \'              */
-/* f8 */ 0,            0x20,           0x35,           0x4b,
-/* -----                                                               */
-/* fc */ 0,            0,              0,              0,
-};
-
diff --git a/drivers/tc/lk201.c b/drivers/tc/lk201.c
deleted file mode 100644 (file)
index a90c255..0000000
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1999-2002 Harald Koerfgen <hkoerfg@web.de>
- * Copyright (C) 2001, 2002, 2003, 2004  Maciej W. Rozycki
- */
-
-
-#include <linux/errno.h>
-#include <linux/tty.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/kbd_ll.h>
-#include <linux/kbd_kern.h>
-#include <linux/vt_kern.h>
-
-#include <asm/keyboard.h>
-#include <asm/dec/tc.h>
-#include <asm/dec/machtype.h>
-#include <asm/dec/serial.h>
-
-#include "lk201.h"
-
-/*
- * Only handle DECstations that have an LK201 interface.
- * Maxine uses LK501 at the Access.Bus and various DECsystems
- * have no keyboard interface at all.
- */
-#define LK_IFACE       (mips_machtype == MACH_DS23100    || \
-                        mips_machtype == MACH_DS5000_200 || \
-                        mips_machtype == MACH_DS5000_1XX || \
-                        mips_machtype == MACH_DS5000_2X0)
-/*
- * These use the Z8530 SCC.  Others use the DZ11.
- */
-#define LK_IFACE_ZS    (mips_machtype == MACH_DS5000_1XX || \
-                        mips_machtype == MACH_DS5000_2X0)
-
-/* Simple translation table for the SysRq keys */
-
-#ifdef CONFIG_MAGIC_SYSRQ
-/*
- * Actually no translation at all, at least until we figure out
- * how to define SysRq for LK201 and friends. --macro
- */
-unsigned char lk201_sysrq_xlate[128];
-unsigned char *kbd_sysrq_xlate = lk201_sysrq_xlate;
-
-unsigned char kbd_sysrq_key = -1;
-#endif
-
-#define KEYB_LINE      3
-
-static int __init lk201_init(void *);
-static void __init lk201_info(void *);
-static void lk201_rx_char(unsigned char, unsigned char);
-
-static struct dec_serial_hook lk201_hook = {
-       .init_channel   = lk201_init,
-       .init_info      = lk201_info,
-       .rx_char        = NULL,
-       .poll_rx_char   = NULL,
-       .poll_tx_char   = NULL,
-       .cflags         = B4800 | CS8 | CSTOPB | CLOCAL,
-};
-
-/*
- * This is used during keyboard initialisation
- */
-static unsigned char lk201_reset_string[] = {
-       LK_CMD_SET_DEFAULTS,
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 1),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 2),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 3),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 4),
-       LK_CMD_MODE(LK_MODE_DOWN_UP, 5),
-       LK_CMD_MODE(LK_MODE_DOWN_UP, 6),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 7),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 8),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 9),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 10),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 11),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 12),
-       LK_CMD_MODE(LK_MODE_DOWN, 13),
-       LK_CMD_MODE(LK_MODE_RPT_DOWN, 14),
-       LK_CMD_DIS_KEYCLK,
-       LK_CMD_ENB_BELL, LK_PARAM_VOLUME(4),
-};
-
-static void *lk201_handle;
-
-static int lk201_send(unsigned char ch)
-{
-       if (lk201_hook.poll_tx_char(lk201_handle, ch)) {
-               printk(KERN_ERR "lk201: transmit timeout\n");
-               return -EIO;
-       }
-       return 0;
-}
-
-static inline int lk201_get_id(void)
-{
-       return lk201_send(LK_CMD_REQ_ID);
-}
-
-static int lk201_reset(void)
-{
-       int i, r;
-
-       for (i = 0; i < sizeof(lk201_reset_string); i++) {
-               r = lk201_send(lk201_reset_string[i]);
-               if (r < 0)
-                       return r;
-       }
-       return 0;
-}
-
-static void lk201_report(unsigned char id[6])
-{
-       char *report = "lk201: keyboard attached, ";
-
-       switch (id[2]) {
-       case LK_STAT_PWRUP_OK:
-               printk(KERN_INFO "%sself-test OK\n", report);
-               break;
-       case LK_STAT_PWRUP_KDOWN:
-               /* The keyboard will resend the power-up ID
-                  after all keys are released, so we don't
-                  bother handling the error specially.  Still
-                  there may be a short-circuit inside.
-                */
-               printk(KERN_ERR "%skey down (stuck?), code: 0x%02x\n",
-                      report, id[3]);
-               break;
-       case LK_STAT_PWRUP_ERROR:
-               printk(KERN_ERR "%sself-test failure\n", report);
-               break;
-       default:
-               printk(KERN_ERR "%sunknown error: 0x%02x\n",
-                      report, id[2]);
-       }
-}
-
-static void lk201_id(unsigned char id[6])
-{
-       /*
-        * Report whether there is an LK201 or an LK401
-        * The LK401 has ALT keys...
-        */
-       switch (id[4]) {
-       case 1:
-               printk(KERN_INFO "lk201: LK201 detected\n");
-               break;
-       case 2:
-               printk(KERN_INFO "lk201: LK401 detected\n");
-               break;
-       case 3:
-               printk(KERN_INFO "lk201: LK443 detected\n");
-               break;
-       case 4:
-               printk(KERN_INFO "lk201: LK421 detected\n");
-               break;
-       default:
-               printk(KERN_WARNING
-                      "lk201: unknown keyboard detected, ID %d\n", id[4]);
-               printk(KERN_WARNING "lk201: ... please report to "
-                      "<linux-mips@linux-mips.org>\n");
-       }
-}
-
-#define DEFAULT_KEYB_REP_DELAY (250/5) /* [5ms] */
-#define DEFAULT_KEYB_REP_RATE  30      /* [cps] */
-
-static struct kbd_repeat kbdrate = {
-       DEFAULT_KEYB_REP_DELAY,
-       DEFAULT_KEYB_REP_RATE
-};
-
-static void parse_kbd_rate(struct kbd_repeat *r)
-{
-       if (r->delay <= 0)
-               r->delay = kbdrate.delay;
-       if (r->rate <= 0)
-               r->rate = kbdrate.rate;
-
-       if (r->delay < 5)
-               r->delay = 5;
-       if (r->delay > 630)
-               r->delay = 630;
-       if (r->rate < 12)
-               r->rate = 12;
-       if (r->rate > 127)
-               r->rate = 127;
-       if (r->rate == 125)
-               r->rate = 124;
-}
-
-static int write_kbd_rate(struct kbd_repeat *rep)
-{
-       int delay, rate;
-       int i;
-
-       delay = rep->delay / 5;
-       rate = rep->rate;
-       for (i = 0; i < 4; i++) {
-               if (lk201_hook.poll_tx_char(lk201_handle,
-                                           LK_CMD_RPT_RATE(i)))
-                       return 1;
-               if (lk201_hook.poll_tx_char(lk201_handle,
-                                           LK_PARAM_DELAY(delay)))
-                       return 1;
-               if (lk201_hook.poll_tx_char(lk201_handle,
-                                           LK_PARAM_RATE(rate)))
-                       return 1;
-       }
-       return 0;
-}
-
-static int lk201_kbd_rate(struct kbd_repeat *rep)
-{
-       if (rep == NULL)
-               return -EINVAL;
-
-       parse_kbd_rate(rep);
-
-       if (write_kbd_rate(rep)) {
-               memcpy(rep, &kbdrate, sizeof(struct kbd_repeat));
-               return -EIO;
-       }
-
-       memcpy(&kbdrate, rep, sizeof(struct kbd_repeat));
-
-       return 0;
-}
-
-static void lk201_kd_mksound(unsigned int hz, unsigned int ticks)
-{
-       if (!ticks)
-               return;
-
-       /*
-        * Can't set frequency and we "approximate"
-        * duration by volume. ;-)
-        */
-       ticks /= HZ / 32;
-       if (ticks > 7)
-               ticks = 7;
-       ticks = 7 - ticks;
-
-       if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_ENB_BELL))
-               return;
-       if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_VOLUME(ticks)))
-               return;
-       if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_BELL))
-               return;
-}
-
-void kbd_leds(unsigned char leds)
-{
-       unsigned char l = 0;
-
-       if (!lk201_handle)              /* FIXME */
-               return;
-
-       /* FIXME -- Only Hold and Lock LEDs for now. --macro */
-       if (leds & LED_SCR)
-               l |= LK_LED_HOLD;
-       if (leds & LED_CAP)
-               l |= LK_LED_LOCK;
-
-       if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_ON))
-               return;
-       if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(l)))
-               return;
-       if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_OFF))
-               return;
-       if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(~l)))
-               return;
-}
-
-int kbd_setkeycode(unsigned int scancode, unsigned int keycode)
-{
-       return -EINVAL;
-}
-
-int kbd_getkeycode(unsigned int scancode)
-{
-       return -EINVAL;
-}
-
-int kbd_translate(unsigned char scancode, unsigned char *keycode,
-                 char raw_mode)
-{
-       *keycode = scancode;
-       return 1;
-}
-
-char kbd_unexpected_up(unsigned char keycode)
-{
-       return 0x80;
-}
-
-static void lk201_rx_char(unsigned char ch, unsigned char fl)
-{
-       static unsigned char id[6];
-       static int id_i;
-
-       static int shift_state = 0;
-       static int prev_scancode;
-       unsigned char c = scancodeRemap[ch];
-
-       if (fl != TTY_NORMAL && fl != TTY_OVERRUN) {
-               printk(KERN_ERR "lk201: keyboard receive error: 0x%02x\n", fl);
-               return;
-       }
-
-       /* Assume this is a power-up ID. */
-       if (ch == LK_STAT_PWRUP_ID && !id_i) {
-               id[id_i++] = ch;
-               return;
-       }
-
-       /* Handle the power-up sequence. */
-       if (id_i) {
-               id[id_i++] = ch;
-               if (id_i == 4) {
-                       /* OK, the power-up concluded. */
-                       lk201_report(id);
-                       if (id[2] == LK_STAT_PWRUP_OK)
-                               lk201_get_id();
-                       else {
-                               id_i = 0;
-                               printk(KERN_ERR "lk201: keyboard power-up "
-                                      "error, skipping initialization\n");
-                       }
-               } else if (id_i == 6) {
-                       /* We got the ID; report it and start operation. */
-                       id_i = 0;
-                       lk201_id(id);
-                       lk201_reset();
-               }
-               return;
-       }
-
-       /* Everything else is a scancode/status response. */
-       id_i = 0;
-       switch (ch) {
-       case LK_STAT_RESUME_ERR:
-       case LK_STAT_ERROR:
-       case LK_STAT_INHIBIT_ACK:
-       case LK_STAT_TEST_ACK:
-       case LK_STAT_MODE_KEYDOWN:
-       case LK_STAT_MODE_ACK:
-               break;
-       case LK_KEY_LOCK:
-               shift_state ^= LK_LOCK;
-               handle_scancode(c, (shift_state & LK_LOCK) ? 1 : 0);
-               break;
-       case LK_KEY_SHIFT:
-               shift_state ^= LK_SHIFT;
-               handle_scancode(c, (shift_state & LK_SHIFT) ? 1 : 0);
-               break;
-       case LK_KEY_CTRL:
-               shift_state ^= LK_CTRL;
-               handle_scancode(c, (shift_state & LK_CTRL) ? 1 : 0);
-               break;
-       case LK_KEY_COMP:
-               shift_state ^= LK_COMP;
-               handle_scancode(c, (shift_state & LK_COMP) ? 1 : 0);
-               break;
-       case LK_KEY_RELEASE:
-               if (shift_state & LK_SHIFT)
-                       handle_scancode(scancodeRemap[LK_KEY_SHIFT], 0);
-               if (shift_state & LK_CTRL)
-                       handle_scancode(scancodeRemap[LK_KEY_CTRL], 0);
-               if (shift_state & LK_COMP)
-                       handle_scancode(scancodeRemap[LK_KEY_COMP], 0);
-               if (shift_state & LK_LOCK)
-                       handle_scancode(scancodeRemap[LK_KEY_LOCK], 0);
-               shift_state = 0;
-               break;
-       case LK_KEY_REPEAT:
-               handle_scancode(prev_scancode, 1);
-               break;
-       default:
-               prev_scancode = c;
-               handle_scancode(c, 1);
-               break;
-       }
-       tasklet_schedule(&keyboard_tasklet);
-}
-
-static void __init lk201_info(void *handle)
-{
-}
-
-static int __init lk201_init(void *handle)
-{
-       /* First install handlers. */
-       lk201_handle = handle;
-       kbd_rate = lk201_kbd_rate;
-       kd_mksound = lk201_kd_mksound;
-
-       lk201_hook.rx_char = lk201_rx_char;
-
-       /* Then just issue a reset -- the handlers will do the rest. */
-       lk201_send(LK_CMD_POWER_UP);
-
-       return 0;
-}
-
-void __init kbd_init_hw(void)
-{
-       /* Maxine uses LK501 at the Access.Bus. */
-       if (!LK_IFACE)
-               return;
-
-       printk(KERN_INFO "lk201: DECstation LK keyboard driver v0.05.\n");
-
-       if (LK_IFACE_ZS) {
-               /*
-                * kbd_init_hw() is being called before
-                * rs_init() so just register the kbd hook
-                * and let zs_init do the rest :-)
-                */
-               if (!register_dec_serial_hook(KEYB_LINE, &lk201_hook))
-                       unregister_dec_serial_hook(KEYB_LINE);
-       } else {
-               /*
-                * TODO: modify dz.c to allow similar hooks
-                * for LK201 handling on DS2100, DS3100, and DS5000/200
-                */
-               printk(KERN_ERR "lk201: support for DZ11 not yet ready.\n");
-       }
-}
diff --git a/drivers/tc/lk201.h b/drivers/tc/lk201.h
deleted file mode 100644 (file)
index 99f3203..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *     Commands to the keyboard processor
- */
-
-#define LK_PARAM               0x80    /* start/end parameter list */
-
-#define LK_CMD_RESUME          0x8b    /* resume transmission to the host */
-#define LK_CMD_INHIBIT         0x89    /* stop transmission to the host */
-#define LK_CMD_LEDS_ON         0x13    /* light LEDs */
-                                       /* 1st param: led bitmask */
-#define LK_CMD_LEDS_OFF                0x11    /* turn off LEDs */
-                                       /* 1st param: led bitmask */
-#define LK_CMD_DIS_KEYCLK      0x99    /* disable the keyclick */
-#define LK_CMD_ENB_KEYCLK      0x1b    /* enable the keyclick */
-                                       /* 1st param: volume */
-#define LK_CMD_DIS_CTLCLK      0xb9    /* disable the Ctrl keyclick */
-#define LK_CMD_ENB_CTLCLK      0xbb    /* enable the Ctrl keyclick */
-#define LK_CMD_SOUND_CLK       0x9f    /* emit a keyclick */
-#define LK_CMD_DIS_BELL                0xa1    /* disable the bell */
-#define LK_CMD_ENB_BELL                0x23    /* enable the bell */
-                                       /* 1st param: volume */
-#define LK_CMD_BELL            0xa7    /* emit a bell */
-#define LK_CMD_TMP_NORPT       0xd1    /* disable typematic */
-                                       /* for the currently pressed key */
-#define LK_CMD_ENB_RPT         0xe3    /* enable typematic */
-                                       /* for RPT_DOWN groups */
-#define LK_CMD_DIS_RPT         0xe1    /* disable typematic */
-                                       /* for RPT_DOWN groups */
-#define LK_CMD_RPT_TO_DOWN     0xd9    /* set RPT_DOWN groups to DOWN */
-#define LK_CMD_REQ_ID          0xab    /* request the keyboard ID */
-#define LK_CMD_POWER_UP                0xfd    /* init power-up sequence */
-#define LK_CMD_TEST_MODE       0xcb    /* enter the factory test mode */
-#define LK_CMD_TEST_EXIT       0x80    /* exit the factory test mode */
-#define LK_CMD_SET_DEFAULTS    0xd3    /* set power-up defaults */
-
-#define LK_CMD_MODE(m,div)     (LK_PARAM|(((div)&0xf)<<3)|(((m)&0x3)<<1))
-                                       /* select the repeat mode */
-                                       /* for the selected key group */
-#define LK_CMD_MODE_AR(m,div)  ((((div)&0xf)<<3)|(((m)&0x3)<<1))
-                                       /* select the repeat mode */
-                                       /* and the repeat register */
-                                       /* for the selected key group */
-                                       /* 1st param: register number */
-#define LK_CMD_RPT_RATE(r)     (0x78|(((r)&0x3)<<1))
-                                       /* set the delay and repeat rate */
-                                       /* for the selected repeat register */
-                                       /* 1st param: initial delay */
-                                       /* 2nd param: repeat rate */
-
-/* there are 4 leds, represent them in the low 4 bits of a byte */
-#define LK_PARAM_LED_MASK(ledbmap)     (LK_PARAM|((ledbmap)&0xf))
-#define LK_LED_WAIT            0x1     /* Wait LED */
-#define LK_LED_COMP            0x2     /* Compose LED */
-#define LK_LED_LOCK            0x4     /* Lock LED */
-#define LK_LED_HOLD            0x8     /* Hold Screen LED */
-
-/* max volume is 0, lowest is 0x7 */
-#define LK_PARAM_VOLUME(v)             (LK_PARAM|((v)&0x7))
-
-/* mode set command details, div is a key group number */
-#define LK_MODE_DOWN           0x0     /* make only */
-#define LK_MODE_RPT_DOWN       0x1     /* make and typematic */
-#define LK_MODE_DOWN_UP                0x3     /* make and release */
-
-/* there are 4 repeat registers */
-#define LK_PARAM_AR(r)         (LK_PARAM|((v)&0x3))
-
-/*
- * Mappings between key groups and keycodes are as follows:
- *
- *  1: 0xbf - 0xff -- alphanumeric,
- *  2: 0x91 - 0xa5 -- numeric keypad,
- *  3: 0xbc        -- Backspace,
- *  4: 0xbd - 0xbe -- Tab, Return,
- *  5: 0xb0 - 0xb2 -- Lock, Compose Character,
- *  6: 0xad - 0xaf -- Ctrl, Shift,
- *  7: 0xa6 - 0xa8 -- Left Arrow, Right Arrow,
- *  8: 0xa9 - 0xac -- Up Arrow, Down Arrow, Right Shift,
- *  9: 0x88 - 0x90 -- editor keypad,
- * 10: 0x56 - 0x62 -- F1 - F5,
- * 11: 0x63 - 0x6e -- F6 - F10,
- * 12: 0x6f - 0x7a -- F11 - F14,
- * 13: 0x7b - 0x7d -- Help, Do,
- * 14: 0x7e - 0x87 -- F17 - F20.
- *
- * Notes:
- * 1. Codes in the 0x00 - 0x40 range are reserved.
- * 2. The assignment of the 0x41 - 0x55 range is undiscovered, probably 10.
- */
-
-/* delay is 5 - 630 ms; 0x00 and 0x7f are reserved */
-#define LK_PARAM_DELAY(t)      ((t)&0x7f)
-
-/* rate is 12 - 127 Hz; 0x00 - 0x0b and 0x7d (power-up!) are reserved */
-#define LK_PARAM_RATE(r)       (LK_PARAM|((r)&0x7f))
-
-#define LK_SHIFT 1<<0
-#define LK_CTRL 1<<1
-#define LK_LOCK 1<<2
-#define LK_COMP 1<<3
-
-#define LK_KEY_SHIFT           0xae
-#define LK_KEY_CTRL            0xaf
-#define LK_KEY_LOCK            0xb0
-#define LK_KEY_COMP            0xb1
-
-#define LK_KEY_RELEASE         0xb3    /* all keys released */
-#define LK_KEY_REPEAT          0xb4    /* repeat the last key */
-
-/* status responses */
-#define LK_STAT_RESUME_ERR     0xb5    /* keystrokes lost while inhibited */
-#define LK_STAT_ERROR          0xb6    /* an invalid command received */
-#define LK_STAT_INHIBIT_ACK    0xb7    /* transmission inhibited */
-#define LK_STAT_TEST_ACK       0xb8    /* the factory test mode entered */
-#define LK_STAT_MODE_KEYDOWN   0xb9    /* a key is down on a change */
-                                       /* to the DOWN_UP mode; */
-                                       /* the keycode follows */
-#define LK_STAT_MODE_ACK       0xba    /* the mode command succeeded */
-
-#define LK_STAT_PWRUP_ID       0x01    /* the power-up response start mark */
-#define LK_STAT_PWRUP_OK       0x00    /* the power-up self test OK */
-#define LK_STAT_PWRUP_KDOWN    0x3d    /* a key was down during the test */
-#define LK_STAT_PWRUP_ERROR    0x3e    /* keyboard self test failure */
-
-extern unsigned char scancodeRemap[256];
index c99938d5f78e6299ffacf7c732e20959c94ffc47..69aa68287d3f8b5cf7884955b703760fd1897c46 100644 (file)
@@ -982,7 +982,6 @@ EXPORT_SYMBOL(usb_altnum_to_altsetting);
 
 EXPORT_SYMBOL(__usb_get_extra_descriptor);
 
-EXPORT_SYMBOL(usb_find_device);
 EXPORT_SYMBOL(usb_get_current_frame_number);
 
 EXPORT_SYMBOL(usb_buffer_alloc);
index ebb04ac4857b2019d234cedb37631a877a63dbc0..5e3e4e9b6c77040c46cecefca82714ecbc4f4af1 100644 (file)
@@ -87,7 +87,7 @@ struct mon_reader_text {
 
 static struct dentry *mon_dir;         /* Usually /sys/kernel/debug/usbmon */
 
-static void mon_text_ctor(void *, struct kmem_cache *, unsigned long);
+static void mon_text_ctor(struct kmem_cache *, void *);
 
 struct mon_text_ptr {
        int cnt, limit;
@@ -720,7 +720,7 @@ void mon_text_del(struct mon_bus *mbus)
 /*
  * Slab interface: constructor.
  */
-static void mon_text_ctor(void *mem, struct kmem_cache *slab, unsigned long sflags)
+static void mon_text_ctor(struct kmem_cache *slab, void *mem)
 {
        /*
         * Nothing to initialize. No, really!
index 06d1107dbd47e65eb85d8db1d6a40aa441fe4ec5..55b952084f0c07d065546526ea870ca27d869f3e 100644 (file)
@@ -30,7 +30,7 @@ static atomic_t usu_bias = ATOMIC_INIT(USB_US_DEFAULT_BIAS);
 #define BIAS_NAME_SIZE  (sizeof("usb-storage"))
 static const char *bias_names[3] = { "none", "usb-storage", "ub" };
 
-static DECLARE_MUTEX_LOCKED(usu_init_notify);
+static struct semaphore usu_init_notify;
 static DECLARE_COMPLETION(usu_end_notify);
 static atomic_t total_threads = ATOMIC_INIT(0);
 
@@ -204,6 +204,8 @@ static int __init usb_usual_init(void)
 {
        int rc;
 
+       sema_init(&usu_init_notify, 0);
+
        rc = usb_register(&usu_driver);
        up(&usu_init_notify);
        return rc;
index 51807b4e26d1428883548a65f8ad3f1d1a787c9e..c604d935c1881ec784b6187f11d8ab79a3263c79 100644 (file)
@@ -28,8 +28,6 @@
 
 #define MODULE_NAME    "omapfb-lcd_h3"
 
-#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
-
 static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
 {
        return 0;
@@ -48,7 +46,7 @@ static int h3_panel_enable(struct lcd_panel *panel)
        if (!r)
                r = tps65010_set_gpio_out_value(GPIO2, HIGH);
        if (r)
-               pr_err("Unable to turn on LCD panel\n");
+               pr_err(MODULE_NAME ": Unable to turn on LCD panel\n");
 
        return r;
 }
@@ -62,7 +60,7 @@ static void h3_panel_disable(struct lcd_panel *panel)
        if (!r)
                tps65010_set_gpio_out_value(GPIO2, LOW);
        if (r)
-               pr_err("Unable to turn off LCD panel\n");
+               pr_err(MODULE_NAME ": Unable to turn off LCD panel\n");
 }
 
 static unsigned long h3_panel_get_caps(struct lcd_panel *panel)
index 95604ca43301e7004ce61ae5d1b52dce91c092ff..5ef119c813e00dffd32c2bdbe486a915fa39ae36 100644 (file)
 
 #define MODULE_NAME    "omapfb-lcd_h3"
 
-#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
-
 static int innovator1610_panel_init(struct lcd_panel *panel,
                                    struct omapfb_device *fbdev)
 {
        int r = 0;
 
        if (omap_request_gpio(14)) {
-               pr_err("can't request GPIO 14\n");
+               pr_err(MODULE_NAME ": can't request GPIO 14\n");
                r = -1;
                goto exit;
        }
        if (omap_request_gpio(15)) {
-               pr_err("can't request GPIO 15\n");
+               pr_err(MODULE_NAME ": can't request GPIO 15\n");
                omap_free_gpio(14);
                r = -1;
                goto exit;
index d356da5709fce3b1dc81f5644ff49e0592fec494..1550431ccb6ade0b3b1ee556d3ea809f1c125132 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/slab.h>
 #include <linux/pci_ids.h>
 #include <linux/pci.h>
-#include <linux/timer.h>
 
 #include "../w1.h"
 #include "../w1_int.h"
index 815d201d86008edec9c2004a4f25886d2988a84f..d8062745716ae407fee7948a12a88a6370e5e9aa 100644 (file)
@@ -534,6 +534,24 @@ config QUOTA
          with the quota tools. Probably the quota support is only useful for
          multi user systems. If unsure, say N.
 
+config QUOTA_NETLINK_INTERFACE
+       bool "Report quota messages through netlink interface"
+       depends on QUOTA && NET
+       help
+         If you say Y here, quota warnings (about exceeding softlimit, reaching
+         hardlimit, etc.) will be reported through netlink interface. If unsure,
+         say Y.
+
+config PRINT_QUOTA_WARNING
+       bool "Print quota warnings to console (OBSOLETE)"
+       depends on QUOTA
+       default y
+       help
+         If you say Y here, quota warnings (about exceeding softlimit, reaching
+         hardlimit, etc.) will be printed to the process' controlling terminal.
+         Note that this behavior is currently deprecated and may go away in
+         future. Please use notification via netlink socket instead.
+
 config QFMT_V1
        tristate "Old quota format support"
        depends on QUOTA
@@ -555,7 +573,7 @@ config QUOTACTL
        default y
 
 config DNOTIFY
-       bool "Dnotify support" if EMBEDDED
+       bool "Dnotify support"
        default y
        help
          Dnotify is a directory-based per-fd file change notification system
@@ -563,7 +581,7 @@ config DNOTIFY
          superior alternatives, but some applications may still rely on
          dnotify.
 
-         Because of this, if unsure, say Y.
+         If unsure, say Y.
 
 config AUTOFS_FS
        tristate "Kernel automounter support"
@@ -999,20 +1017,6 @@ config HUGETLBFS
 config HUGETLB_PAGE
        def_bool HUGETLBFS
 
-config RAMFS
-       bool
-       default y
-       ---help---
-         Ramfs is a file system which keeps all files in RAM. It allows
-         read and write access.
-
-         It is more of an programming example than a useable file system.  If
-         you need a file system which lives in RAM with limit checking use
-         tmpfs.
-
-         To compile this as a module, choose M here: the module will be called
-         ramfs.
-
 config CONFIGFS_FS
        tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)"
        depends on SYSFS && EXPERIMENTAL
@@ -1543,8 +1547,20 @@ config UFS_DEBUG
 
 endmenu
 
-menu "Network File Systems"
+menuconfig NETWORK_FILESYSTEMS
+       bool "Network File Systems"
+       default y
        depends on NET
+       ---help---
+         Say Y here to get to see options for network filesystems and
+         filesystem-related networking code, such as NFS daemon and
+         RPCSEC security modules.
+         This option alone does not add any kernel code.
+
+         If you say N, all options in this submenu will be skipped and
+         disabled; if unsure, say Y here.
+
+if NETWORK_FILESYSTEMS
 
 config NFS_FS
        tristate "NFS file system support"
@@ -2090,7 +2106,7 @@ config 9P_FS
 
          If unsure, say N.
 
-endmenu
+endif # NETWORK_FILESYSTEMS
 
 if BLOCK
 menu "Partition Types"
index 720c29d57a626f19b6ca6577b330309248247f5b..500cf15cdb4ba94f5811ae53178fc685fe9da79e 100644 (file)
@@ -72,7 +72,7 @@ obj-$(CONFIG_JBD)             += jbd/
 obj-$(CONFIG_JBD2)             += jbd2/
 obj-$(CONFIG_EXT2_FS)          += ext2/
 obj-$(CONFIG_CRAMFS)           += cramfs/
-obj-$(CONFIG_RAMFS)            += ramfs/
+obj-y                          += ramfs/
 obj-$(CONFIG_HUGETLBFS)                += hugetlbfs/
 obj-$(CONFIG_CODA_FS)          += coda/
 obj-$(CONFIG_MINIX_FS)         += minix/
index 1c9fd3029496f577a69252b119adc817ff26fe85..b36695ae5c2e9ff97b06ae999f0f1baaf01dd333 100644 (file)
@@ -228,7 +228,7 @@ static void adfs_destroy_inode(struct inode *inode)
        kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
 
index b330009fe42dbdb02ca987169981a9e67706e7e4..c4a5ad09ddf2c2a76d38ddf4d91f7126058029c3 100644 (file)
@@ -11,7 +11,7 @@
 
 /* This is, of course, shamelessly stolen from fs/minix */
 
-static int nibblemap[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 };
+static const int nibblemap[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 };
 
 static u32
 affs_count_free_bits(u32 blocksize, const void *data)
index c80191ae2059d751ee413a244892934ba39b9733..b53e5d0ec65c4b3fd52417dab5c85cdd176ebb76 100644 (file)
@@ -84,7 +84,7 @@ static void affs_destroy_inode(struct inode *inode)
        kmem_cache_free(affs_inode_cachep, AFFS_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct affs_inode_info *ei = (struct affs_inode_info *) foo;
 
index b8243945818de3abd394435953acb8ed8e88eeef..a78d5b236bb1685ffe5e3eaf36ee3e2ccd6db28b 100644 (file)
@@ -20,7 +20,9 @@
 #include <linux/sched.h>
 #include "internal.h"
 
+#if 0
 unsigned afs_vnode_update_timeout = 10;
+#endif  /*  0  */
 
 #define afs_breakring_space(server) \
        CIRC_SPACE((server)->cb_break_head, (server)->cb_break_tail,    \
index 175a567db78ce61fad810430c950e958f65b9fac..970d38f305652f3b472fe558ffb68bb4376c283f 100644 (file)
@@ -33,6 +33,7 @@ static struct afs_cell *afs_cell_root;
 static struct afs_cell *afs_cell_alloc(const char *name, char *vllist)
 {
        struct afs_cell *cell;
+       struct key *key;
        size_t namelen;
        char keyname[4 + AFS_MAXCELLNAME + 1], *cp, *dp, *next;
        int ret;
@@ -89,20 +90,14 @@ static struct afs_cell *afs_cell_alloc(const char *name, char *vllist)
        do {
                *dp++ = toupper(*cp);
        } while (*cp++);
-       cell->anonymous_key = key_alloc(&key_type_rxrpc, keyname, 0, 0, current,
-                                       KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA);
-       if (IS_ERR(cell->anonymous_key)) {
-               _debug("no key");
-               ret = PTR_ERR(cell->anonymous_key);
-               goto error;
-       }
 
-       ret = key_instantiate_and_link(cell->anonymous_key, NULL, 0,
-                                      NULL, NULL);
-       if (ret < 0) {
-               _debug("instantiate failed");
+       key = rxrpc_get_null_key(keyname);
+       if (IS_ERR(key)) {
+               _debug("no key");
+               ret = PTR_ERR(key);
                goto error;
        }
+       cell->anonymous_key = key;
 
        _debug("anon key %p{%x}",
               cell->anonymous_key, key_serial(cell->anonymous_key));
@@ -265,6 +260,7 @@ struct afs_cell *afs_cell_lookup(const char *name, unsigned namesz)
        return cell;
 }
 
+#if 0
 /*
  * try and get a cell record
  */
@@ -280,6 +276,7 @@ struct afs_cell *afs_get_cell_maybe(struct afs_cell *cell)
        write_unlock(&afs_cells_lock);
        return cell;
 }
+#endif  /*  0  */
 
 /*
  * destroy a cell record
index d5b2ad6575bc05dfe4a3af63ed0ee4f38f1be094..47b71c8947f91221ac9551b75a5dfa91810d2bd8 100644 (file)
@@ -16,7 +16,9 @@
 #include "internal.h"
 #include "afs_cm.h"
 
+#if 0
 struct workqueue_struct *afs_cm_workqueue;
+#endif  /*  0  */
 
 static int afs_deliver_cb_init_call_back_state(struct afs_call *,
                                               struct sk_buff *, bool);
index 6306438f331f7b14451366dbbb04182d9dae5cc5..5ca3625cd39edcb3c73bd23bd03e1282e96bdf91 100644 (file)
@@ -570,7 +570,6 @@ extern int afs_abort_to_error(u32);
  */
 extern const struct inode_operations afs_mntpt_inode_operations;
 extern const struct file_operations afs_mntpt_file_operations;
-extern unsigned long afs_mntpt_expiry_timeout;
 
 extern int afs_mntpt_check_symlink(struct afs_vnode *, struct key *);
 extern void afs_mntpt_kill_timer(void);
index 6f8c96fb29eb04d797d744991f7570b89a5f9f66..5ce43b63c60ea66972fd31989836f141b292fec2 100644 (file)
@@ -42,7 +42,7 @@ const struct inode_operations afs_mntpt_inode_operations = {
 static LIST_HEAD(afs_vfsmounts);
 static DECLARE_DELAYED_WORK(afs_mntpt_expiry_timer, afs_mntpt_expiry_timed_out);
 
-unsigned long afs_mntpt_expiry_timeout = 10 * 60;
+static unsigned long afs_mntpt_expiry_timeout = 10 * 60;
 
 /*
  * check a symbolic link to see whether it actually encodes a mountpoint
index 6edb56683b9ab496f3834720dbb8cc12817536b7..846c7615ac9e516bdb7810bc6498b9b516defbe6 100644 (file)
@@ -513,7 +513,7 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
        up_read(&cell->vl_sem);
 }
 
-const char afs_vlocation_states[][4] = {
+static const char afs_vlocation_states[][4] = {
        [AFS_VL_NEW]                    = "New",
        [AFS_VL_CREATING]               = "Crt",
        [AFS_VL_VALID]                  = "Val",
index 8ccee9ee1d9d0dbfb66f851ed0f50ae811c3f354..bde3f19c0995015b2a2496aaf805807a7d7348db 100644 (file)
@@ -239,7 +239,8 @@ void afs_flat_call_destructor(struct afs_call *call)
 /*
  * attach the data from a bunch of pages on an inode to a call
  */
-int afs_send_pages(struct afs_call *call, struct msghdr *msg, struct kvec *iov)
+static int afs_send_pages(struct afs_call *call, struct msghdr *msg,
+                         struct kvec *iov)
 {
        struct page *pages[8];
        unsigned count, n, loop, offset, to;
index 231ae4150279e2b98f78dac4b9a45ec5bde26633..28f2451419e1406b3be0aa0a0258fe14f73a0834 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/slab.h>
 #include "internal.h"
 
-unsigned afs_server_timeout = 10;      /* server timeout in seconds */
+static unsigned afs_server_timeout = 10;       /* server timeout in seconds */
 
 static void afs_reap_server(struct work_struct *);
 
index b8808b40f82b3c01f35fb37e3c88a67a36775170..4b2558c42213c5e79328fe71ef0b2380f07b8405 100644 (file)
@@ -27,8 +27,7 @@
 
 #define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
 
-static void afs_i_init_once(void *foo, struct kmem_cache *cachep,
-                           unsigned long flags);
+static void afs_i_init_once(struct kmem_cache *cachep, void *foo);
 static int afs_get_sb(struct file_system_type *fs_type,
                      int flags, const char *dev_name,
                      void *data, struct vfsmount *mnt);
@@ -446,8 +445,7 @@ static void afs_put_super(struct super_block *sb)
 /*
  * initialise an inode cache slab element prior to any use
  */
-static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
-                           unsigned long flags)
+static void afs_i_init_once(struct kmem_cache *cachep, void *_vnode)
 {
        struct afs_vnode *vnode = _vnode;
 
index 09e3ad0fc7cc2163684a97cbe54b4f1eb51cf6b9..7b4bbe48112d547555433666ccccf5926ce79e2c 100644 (file)
@@ -15,8 +15,8 @@
 #include <linux/sched.h>
 #include "internal.h"
 
-unsigned afs_vlocation_timeout = 10;   /* volume location timeout in seconds */
-unsigned afs_vlocation_update_timeout = 10 * 60;
+static unsigned afs_vlocation_timeout = 10;    /* volume location timeout in seconds */
+static unsigned afs_vlocation_update_timeout = 10 * 60;
 
 static void afs_vlocation_reaper(struct work_struct *);
 static void afs_vlocation_updater(struct work_struct *);
@@ -335,7 +335,7 @@ static int afs_vlocation_fill_in_record(struct afs_vlocation *vl,
 /*
  * queue a vlocation record for updates
  */
-void afs_vlocation_queue_for_updates(struct afs_vlocation *vl)
+static void afs_vlocation_queue_for_updates(struct afs_vlocation *vl)
 {
        struct afs_vlocation *xvl;
 
index a03b92a0fe1db9240d7b3ff4d1ffc0a92a222193..9a849ad3c489411c8043cb66d50f8feceadfe7b8 100644 (file)
@@ -8,7 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#include <linux/backing-dev.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
@@ -510,9 +510,9 @@ int afs_writepage(struct page *page, struct writeback_control *wbc)
 /*
  * write a region of pages back to the server
  */
-int afs_writepages_region(struct address_space *mapping,
-                         struct writeback_control *wbc,
-                         pgoff_t index, pgoff_t end, pgoff_t *_next)
+static int afs_writepages_region(struct address_space *mapping,
+                                struct writeback_control *wbc,
+                                pgoff_t index, pgoff_t end, pgoff_t *_next)
 {
        struct backing_dev_info *bdi = mapping->backing_dev_info;
        struct afs_writeback *wb;
index ea2e198203818a4703f8dc56a6d8473cf6ada21a..d02f43b50a3d83e9fb6e20c8c64bb83df05eb1a3 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -303,7 +303,7 @@ static void wait_for_all_aios(struct kioctx *ctx)
        set_task_state(tsk, TASK_UNINTERRUPTIBLE);
        while (ctx->reqs_active) {
                spin_unlock_irq(&ctx->ctx_lock);
-               schedule();
+               io_schedule();
                set_task_state(tsk, TASK_UNINTERRUPTIBLE);
                spin_lock_irq(&ctx->ctx_lock);
        }
@@ -323,7 +323,7 @@ ssize_t fastcall wait_on_sync_kiocb(struct kiocb *iocb)
                set_current_state(TASK_UNINTERRUPTIBLE);
                if (!iocb->ki_users)
                        break;
-               schedule();
+               io_schedule();
        }
        __set_current_state(TASK_RUNNING);
        return iocb->ki_user_data;
@@ -1170,7 +1170,7 @@ retry:
                        ret = 0;
                        if (to.timed_out)       /* Only check after read evt */
                                break;
-                       schedule();
+                       io_schedule();
                        if (signal_pending(tsk)) {
                                ret = -EINTR;
                                break;
index b4a75880f6fd175b2f1f07d4c97c3a95024e5bfb..23321889d9b09d89075272ee419d4e00b496f1d8 100644 (file)
@@ -76,7 +76,6 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
 {
        struct qstr this;
        struct dentry *dentry;
-       struct inode *inode;
        struct file *file;
        int error, fd;
 
@@ -86,15 +85,9 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
        if (!file)
                return -ENFILE;
 
-       inode = igrab(anon_inode_inode);
-       if (IS_ERR(inode)) {
-               error = PTR_ERR(inode);
-               goto err_put_filp;
-       }
-
        error = get_unused_fd();
        if (error < 0)
-               goto err_iput;
+               goto err_put_filp;
        fd = error;
 
        /*
@@ -108,14 +101,22 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
        dentry = d_alloc(anon_inode_mnt->mnt_sb->s_root, &this);
        if (!dentry)
                goto err_put_unused_fd;
+
+       /*
+        * We know the anon_inode inode count is always greater than zero,
+        * so we can avoid doing an igrab() and we can use an open-coded
+        * atomic_inc().
+        */
+       atomic_inc(&anon_inode_inode->i_count);
+
        dentry->d_op = &anon_inodefs_dentry_operations;
        /* Do not publish this dentry inside the global dentry hash table */
        dentry->d_flags &= ~DCACHE_UNHASHED;
-       d_instantiate(dentry, inode);
+       d_instantiate(dentry, anon_inode_inode);
 
        file->f_path.mnt = mntget(anon_inode_mnt);
        file->f_path.dentry = dentry;
-       file->f_mapping = inode->i_mapping;
+       file->f_mapping = anon_inode_inode->i_mapping;
 
        file->f_pos = 0;
        file->f_flags = O_RDWR;
@@ -127,14 +128,12 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
        fd_install(fd, file);
 
        *pfd = fd;
-       *pinode = inode;
+       *pinode = anon_inode_inode;
        *pfile = file;
        return 0;
 
 err_put_unused_fd:
        put_unused_fd(fd);
-err_iput:
-       iput(inode);
 err_put_filp:
        put_filp(file);
        return error;
index f8dfc2269d85634aa61ebb19a761e986ea0bbc93..ae58bd3f875f9c92c9599bacebbab85ebdf2c800 100644 (file)
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -116,6 +116,15 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
                attr->ia_atime = now;
        if (!(ia_valid & ATTR_MTIME_SET))
                attr->ia_mtime = now;
+       if (ia_valid & ATTR_KILL_PRIV) {
+               attr->ia_valid &= ~ATTR_KILL_PRIV;
+               ia_valid &= ~ATTR_KILL_PRIV;
+               error = security_inode_need_killpriv(dentry);
+               if (error > 0)
+                       error = security_inode_killpriv(dentry);
+               if (error)
+                       return error;
+       }
        if (ia_valid & ATTR_KILL_SUID) {
                attr->ia_valid &= ~ATTR_KILL_SUID;
                if (mode & S_ISUID) {
index 692364e8ffc395117d3deb0eec2676eac89dc2d2..cd81f0836671d436f5a55049812b8d854e78233c 100644 (file)
@@ -312,13 +312,11 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
        struct autofs_sb_info *sbi;
        struct autofs_info *ino;
 
-       sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
+       sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
                goto fail_unlock;
        DPRINTK("starting up, sbi = %p",sbi);
 
-       memset(sbi, 0, sizeof(*sbi));
-
        s->s_fs_info = sbi;
        sbi->magic = AUTOFS_SBI_MAGIC;
        sbi->pipefd = -1;
index a45141827681c9294518cbbb1185033dcdd2dcc4..b28a20e61b8061f294ea24d0037f183550fa1e7d 100644 (file)
@@ -289,7 +289,7 @@ befs_destroy_inode(struct inode *inode)
         kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
         struct befs_inode_info *bi = (struct befs_inode_info *) foo;
 
index f346eb14e86f37b88a820a7231eb10dc19414fd6..7bd9c2bbe6ee61e5d48485d80b9b0b3096512370 100644 (file)
@@ -244,7 +244,7 @@ static void bfs_destroy_inode(struct inode *inode)
        kmem_cache_free(bfs_inode_cachep, BFS_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct bfs_inode_info *bi = foo;
 
index 813a887cd2b3257d4b4b039091d0194c3a232721..e176d195e7e53982659388b970d60270f9bb695b 100644 (file)
@@ -31,7 +31,7 @@
 
 static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
 static int load_aout_library(struct file*);
-static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file);
+static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
 
 static struct linux_binfmt aout_format = {
        .module         = THIS_MODULE,
@@ -88,7 +88,7 @@ if (file->f_op->llseek) { \
  * dumping of the process results in another error..
  */
 
-static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
+static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
 {
        mm_segment_t fs;
        int has_dumped = 0;
@@ -123,23 +123,19 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
 /* If the size of the dump file exceeds the rlimit, then see what would happen
    if we wrote the stack, but not the data area.  */
 #ifdef __sparc__
-       if ((dump.u_dsize+dump.u_ssize) >
-           current->signal->rlim[RLIMIT_CORE].rlim_cur)
+       if ((dump.u_dsize + dump.u_ssize) > limit)
                dump.u_dsize = 0;
 #else
-       if ((dump.u_dsize+dump.u_ssize+1) * PAGE_SIZE >
-           current->signal->rlim[RLIMIT_CORE].rlim_cur)
+       if ((dump.u_dsize + dump.u_ssize+1) * PAGE_SIZE > limit)
                dump.u_dsize = 0;
 #endif
 
 /* Make sure we have enough room to write the stack and data areas. */
 #ifdef __sparc__
-       if ((dump.u_ssize) >
-           current->signal->rlim[RLIMIT_CORE].rlim_cur)
+       if (dump.u_ssize > limit)
                dump.u_ssize = 0;
 #else
-       if ((dump.u_ssize+1) * PAGE_SIZE >
-           current->signal->rlim[RLIMIT_CORE].rlim_cur)
+       if ((dump.u_ssize + 1) * PAGE_SIZE > limit)
                dump.u_ssize = 0;
 #endif
 
index f3037c645ca900cdd446ad3f8153e37db8e6d1f5..6e2f3b8dde7f2c9dd636101b86b6049580d8143d 100644 (file)
@@ -52,7 +52,7 @@ static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, i
  * don't even try.
  */
 #if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
-static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file);
+static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
 #else
 #define elf_core_dump  NULL
 #endif
@@ -150,6 +150,14 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
        struct task_struct *tsk = current;
        struct vm_area_struct *vma;
 
+       /*
+        * In some cases (e.g. Hyper-Threading), we want to avoid L1
+        * evictions by the processes running on the same package. One
+        * thing we can do is to shuffle the initial stack for them.
+        */
+
+       p = arch_align_stack(p);
+
        /*
         * If this architecture has a platform capability string, copy it
         * to userspace.  In some cases (Sparc), this info is impossible
@@ -160,14 +168,6 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
        if (k_platform) {
                size_t len = strlen(k_platform) + 1;
 
-               /*
-                * In some cases (e.g. Hyper-Threading), we want to avoid L1
-                * evictions by the processes running on the same package. One
-                * thing we can do is to shuffle the initial stack for them.
-                */
-
-               p = arch_align_stack(p);
-
                u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
                if (__copy_to_user(u_platform, k_platform, len))
                        return -EFAULT;
@@ -175,6 +175,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
 
        /* Create the ELF interpreter info */
        elf_info = (elf_addr_t *)current->mm->saved_auxv;
+       /* update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes */
 #define NEW_AUX_ENT(id, val) \
        do { \
                elf_info[ei_index++] = id; \
@@ -185,6 +186,8 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
        /* 
         * ARCH_DLINFO must come first so PPC can do its special alignment of
         * AUXV.
+        * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT() in
+        * ARCH_DLINFO changes
         */
        ARCH_DLINFO;
 #endif
@@ -730,6 +733,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
 
        /* Some simple consistency checks for the interpreter */
        if (elf_interpreter) {
+               static int warn;
                interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT;
 
                /* Now figure out which format our binary is */
@@ -741,6 +745,13 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
                if (memcmp(loc->interp_elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
                        interpreter_type &= ~INTERPRETER_ELF;
 
+               if (interpreter_type == INTERPRETER_AOUT && warn < 10) {
+                       printk(KERN_WARNING "a.out ELF interpreter %s is "
+                               "deprecated and will not be supported "
+                               "after Linux 2.6.25\n", elf_interpreter);
+                       warn++;
+               }
+
                retval = -ELIBBAD;
                if (!interpreter_type)
                        goto out_free_dentry;
@@ -1193,35 +1204,68 @@ static int dump_seek(struct file *file, loff_t off)
 }
 
 /*
- * Decide whether a segment is worth dumping; default is yes to be
- * sure (missing info is worse than too much; etc).
- * Personally I'd include everything, and use the coredump limit...
- *
- * I think we should skip something. But I am not sure how. H.J.
+ * Decide what to dump of a segment, part, all or none.
  */
-static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
+static unsigned long vma_dump_size(struct vm_area_struct *vma,
+                                  unsigned long mm_flags)
 {
        /* The vma can be set up to tell us the answer directly.  */
        if (vma->vm_flags & VM_ALWAYSDUMP)
-               return 1;
+               goto whole;
 
        /* Do not dump I/O mapped devices or special mappings */
        if (vma->vm_flags & (VM_IO | VM_RESERVED))
                return 0;
 
+#define FILTER(type)   (mm_flags & (1UL << MMF_DUMP_##type))
+
        /* By default, dump shared memory if mapped from an anonymous file. */
        if (vma->vm_flags & VM_SHARED) {
-               if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0)
-                       return test_bit(MMF_DUMP_ANON_SHARED, &mm_flags);
-               else
-                       return test_bit(MMF_DUMP_MAPPED_SHARED, &mm_flags);
+               if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0 ?
+                   FILTER(ANON_SHARED) : FILTER(MAPPED_SHARED))
+                       goto whole;
+               return 0;
        }
 
-       /* By default, if it hasn't been written to, don't write it out. */
-       if (!vma->anon_vma)
-               return test_bit(MMF_DUMP_MAPPED_PRIVATE, &mm_flags);
+       /* Dump segments that have been written to.  */
+       if (vma->anon_vma && FILTER(ANON_PRIVATE))
+               goto whole;
+       if (vma->vm_file == NULL)
+               return 0;
+
+       if (FILTER(MAPPED_PRIVATE))
+               goto whole;
 
-       return test_bit(MMF_DUMP_ANON_PRIVATE, &mm_flags);
+       /*
+        * If this looks like the beginning of a DSO or executable mapping,
+        * check for an ELF header.  If we find one, dump the first page to
+        * aid in determining what was mapped here.
+        */
+       if (FILTER(ELF_HEADERS) && vma->vm_file != NULL && vma->vm_pgoff == 0) {
+               u32 __user *header = (u32 __user *) vma->vm_start;
+               u32 word;
+               /*
+                * Doing it this way gets the constant folded by GCC.
+                */
+               union {
+                       u32 cmp;
+                       char elfmag[SELFMAG];
+               } magic;
+               BUILD_BUG_ON(SELFMAG != sizeof word);
+               magic.elfmag[EI_MAG0] = ELFMAG0;
+               magic.elfmag[EI_MAG1] = ELFMAG1;
+               magic.elfmag[EI_MAG2] = ELFMAG2;
+               magic.elfmag[EI_MAG3] = ELFMAG3;
+               if (get_user(word, header) == 0 && word == magic.cmp)
+                       return PAGE_SIZE;
+       }
+
+#undef FILTER
+
+       return 0;
+
+whole:
+       return vma->vm_end - vma->vm_start;
 }
 
 /* An ELF note in memory */
@@ -1411,7 +1455,7 @@ struct elf_thread_status
        elf_fpregset_t fpu;             /* NT_PRFPREG */
        struct task_struct *thread;
 #ifdef ELF_CORE_COPY_XFPREGS
-       elf_fpxregset_t xfpu;           /* NT_PRXFPREG */
+       elf_fpxregset_t xfpu;           /* ELF_CORE_XFPREG_TYPE */
 #endif
        struct memelfnote notes[3];
        int num_notes;
@@ -1446,8 +1490,8 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t)
 
 #ifdef ELF_CORE_COPY_XFPREGS
        if (elf_core_copy_task_xfpregs(p, &t->xfpu)) {
-               fill_note(&t->notes[2], "LINUX", NT_PRXFPREG, sizeof(t->xfpu),
-                         &t->xfpu);
+               fill_note(&t->notes[2], "LINUX", ELF_CORE_XFPREG_TYPE,
+                         sizeof(t->xfpu), &t->xfpu);
                t->num_notes++;
                sz += notesize(&t->notes[2]);
        }
@@ -1488,7 +1532,7 @@ static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma,
  * and then they are actually written out.  If we run out of core limit
  * we just truncate.
  */
-static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
+static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
 {
 #define        NUM_NOTES       6
        int has_dumped = 0;
@@ -1499,7 +1543,6 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
        struct vm_area_struct *vma, *gate_vma;
        struct elfhdr *elf = NULL;
        loff_t offset = 0, dataoff, foffset;
-       unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
        int numnote;
        struct memelfnote *notes = NULL;
        struct elf_prstatus *prstatus = NULL;   /* NT_PRSTATUS */
@@ -1621,7 +1664,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
 #ifdef ELF_CORE_COPY_XFPREGS
        if (elf_core_copy_task_xfpregs(current, xfpu))
                fill_note(notes + numnote++,
-                         "LINUX", NT_PRXFPREG, sizeof(*xfpu), xfpu);
+                         "LINUX", ELF_CORE_XFPREG_TYPE, sizeof(*xfpu), xfpu);
 #endif 
   
        fs = get_fs();
@@ -1662,16 +1705,13 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
        for (vma = first_vma(current, gate_vma); vma != NULL;
                        vma = next_vma(vma, gate_vma)) {
                struct elf_phdr phdr;
-               size_t sz;
-
-               sz = vma->vm_end - vma->vm_start;
 
                phdr.p_type = PT_LOAD;
                phdr.p_offset = offset;
                phdr.p_vaddr = vma->vm_start;
                phdr.p_paddr = 0;
-               phdr.p_filesz = maydump(vma, mm_flags) ? sz : 0;
-               phdr.p_memsz = sz;
+               phdr.p_filesz = vma_dump_size(vma, mm_flags);
+               phdr.p_memsz = vma->vm_end - vma->vm_start;
                offset += phdr.p_filesz;
                phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0;
                if (vma->vm_flags & VM_WRITE)
@@ -1711,13 +1751,11 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
        for (vma = first_vma(current, gate_vma); vma != NULL;
                        vma = next_vma(vma, gate_vma)) {
                unsigned long addr;
+               unsigned long end;
 
-               if (!maydump(vma, mm_flags))
-                       continue;
+               end = vma->vm_start + vma_dump_size(vma, mm_flags);
 
-               for (addr = vma->vm_start;
-                    addr < vma->vm_end;
-                    addr += PAGE_SIZE) {
+               for (addr = vma->vm_start; addr < end; addr += PAGE_SIZE) {
                        struct page *page;
                        struct vm_area_struct *vma;
 
index c5ca2f0aca7f5c846e0f89e78fc69e919b7dea7c..033861c6b8f13028905826bcd6424bd3121f8eb2 100644 (file)
@@ -75,7 +75,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *,
                                             struct file *, struct mm_struct *);
 
 #if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
-static int elf_fdpic_core_dump(long, struct pt_regs *, struct file *);
+static int elf_fdpic_core_dump(long, struct pt_regs *, struct file *, unsigned long limit);
 #endif
 
 static struct linux_binfmt elf_fdpic_format = {
@@ -1417,7 +1417,7 @@ struct elf_thread_status
        elf_fpregset_t fpu;             /* NT_PRFPREG */
        struct task_struct *thread;
 #ifdef ELF_CORE_COPY_XFPREGS
-       elf_fpxregset_t xfpu;           /* NT_PRXFPREG */
+       elf_fpxregset_t xfpu;           /* ELF_CORE_XFPREG_TYPE */
 #endif
        struct memelfnote notes[3];
        int num_notes;
@@ -1453,8 +1453,8 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t)
 
 #ifdef ELF_CORE_COPY_XFPREGS
        if (elf_core_copy_task_xfpregs(p, &t->xfpu)) {
-               fill_note(&t->notes[2], "LINUX", NT_PRXFPREG, sizeof(t->xfpu),
-                         &t->xfpu);
+               fill_note(&t->notes[2], "LINUX", ELF_CORE_XFPREG_TYPE,
+                         sizeof(t->xfpu), &t->xfpu);
                t->num_notes++;
                sz += notesize(&t->notes[2]);
        }
@@ -1552,7 +1552,7 @@ static int elf_fdpic_dump_segments(struct file *file, size_t *size,
  * we just truncate.
  */
 static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
-                              struct file *file)
+                              struct file *file, unsigned long limit)
 {
 #define        NUM_NOTES       6
        int has_dumped = 0;
@@ -1563,7 +1563,6 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
        struct vm_area_struct *vma;
        struct elfhdr *elf = NULL;
        loff_t offset = 0, dataoff;
-       unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
        int numnote;
        struct memelfnote *notes = NULL;
        struct elf_prstatus *prstatus = NULL;   /* NT_PRSTATUS */
@@ -1690,7 +1689,7 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
 #ifdef ELF_CORE_COPY_XFPREGS
        if (elf_core_copy_task_xfpregs(current, xfpu))
                fill_note(notes + numnote++,
-                         "LINUX", NT_PRXFPREG, sizeof(*xfpu), xfpu);
+                         "LINUX", ELF_CORE_XFPREG_TYPE, sizeof(*xfpu), xfpu);
 #endif
 
        fs = get_fs();
index fcb3405bb14e99b64aa322f7e3856ee3fa2ddbb1..33764fd6db66122ff36b52fba3ebf95f26d4a5d7 100644 (file)
@@ -75,7 +75,7 @@ static int load_flat_shared_library(int id, struct lib_info *p);
 #endif
 
 static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs);
-static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file);
+static int flat_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
 
 static struct linux_binfmt flat_format = {
        .module         = THIS_MODULE,
@@ -90,7 +90,7 @@ static struct linux_binfmt flat_format = {
  * Currently only a stub-function.
  */
 
-static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file)
+static int flat_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
 {
        printk("Process %s:%d received signr %d and should have core dumped\n",
                        current->comm, current->pid, (int) signr);
@@ -113,7 +113,7 @@ static unsigned long create_flat_tables(
        char * p = (char*)pp;
        int argc = bprm->argc;
        int envc = bprm->envc;
-       char dummy;
+       char uninitialized_var(dummy);
 
        sp = (unsigned long *) ((-(unsigned long)sizeof(char *))&(unsigned long) p);
 
@@ -290,7 +290,6 @@ out_free_buf:
        kfree(buf);
 out_free:
        kfree(strm.workspace);
-out:
        return retval;
 }
 
@@ -459,7 +458,9 @@ static int load_flat_file(struct linux_binprm * bprm,
                printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename);
 
        if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) {
-               printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION);
+               printk("BINFMT_FLAT: bad flat file version 0x%x (supported "
+                       "0x%lx and 0x%lx)\n",
+                       rev, FLAT_VERSION, OLD_FLAT_VERSION);
                ret = -ENOEXEC;
                goto err;
        }
@@ -515,7 +516,8 @@ static int load_flat_file(struct linux_binprm * bprm,
        /*
         * calculate the extra space we need to map in
         */
-       extra = max(bss_len + stack_len, relocs * sizeof(unsigned long));
+       extra = max_t(unsigned long, bss_len + stack_len,
+                       relocs * sizeof(unsigned long));
 
        /*
         * there are a couple of cases here,  the separate code/data
@@ -546,7 +548,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                        PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
                /* Remap to use all availabe slack region space */
                if (realdatastart && (realdatastart < (unsigned long)-4096)) {
-                       reallen = ksize(realdatastart);
+                       reallen = ksize((void *)realdatastart);
                        if (reallen > len) {
                                realdatastart = do_mremap(realdatastart, len,
                                        reallen, MREMAP_FIXED, realdatastart);
@@ -598,7 +600,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                        PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
                /* Remap to use all availabe slack region space */
                if (textpos && (textpos < (unsigned long) -4096)) {
-                       reallen = ksize(textpos);
+                       reallen = ksize((void *)textpos);
                        if (reallen > len) {
                                textpos = do_mremap(textpos, len, reallen,
                                        MREMAP_FIXED, textpos);
index 5bcdaaf4eae082f26adb82f0d2fe843dd4fc6ad1..9208c41209f9a1b21c93ee74f7981346740fa844 100644 (file)
@@ -44,7 +44,7 @@ static int load_som_library(struct file *);
  * don't even try.
  */
 #if 0
-static int som_core_dump(long signr, struct pt_regs * regs);
+static int som_core_dump(long signr, struct pt_regs *regs, unsigned long limit);
 #else
 #define som_core_dump  NULL
 #endif
index 379a446e243e05c82e92968931e4214794747344..993f78c55221c4c4083ac72114afceadfafd12fe 100644 (file)
@@ -465,7 +465,7 @@ static void bdev_destroy_inode(struct inode *inode)
        kmem_cache_free(bdev_cachep, bdi);
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct bdev_inode *ei = (struct bdev_inode *) foo;
        struct block_device *bdev = &ei->bdev;
index faceb5eecca96d5fd8d879640c510e2edb944a85..76403b1764c54e53b5b2cb2660ae11d7352f0319 100644 (file)
@@ -710,6 +710,8 @@ static int __set_page_dirty(struct page *page,
 
                if (mapping_cap_account_dirty(mapping)) {
                        __inc_zone_page_state(page, NR_FILE_DIRTY);
+                       __inc_bdi_stat(mapping->backing_dev_info,
+                                       BDI_RECLAIMABLE);
                        task_io_account_write(PAGE_CACHE_SIZE);
                }
                radix_tree_tag_set(&mapping->page_tree,
@@ -1728,7 +1730,6 @@ done:
                 * The page and buffer_heads can be released at any time from
                 * here on.
                 */
-               wbc->pages_skipped++;   /* We didn't write this page */
        }
        return err;
 
index bbbf07baa1454a9fd80eb2ea37c30fdc98911bd0..c3bfa76765c45c6c516c467663cdb23e6d08907c 100644 (file)
@@ -545,6 +545,7 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data)
 void __init chrdev_init(void)
 {
        cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
+       bdi_init(&directly_mappable_cdev_bdi);
 }
 
 
index cabb6a55d7ddaf2d3e19ce22ae1c20e38fd5ff0b..ba8f7868cb23c84a5e713910f7b7d5a72bfc6f8a 100644 (file)
@@ -704,7 +704,7 @@ const struct file_operations cifs_dir_ops = {
 };
 
 static void
-cifs_init_once(void *inode, struct kmem_cache *cachep, unsigned long flags)
+cifs_init_once(struct kmem_cache *cachep, void *inode)
 {
        struct cifsInodeInfo *cifsi = inode;
 
index 342f4e0d582e6468ff41eaaab4eac3f2674b3552..2f58dfc70083536004ea5f1d8945be4650c27992 100644 (file)
@@ -58,7 +58,7 @@ static void coda_destroy_inode(struct inode *inode)
        kmem_cache_free(coda_inode_cachep, ITOC(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct coda_inode_info *ei = (struct coda_inode_info *) foo;
 
index 9c3fd07f35e0f25b04763a021c9c636e22ce43e5..6dacd39bf04842c89a53f42de5117fa2ac67bcc3 100644 (file)
 #include <linux/dvb/dmx.h>
 #include <linux/dvb/frontend.h>
 #include <linux/dvb/video.h>
-#include <linux/lp.h>
 
 #ifdef CONFIG_SPARC
 #include <asm/fbio.h>
index 3b0185fdf9a4c8834dc0e669a68cffe84ec12ece..cca98609aa7f360ba8736f6270645a06f838f8de 100644 (file)
@@ -56,6 +56,8 @@ extern int configfs_is_root(struct config_item *item);
 
 extern struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent *);
 extern int configfs_create(struct dentry *, int mode, int (*init)(struct inode *));
+extern int configfs_inode_init(void);
+extern void configfs_inode_exit(void);
 
 extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
 extern int configfs_make_dirent(struct configfs_dirent *,
index 2f436d4f1d6db5ab11eacf6c5f3a766f70b03780..50ed691098bc83f6d9058ccb8bc3bbdd142a15d1 100644 (file)
@@ -142,7 +142,7 @@ static int init_dir(struct inode * inode)
        return 0;
 }
 
-static int init_file(struct inode * inode)
+static int configfs_init_file(struct inode * inode)
 {
        inode->i_size = PAGE_SIZE;
        inode->i_fop = &configfs_file_operations;
@@ -283,7 +283,8 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den
 
        dentry->d_fsdata = configfs_get(sd);
        sd->s_dentry = dentry;
-       error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG, init_file);
+       error = configfs_create(dentry, (attr->ca_mode & S_IALLUGO) | S_IFREG,
+                               configfs_init_file);
        if (error) {
                configfs_put(sd);
                return error;
index dbd257d956c40114717de0712437b6be63b4607a..4c1ebff778eef936479b2869ed34c620694479fb 100644 (file)
@@ -256,4 +256,12 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name)
        mutex_unlock(&dir->d_inode->i_mutex);
 }
 
+int __init configfs_inode_init(void)
+{
+       return bdi_init(&configfs_backing_dev_info);
+}
 
+void __exit configfs_inode_exit(void)
+{
+       bdi_destroy(&configfs_backing_dev_info);
+}
index 871b0cb618399223e3e500cae1a46b54c42475b9..3bf0278ea8435cdcb132662bb13fb17a2e78c004 100644 (file)
@@ -154,8 +154,16 @@ static int __init configfs_init(void)
                subsystem_unregister(&config_subsys);
                kmem_cache_destroy(configfs_dir_cachep);
                configfs_dir_cachep = NULL;
+               goto out;
        }
 
+       err = configfs_inode_init();
+       if (err) {
+               unregister_filesystem(&configfs_fs_type);
+               subsystem_unregister(&config_subsys);
+               kmem_cache_destroy(configfs_dir_cachep);
+               configfs_dir_cachep = NULL;
+       }
 out:
        return err;
 }
@@ -166,6 +174,7 @@ static void __exit configfs_exit(void)
        subsystem_unregister(&config_subsys);
        kmem_cache_destroy(configfs_dir_cachep);
        configfs_dir_cachep = NULL;
+       configfs_inode_exit();
 }
 
 MODULE_AUTHOR("Oracle");
index 3d194a2be3f511e869a541d9b782d6cbe5dddaec..5c817bd0838980c1089ca38d13505c864fb878dc 100644 (file)
@@ -258,12 +258,21 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
 
        /* Do sanity checks on the superblock */
        if (super.magic != CRAMFS_MAGIC) {
+               /* check for wrong endianess */
+               if (super.magic == CRAMFS_MAGIC_WEND) {
+                       if (!silent)
+                               printk(KERN_ERR "cramfs: wrong endianess\n");
+                       goto out;
+               }
+
                /* check at 512 byte offset */
                mutex_lock(&read_mutex);
                memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
                mutex_unlock(&read_mutex);
                if (super.magic != CRAMFS_MAGIC) {
-                       if (!silent)
+                       if (super.magic == CRAMFS_MAGIC_WEND && !silent)
+                               printk(KERN_ERR "cramfs: wrong endianess\n");
+                       else if (!silent)
                                printk(KERN_ERR "cramfs: wrong magic\n");
                        goto out;
                }
index 7da0cf50873e5088fea6a496872a28f401f7a899..5489b2d98a002901d28fdc2417135aab1744b9d0 100644 (file)
@@ -381,20 +381,17 @@ restart:
  * Throw away a dentry - free the inode, dput the parent.  This requires that
  * the LRU list has already been removed.
  *
- * If prune_parents is true, try to prune ancestors as well.
+ * Try to prune ancestors as well.  This is necessary to prevent
+ * quadratic behavior of shrink_dcache_parent(), but is also expected
+ * to be beneficial in reducing dentry cache fragmentation.
  *
  * Called with dcache_lock, drops it and then regains.
  * Called with dentry->d_lock held, drops it.
  */
-static void prune_one_dentry(struct dentry * dentry, int prune_parents)
+static void prune_one_dentry(struct dentry * dentry)
 {
        __d_drop(dentry);
        dentry = d_kill(dentry);
-       if (!prune_parents) {
-               dput(dentry);
-               spin_lock(&dcache_lock);
-               return;
-       }
 
        /*
         * Prune ancestors.  Locking is simpler than in dput(),
@@ -422,7 +419,6 @@ static void prune_one_dentry(struct dentry * dentry, int prune_parents)
  * @count: number of entries to try and free
  * @sb: if given, ignore dentries for other superblocks
  *         which are being unmounted.
- * @prune_parents: if true, try to prune ancestors as well in one go
  *
  * Shrink the dcache. This is done when we need
  * more memory, or simply when we need to unmount
@@ -433,7 +429,7 @@ static void prune_one_dentry(struct dentry * dentry, int prune_parents)
  * all the dentries are in use.
  */
  
-static void prune_dcache(int count, struct super_block *sb, int prune_parents)
+static void prune_dcache(int count, struct super_block *sb)
 {
        spin_lock(&dcache_lock);
        for (; count ; count--) {
@@ -493,7 +489,7 @@ static void prune_dcache(int count, struct super_block *sb, int prune_parents)
                 * without taking the s_umount lock (I already hold it).
                 */
                if (sb && dentry->d_sb == sb) {
-                       prune_one_dentry(dentry, prune_parents);
+                       prune_one_dentry(dentry);
                        continue;
                }
                /*
@@ -508,7 +504,7 @@ static void prune_dcache(int count, struct super_block *sb, int prune_parents)
                s_umount = &dentry->d_sb->s_umount;
                if (down_read_trylock(s_umount)) {
                        if (dentry->d_sb->s_root != NULL) {
-                               prune_one_dentry(dentry, prune_parents);
+                               prune_one_dentry(dentry);
                                up_read(s_umount);
                                continue;
                        }
@@ -557,18 +553,18 @@ void shrink_dcache_sb(struct super_block * sb)
         * superblock to the most recent end of the unused list.
         */
        spin_lock(&dcache_lock);
-       list_for_each_safe(tmp, next, &dentry_unused) {
+       list_for_each_prev_safe(tmp, next, &dentry_unused) {
                dentry = list_entry(tmp, struct dentry, d_lru);
                if (dentry->d_sb != sb)
                        continue;
-               list_move(tmp, &dentry_unused);
+               list_move_tail(tmp, &dentry_unused);
        }
 
        /*
         * Pass two ... free the dentries for this superblock.
         */
 repeat:
-       list_for_each_safe(tmp, next, &dentry_unused) {
+       list_for_each_prev_safe(tmp, next, &dentry_unused) {
                dentry = list_entry(tmp, struct dentry, d_lru);
                if (dentry->d_sb != sb)
                        continue;
@@ -579,7 +575,7 @@ repeat:
                        spin_unlock(&dentry->d_lock);
                        continue;
                }
-               prune_one_dentry(dentry, 1);
+               prune_one_dentry(dentry);
                cond_resched_lock(&dcache_lock);
                goto repeat;
        }
@@ -858,7 +854,7 @@ void shrink_dcache_parent(struct dentry * parent)
        int found;
 
        while ((found = select_parent(parent)) != 0)
-               prune_dcache(found, parent->d_sb, 1);
+               prune_dcache(found, parent->d_sb);
 }
 
 /*
@@ -878,7 +874,7 @@ static int shrink_dcache_memory(int nr, gfp_t gfp_mask)
        if (nr) {
                if (!(gfp_mask & __GFP_FS))
                        return -1;
-               prune_dcache(nr, NULL, 1);
+               prune_dcache(nr, NULL);
        }
        return (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
 }
@@ -1514,8 +1510,8 @@ static void switch_names(struct dentry *dentry, struct dentry *target)
  * This forceful removal will result in ugly /proc output if
  * somebody holds a file open that got deleted due to a rename.
  * We could be nicer about the deleted file, and let it show
- * up under the name it got deleted rather than the name that
- * deleted it.
+ * up under the name it had before it was deleted rather than
+ * under the original name of the file that was moved on top of it.
  */
  
 /*
@@ -1546,7 +1542,7 @@ static void d_move_locked(struct dentry * dentry, struct dentry * target)
        }
 
        /* Move the dentry to the target hash queue, if on different bucket */
-       if (dentry->d_flags & DCACHE_UNHASHED)
+       if (d_unhashed(dentry))
                goto already_unhashed;
 
        hlist_del_rcu(&dentry->d_hash);
@@ -2108,7 +2104,7 @@ static void __init dcache_init_early(void)
                INIT_HLIST_HEAD(&dentry_hashtable[loop]);
 }
 
-static void __init dcache_init(unsigned long mempages)
+static void __init dcache_init(void)
 {
        int loop;
 
@@ -2170,10 +2166,10 @@ void __init vfs_caches_init(unsigned long mempages)
        filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
                        SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
 
-       dcache_init(mempages);
-       inode_init(mempages);
+       dcache_init();
+       inode_init();
        files_init(mempages);
-       mnt_init(mempages);
+       mnt_init();
        bdev_cache_init();
        chrdev_init();
 }
index 54bcc00ec8df7daadc6cb466f4a5279bf14e1df6..2dbb422e81164f66f2ed8bf1a05ab8d5205160ff 100644 (file)
@@ -1,8 +1,6 @@
-menu "Distributed Lock Manager"
-       depends on EXPERIMENTAL && INET
-
-config DLM
+menuconfig DLM
        tristate "Distributed Lock Manager (DLM)"
+       depends on EXPERIMENTAL && INET
        depends on SYSFS && (IPV6 || IPV6=n)
        select CONFIGFS_FS
        select IP_SCTP
@@ -17,5 +15,3 @@ config DLM_DEBUG
        Under the debugfs mount point, the name of each lockspace will
        appear as a file in the "dlm" directory.  The output is the
        list of resource and locks the local node knows about.
-
-endmenu
index de9a29f64ff3bd65dd082b08fa74aa18f02b0ab5..2809768d9c4106e20f14d75ab86ccc408ea689c5 100644 (file)
 #include <linux/capability.h>
 #include <linux/quotaops.h>
 #include <linux/writeback.h> /* for inode_lock, oddly enough.. */
+#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
+#include <net/netlink.h>
+#include <net/genetlink.h>
+#endif
 
 #include <asm/uaccess.h>
 
@@ -823,6 +827,7 @@ static inline void dquot_decr_space(struct dquot *dquot, qsize_t number)
        clear_bit(DQ_BLKS_B, &dquot->dq_flags);
 }
 
+#ifdef CONFIG_PRINT_QUOTA_WARNING
 static int flag_print_warnings = 1;
 
 static inline int need_print_warning(struct dquot *dquot)
@@ -839,22 +844,15 @@ static inline int need_print_warning(struct dquot *dquot)
        return 0;
 }
 
-/* Values of warnings */
-#define NOWARN 0
-#define IHARDWARN 1
-#define ISOFTLONGWARN 2
-#define ISOFTWARN 3
-#define BHARDWARN 4
-#define BSOFTLONGWARN 5
-#define BSOFTWARN 6
-
 /* Print warning to user which exceeded quota */
 static void print_warning(struct dquot *dquot, const char warntype)
 {
        char *msg = NULL;
        struct tty_struct *tty;
-       int flag = (warntype == BHARDWARN || warntype == BSOFTLONGWARN) ? DQ_BLKS_B :
-         ((warntype == IHARDWARN || warntype == ISOFTLONGWARN) ? DQ_INODES_B : 0);
+       int flag = (warntype == QUOTA_NL_BHARDWARN ||
+               warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
+               ((warntype == QUOTA_NL_IHARDWARN ||
+               warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);
 
        if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
                return;
@@ -864,28 +862,28 @@ static void print_warning(struct dquot *dquot, const char warntype)
        if (!tty)
                goto out_lock;
        tty_write_message(tty, dquot->dq_sb->s_id);
-       if (warntype == ISOFTWARN || warntype == BSOFTWARN)
+       if (warntype == QUOTA_NL_ISOFTWARN || warntype == QUOTA_NL_BSOFTWARN)
                tty_write_message(tty, ": warning, ");
        else
                tty_write_message(tty, ": write failed, ");
        tty_write_message(tty, quotatypes[dquot->dq_type]);
        switch (warntype) {
-               case IHARDWARN:
+               case QUOTA_NL_IHARDWARN:
                        msg = " file limit reached.\r\n";
                        break;
-               case ISOFTLONGWARN:
+               case QUOTA_NL_ISOFTLONGWARN:
                        msg = " file quota exceeded too long.\r\n";
                        break;
-               case ISOFTWARN:
+               case QUOTA_NL_ISOFTWARN:
                        msg = " file quota exceeded.\r\n";
                        break;
-               case BHARDWARN:
+               case QUOTA_NL_BHARDWARN:
                        msg = " block limit reached.\r\n";
                        break;
-               case BSOFTLONGWARN:
+               case QUOTA_NL_BSOFTLONGWARN:
                        msg = " block quota exceeded too long.\r\n";
                        break;
-               case BSOFTWARN:
+               case QUOTA_NL_BSOFTWARN:
                        msg = " block quota exceeded.\r\n";
                        break;
        }
@@ -893,14 +891,93 @@ static void print_warning(struct dquot *dquot, const char warntype)
 out_lock:
        mutex_unlock(&tty_mutex);
 }
+#endif
+
+#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
+
+/* Size of quota netlink message - actually an upperbound for buffer size */
+#define QUOTA_NL_MSG_SIZE 32
+
+/* Netlink family structure for quota */
+static struct genl_family quota_genl_family = {
+       .id = GENL_ID_GENERATE,
+       .hdrsize = 0,
+       .name = "VFS_DQUOT",
+       .version = 1,
+       .maxattr = QUOTA_NL_A_MAX,
+};
+
+/* Send warning to userspace about user which exceeded quota */
+static void send_warning(const struct dquot *dquot, const char warntype)
+{
+       static atomic_t seq;
+       struct sk_buff *skb;
+       void *msg_head;
+       int ret;
+
+       /* We have to allocate using GFP_NOFS as we are called from a
+        * filesystem performing write and thus further recursion into
+        * the fs to free some data could cause deadlocks. */
+       skb = genlmsg_new(QUOTA_NL_MSG_SIZE, GFP_NOFS);
+       if (!skb) {
+               printk(KERN_ERR
+                 "VFS: Not enough memory to send quota warning.\n");
+               return;
+       }
+       msg_head = genlmsg_put(skb, 0, atomic_add_return(1, &seq),
+                       &quota_genl_family, 0, QUOTA_NL_C_WARNING);
+       if (!msg_head) {
+               printk(KERN_ERR
+                 "VFS: Cannot store netlink header in quota warning.\n");
+               goto err_out;
+       }
+       ret = nla_put_u32(skb, QUOTA_NL_A_QTYPE, dquot->dq_type);
+       if (ret)
+               goto attr_err_out;
+       ret = nla_put_u64(skb, QUOTA_NL_A_EXCESS_ID, dquot->dq_id);
+       if (ret)
+               goto attr_err_out;
+       ret = nla_put_u32(skb, QUOTA_NL_A_WARNING, warntype);
+       if (ret)
+               goto attr_err_out;
+       ret = nla_put_u32(skb, QUOTA_NL_A_DEV_MAJOR,
+               MAJOR(dquot->dq_sb->s_dev));
+       if (ret)
+               goto attr_err_out;
+       ret = nla_put_u32(skb, QUOTA_NL_A_DEV_MINOR,
+               MINOR(dquot->dq_sb->s_dev));
+       if (ret)
+               goto attr_err_out;
+       ret = nla_put_u64(skb, QUOTA_NL_A_CAUSED_ID, current->user->uid);
+       if (ret)
+               goto attr_err_out;
+       genlmsg_end(skb, msg_head);
+
+       ret = genlmsg_multicast(skb, 0, quota_genl_family.id, GFP_NOFS);
+       if (ret < 0 && ret != -ESRCH)
+               printk(KERN_ERR
+                       "VFS: Failed to send notification message: %d\n", ret);
+       return;
+attr_err_out:
+       printk(KERN_ERR "VFS: Failed to compose quota message: %d\n", ret);
+err_out:
+       kfree_skb(skb);
+}
+#endif
 
 static inline void flush_warnings(struct dquot **dquots, char *warntype)
 {
        int i;
 
        for (i = 0; i < MAXQUOTAS; i++)
-               if (dquots[i] != NODQUOT && warntype[i] != NOWARN)
+               if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN) {
+#ifdef CONFIG_PRINT_QUOTA_WARNING
                        print_warning(dquots[i], warntype[i]);
+#endif
+#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
+                       send_warning(dquots[i], warntype[i]);
+#endif
+               }
 }
 
 static inline char ignore_hardlimit(struct dquot *dquot)
@@ -914,14 +991,14 @@ static inline char ignore_hardlimit(struct dquot *dquot)
 /* needs dq_data_lock */
 static int check_idq(struct dquot *dquot, ulong inodes, char *warntype)
 {
-       *warntype = NOWARN;
+       *warntype = QUOTA_NL_NOWARN;
        if (inodes <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags))
                return QUOTA_OK;
 
        if (dquot->dq_dqb.dqb_ihardlimit &&
           (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_ihardlimit &&
             !ignore_hardlimit(dquot)) {
-               *warntype = IHARDWARN;
+               *warntype = QUOTA_NL_IHARDWARN;
                return NO_QUOTA;
        }
 
@@ -929,14 +1006,14 @@ static int check_idq(struct dquot *dquot, ulong inodes, char *warntype)
           (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit &&
            dquot->dq_dqb.dqb_itime && get_seconds() >= dquot->dq_dqb.dqb_itime &&
             !ignore_hardlimit(dquot)) {
-               *warntype = ISOFTLONGWARN;
+               *warntype = QUOTA_NL_ISOFTLONGWARN;
                return NO_QUOTA;
        }
 
        if (dquot->dq_dqb.dqb_isoftlimit &&
           (dquot->dq_dqb.dqb_curinodes + inodes) > dquot->dq_dqb.dqb_isoftlimit &&
            dquot->dq_dqb.dqb_itime == 0) {
-               *warntype = ISOFTWARN;
+               *warntype = QUOTA_NL_ISOFTWARN;
                dquot->dq_dqb.dqb_itime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace;
        }
 
@@ -946,7 +1023,7 @@ static int check_idq(struct dquot *dquot, ulong inodes, char *warntype)
 /* needs dq_data_lock */
 static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *warntype)
 {
-       *warntype = 0;
+       *warntype = QUOTA_NL_NOWARN;
        if (space <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags))
                return QUOTA_OK;
 
@@ -954,7 +1031,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
           toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bhardlimit &&
             !ignore_hardlimit(dquot)) {
                if (!prealloc)
-                       *warntype = BHARDWARN;
+                       *warntype = QUOTA_NL_BHARDWARN;
                return NO_QUOTA;
        }
 
@@ -963,7 +1040,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
            dquot->dq_dqb.dqb_btime && get_seconds() >= dquot->dq_dqb.dqb_btime &&
             !ignore_hardlimit(dquot)) {
                if (!prealloc)
-                       *warntype = BSOFTLONGWARN;
+                       *warntype = QUOTA_NL_BSOFTLONGWARN;
                return NO_QUOTA;
        }
 
@@ -971,7 +1048,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
           toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bsoftlimit &&
            dquot->dq_dqb.dqb_btime == 0) {
                if (!prealloc) {
-                       *warntype = BSOFTWARN;
+                       *warntype = QUOTA_NL_BSOFTWARN;
                        dquot->dq_dqb.dqb_btime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace;
                }
                else
@@ -1066,7 +1143,7 @@ out_add:
                return QUOTA_OK;
        }
        for (cnt = 0; cnt < MAXQUOTAS; cnt++)
-               warntype[cnt] = NOWARN;
+               warntype[cnt] = QUOTA_NL_NOWARN;
 
        down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
        if (IS_NOQUOTA(inode)) {        /* Now we can do reliable test... */
@@ -1112,7 +1189,7 @@ int dquot_alloc_inode(const struct inode *inode, unsigned long number)
        if (IS_NOQUOTA(inode))
                return QUOTA_OK;
        for (cnt = 0; cnt < MAXQUOTAS; cnt++)
-               warntype[cnt] = NOWARN;
+               warntype[cnt] = QUOTA_NL_NOWARN;
        down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
        if (IS_NOQUOTA(inode)) {
                up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
@@ -1234,7 +1311,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
        /* Clear the arrays */
        for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
                transfer_to[cnt] = transfer_from[cnt] = NODQUOT;
-               warntype[cnt] = NOWARN;
+               warntype[cnt] = QUOTA_NL_NOWARN;
        }
        down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
        /* Now recheck reliably when holding dqptr_sem */
@@ -1808,6 +1885,7 @@ static ctl_table fs_dqstats_table[] = {
                .mode           = 0444,
                .proc_handler   = &proc_dointvec,
        },
+#ifdef CONFIG_PRINT_QUOTA_WARNING
        {
                .ctl_name       = FS_DQ_WARNINGS,
                .procname       = "warnings",
@@ -1816,6 +1894,7 @@ static ctl_table fs_dqstats_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_dointvec,
        },
+#endif
        { .ctl_name = 0 },
 };
 
@@ -1877,6 +1956,11 @@ static int __init dquot_init(void)
 
        register_shrinker(&dqcache_shrinker);
 
+#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
+       if (genl_register_family(&quota_genl_family) != 0)
+               printk(KERN_ERR "VFS: Failed to create quota netlink interface.\n");
+#endif
+
        return 0;
 }
 module_init(dquot_init);
index 97e6801f722cef2c87354fed3e31dd2e56238f5e..b83a512b7e085183e6ea3edb15c8dda3047889b5 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/crypto.h>
 #include <linux/netlink.h>
 #include <linux/mount.h>
-#include <linux/dcache.h>
 #include <linux/pagemap.h>
 #include <linux/key.h>
 #include <linux/parser.h>
@@ -611,7 +610,7 @@ static struct file_system_type ecryptfs_fs_type = {
  * Initializes the ecryptfs_inode_info_cache when it is created
  */
 static void
-inode_info_init_once(void *vptr, struct kmem_cache *cachep, unsigned long flags)
+inode_info_init_once(struct kmem_cache *cachep, void *vptr)
 {
        struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr;
 
@@ -622,7 +621,7 @@ static struct ecryptfs_cache_info {
        struct kmem_cache **cache;
        const char *name;
        size_t size;
-       void (*ctor)(void*, struct kmem_cache *, unsigned long);
+       void (*ctor)(struct kmem_cache *cache, void *obj);
 } ecryptfs_cache_infos[] = {
        {
                .cache = &ecryptfs_auth_tok_list_item_cache,
index ce4acb8ff819a70b4f76733bd804c7d72e0beb2b..25d0326c5f1c9a6c44b220c89e5bd94a9f32c6be 100644 (file)
@@ -69,7 +69,7 @@ static void efs_destroy_inode(struct inode *inode)
        kmem_cache_free(efs_inode_cachep, INODE_INFO(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct efs_inode_info *ei = (struct efs_inode_info *) foo;
 
index 073b0b8c6d055a3fd947f16fbdbe5552a6bc34c8..070ddf13cb719d62ead6233961c2bb9716beed02 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -29,6 +29,7 @@
 #include <linux/stat.h>
 #include <linux/fcntl.h>
 #include <linux/smp_lock.h>
+#include <linux/string.h>
 #include <linux/init.h>
 #include <linux/pagemap.h>
 #include <linux/highmem.h>
@@ -63,52 +64,28 @@ int core_uses_pid;
 char core_pattern[CORENAME_MAX_SIZE] = "core";
 int suid_dumpable = 0;
 
-EXPORT_SYMBOL(suid_dumpable);
 /* The maximal length of core_pattern is also specified in sysctl.c */
 
-static struct linux_binfmt *formats;
+static LIST_HEAD(formats);
 static DEFINE_RWLOCK(binfmt_lock);
 
 int register_binfmt(struct linux_binfmt * fmt)
 {
-       struct linux_binfmt ** tmp = &formats;
-
        if (!fmt)
                return -EINVAL;
-       if (fmt->next)
-               return -EBUSY;
        write_lock(&binfmt_lock);
-       while (*tmp) {
-               if (fmt == *tmp) {
-                       write_unlock(&binfmt_lock);
-                       return -EBUSY;
-               }
-               tmp = &(*tmp)->next;
-       }
-       fmt->next = formats;
-       formats = fmt;
+       list_add(&fmt->lh, &formats);
        write_unlock(&binfmt_lock);
        return 0;       
 }
 
 EXPORT_SYMBOL(register_binfmt);
 
-int unregister_binfmt(struct linux_binfmt * fmt)
+void unregister_binfmt(struct linux_binfmt * fmt)
 {
-       struct linux_binfmt ** tmp = &formats;
-
        write_lock(&binfmt_lock);
-       while (*tmp) {
-               if (fmt == *tmp) {
-                       *tmp = fmt->next;
-                       fmt->next = NULL;
-                       write_unlock(&binfmt_lock);
-                       return 0;
-               }
-               tmp = &(*tmp)->next;
-       }
+       list_del(&fmt->lh);
        write_unlock(&binfmt_lock);
-       return -EINVAL;
 }
 
 EXPORT_SYMBOL(unregister_binfmt);
@@ -134,9 +111,6 @@ asmlinkage long sys_uselib(const char __user * library)
        if (error)
                goto out;
 
-       error = -EACCES;
-       if (nd.mnt->mnt_flags & MNT_NOEXEC)
-               goto exit;
        error = -EINVAL;
        if (!S_ISREG(nd.dentry->d_inode->i_mode))
                goto exit;
@@ -155,7 +129,7 @@ asmlinkage long sys_uselib(const char __user * library)
                struct linux_binfmt * fmt;
 
                read_lock(&binfmt_lock);
-               for (fmt = formats ; fmt ; fmt = fmt->next) {
+               list_for_each_entry(fmt, &formats, lh) {
                        if (!fmt->load_shlib)
                                continue;
                        if (!try_module_get(fmt->module))
@@ -680,8 +654,7 @@ struct file *open_exec(const char *name)
        if (!err) {
                struct inode *inode = nd.dentry->d_inode;
                file = ERR_PTR(-EACCES);
-               if (!(nd.mnt->mnt_flags & MNT_NOEXEC) &&
-                   S_ISREG(inode->i_mode)) {
+               if (S_ISREG(inode->i_mode)) {
                        int err = vfs_permission(&nd, MAY_EXEC);
                        file = ERR_PTR(err);
                        if (!err) {
@@ -773,24 +746,11 @@ static int exec_mmap(struct mm_struct *mm)
 static int de_thread(struct task_struct *tsk)
 {
        struct signal_struct *sig = tsk->signal;
-       struct sighand_struct *newsighand, *oldsighand = tsk->sighand;
+       struct sighand_struct *oldsighand = tsk->sighand;
        spinlock_t *lock = &oldsighand->siglock;
        struct task_struct *leader = NULL;
        int count;
 
-       /*
-        * If we don't share sighandlers, then we aren't sharing anything
-        * and we can just re-use it all.
-        */
-       if (atomic_read(&oldsighand->count) <= 1) {
-               exit_itimers(sig);
-               return 0;
-       }
-
-       newsighand = kmem_cache_alloc(sighand_cachep, GFP_KERNEL);
-       if (!newsighand)
-               return -ENOMEM;
-
        if (thread_group_empty(tsk))
                goto no_thread_group;
 
@@ -807,7 +767,6 @@ static int de_thread(struct task_struct *tsk)
                 */
                spin_unlock_irq(lock);
                read_unlock(&tasklist_lock);
-               kmem_cache_free(sighand_cachep, newsighand);
                return -EAGAIN;
        }
 
@@ -841,16 +800,15 @@ static int de_thread(struct task_struct *tsk)
                        hrtimer_restart(&sig->real_timer);
                spin_lock_irq(lock);
        }
+
+       sig->notify_count = count;
+       sig->group_exit_task = tsk;
        while (atomic_read(&sig->count) > count) {
-               sig->group_exit_task = tsk;
-               sig->notify_count = count;
                __set_current_state(TASK_UNINTERRUPTIBLE);
                spin_unlock_irq(lock);
                schedule();
                spin_lock_irq(lock);
        }
-       sig->group_exit_task = NULL;
-       sig->notify_count = 0;
        spin_unlock_irq(lock);
 
        /*
@@ -859,14 +817,17 @@ static int de_thread(struct task_struct *tsk)
         * and to assume its PID:
         */
        if (!thread_group_leader(tsk)) {
-               /*
-                * Wait for the thread group leader to be a zombie.
-                * It should already be zombie at this point, most
-                * of the time.
-                */
                leader = tsk->group_leader;
-               while (leader->exit_state != EXIT_ZOMBIE)
-                       yield();
+
+               sig->notify_count = -1;
+               for (;;) {
+                       write_lock_irq(&tasklist_lock);
+                       if (likely(leader->exit_state))
+                               break;
+                       __set_current_state(TASK_UNINTERRUPTIBLE);
+                       write_unlock_irq(&tasklist_lock);
+                       schedule();
+               }
 
                /*
                 * The only record we have of the real-time age of a
@@ -880,8 +841,6 @@ static int de_thread(struct task_struct *tsk)
                 */
                tsk->start_time = leader->start_time;
 
-               write_lock_irq(&tasklist_lock);
-
                BUG_ON(leader->tgid != tsk->tgid);
                BUG_ON(tsk->pid == tsk->tgid);
                /*
@@ -914,6 +873,8 @@ static int de_thread(struct task_struct *tsk)
                write_unlock_irq(&tasklist_lock);
         }
 
+       sig->group_exit_task = NULL;
+       sig->notify_count = 0;
        /*
         * There may be one thread left which is just exiting,
         * but it's safe to stop telling the group to kill themselves.
@@ -925,29 +886,23 @@ no_thread_group:
        if (leader)
                release_task(leader);
 
-       if (atomic_read(&oldsighand->count) == 1) {
-               /*
-                * Now that we nuked the rest of the thread group,
-                * it turns out we are not sharing sighand any more either.
-                * So we can just keep it.
-                */
-               kmem_cache_free(sighand_cachep, newsighand);
-       } else {
+       if (atomic_read(&oldsighand->count) != 1) {
+               struct sighand_struct *newsighand;
                /*
-                * Move our state over to newsighand and switch it in.
+                * This ->sighand is shared with the CLONE_SIGHAND
+                * but not CLONE_THREAD task, switch to the new one.
                 */
+               newsighand = kmem_cache_alloc(sighand_cachep, GFP_KERNEL);
+               if (!newsighand)
+                       return -ENOMEM;
+
                atomic_set(&newsighand->count, 1);
                memcpy(newsighand->action, oldsighand->action,
                       sizeof(newsighand->action));
 
                write_lock_irq(&tasklist_lock);
                spin_lock(&oldsighand->siglock);
-               spin_lock_nested(&newsighand->siglock, SINGLE_DEPTH_NESTING);
-
                rcu_assign_pointer(tsk->sighand, newsighand);
-               recalc_sigpending();
-
-               spin_unlock(&newsighand->siglock);
                spin_unlock(&oldsighand->siglock);
                write_unlock_irq(&tasklist_lock);
 
@@ -957,12 +912,11 @@ no_thread_group:
        BUG_ON(!thread_group_leader(tsk));
        return 0;
 }
-       
+
 /*
  * These functions flushes out all traces of the currently running executable
  * so that a new one can be started
  */
-
 static void flush_old_files(struct files_struct * files)
 {
        long j = -1;
@@ -1284,7 +1238,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
        retval = -ENOENT;
        for (try=0; try<2; try++) {
                read_lock(&binfmt_lock);
-               for (fmt = formats ; fmt ; fmt = fmt->next) {
+               list_for_each_entry(fmt, &formats, lh) {
                        int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary;
                        if (!fn)
                                continue;
@@ -1537,6 +1491,14 @@ static int format_corename(char *corename, const char *pattern, long signr)
                                        goto out;
                                out_ptr += rc;
                                break;
+                       /* core limit size */
+                       case 'c':
+                               rc = snprintf(out_ptr, out_end - out_ptr,
+                                             "%lu", current->signal->rlim[RLIMIT_CORE].rlim_cur);
+                               if (rc > out_end - out_ptr)
+                                       goto out;
+                               out_ptr += rc;
+                               break;
                        default:
                                break;
                        }
@@ -1699,7 +1661,6 @@ void set_dumpable(struct mm_struct *mm, int value)
                break;
        }
 }
-EXPORT_SYMBOL_GPL(set_dumpable);
 
 int get_dumpable(struct mm_struct *mm)
 {
@@ -1720,6 +1681,10 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
        int fsuid = current->fsuid;
        int flag = 0;
        int ispipe = 0;
+       unsigned long core_limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
+       char **helper_argv = NULL;
+       int helper_argc = 0;
+       char *delimit;
 
        audit_core_dumps(signr);
 
@@ -1753,9 +1718,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
         */
        clear_thread_flag(TIF_SIGPENDING);
 
-       if (current->signal->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
-               goto fail_unlock;
-
        /*
         * lock_kernel() because format_corename() is controlled by sysctl, which
         * uses lock_kernel()
@@ -1763,9 +1725,39 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
        lock_kernel();
        ispipe = format_corename(corename, core_pattern, signr);
        unlock_kernel();
+       /*
+        * Don't bother to check the RLIMIT_CORE value if core_pattern points
+        * to a pipe.  Since we're not writing directly to the filesystem
+        * RLIMIT_CORE doesn't really apply, as no actual core file will be
+        * created unless the pipe reader choses to write out the core file
+        * at which point file size limits and permissions will be imposed
+        * as it does with any other process
+        */
+       if ((!ispipe) && (core_limit < binfmt->min_coredump))
+               goto fail_unlock;
+
        if (ispipe) {
+               helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc);
+               /* Terminate the string before the first option */
+               delimit = strchr(corename, ' ');
+               if (delimit)
+                       *delimit = '\0';
+               delimit = strrchr(helper_argv[0], '/');
+               if (delimit)
+                       delimit++;
+               else
+                       delimit = helper_argv[0];
+               if (!strcmp(delimit, current->comm)) {
+                       printk(KERN_NOTICE "Recursive core dump detected, "
+                                       "aborting\n");
+                       goto fail_unlock;
+               }
+
+               core_limit = RLIM_INFINITY;
+
                /* SIGPIPE can happen, but it's just never processed */
-               if(call_usermodehelper_pipe(corename+1, NULL, NULL, &file)) {
+               if (call_usermodehelper_pipe(corename+1, helper_argv, NULL,
+                               &file)) {
                        printk(KERN_INFO "Core dump to %s pipe failed\n",
                               corename);
                        goto fail_unlock;
@@ -1793,13 +1785,16 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
        if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
                goto close_fail;
 
-       retval = binfmt->core_dump(signr, regs, file);
+       retval = binfmt->core_dump(signr, regs, file, core_limit);
 
        if (retval)
                current->signal->group_exit_code |= 0x80;
 close_fail:
        filp_close(file, NULL);
 fail_unlock:
+       if (helper_argv)
+               argv_free(helper_argv);
+
        current->fsuid = fsuid;
        complete_all(&mm->core_done);
 fail:
index baf71dd721fa161adcb936735ba69355c79d9acb..18a42de25b556dd2b311f06619678c4bc06c66e7 100644 (file)
@@ -69,6 +69,14 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
        return desc + offset;
 }
 
+static inline int
+block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
+{
+       return ext2_test_bit ((block -
+               le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block)) %
+                        EXT2_BLOCKS_PER_GROUP(sb), map);
+}
+
 /*
  * Read the bitmap for a given block_group, reading into the specified 
  * slot in the superblock's bitmap cache.
@@ -78,55 +86,51 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
 static struct buffer_head *
 read_block_bitmap(struct super_block *sb, unsigned int block_group)
 {
+       int i;
        struct ext2_group_desc * desc;
        struct buffer_head * bh = NULL;
-       
+       unsigned int bitmap_blk;
+
        desc = ext2_get_group_desc (sb, block_group, NULL);
        if (!desc)
-               goto error_out;
-       bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap));
+               return NULL;
+       bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
+       bh = sb_bread(sb, bitmap_blk);
        if (!bh)
-               ext2_error (sb, "read_block_bitmap",
+               ext2_error (sb, __FUNCTION__,
                            "Cannot read block bitmap - "
                            "block_group = %d, block_bitmap = %u",
                            block_group, le32_to_cpu(desc->bg_block_bitmap));
-error_out:
-       return bh;
-}
-
-/*
- * Set sb->s_dirt here because the superblock was "logically" altered.  We
- * need to recalculate its free blocks count and flush it out.
- */
-static int reserve_blocks(struct super_block *sb, int count)
-{
-       struct ext2_sb_info *sbi = EXT2_SB(sb);
-       struct ext2_super_block *es = sbi->s_es;
-       unsigned free_blocks;
-       unsigned root_blocks;
-
-       free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
-       root_blocks = le32_to_cpu(es->s_r_blocks_count);
 
-       if (free_blocks < count)
-               count = free_blocks;
-
-       if (free_blocks < root_blocks + count && !capable(CAP_SYS_RESOURCE) &&
-           sbi->s_resuid != current->fsuid &&
-           (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) {
-               /*
-                * We are too close to reserve and we are not privileged.
-                * Can we allocate anything at all?
-                */
-               if (free_blocks > root_blocks)
-                       count = free_blocks - root_blocks;
-               else
-                       return 0;
+       /* check whether block bitmap block number is set */
+       if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+               /* bad block bitmap */
+               goto error_out;
        }
+       /* check whether the inode bitmap block number is set */
+       bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
+       if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+               /* bad block bitmap */
+               goto error_out;
+       }
+       /* check whether the inode table block number is set */
+       bitmap_blk = le32_to_cpu(desc->bg_inode_table);
+       for (i = 0; i < EXT2_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
+               if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+                       /* bad block bitmap */
+                       goto error_out;
+               }
+       }
+
+       return bh;
 
-       percpu_counter_mod(&sbi->s_freeblocks_counter, -count);
-       sb->s_dirt = 1;
-       return count;
+error_out:
+       brelse(bh);
+       ext2_error(sb, __FUNCTION__,
+                       "Invalid block bitmap - "
+                       "block_group = %d, block = %u",
+                       block_group, bitmap_blk);
+       return NULL;
 }
 
 static void release_blocks(struct super_block *sb, int count)
@@ -134,30 +138,12 @@ static void release_blocks(struct super_block *sb, int count)
        if (count) {
                struct ext2_sb_info *sbi = EXT2_SB(sb);
 
-               percpu_counter_mod(&sbi->s_freeblocks_counter, count);
+               percpu_counter_add(&sbi->s_freeblocks_counter, count);
                sb->s_dirt = 1;
        }
 }
 
-static int group_reserve_blocks(struct ext2_sb_info *sbi, int group_no,
-       struct ext2_group_desc *desc, struct buffer_head *bh, int count)
-{
-       unsigned free_blocks;
-
-       if (!desc->bg_free_blocks_count)
-               return 0;
-
-       spin_lock(sb_bgl_lock(sbi, group_no));
-       free_blocks = le16_to_cpu(desc->bg_free_blocks_count);
-       if (free_blocks < count)
-               count = free_blocks;
-       desc->bg_free_blocks_count = cpu_to_le16(free_blocks - count);
-       spin_unlock(sb_bgl_lock(sbi, group_no));
-       mark_buffer_dirty(bh);
-       return count;
-}
-
-static void group_release_blocks(struct super_block *sb, int group_no,
+static void group_adjust_blocks(struct super_block *sb, int group_no,
        struct ext2_group_desc *desc, struct buffer_head *bh, int count)
 {
        if (count) {
@@ -173,7 +159,306 @@ static void group_release_blocks(struct super_block *sb, int group_no,
        }
 }
 
-/* Free given blocks, update quota and i_blocks field */
+/*
+ * The reservation window structure operations
+ * --------------------------------------------
+ * Operations include:
+ * dump, find, add, remove, is_empty, find_next_reservable_window, etc.
+ *
+ * We use a red-black tree to represent per-filesystem reservation
+ * windows.
+ *
+ */
+
+/**
+ * __rsv_window_dump() -- Dump the filesystem block allocation reservation map
+ * @rb_root:           root of per-filesystem reservation rb tree
+ * @verbose:           verbose mode
+ * @fn:                        function which wishes to dump the reservation map
+ *
+ * If verbose is turned on, it will print the whole block reservation
+ * windows(start, end). Otherwise, it will only print out the "bad" windows,
+ * those windows that overlap with their immediate neighbors.
+ */
+#if 1
+static void __rsv_window_dump(struct rb_root *root, int verbose,
+                             const char *fn)
+{
+       struct rb_node *n;
+       struct ext2_reserve_window_node *rsv, *prev;
+       int bad;
+
+restart:
+       n = rb_first(root);
+       bad = 0;
+       prev = NULL;
+
+       printk("Block Allocation Reservation Windows Map (%s):\n", fn);
+       while (n) {
+               rsv = rb_entry(n, struct ext2_reserve_window_node, rsv_node);
+               if (verbose)
+                       printk("reservation window 0x%p "
+                               "start: %lu, end: %lu\n",
+                               rsv, rsv->rsv_start, rsv->rsv_end);
+               if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) {
+                       printk("Bad reservation %p (start >= end)\n",
+                              rsv);
+                       bad = 1;
+               }
+               if (prev && prev->rsv_end >= rsv->rsv_start) {
+                       printk("Bad reservation %p (prev->end >= start)\n",
+                              rsv);
+                       bad = 1;
+               }
+               if (bad) {
+                       if (!verbose) {
+                               printk("Restarting reservation walk in verbose mode\n");
+                               verbose = 1;
+                               goto restart;
+                       }
+               }
+               n = rb_next(n);
+               prev = rsv;
+       }
+       printk("Window map complete.\n");
+       if (bad)
+               BUG();
+}
+#define rsv_window_dump(root, verbose) \
+       __rsv_window_dump((root), (verbose), __FUNCTION__)
+#else
+#define rsv_window_dump(root, verbose) do {} while (0)
+#endif
+
+/**
+ * goal_in_my_reservation()
+ * @rsv:               inode's reservation window
+ * @grp_goal:          given goal block relative to the allocation block group
+ * @group:             the current allocation block group
+ * @sb:                        filesystem super block
+ *
+ * Test if the given goal block (group relative) is within the file's
+ * own block reservation window range.
+ *
+ * If the reservation window is outside the goal allocation group, return 0;
+ * grp_goal (given goal block) could be -1, which means no specific
+ * goal block. In this case, always return 1.
+ * If the goal block is within the reservation window, return 1;
+ * otherwise, return 0;
+ */
+static int
+goal_in_my_reservation(struct ext2_reserve_window *rsv, ext2_grpblk_t grp_goal,
+                       unsigned int group, struct super_block * sb)
+{
+       ext2_fsblk_t group_first_block, group_last_block;
+
+       group_first_block = ext2_group_first_block_no(sb, group);
+       group_last_block = group_first_block + EXT2_BLOCKS_PER_GROUP(sb) - 1;
+
+       if ((rsv->_rsv_start > group_last_block) ||
+           (rsv->_rsv_end < group_first_block))
+               return 0;
+       if ((grp_goal >= 0) && ((grp_goal + group_first_block < rsv->_rsv_start)
+               || (grp_goal + group_first_block > rsv->_rsv_end)))
+               return 0;
+       return 1;
+}
+
+/**
+ * search_reserve_window()
+ * @rb_root:           root of reservation tree
+ * @goal:              target allocation block
+ *
+ * Find the reserved window which includes the goal, or the previous one
+ * if the goal is not in any window.
+ * Returns NULL if there are no windows or if all windows start after the goal.
+ */
+static struct ext2_reserve_window_node *
+search_reserve_window(struct rb_root *root, ext2_fsblk_t goal)
+{
+       struct rb_node *n = root->rb_node;
+       struct ext2_reserve_window_node *rsv;
+
+       if (!n)
+               return NULL;
+
+       do {
+               rsv = rb_entry(n, struct ext2_reserve_window_node, rsv_node);
+
+               if (goal < rsv->rsv_start)
+                       n = n->rb_left;
+               else if (goal > rsv->rsv_end)
+                       n = n->rb_right;
+               else
+                       return rsv;
+       } while (n);
+       /*
+        * We've fallen off the end of the tree: the goal wasn't inside
+        * any particular node.  OK, the previous node must be to one
+        * side of the interval containing the goal.  If it's the RHS,
+        * we need to back up one.
+        */
+       if (rsv->rsv_start > goal) {
+               n = rb_prev(&rsv->rsv_node);
+               rsv = rb_entry(n, struct ext2_reserve_window_node, rsv_node);
+       }
+       return rsv;
+}
+
+/*
+ * ext2_rsv_window_add() -- Insert a window to the block reservation rb tree.
+ * @sb:                        super block
+ * @rsv:               reservation window to add
+ *
+ * Must be called with rsv_lock held.
+ */
+void ext2_rsv_window_add(struct super_block *sb,
+                   struct ext2_reserve_window_node *rsv)
+{
+       struct rb_root *root = &EXT2_SB(sb)->s_rsv_window_root;
+       struct rb_node *node = &rsv->rsv_node;
+       ext2_fsblk_t start = rsv->rsv_start;
+
+       struct rb_node ** p = &root->rb_node;
+       struct rb_node * parent = NULL;
+       struct ext2_reserve_window_node *this;
+
+       while (*p)
+       {
+               parent = *p;
+               this = rb_entry(parent, struct ext2_reserve_window_node, rsv_node);
+
+               if (start < this->rsv_start)
+                       p = &(*p)->rb_left;
+               else if (start > this->rsv_end)
+                       p = &(*p)->rb_right;
+               else {
+                       rsv_window_dump(root, 1);
+                       BUG();
+               }
+       }
+
+       rb_link_node(node, parent, p);
+       rb_insert_color(node, root);
+}
+
+/**
+ * rsv_window_remove() -- unlink a window from the reservation rb tree
+ * @sb:                        super block
+ * @rsv:               reservation window to remove
+ *
+ * Mark the block reservation window as not allocated, and unlink it
+ * from the filesystem reservation window rb tree. Must be called with
+ * rsv_lock held.
+ */
+static void rsv_window_remove(struct super_block *sb,
+                             struct ext2_reserve_window_node *rsv)
+{
+       rsv->rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
+       rsv->rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
+       rsv->rsv_alloc_hit = 0;
+       rb_erase(&rsv->rsv_node, &EXT2_SB(sb)->s_rsv_window_root);
+}
+
+/*
+ * rsv_is_empty() -- Check if the reservation window is allocated.
+ * @rsv:               given reservation window to check
+ *
+ * returns 1 if the end block is EXT2_RESERVE_WINDOW_NOT_ALLOCATED.
+ */
+static inline int rsv_is_empty(struct ext2_reserve_window *rsv)
+{
+       /* a valid reservation end block could not be 0 */
+       return (rsv->_rsv_end == EXT2_RESERVE_WINDOW_NOT_ALLOCATED);
+}
+
+/**
+ * ext2_init_block_alloc_info()
+ * @inode:             file inode structure
+ *
+ * Allocate and initialize the  reservation window structure, and
+ * link the window to the ext2 inode structure at last
+ *
+ * The reservation window structure is only dynamically allocated
+ * and linked to ext2 inode the first time the open file
+ * needs a new block. So, before every ext2_new_block(s) call, for
+ * regular files, we should check whether the reservation window
+ * structure exists or not. In the latter case, this function is called.
+ * Fail to do so will result in block reservation being turned off for that
+ * open file.
+ *
+ * This function is called from ext2_get_blocks_handle(), also called
+ * when setting the reservation window size through ioctl before the file
+ * is open for write (needs block allocation).
+ *
+ * Needs truncate_mutex protection prior to calling this function.
+ */
+void ext2_init_block_alloc_info(struct inode *inode)
+{
+       struct ext2_inode_info *ei = EXT2_I(inode);
+       struct ext2_block_alloc_info *block_i = ei->i_block_alloc_info;
+       struct super_block *sb = inode->i_sb;
+
+       block_i = kmalloc(sizeof(*block_i), GFP_NOFS);
+       if (block_i) {
+               struct ext2_reserve_window_node *rsv = &block_i->rsv_window_node;
+
+               rsv->rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
+               rsv->rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
+
+               /*
+                * if filesystem is mounted with NORESERVATION, the goal
+                * reservation window size is set to zero to indicate
+                * block reservation is off
+                */
+               if (!test_opt(sb, RESERVATION))
+                       rsv->rsv_goal_size = 0;
+               else
+                       rsv->rsv_goal_size = EXT2_DEFAULT_RESERVE_BLOCKS;
+               rsv->rsv_alloc_hit = 0;
+               block_i->last_alloc_logical_block = 0;
+               block_i->last_alloc_physical_block = 0;
+       }
+       ei->i_block_alloc_info = block_i;
+}
+
+/**
+ * ext2_discard_reservation()
+ * @inode:             inode
+ *
+ * Discard(free) block reservation window on last file close, or truncate
+ * or at last iput().
+ *
+ * It is being called in three cases:
+ *     ext2_release_file(): last writer closes the file
+ *     ext2_clear_inode(): last iput(), when nobody links to this file.
+ *     ext2_truncate(): when the block indirect map is about to change.
+ */
+void ext2_discard_reservation(struct inode *inode)
+{
+       struct ext2_inode_info *ei = EXT2_I(inode);
+       struct ext2_block_alloc_info *block_i = ei->i_block_alloc_info;
+       struct ext2_reserve_window_node *rsv;
+       spinlock_t *rsv_lock = &EXT2_SB(inode->i_sb)->s_rsv_window_lock;
+
+       if (!block_i)
+               return;
+
+       rsv = &block_i->rsv_window_node;
+       if (!rsv_is_empty(&rsv->rsv_window)) {
+               spin_lock(rsv_lock);
+               if (!rsv_is_empty(&rsv->rsv_window))
+                       rsv_window_remove(inode->i_sb, rsv);
+               spin_unlock(rsv_lock);
+       }
+}
+
+/**
+ * ext2_free_blocks_sb() -- Free given blocks and update quota and i_blocks
+ * @inode:             inode
+ * @block:             start physcial block to free
+ * @count:             number of blocks to free
+ */
 void ext2_free_blocks (struct inode * inode, unsigned long block,
                       unsigned long count)
 {
@@ -248,7 +533,7 @@ do_more:
        if (sb->s_flags & MS_SYNCHRONOUS)
                sync_dirty_buffer(bitmap_bh);
 
-       group_release_blocks(sb, block_group, desc, bh2, group_freed);
+       group_adjust_blocks(sb, block_group, desc, bh2, group_freed);
        freed += group_freed;
 
        if (overflow) {
@@ -262,16 +547,46 @@ error_return:
        DQUOT_FREE_BLOCK(inode, freed);
 }
 
-static int grab_block(spinlock_t *lock, char *map, unsigned size, int goal)
+/**
+ * bitmap_search_next_usable_block()
+ * @start:             the starting block (group relative) of the search
+ * @bh:                        bufferhead contains the block group bitmap
+ * @maxblocks:         the ending block (group relative) of the reservation
+ *
+ * The bitmap search --- search forward through the actual bitmap on disk until
+ * we find a bit free.
+ */
+static ext2_grpblk_t
+bitmap_search_next_usable_block(ext2_grpblk_t start, struct buffer_head *bh,
+                                       ext2_grpblk_t maxblocks)
 {
-       int k;
-       char *p, *r;
+       ext2_grpblk_t next;
 
-       if (!ext2_test_bit(goal, map))
-               goto got_it;
+       next = ext2_find_next_zero_bit(bh->b_data, maxblocks, start);
+       if (next >= maxblocks)
+               return -1;
+       return next;
+}
 
-repeat:
-       if (goal) {
+/**
+ * find_next_usable_block()
+ * @start:             the starting block (group relative) to find next
+ *                     allocatable block in bitmap.
+ * @bh:                        bufferhead contains the block group bitmap
+ * @maxblocks:         the ending block (group relative) for the search
+ *
+ * Find an allocatable block in a bitmap.  We perform the "most
+ * appropriate allocation" algorithm of looking for a free block near
+ * the initial goal; then for a free byte somewhere in the bitmap;
+ * then for any free bit in the bitmap.
+ */
+static ext2_grpblk_t
+find_next_usable_block(int start, struct buffer_head *bh, int maxblocks)
+{
+       ext2_grpblk_t here, next;
+       char *p, *r;
+
+       if (start > 0) {
                /*
                 * The goal was occupied; search forward for a free 
                 * block within the next XX blocks.
@@ -280,249 +595,812 @@ repeat:
                 * less than EXT2_BLOCKS_PER_GROUP. Aligning up to the
                 * next 64-bit boundary is simple..
                 */
-               k = (goal + 63) & ~63;
-               goal = ext2_find_next_zero_bit(map, k, goal);
-               if (goal < k)
-                       goto got_it;
+               ext2_grpblk_t end_goal = (start + 63) & ~63;
+               if (end_goal > maxblocks)
+                       end_goal = maxblocks;
+               here = ext2_find_next_zero_bit(bh->b_data, end_goal, start);
+               if (here < end_goal)
+                       return here;
+               ext2_debug("Bit not found near goal\n");
+       }
+
+       here = start;
+       if (here < 0)
+               here = 0;
+
+       p = ((char *)bh->b_data) + (here >> 3);
+       r = memscan(p, 0, ((maxblocks + 7) >> 3) - (here >> 3));
+       next = (r - ((char *)bh->b_data)) << 3;
+
+       if (next < maxblocks && next >= here)
+               return next;
+
+       here = bitmap_search_next_usable_block(here, bh, maxblocks);
+       return here;
+}
+
+/*
+ * ext2_try_to_allocate()
+ * @sb:                        superblock
+ * @handle:            handle to this transaction
+ * @group:             given allocation block group
+ * @bitmap_bh:         bufferhead holds the block bitmap
+ * @grp_goal:          given target block within the group
+ * @count:             target number of blocks to allocate
+ * @my_rsv:            reservation window
+ *
+ * Attempt to allocate blocks within a give range. Set the range of allocation
+ * first, then find the first free bit(s) from the bitmap (within the range),
+ * and at last, allocate the blocks by claiming the found free bit as allocated.
+ *
+ * To set the range of this allocation:
+ *     if there is a reservation window, only try to allocate block(s)
+ *     from the file's own reservation window;
+ *     Otherwise, the allocation range starts from the give goal block,
+ *     ends at the block group's last block.
+ *
+ * If we failed to allocate the desired block then we may end up crossing to a
+ * new bitmap.
+ */
+static int
+ext2_try_to_allocate(struct super_block *sb, int group,
+                       struct buffer_head *bitmap_bh, ext2_grpblk_t grp_goal,
+                       unsigned long *count,
+                       struct ext2_reserve_window *my_rsv)
+{
+       ext2_fsblk_t group_first_block;
+               ext2_grpblk_t start, end;
+       unsigned long num = 0;
+
+       /* we do allocation within the reservation window if we have a window */
+       if (my_rsv) {
+               group_first_block = ext2_group_first_block_no(sb, group);
+               if (my_rsv->_rsv_start >= group_first_block)
+                       start = my_rsv->_rsv_start - group_first_block;
+               else
+                       /* reservation window cross group boundary */
+                       start = 0;
+               end = my_rsv->_rsv_end - group_first_block + 1;
+               if (end > EXT2_BLOCKS_PER_GROUP(sb))
+                       /* reservation window crosses group boundary */
+                       end = EXT2_BLOCKS_PER_GROUP(sb);
+               if ((start <= grp_goal) && (grp_goal < end))
+                       start = grp_goal;
+               else
+                       grp_goal = -1;
+       } else {
+               if (grp_goal > 0)
+                       start = grp_goal;
+               else
+                       start = 0;
+               end = EXT2_BLOCKS_PER_GROUP(sb);
+       }
+
+       BUG_ON(start > EXT2_BLOCKS_PER_GROUP(sb));
+
+repeat:
+       if (grp_goal < 0) {
+               grp_goal = find_next_usable_block(start, bitmap_bh, end);
+               if (grp_goal < 0)
+                       goto fail_access;
+               if (!my_rsv) {
+                       int i;
+
+                       for (i = 0; i < 7 && grp_goal > start &&
+                                       !ext2_test_bit(grp_goal - 1,
+                                                       bitmap_bh->b_data);
+                                       i++, grp_goal--)
+                               ;
+               }
+       }
+       start = grp_goal;
+
+       if (ext2_set_bit_atomic(sb_bgl_lock(EXT2_SB(sb), group), grp_goal,
+                                                       bitmap_bh->b_data)) {
+               /*
+                * The block was allocated by another thread, or it was
+                * allocated and then freed by another thread
+                */
+               start++;
+               grp_goal++;
+               if (start >= end)
+                       goto fail_access;
+               goto repeat;
+       }
+       num++;
+       grp_goal++;
+       while (num < *count && grp_goal < end
+               && !ext2_set_bit_atomic(sb_bgl_lock(EXT2_SB(sb), group),
+                                       grp_goal, bitmap_bh->b_data)) {
+               num++;
+               grp_goal++;
+       }
+       *count = num;
+       return grp_goal - num;
+fail_access:
+       *count = num;
+       return -1;
+}
+
+/**
+ *     find_next_reservable_window():
+ *             find a reservable space within the given range.
+ *             It does not allocate the reservation window for now:
+ *             alloc_new_reservation() will do the work later.
+ *
+ *     @search_head: the head of the searching list;
+ *             This is not necessarily the list head of the whole filesystem
+ *
+ *             We have both head and start_block to assist the search
+ *             for the reservable space. The list starts from head,
+ *             but we will shift to the place where start_block is,
+ *             then start from there, when looking for a reservable space.
+ *
+ *     @size: the target new reservation window size
+ *
+ *     @group_first_block: the first block we consider to start
+ *                     the real search from
+ *
+ *     @last_block:
+ *             the maximum block number that our goal reservable space
+ *             could start from. This is normally the last block in this
+ *             group. The search will end when we found the start of next
+ *             possible reservable space is out of this boundary.
+ *             This could handle the cross boundary reservation window
+ *             request.
+ *
+ *     basically we search from the given range, rather than the whole
+ *     reservation double linked list, (start_block, last_block)
+ *     to find a free region that is of my size and has not
+ *     been reserved.
+ *
+ */
+static int find_next_reservable_window(
+                               struct ext2_reserve_window_node *search_head,
+                               struct ext2_reserve_window_node *my_rsv,
+                               struct super_block * sb,
+                               ext2_fsblk_t start_block,
+                               ext2_fsblk_t last_block)
+{
+       struct rb_node *next;
+       struct ext2_reserve_window_node *rsv, *prev;
+       ext2_fsblk_t cur;
+       int size = my_rsv->rsv_goal_size;
+
+       /* TODO: make the start of the reservation window byte-aligned */
+       /* cur = *start_block & ~7;*/
+       cur = start_block;
+       rsv = search_head;
+       if (!rsv)
+               return -1;
+
+       while (1) {
+               if (cur <= rsv->rsv_end)
+                       cur = rsv->rsv_end + 1;
+
+               /* TODO?
+                * in the case we could not find a reservable space
+                * that is what is expected, during the re-search, we could
+                * remember what's the largest reservable space we could have
+                * and return that one.
+                *
+                * For now it will fail if we could not find the reservable
+                * space with expected-size (or more)...
+                */
+               if (cur > last_block)
+                       return -1;              /* fail */
+
+               prev = rsv;
+               next = rb_next(&rsv->rsv_node);
+               rsv = rb_entry(next,struct ext2_reserve_window_node,rsv_node);
+
+               /*
+                * Reached the last reservation, we can just append to the
+                * previous one.
+                */
+               if (!next)
+                       break;
+
+               if (cur + size <= rsv->rsv_start) {
+                       /*
+                        * Found a reserveable space big enough.  We could
+                        * have a reservation across the group boundary here
+                        */
+                       break;
+               }
+       }
+       /*
+        * we come here either :
+        * when we reach the end of the whole list,
+        * and there is empty reservable space after last entry in the list.
+        * append it to the end of the list.
+        *
+        * or we found one reservable space in the middle of the list,
+        * return the reservation window that we could append to.
+        * succeed.
+        */
+
+       if ((prev != my_rsv) && (!rsv_is_empty(&my_rsv->rsv_window)))
+               rsv_window_remove(sb, my_rsv);
+
+       /*
+        * Let's book the whole avaliable window for now.  We will check the
+        * disk bitmap later and then, if there are free blocks then we adjust
+        * the window size if it's larger than requested.
+        * Otherwise, we will remove this node from the tree next time
+        * call find_next_reservable_window.
+        */
+       my_rsv->rsv_start = cur;
+       my_rsv->rsv_end = cur + size - 1;
+       my_rsv->rsv_alloc_hit = 0;
+
+       if (prev != my_rsv)
+               ext2_rsv_window_add(sb, my_rsv);
+
+       return 0;
+}
+
+/**
+ *     alloc_new_reservation()--allocate a new reservation window
+ *
+ *             To make a new reservation, we search part of the filesystem
+ *             reservation list (the list that inside the group). We try to
+ *             allocate a new reservation window near the allocation goal,
+ *             or the beginning of the group, if there is no goal.
+ *
+ *             We first find a reservable space after the goal, then from
+ *             there, we check the bitmap for the first free block after
+ *             it. If there is no free block until the end of group, then the
+ *             whole group is full, we failed. Otherwise, check if the free
+ *             block is inside the expected reservable space, if so, we
+ *             succeed.
+ *             If the first free block is outside the reservable space, then
+ *             start from the first free block, we search for next available
+ *             space, and go on.
+ *
+ *     on succeed, a new reservation will be found and inserted into the list
+ *     It contains at least one free block, and it does not overlap with other
+ *     reservation windows.
+ *
+ *     failed: we failed to find a reservation window in this group
+ *
+ *     @rsv: the reservation
+ *
+ *     @grp_goal: The goal (group-relative).  It is where the search for a
+ *             free reservable space should start from.
+ *             if we have a goal(goal >0 ), then start from there,
+ *             no goal(goal = -1), we start from the first block
+ *             of the group.
+ *
+ *     @sb: the super block
+ *     @group: the group we are trying to allocate in
+ *     @bitmap_bh: the block group block bitmap
+ *
+ */
+static int alloc_new_reservation(struct ext2_reserve_window_node *my_rsv,
+               ext2_grpblk_t grp_goal, struct super_block *sb,
+               unsigned int group, struct buffer_head *bitmap_bh)
+{
+       struct ext2_reserve_window_node *search_head;
+       ext2_fsblk_t group_first_block, group_end_block, start_block;
+       ext2_grpblk_t first_free_block;
+       struct rb_root *fs_rsv_root = &EXT2_SB(sb)->s_rsv_window_root;
+       unsigned long size;
+       int ret;
+       spinlock_t *rsv_lock = &EXT2_SB(sb)->s_rsv_window_lock;
+
+       group_first_block = ext2_group_first_block_no(sb, group);
+       group_end_block = group_first_block + (EXT2_BLOCKS_PER_GROUP(sb) - 1);
+
+       if (grp_goal < 0)
+               start_block = group_first_block;
+       else
+               start_block = grp_goal + group_first_block;
+
+       size = my_rsv->rsv_goal_size;
+
+       if (!rsv_is_empty(&my_rsv->rsv_window)) {
                /*
-                * Search in the remainder of the current group.
+                * if the old reservation is cross group boundary
+                * and if the goal is inside the old reservation window,
+                * we will come here when we just failed to allocate from
+                * the first part of the window. We still have another part
+                * that belongs to the next group. In this case, there is no
+                * point to discard our window and try to allocate a new one
+                * in this group(which will fail). we should
+                * keep the reservation window, just simply move on.
+                *
+                * Maybe we could shift the start block of the reservation
+                * window to the first block of next group.
                 */
+
+               if ((my_rsv->rsv_start <= group_end_block) &&
+                               (my_rsv->rsv_end > group_end_block) &&
+                               (start_block >= my_rsv->rsv_start))
+                       return -1;
+
+               if ((my_rsv->rsv_alloc_hit >
+                    (my_rsv->rsv_end - my_rsv->rsv_start + 1) / 2)) {
+                       /*
+                        * if the previously allocation hit ratio is
+                        * greater than 1/2, then we double the size of
+                        * the reservation window the next time,
+                        * otherwise we keep the same size window
+                        */
+                       size = size * 2;
+                       if (size > EXT2_MAX_RESERVE_BLOCKS)
+                               size = EXT2_MAX_RESERVE_BLOCKS;
+                       my_rsv->rsv_goal_size= size;
+               }
        }
 
-       p = map + (goal >> 3);
-       r = memscan(p, 0, (size - goal + 7) >> 3);
-       k = (r - map) << 3;
-       if (k < size) {
-               /* 
-                * We have succeeded in finding a free byte in the block
-                * bitmap.  Now search backwards to find the start of this
-                * group of free blocks - won't take more than 7 iterations.
+       spin_lock(rsv_lock);
+       /*
+        * shift the search start to the window near the goal block
+        */
+       search_head = search_reserve_window(fs_rsv_root, start_block);
+
+       /*
+        * find_next_reservable_window() simply finds a reservable window
+        * inside the given range(start_block, group_end_block).
+        *
+        * To make sure the reservation window has a free bit inside it, we
+        * need to check the bitmap after we found a reservable window.
+        */
+retry:
+       ret = find_next_reservable_window(search_head, my_rsv, sb,
+                                               start_block, group_end_block);
+
+       if (ret == -1) {
+               if (!rsv_is_empty(&my_rsv->rsv_window))
+                       rsv_window_remove(sb, my_rsv);
+               spin_unlock(rsv_lock);
+               return -1;
+       }
+
+       /*
+        * On success, find_next_reservable_window() returns the
+        * reservation window where there is a reservable space after it.
+        * Before we reserve this reservable space, we need
+        * to make sure there is at least a free block inside this region.
+        *
+        * Search the first free bit on the block bitmap.  Search starts from
+        * the start block of the reservable space we just found.
+        */
+       spin_unlock(rsv_lock);
+       first_free_block = bitmap_search_next_usable_block(
+                       my_rsv->rsv_start - group_first_block,
+                       bitmap_bh, group_end_block - group_first_block + 1);
+
+       if (first_free_block < 0) {
+               /*
+                * no free block left on the bitmap, no point
+                * to reserve the space. return failed.
                 */
-               for (goal = k; goal && !ext2_test_bit (goal - 1, map); goal--)
-                       ;
-               goto got_it;
+               spin_lock(rsv_lock);
+               if (!rsv_is_empty(&my_rsv->rsv_window))
+                       rsv_window_remove(sb, my_rsv);
+               spin_unlock(rsv_lock);
+               return -1;              /* failed */
        }
 
-       k = ext2_find_next_zero_bit ((u32 *)map, size, goal);
-       if (k < size) {
-               goal = k;
-               goto got_it;
+       start_block = first_free_block + group_first_block;
+       /*
+        * check if the first free block is within the
+        * free space we just reserved
+        */
+       if (start_block >= my_rsv->rsv_start && start_block <= my_rsv->rsv_end)
+               return 0;               /* success */
+       /*
+        * if the first free bit we found is out of the reservable space
+        * continue search for next reservable space,
+        * start from where the free block is,
+        * we also shift the list head to where we stopped last time
+        */
+       search_head = my_rsv;
+       spin_lock(rsv_lock);
+       goto retry;
+}
+
+/**
+ * try_to_extend_reservation()
+ * @my_rsv:            given reservation window
+ * @sb:                        super block
+ * @size:              the delta to extend
+ *
+ * Attempt to expand the reservation window large enough to have
+ * required number of free blocks
+ *
+ * Since ext2_try_to_allocate() will always allocate blocks within
+ * the reservation window range, if the window size is too small,
+ * multiple blocks allocation has to stop at the end of the reservation
+ * window. To make this more efficient, given the total number of
+ * blocks needed and the current size of the window, we try to
+ * expand the reservation window size if necessary on a best-effort
+ * basis before ext2_new_blocks() tries to allocate blocks.
+ */
+static void try_to_extend_reservation(struct ext2_reserve_window_node *my_rsv,
+                       struct super_block *sb, int size)
+{
+       struct ext2_reserve_window_node *next_rsv;
+       struct rb_node *next;
+       spinlock_t *rsv_lock = &EXT2_SB(sb)->s_rsv_window_lock;
+
+       if (!spin_trylock(rsv_lock))
+               return;
+
+       next = rb_next(&my_rsv->rsv_node);
+
+       if (!next)
+               my_rsv->rsv_end += size;
+       else {
+               next_rsv = rb_entry(next, struct ext2_reserve_window_node, rsv_node);
+
+               if ((next_rsv->rsv_start - my_rsv->rsv_end - 1) >= size)
+                       my_rsv->rsv_end += size;
+               else
+                       my_rsv->rsv_end = next_rsv->rsv_start - 1;
        }
-       return -1;
-got_it:
-       if (ext2_set_bit_atomic(lock, goal, (void *) map)) 
-               goto repeat;    
-       return goal;
+       spin_unlock(rsv_lock);
+}
+
+/**
+ * ext2_try_to_allocate_with_rsv()
+ * @sb:                        superblock
+ * @group:             given allocation block group
+ * @bitmap_bh:         bufferhead holds the block bitmap
+ * @grp_goal:          given target block within the group
+ * @count:             target number of blocks to allocate
+ * @my_rsv:            reservation window
+ *
+ * This is the main function used to allocate a new block and its reservation
+ * window.
+ *
+ * Each time when a new block allocation is need, first try to allocate from
+ * its own reservation.  If it does not have a reservation window, instead of
+ * looking for a free bit on bitmap first, then look up the reservation list to
+ * see if it is inside somebody else's reservation window, we try to allocate a
+ * reservation window for it starting from the goal first. Then do the block
+ * allocation within the reservation window.
+ *
+ * This will avoid keeping on searching the reservation list again and
+ * again when somebody is looking for a free block (without
+ * reservation), and there are lots of free blocks, but they are all
+ * being reserved.
+ *
+ * We use a red-black tree for the per-filesystem reservation list.
+ */
+static ext2_grpblk_t
+ext2_try_to_allocate_with_rsv(struct super_block *sb, unsigned int group,
+                       struct buffer_head *bitmap_bh, ext2_grpblk_t grp_goal,
+                       struct ext2_reserve_window_node * my_rsv,
+                       unsigned long *count)
+{
+       ext2_fsblk_t group_first_block, group_last_block;
+       ext2_grpblk_t ret = 0;
+       unsigned long num = *count;
+
+       /*
+        * we don't deal with reservation when
+        * filesystem is mounted without reservation
+        * or the file is not a regular file
+        * or last attempt to allocate a block with reservation turned on failed
+        */
+       if (my_rsv == NULL) {
+               return ext2_try_to_allocate(sb, group, bitmap_bh,
+                                               grp_goal, count, NULL);
+       }
+       /*
+        * grp_goal is a group relative block number (if there is a goal)
+        * 0 <= grp_goal < EXT2_BLOCKS_PER_GROUP(sb)
+        * first block is a filesystem wide block number
+        * first block is the block number of the first block in this group
+        */
+       group_first_block = ext2_group_first_block_no(sb, group);
+       group_last_block = group_first_block + (EXT2_BLOCKS_PER_GROUP(sb) - 1);
+
+       /*
+        * Basically we will allocate a new block from inode's reservation
+        * window.
+        *
+        * We need to allocate a new reservation window, if:
+        * a) inode does not have a reservation window; or
+        * b) last attempt to allocate a block from existing reservation
+        *    failed; or
+        * c) we come here with a goal and with a reservation window
+        *
+        * We do not need to allocate a new reservation window if we come here
+        * at the beginning with a goal and the goal is inside the window, or
+        * we don't have a goal but already have a reservation window.
+        * then we could go to allocate from the reservation window directly.
+        */
+       while (1) {
+               if (rsv_is_empty(&my_rsv->rsv_window) || (ret < 0) ||
+                       !goal_in_my_reservation(&my_rsv->rsv_window,
+                                               grp_goal, group, sb)) {
+                       if (my_rsv->rsv_goal_size < *count)
+                               my_rsv->rsv_goal_size = *count;
+                       ret = alloc_new_reservation(my_rsv, grp_goal, sb,
+                                                       group, bitmap_bh);
+                       if (ret < 0)
+                               break;                  /* failed */
+
+                       if (!goal_in_my_reservation(&my_rsv->rsv_window,
+                                                       grp_goal, group, sb))
+                               grp_goal = -1;
+               } else if (grp_goal >= 0) {
+                       int curr = my_rsv->rsv_end -
+                                       (grp_goal + group_first_block) + 1;
+
+                       if (curr < *count)
+                               try_to_extend_reservation(my_rsv, sb,
+                                                       *count - curr);
+               }
+
+               if ((my_rsv->rsv_start > group_last_block) ||
+                               (my_rsv->rsv_end < group_first_block)) {
+                       rsv_window_dump(&EXT2_SB(sb)->s_rsv_window_root, 1);
+                       BUG();
+               }
+               ret = ext2_try_to_allocate(sb, group, bitmap_bh, grp_goal,
+                                          &num, &my_rsv->rsv_window);
+               if (ret >= 0) {
+                       my_rsv->rsv_alloc_hit += num;
+                       *count = num;
+                       break;                          /* succeed */
+               }
+               num = *count;
+       }
+       return ret;
+}
+
+/**
+ * ext2_has_free_blocks()
+ * @sbi:               in-core super block structure.
+ *
+ * Check if filesystem has at least 1 free block available for allocation.
+ */
+static int ext2_has_free_blocks(struct ext2_sb_info *sbi)
+{
+       ext2_fsblk_t free_blocks, root_blocks;
+
+       free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter);
+       root_blocks = le32_to_cpu(sbi->s_es->s_r_blocks_count);
+       if (free_blocks < root_blocks + 1 && !capable(CAP_SYS_RESOURCE) &&
+               sbi->s_resuid != current->fsuid &&
+               (sbi->s_resgid == 0 || !in_group_p (sbi->s_resgid))) {
+               return 0;
+       }
+       return 1;
 }
 
 /*
- * ext2_new_block uses a goal block to assist allocation.  If the goal is
+ * ext2_new_blocks() -- core block(s) allocation function
+ * @inode:             file inode
+ * @goal:              given target block(filesystem wide)
+ * @count:             target number of blocks to allocate
+ * @errp:              error code
+ *
+ * ext2_new_blocks uses a goal block to assist allocation.  If the goal is
  * free, or there is a free block within 32 blocks of the goal, that block
  * is allocated.  Otherwise a forward search is made for a free block; within 
  * each block group the search first looks for an entire free byte in the block
  * bitmap, and then for any free bit if that fails.
  * This function also updates quota and i_blocks field.
  */
-int ext2_new_block(struct inode *inode, unsigned long goal,
-                       u32 *prealloc_count, u32 *prealloc_block, int *err)
+ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
+                   unsigned long *count, int *errp)
 {
        struct buffer_head *bitmap_bh = NULL;
-       struct buffer_head *gdp_bh;     /* bh2 */
-       struct ext2_group_desc *desc;
-       int group_no;                   /* i */
-       int ret_block;                  /* j */
-       int group_idx;                  /* k */
-       int target_block;               /* tmp */
-       int block = 0;
-       struct super_block *sb = inode->i_sb;
-       struct ext2_sb_info *sbi = EXT2_SB(sb);
-       struct ext2_super_block *es = sbi->s_es;
-       unsigned group_size = EXT2_BLOCKS_PER_GROUP(sb);
-       unsigned prealloc_goal = es->s_prealloc_blocks;
-       unsigned group_alloc = 0, es_alloc, dq_alloc;
-       int nr_scanned_groups;
-
-       if (!prealloc_goal--)
-               prealloc_goal = EXT2_DEFAULT_PREALLOC_BLOCKS - 1;
-       if (!prealloc_count || *prealloc_count)
-               prealloc_goal = 0;
-
-       if (DQUOT_ALLOC_BLOCK(inode, 1)) {
-               *err = -EDQUOT;
-               goto out;
+       struct buffer_head *gdp_bh;
+       int group_no;
+       int goal_group;
+       ext2_grpblk_t grp_target_blk;   /* blockgroup relative goal block */
+       ext2_grpblk_t grp_alloc_blk;    /* blockgroup-relative allocated block*/
+       ext2_fsblk_t ret_block;         /* filesyetem-wide allocated block */
+       int bgi;                        /* blockgroup iteration index */
+       int performed_allocation = 0;
+       ext2_grpblk_t free_blocks;      /* number of free blocks in a group */
+       struct super_block *sb;
+       struct ext2_group_desc *gdp;
+       struct ext2_super_block *es;
+       struct ext2_sb_info *sbi;
+       struct ext2_reserve_window_node *my_rsv = NULL;
+       struct ext2_block_alloc_info *block_i;
+       unsigned short windowsz = 0;
+       unsigned long ngroups;
+       unsigned long num = *count;
+
+       *errp = -ENOSPC;
+       sb = inode->i_sb;
+       if (!sb) {
+               printk("ext2_new_blocks: nonexistent device");
+               return 0;
        }
 
-       while (prealloc_goal && DQUOT_PREALLOC_BLOCK(inode, prealloc_goal))
-               prealloc_goal--;
+       /*
+        * Check quota for allocation of this block.
+        */
+       if (DQUOT_ALLOC_BLOCK(inode, num)) {
+               *errp = -EDQUOT;
+               return 0;
+       }
 
-       dq_alloc = prealloc_goal + 1;
-       es_alloc = reserve_blocks(sb, dq_alloc);
-       if (!es_alloc) {
-               *err = -ENOSPC;
-               goto out_dquot;
+       sbi = EXT2_SB(sb);
+       es = EXT2_SB(sb)->s_es;
+       ext2_debug("goal=%lu.\n", goal);
+       /*
+        * Allocate a block from reservation only when
+        * filesystem is mounted with reservation(default,-o reservation), and
+        * it's a regular file, and
+        * the desired window size is greater than 0 (One could use ioctl
+        * command EXT2_IOC_SETRSVSZ to set the window size to 0 to turn off
+        * reservation on that particular file)
+        */
+       block_i = EXT2_I(inode)->i_block_alloc_info;
+       if (block_i) {
+               windowsz = block_i->rsv_window_node.rsv_goal_size;
+               if (windowsz > 0)
+                       my_rsv = &block_i->rsv_window_node;
        }
 
-       ext2_debug ("goal=%lu.\n", goal);
+       if (!ext2_has_free_blocks(sbi)) {
+               *errp = -ENOSPC;
+               goto out;
+       }
 
+       /*
+        * First, test whether the goal block is free.
+        */
        if (goal < le32_to_cpu(es->s_first_data_block) ||
            goal >= le32_to_cpu(es->s_blocks_count))
                goal = le32_to_cpu(es->s_first_data_block);
-       group_no = (goal - le32_to_cpu(es->s_first_data_block)) / group_size;
-       desc = ext2_get_group_desc (sb, group_no, &gdp_bh);
-       if (!desc) {
-               /*
-                * gdp_bh may still be uninitialised.  But group_release_blocks
-                * will not touch it because group_alloc is zero.
-                */
+       group_no = (goal - le32_to_cpu(es->s_first_data_block)) /
+                       EXT2_BLOCKS_PER_GROUP(sb);
+       goal_group = group_no;
+retry_alloc:
+       gdp = ext2_get_group_desc(sb, group_no, &gdp_bh);
+       if (!gdp)
                goto io_error;
-       }
 
-       group_alloc = group_reserve_blocks(sbi, group_no, desc,
-                                       gdp_bh, es_alloc);
-       if (group_alloc) {
-               ret_block = ((goal - le32_to_cpu(es->s_first_data_block)) %
-                                       group_size);
-               brelse(bitmap_bh);
+       free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
+       /*
+        * if there is not enough free blocks to make a new resevation
+        * turn off reservation for this allocation
+        */
+       if (my_rsv && (free_blocks < windowsz)
+               && (rsv_is_empty(&my_rsv->rsv_window)))
+               my_rsv = NULL;
+
+       if (free_blocks > 0) {
+               grp_target_blk = ((goal - le32_to_cpu(es->s_first_data_block)) %
+                               EXT2_BLOCKS_PER_GROUP(sb));
                bitmap_bh = read_block_bitmap(sb, group_no);
                if (!bitmap_bh)
                        goto io_error;
-               
-               ext2_debug("goal is at %d:%d.\n", group_no, ret_block);
-
-               ret_block = grab_block(sb_bgl_lock(sbi, group_no),
-                               bitmap_bh->b_data, group_size, ret_block);
-               if (ret_block >= 0)
-                       goto got_block;
-               group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc);
-               group_alloc = 0;
+               grp_alloc_blk = ext2_try_to_allocate_with_rsv(sb, group_no,
+                                       bitmap_bh, grp_target_blk,
+                                       my_rsv, &num);
+               if (grp_alloc_blk >= 0)
+                       goto allocated;
        }
 
-       ext2_debug ("Bit not found in block group %d.\n", group_no);
+       ngroups = EXT2_SB(sb)->s_groups_count;
+       smp_rmb();
 
        /*
         * Now search the rest of the groups.  We assume that 
-        * i and desc correctly point to the last group visited.
+        * i and gdp correctly point to the last group visited.
         */
-       nr_scanned_groups = 0;
-retry:
-       for (group_idx = 0; !group_alloc &&
-                       group_idx < sbi->s_groups_count; group_idx++) {
+       for (bgi = 0; bgi < ngroups; bgi++) {
                group_no++;
-               if (group_no >= sbi->s_groups_count)
+               if (group_no >= ngroups)
                        group_no = 0;
-               desc = ext2_get_group_desc(sb, group_no, &gdp_bh);
-               if (!desc)
+               gdp = ext2_get_group_desc(sb, group_no, &gdp_bh);
+               if (!gdp)
                        goto io_error;
-               group_alloc = group_reserve_blocks(sbi, group_no, desc,
-                                               gdp_bh, es_alloc);
-       }
-       if (!group_alloc) {
-               *err = -ENOSPC;
-               goto out_release;
-       }
-       brelse(bitmap_bh);
-       bitmap_bh = read_block_bitmap(sb, group_no);
-       if (!bitmap_bh)
-               goto io_error;
 
-       ret_block = grab_block(sb_bgl_lock(sbi, group_no), bitmap_bh->b_data,
-                               group_size, 0);
-       if (ret_block < 0) {
+               free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
                /*
-                * If a free block counter is corrupted we can loop inifintely.
-                * Detect that here.
+                * skip this group if the number of
+                * free blocks is less than half of the reservation
+                * window size.
                 */
-               nr_scanned_groups++;
-               if (nr_scanned_groups > 2 * sbi->s_groups_count) {
-                       ext2_error(sb, "ext2_new_block",
-                               "corrupted free blocks counters");
+               if (free_blocks <= (windowsz/2))
+                       continue;
+
+               brelse(bitmap_bh);
+               bitmap_bh = read_block_bitmap(sb, group_no);
+               if (!bitmap_bh)
                        goto io_error;
-               }
                /*
-                * Someone else grabbed the last free block in this blockgroup
-                * before us.  Retry the scan.
+                * try to allocate block(s) from this group, without a goal(-1).
                 */
-               group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc);
-               group_alloc = 0;
-               goto retry;
+               grp_alloc_blk = ext2_try_to_allocate_with_rsv(sb, group_no,
+                                       bitmap_bh, -1, my_rsv, &num);
+               if (grp_alloc_blk >= 0)
+                       goto allocated;
+       }
+       /*
+        * We may end up a bogus ealier ENOSPC error due to
+        * filesystem is "full" of reservations, but
+        * there maybe indeed free blocks avaliable on disk
+        * In this case, we just forget about the reservations
+        * just do block allocation as without reservations.
+        */
+       if (my_rsv) {
+               my_rsv = NULL;
+               windowsz = 0;
+               group_no = goal_group;
+               goto retry_alloc;
        }
+       /* No space left on the device */
+       *errp = -ENOSPC;
+       goto out;
+
+allocated:
 
-got_block:
        ext2_debug("using block group %d(%d)\n",
-               group_no, desc->bg_free_blocks_count);
+                       group_no, gdp->bg_free_blocks_count);
 
-       target_block = ret_block + group_no * group_size +
-                       le32_to_cpu(es->s_first_data_block);
+       ret_block = grp_alloc_blk + ext2_group_first_block_no(sb, group_no);
 
-       if (target_block == le32_to_cpu(desc->bg_block_bitmap) ||
-           target_block == le32_to_cpu(desc->bg_inode_bitmap) ||
-           in_range(target_block, le32_to_cpu(desc->bg_inode_table),
-                     sbi->s_itb_per_group))
-               ext2_error (sb, "ext2_new_block",
+       if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) ||
+           in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) ||
+           in_range(ret_block, le32_to_cpu(gdp->bg_inode_table),
+                     EXT2_SB(sb)->s_itb_per_group) ||
+           in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table),
+                     EXT2_SB(sb)->s_itb_per_group))
+               ext2_error(sb, "ext2_new_blocks",
                            "Allocating block in system zone - "
-                           "block = %u", target_block);
+                           "blocks from "E2FSBLK", length %lu",
+                           ret_block, num);
+
+       performed_allocation = 1;
 
-       if (target_block >= le32_to_cpu(es->s_blocks_count)) {
-               ext2_error (sb, "ext2_new_block",
-                           "block(%d) >= blocks count(%d) - "
+       if (ret_block + num - 1 >= le32_to_cpu(es->s_blocks_count)) {
+               ext2_error(sb, "ext2_new_blocks",
+                           "block("E2FSBLK") >= blocks count(%d) - "
                            "block_group = %d, es == %p ", ret_block,
                        le32_to_cpu(es->s_blocks_count), group_no, es);
-               goto io_error;
+               goto out;
        }
-       block = target_block;
 
-       /* OK, we _had_ allocated something */
-       ext2_debug("found bit %d\n", ret_block);
-
-       dq_alloc--;
-       es_alloc--;
-       group_alloc--;
-
-       /*
-        * Do block preallocation now if required.
-        */
-       write_lock(&EXT2_I(inode)->i_meta_lock);
-       if (group_alloc && !*prealloc_count) {
-               unsigned n;
-
-               for (n = 0; n < group_alloc && ++ret_block < group_size; n++) {
-                       if (ext2_set_bit_atomic(sb_bgl_lock(sbi, group_no),
-                                               ret_block,
-                                               (void*) bitmap_bh->b_data))
-                               break;
-               }
-               *prealloc_block = block + 1;
-               *prealloc_count = n;
-               es_alloc -= n;
-               dq_alloc -= n;
-               group_alloc -= n;
-       }
-       write_unlock(&EXT2_I(inode)->i_meta_lock);
+       group_adjust_blocks(sb, group_no, gdp, gdp_bh, -num);
+       percpu_counter_sub(&sbi->s_freeblocks_counter, num);
 
        mark_buffer_dirty(bitmap_bh);
        if (sb->s_flags & MS_SYNCHRONOUS)
                sync_dirty_buffer(bitmap_bh);
 
-       ext2_debug ("allocating block %d. ", block);
+       *errp = 0;
+       brelse(bitmap_bh);
+       DQUOT_FREE_BLOCK(inode, *count-num);
+       *count = num;
+       return ret_block;
 
-       *err = 0;
-out_release:
-       group_release_blocks(sb, group_no, desc, gdp_bh, group_alloc);
-       release_blocks(sb, es_alloc);
-out_dquot:
-       DQUOT_FREE_BLOCK(inode, dq_alloc);
+io_error:
+       *errp = -EIO;
 out:
+       /*
+        * Undo the block allocation
+        */
+       if (!performed_allocation)
+               DQUOT_FREE_BLOCK(inode, *count);
        brelse(bitmap_bh);
-       return block;
+       return 0;
+}
 
-io_error:
-       *err = -EIO;
-       goto out_release;
+ext2_fsblk_t ext2_new_block(struct inode *inode, unsigned long goal, int *errp)
+{
+       unsigned long count = 1;
+
+       return ext2_new_blocks(inode, goal, &count, errp);
 }
 
 #ifdef EXT2FS_DEBUG
 
-static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
+static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
 
 unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars)
 {
@@ -583,13 +1461,6 @@ unsigned long ext2_count_free_blocks (struct super_block * sb)
 #endif
 }
 
-static inline int
-block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
-{
-       return ext2_test_bit ((block -
-               le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block)) %
-                        EXT2_BLOCKS_PER_GROUP(sb), map);
-}
 
 static inline int test_root(int a, int b)
 {
index a08052d2c008234ae362296aad927c7ff6404bbd..7730388c4931857f83ccdf9aa758d3120534d5ab 100644 (file)
@@ -33,22 +33,9 @@ struct ext2_inode_info {
         */
        __u32   i_block_group;
 
-       /*
-        * i_next_alloc_block is the logical (file-relative) number of the
-        * most-recently-allocated block in this file.  Yes, it is misnamed.
-        * We use this for detecting linearly ascending allocation requests.
-        */
-       __u32   i_next_alloc_block;
+       /* block reservation info */
+       struct ext2_block_alloc_info *i_block_alloc_info;
 
-       /*
-        * i_next_alloc_goal is the *physical* companion to i_next_alloc_block.
-        * it the the physical block number of the block which was most-recently
-        * allocated to this file.  This give us the goal (target) for the next
-        * allocation when we detect linearly ascending requests.
-        */
-       __u32   i_next_alloc_goal;
-       __u32   i_prealloc_block;
-       __u32   i_prealloc_count;
        __u32   i_dir_start_lookup;
 #ifdef CONFIG_EXT2_FS_XATTR
        /*
@@ -65,7 +52,16 @@ struct ext2_inode_info {
        struct posix_acl        *i_default_acl;
 #endif
        rwlock_t i_meta_lock;
+
+       /*
+        * truncate_mutex is for serialising ext2_truncate() against
+        * ext2_getblock().  It also protects the internals of the inode's
+        * reservation data structures: ext2_reserve_window and
+        * ext2_reserve_window_node.
+        */
+       struct mutex truncate_mutex;
        struct inode    vfs_inode;
+       struct list_head i_orphan;      /* unlinked but open inodes */
 };
 
 /*
@@ -91,8 +87,9 @@ static inline struct ext2_inode_info *EXT2_I(struct inode *inode)
 /* balloc.c */
 extern int ext2_bg_has_super(struct super_block *sb, int group);
 extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
-extern int ext2_new_block (struct inode *, unsigned long,
-                          __u32 *, __u32 *, int *);
+extern ext2_fsblk_t ext2_new_block(struct inode *, unsigned long, int *);
+extern ext2_fsblk_t ext2_new_blocks(struct inode *, unsigned long,
+                               unsigned long *, int *);
 extern void ext2_free_blocks (struct inode *, unsigned long,
                              unsigned long);
 extern unsigned long ext2_count_free_blocks (struct super_block *);
@@ -101,6 +98,10 @@ extern void ext2_check_blocks_bitmap (struct super_block *);
 extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
                                                    unsigned int block_group,
                                                    struct buffer_head ** bh);
+extern void ext2_discard_reservation (struct inode *);
+extern int ext2_should_retry_alloc(struct super_block *sb, int *retries);
+extern void ext2_init_block_alloc_info(struct inode *);
+extern void ext2_rsv_window_add(struct super_block *sb, struct ext2_reserve_window_node *rsv);
 
 /* dir.c */
 extern int ext2_add_link (struct dentry *, struct inode *);
@@ -128,7 +129,6 @@ extern int ext2_write_inode (struct inode *, int);
 extern void ext2_put_inode (struct inode *);
 extern void ext2_delete_inode (struct inode *);
 extern int ext2_sync_inode (struct inode *);
-extern void ext2_discard_prealloc (struct inode *);
 extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
 extern void ext2_truncate (struct inode *);
 extern int ext2_setattr (struct dentry *, struct iattr *);
index ab7961260c49d9071444d9e28cf6dd619b5058df..c051798459a1c9faf33fa9b1c89508145c646c00 100644 (file)
  */
 static int ext2_release_file (struct inode * inode, struct file * filp)
 {
-       if (filp->f_mode & FMODE_WRITE)
-               ext2_discard_prealloc (inode);
+       if (filp->f_mode & FMODE_WRITE) {
+               mutex_lock(&EXT2_I(inode)->truncate_mutex);
+               ext2_discard_reservation(inode);
+               mutex_unlock(&EXT2_I(inode)->truncate_mutex);
+       }
        return 0;
 }
 
index 2cb545bf0f3c42dba436626c2832bed511e1f7fb..5deb8b74e649ed56c9455780b9ad258d2b974c75 100644 (file)
@@ -177,7 +177,6 @@ static void ext2_preread_inode(struct inode *inode)
        unsigned long block_group;
        unsigned long offset;
        unsigned long block;
-       struct buffer_head *bh;
        struct ext2_group_desc * gdp;
        struct backing_dev_info *bdi;
 
@@ -188,7 +187,7 @@ static void ext2_preread_inode(struct inode *inode)
                return;
 
        block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
-       gdp = ext2_get_group_desc(inode->i_sb, block_group, &bh);
+       gdp = ext2_get_group_desc(inode->i_sb, block_group, NULL);
        if (gdp == NULL)
                return;
 
@@ -217,11 +216,10 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
        int ngroups = EXT2_SB(sb)->s_groups_count;
        int avefreei = ext2_count_free_inodes(sb) / ngroups;
        struct ext2_group_desc *desc, *best_desc = NULL;
-       struct buffer_head *bh, *best_bh = NULL;
        int group, best_group = -1;
 
        for (group = 0; group < ngroups; group++) {
-               desc = ext2_get_group_desc (sb, group, &bh);
+               desc = ext2_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei)
@@ -231,7 +229,6 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
                     le16_to_cpu(best_desc->bg_free_blocks_count))) {
                        best_group = group;
                        best_desc = desc;
-                       best_bh = bh;
                }
        }
        if (!best_desc)
@@ -284,7 +281,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
        int max_debt, max_dirs, min_blocks, min_inodes;
        int group = -1, i;
        struct ext2_group_desc *desc;
-       struct buffer_head *bh;
 
        freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter);
        avefreei = freei / ngroups;
@@ -295,7 +291,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
        if ((parent == sb->s_root->d_inode) ||
            (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) {
                struct ext2_group_desc *best_desc = NULL;
-               struct buffer_head *best_bh = NULL;
                int best_ndir = inodes_per_group;
                int best_group = -1;
 
@@ -303,7 +298,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
                parent_group = (unsigned)group % ngroups;
                for (i = 0; i < ngroups; i++) {
                        group = (parent_group + i) % ngroups;
-                       desc = ext2_get_group_desc (sb, group, &bh);
+                       desc = ext2_get_group_desc (sb, group, NULL);
                        if (!desc || !desc->bg_free_inodes_count)
                                continue;
                        if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir)
@@ -315,11 +310,9 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
                        best_group = group;
                        best_ndir = le16_to_cpu(desc->bg_used_dirs_count);
                        best_desc = desc;
-                       best_bh = bh;
                }
                if (best_group >= 0) {
                        desc = best_desc;
-                       bh = best_bh;
                        group = best_group;
                        goto found;
                }
@@ -345,7 +338,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 
        for (i = 0; i < ngroups; i++) {
                group = (parent_group + i) % ngroups;
-               desc = ext2_get_group_desc (sb, group, &bh);
+               desc = ext2_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (sbi->s_debts[group] >= max_debt)
@@ -362,7 +355,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 fallback:
        for (i = 0; i < ngroups; i++) {
                group = (parent_group + i) % ngroups;
-               desc = ext2_get_group_desc (sb, group, &bh);
+               desc = ext2_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei)
@@ -389,14 +382,13 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
        int parent_group = EXT2_I(parent)->i_block_group;
        int ngroups = EXT2_SB(sb)->s_groups_count;
        struct ext2_group_desc *desc;
-       struct buffer_head *bh;
        int group, i;
 
        /*
         * Try to place the inode in its parent directory
         */
        group = parent_group;
-       desc = ext2_get_group_desc (sb, group, &bh);
+       desc = ext2_get_group_desc (sb, group, NULL);
        if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
                        le16_to_cpu(desc->bg_free_blocks_count))
                goto found;
@@ -420,7 +412,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
                group += i;
                if (group >= ngroups)
                        group -= ngroups;
-               desc = ext2_get_group_desc (sb, group, &bh);
+               desc = ext2_get_group_desc (sb, group, NULL);
                if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
                                le16_to_cpu(desc->bg_free_blocks_count))
                        goto found;
@@ -434,7 +426,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
        for (i = 0; i < ngroups; i++) {
                if (++group >= ngroups)
                        group = 0;
-               desc = ext2_get_group_desc (sb, group, &bh);
+               desc = ext2_get_group_desc (sb, group, NULL);
                if (desc && le16_to_cpu(desc->bg_free_inodes_count))
                        goto found;
        }
@@ -542,7 +534,7 @@ got:
                goto fail;
        }
 
-       percpu_counter_mod(&sbi->s_freeinodes_counter, -1);
+       percpu_counter_add(&sbi->s_freeinodes_counter, -1);
        if (S_ISDIR(mode))
                percpu_counter_inc(&sbi->s_dirs_counter);
 
@@ -589,11 +581,8 @@ got:
        ei->i_file_acl = 0;
        ei->i_dir_acl = 0;
        ei->i_dtime = 0;
+       ei->i_block_alloc_info = NULL;
        ei->i_block_group = group;
-       ei->i_next_alloc_block = 0;
-       ei->i_next_alloc_goal = 0;
-       ei->i_prealloc_block = 0;
-       ei->i_prealloc_count = 0;
        ei->i_dir_start_lookup = 0;
        ei->i_state = EXT2_STATE_NEW;
        ext2_set_inode_flags(inode);
index 1b102a1ccebb373761b02194cc2b138a2f194cf0..b1ab32ab5a779381b1b46d29c61bd5fe2eddac44 100644 (file)
@@ -53,19 +53,6 @@ static inline int ext2_inode_is_fast_symlink(struct inode *inode)
                inode->i_blocks - ea_blocks == 0);
 }
 
-/*
- * Called at each iput().
- *
- * The inode may be "bad" if ext2_read_inode() saw an error from
- * ext2_get_inode(), so we need to check that to avoid freeing random disk
- * blocks.
- */
-void ext2_put_inode(struct inode *inode)
-{
-       if (!is_bad_inode(inode))
-               ext2_discard_prealloc(inode);
-}
-
 /*
  * Called at the last iput() if i_nlink is zero.
  */
@@ -89,61 +76,6 @@ no_delete:
        clear_inode(inode);     /* We must guarantee clearing of inode... */
 }
 
-void ext2_discard_prealloc (struct inode * inode)
-{
-#ifdef EXT2_PREALLOCATE
-       struct ext2_inode_info *ei = EXT2_I(inode);
-       write_lock(&ei->i_meta_lock);
-       if (ei->i_prealloc_count) {
-               unsigned short total = ei->i_prealloc_count;
-               unsigned long block = ei->i_prealloc_block;
-               ei->i_prealloc_count = 0;
-               ei->i_prealloc_block = 0;
-               write_unlock(&ei->i_meta_lock);
-               ext2_free_blocks (inode, block, total);
-               return;
-       } else
-               write_unlock(&ei->i_meta_lock);
-#endif
-}
-
-static int ext2_alloc_block (struct inode * inode, unsigned long goal, int *err)
-{
-#ifdef EXT2FS_DEBUG
-       static unsigned long alloc_hits, alloc_attempts;
-#endif
-       unsigned long result;
-
-
-#ifdef EXT2_PREALLOCATE
-       struct ext2_inode_info *ei = EXT2_I(inode);
-       write_lock(&ei->i_meta_lock);
-       if (ei->i_prealloc_count &&
-           (goal == ei->i_prealloc_block || goal + 1 == ei->i_prealloc_block))
-       {
-               result = ei->i_prealloc_block++;
-               ei->i_prealloc_count--;
-               write_unlock(&ei->i_meta_lock);
-               ext2_debug ("preallocation hit (%lu/%lu).\n",
-                           ++alloc_hits, ++alloc_attempts);
-       } else {
-               write_unlock(&ei->i_meta_lock);
-               ext2_discard_prealloc (inode);
-               ext2_debug ("preallocation miss (%lu/%lu).\n",
-                           alloc_hits, ++alloc_attempts);
-               if (S_ISREG(inode->i_mode))
-                       result = ext2_new_block (inode, goal, 
-                                &ei->i_prealloc_count,
-                                &ei->i_prealloc_block, err);
-               else
-                       result = ext2_new_block(inode, goal, NULL, NULL, err);
-       }
-#else
-       result = ext2_new_block (inode, goal, 0, 0, err);
-#endif
-       return result;
-}
-
 typedef struct {
        __le32  *p;
        __le32  key;
@@ -228,7 +160,8 @@ static int ext2_block_to_path(struct inode *inode,
                ext2_warning (inode->i_sb, "ext2_block_to_path", "block > big");
        }
        if (boundary)
-               *boundary = (i_block & (ptrs - 1)) == (final - 1);
+               *boundary = final - 1 - (i_block & (ptrs - 1));
+
        return n;
 }
 
@@ -355,39 +288,129 @@ static unsigned long ext2_find_near(struct inode *inode, Indirect *ind)
  *     @block:  block we want
  *     @chain:  chain of indirect blocks
  *     @partial: pointer to the last triple within a chain
- *     @goal:  place to store the result.
  *
- *     Normally this function find the prefered place for block allocation,
- *     stores it in *@goal and returns zero. If the branch had been changed
- *     under us we return -EAGAIN.
+ *     Returns preferred place for a block (the goal).
  */
 
 static inline int ext2_find_goal(struct inode *inode,
                                 long block,
                                 Indirect chain[4],
-                                Indirect *partial,
-                                unsigned long *goal)
+                                Indirect *partial)
 {
-       struct ext2_inode_info *ei = EXT2_I(inode);
-       write_lock(&ei->i_meta_lock);
-       if ((block == ei->i_next_alloc_block + 1) && ei->i_next_alloc_goal) {
-               ei->i_next_alloc_block++;
-               ei->i_next_alloc_goal++;
-       } 
-       if (verify_chain(chain, partial)) {
-               /*
-                * try the heuristic for sequential allocation,
-                * failing that at least try to get decent locality.
-                */
-               if (block == ei->i_next_alloc_block)
-                       *goal = ei->i_next_alloc_goal;
-               if (!*goal)
-                       *goal = ext2_find_near(inode, partial);
-               write_unlock(&ei->i_meta_lock);
-               return 0;
+       struct ext2_block_alloc_info *block_i;
+
+       block_i = EXT2_I(inode)->i_block_alloc_info;
+
+       /*
+        * try the heuristic for sequential allocation,
+        * failing that at least try to get decent locality.
+        */
+       if (block_i && (block == block_i->last_alloc_logical_block + 1)
+               && (block_i->last_alloc_physical_block != 0)) {
+               return block_i->last_alloc_physical_block + 1;
        }
-       write_unlock(&ei->i_meta_lock);
-       return -EAGAIN;
+
+       return ext2_find_near(inode, partial);
+}
+
+/**
+ *     ext2_blks_to_allocate: Look up the block map and count the number
+ *     of direct blocks need to be allocated for the given branch.
+ *
+ *     @branch: chain of indirect blocks
+ *     @k: number of blocks need for indirect blocks
+ *     @blks: number of data blocks to be mapped.
+ *     @blocks_to_boundary:  the offset in the indirect block
+ *
+ *     return the total number of blocks to be allocate, including the
+ *     direct and indirect blocks.
+ */
+static int
+ext2_blks_to_allocate(Indirect * branch, int k, unsigned long blks,
+               int blocks_to_boundary)
+{
+       unsigned long count = 0;
+
+       /*
+        * Simple case, [t,d]Indirect block(s) has not allocated yet
+        * then it's clear blocks on that path have not allocated
+        */
+       if (k > 0) {
+               /* right now don't hanel cross boundary allocation */
+               if (blks < blocks_to_boundary + 1)
+                       count += blks;
+               else
+                       count += blocks_to_boundary + 1;
+               return count;
+       }
+
+       count++;
+       while (count < blks && count <= blocks_to_boundary
+               && le32_to_cpu(*(branch[0].p + count)) == 0) {
+               count++;
+       }
+       return count;
+}
+
+/**
+ *     ext2_alloc_blocks: multiple allocate blocks needed for a branch
+ *     @indirect_blks: the number of blocks need to allocate for indirect
+ *                     blocks
+ *
+ *     @new_blocks: on return it will store the new block numbers for
+ *     the indirect blocks(if needed) and the first direct block,
+ *     @blks:  on return it will store the total number of allocated
+ *             direct blocks
+ */
+static int ext2_alloc_blocks(struct inode *inode,
+                       ext2_fsblk_t goal, int indirect_blks, int blks,
+                       ext2_fsblk_t new_blocks[4], int *err)
+{
+       int target, i;
+       unsigned long count = 0;
+       int index = 0;
+       ext2_fsblk_t current_block = 0;
+       int ret = 0;
+
+       /*
+        * Here we try to allocate the requested multiple blocks at once,
+        * on a best-effort basis.
+        * To build a branch, we should allocate blocks for
+        * the indirect blocks(if not allocated yet), and at least
+        * the first direct block of this branch.  That's the
+        * minimum number of blocks need to allocate(required)
+        */
+       target = blks + indirect_blks;
+
+       while (1) {
+               count = target;
+               /* allocating blocks for indirect blocks and direct blocks */
+               current_block = ext2_new_blocks(inode,goal,&count,err);
+               if (*err)
+                       goto failed_out;
+
+               target -= count;
+               /* allocate blocks for indirect blocks */
+               while (index < indirect_blks && count) {
+                       new_blocks[index++] = current_block++;
+                       count--;
+               }
+
+               if (count > 0)
+                       break;
+       }
+
+       /* save the new block number for the first direct block */
+       new_blocks[index] = current_block;
+
+       /* total number of blocks allocated for direct blocks */
+       ret = count;
+       *err = 0;
+       return ret;
+failed_out:
+       for (i = 0; i <index; i++)
+               ext2_free_blocks(inode, new_blocks[i], 1);
+       return ret;
 }
 
 /**
@@ -416,39 +439,49 @@ static inline int ext2_find_goal(struct inode *inode,
  */
 
 static int ext2_alloc_branch(struct inode *inode,
-                            int num,
-                            unsigned long goal,
-                            int *offsets,
-                            Indirect *branch)
+                       int indirect_blks, int *blks, ext2_fsblk_t goal,
+                       int *offsets, Indirect *branch)
 {
        int blocksize = inode->i_sb->s_blocksize;
-       int n = 0;
-       int err;
-       int i;
-       int parent = ext2_alloc_block(inode, goal, &err);
-
-       branch[0].key = cpu_to_le32(parent);
-       if (parent) for (n = 1; n < num; n++) {
-               struct buffer_head *bh;
-               /* Allocate the next block */
-               int nr = ext2_alloc_block(inode, parent, &err);
-               if (!nr)
-                       break;
-               branch[n].key = cpu_to_le32(nr);
+       int i, n = 0;
+       int err = 0;
+       struct buffer_head *bh;
+       int num;
+       ext2_fsblk_t new_blocks[4];
+       ext2_fsblk_t current_block;
+
+       num = ext2_alloc_blocks(inode, goal, indirect_blks,
+                               *blks, new_blocks, &err);
+       if (err)
+               return err;
+
+       branch[0].key = cpu_to_le32(new_blocks[0]);
+       /*
+        * metadata blocks and data blocks are allocated.
+        */
+       for (n = 1; n <= indirect_blks;  n++) {
                /*
-                * Get buffer_head for parent block, zero it out and set 
-                * the pointer to new one, then send parent to disk.
+                * Get buffer_head for parent block, zero it out
+                * and set the pointer to new one, then send
+                * parent to disk.
                 */
-               bh = sb_getblk(inode->i_sb, parent);
-               if (!bh) {
-                       err = -EIO;
-                       break;
-               }
+               bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
+               branch[n].bh = bh;
                lock_buffer(bh);
                memset(bh->b_data, 0, blocksize);
-               branch[n].bh = bh;
                branch[n].p = (__le32 *) bh->b_data + offsets[n];
+               branch[n].key = cpu_to_le32(new_blocks[n]);
                *branch[n].p = branch[n].key;
+               if ( n == indirect_blks) {
+                       current_block = new_blocks[n];
+                       /*
+                        * End of chain, update the last new metablock of
+                        * the chain to point to the new allocated
+                        * data blocks numbers
+                        */
+                       for (i=1; i < num; i++)
+                               *(branch[n].p + i) = cpu_to_le32(++current_block);
+               }
                set_buffer_uptodate(bh);
                unlock_buffer(bh);
                mark_buffer_dirty_inode(bh, inode);
@@ -458,77 +491,68 @@ static int ext2_alloc_branch(struct inode *inode,
                 */
                if (S_ISDIR(inode->i_mode) && IS_DIRSYNC(inode))
                        sync_dirty_buffer(bh);
-               parent = nr;
        }
-       if (n == num)
-               return 0;
-
-       /* Allocation failed, free what we already allocated */
-       for (i = 1; i < n; i++)
-               bforget(branch[i].bh);
-       for (i = 0; i < n; i++)
-               ext2_free_blocks(inode, le32_to_cpu(branch[i].key), 1);
+       *blks = num;
        return err;
 }
 
 /**
- *     ext2_splice_branch - splice the allocated branch onto inode.
- *     @inode: owner
- *     @block: (logical) number of block we are adding
- *     @chain: chain of indirect blocks (with a missing link - see
- *             ext2_alloc_branch)
- *     @where: location of missing link
- *     @num:   number of blocks we are adding
+ * ext2_splice_branch - splice the allocated branch onto inode.
+ * @inode: owner
+ * @block: (logical) number of block we are adding
+ * @chain: chain of indirect blocks (with a missing link - see
+ *     ext2_alloc_branch)
+ * @where: location of missing link
+ * @num:   number of indirect blocks we are adding
+ * @blks:  number of direct blocks we are adding
  *
- *     This function verifies that chain (up to the missing link) had not
- *     changed, fills the missing link and does all housekeeping needed in
- *     inode (->i_blocks, etc.). In case of success we end up with the full
- *     chain to new block and return 0. Otherwise (== chain had been changed)
- *     we free the new blocks (forgetting their buffer_heads, indeed) and
- *     return -EAGAIN.
+ * This function fills the missing link and does all housekeeping needed in
+ * inode (->i_blocks, etc.). In case of success we end up with the full
+ * chain to new block and return 0.
  */
-
-static inline int ext2_splice_branch(struct inode *inode,
-                                    long block,
-                                    Indirect chain[4],
-                                    Indirect *where,
-                                    int num)
+static void ext2_splice_branch(struct inode *inode,
+                       long block, Indirect *where, int num, int blks)
 {
-       struct ext2_inode_info *ei = EXT2_I(inode);
        int i;
+       struct ext2_block_alloc_info *block_i;
+       ext2_fsblk_t current_block;
 
-       /* Verify that place we are splicing to is still there and vacant */
-
-       write_lock(&ei->i_meta_lock);
-       if (!verify_chain(chain, where-1) || *where->p)
-               goto changed;
+       block_i = EXT2_I(inode)->i_block_alloc_info;
 
+       /* XXX LOCKING probably should have i_meta_lock ?*/
        /* That's it */
 
        *where->p = where->key;
-       ei->i_next_alloc_block = block;
-       ei->i_next_alloc_goal = le32_to_cpu(where[num-1].key);
 
-       write_unlock(&ei->i_meta_lock);
+       /*
+        * Update the host buffer_head or inode to point to more just allocated
+        * direct blocks blocks
+        */
+       if (num == 0 && blks > 1) {
+               current_block = le32_to_cpu(where->key) + 1;
+               for (i = 1; i < blks; i++)
+                       *(where->p + i ) = cpu_to_le32(current_block++);
+       }
 
-       /* We are done with atomic stuff, now do the rest of housekeeping */
+       /*
+        * update the most recently allocated logical & physical block
+        * in i_block_alloc_info, to assist find the proper goal block for next
+        * allocation
+        */
+       if (block_i) {
+               block_i->last_alloc_logical_block = block + blks - 1;
+               block_i->last_alloc_physical_block =
+                               le32_to_cpu(where[num].key) + blks - 1;
+       }
 
-       inode->i_ctime = CURRENT_TIME_SEC;
+       /* We are done with atomic stuff, now do the rest of housekeeping */
 
        /* had we spliced it onto indirect block? */
        if (where->bh)
                mark_buffer_dirty_inode(where->bh, inode);
 
+       inode->i_ctime = CURRENT_TIME_SEC;
        mark_inode_dirty(inode);
-       return 0;
-
-changed:
-       write_unlock(&ei->i_meta_lock);
-       for (i = 1; i < num; i++)
-               bforget(where[i].bh);
-       for (i = 0; i < num; i++)
-               ext2_free_blocks(inode, le32_to_cpu(where[i].key), 1);
-       return -EAGAIN;
 }
 
 /*
@@ -542,64 +566,99 @@ changed:
  * That has a nice additional property: no special recovery from the failed
  * allocations is needed - we simply release blocks and do not touch anything
  * reachable from inode.
+ *
+ * `handle' can be NULL if create == 0.
+ *
+ * The BKL may not be held on entry here.  Be sure to take it early.
+ * return > 0, # of blocks mapped or allocated.
+ * return = 0, if plain lookup failed.
+ * return < 0, error case.
  */
-
-int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
+static int ext2_get_blocks(struct inode *inode,
+                          sector_t iblock, unsigned long maxblocks,
+                          struct buffer_head *bh_result,
+                          int create)
 {
        int err = -EIO;
        int offsets[4];
        Indirect chain[4];
        Indirect *partial;
-       unsigned long goal;
-       int left;
-       int boundary = 0;
-       int depth = ext2_block_to_path(inode, iblock, offsets, &boundary);
+       ext2_fsblk_t goal;
+       int indirect_blks;
+       int blocks_to_boundary = 0;
+       int depth;
+       struct ext2_inode_info *ei = EXT2_I(inode);
+       int count = 0;
+       ext2_fsblk_t first_block = 0;
 
-       if (depth == 0)
-               goto out;
+       depth = ext2_block_to_path(inode,iblock,offsets,&blocks_to_boundary);
 
+       if (depth == 0)
+               return (err);
 reread:
        partial = ext2_get_branch(inode, depth, offsets, chain, &err);
 
        /* Simplest case - block found, no allocation needed */
        if (!partial) {
-got_it:
-               map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key));
-               if (boundary)
-                       set_buffer_boundary(bh_result);
-               /* Clean up and exit */
-               partial = chain+depth-1; /* the whole chain */
-               goto cleanup;
+               first_block = le32_to_cpu(chain[depth - 1].key);
+               clear_buffer_new(bh_result); /* What's this do? */
+               count++;
+               /*map more blocks*/
+               while (count < maxblocks && count <= blocks_to_boundary) {
+                       ext2_fsblk_t blk;
+
+                       if (!verify_chain(chain, partial)) {
+                               /*
+                                * Indirect block might be removed by
+                                * truncate while we were reading it.
+                                * Handling of that case: forget what we've
+                                * got now, go to reread.
+                                */
+                               count = 0;
+                               goto changed;
+                       }
+                       blk = le32_to_cpu(*(chain[depth-1].p + count));
+                       if (blk == first_block + count)
+                               count++;
+                       else
+                               break;
+               }
+               goto got_it;
        }
 
        /* Next simple case - plain lookup or failed read of indirect block */
-       if (!create || err == -EIO) {
-cleanup:
-               while (partial > chain) {
-                       brelse(partial->bh);
-                       partial--;
-               }
-out:
-               return err;
-       }
+       if (!create || err == -EIO)
+               goto cleanup;
+
+       mutex_lock(&ei->truncate_mutex);
 
        /*
-        * Indirect block might be removed by truncate while we were
-        * reading it. Handling of that case (forget what we've got and
-        * reread) is taken out of the main path.
-        */
-       if (err == -EAGAIN)
-               goto changed;
+        * Okay, we need to do block allocation.  Lazily initialize the block
+        * allocation info here if necessary
+       */
+       if (S_ISREG(inode->i_mode) && (!ei->i_block_alloc_info))
+               ext2_init_block_alloc_info(inode);
 
-       goal = 0;
-       if (ext2_find_goal(inode, iblock, chain, partial, &goal) < 0)
-               goto changed;
+       goal = ext2_find_goal(inode, iblock, chain, partial);
 
-       left = (chain + depth) - partial;
-       err = ext2_alloc_branch(inode, left, goal,
-                                       offsets+(partial-chain), partial);
-       if (err)
+       /* the number of blocks need to allocate for [d,t]indirect blocks */
+       indirect_blks = (chain + depth) - partial - 1;
+       /*
+        * Next look up the indirect map to count the totoal number of
+        * direct blocks to allocate for this branch.
+        */
+       count = ext2_blks_to_allocate(partial, indirect_blks,
+                                       maxblocks, blocks_to_boundary);
+       /*
+        * XXX ???? Block out ext2_truncate while we alter the tree
+        */
+       err = ext2_alloc_branch(inode, indirect_blks, &count, goal,
+                               offsets + (partial - chain), partial);
+
+       if (err) {
+               mutex_unlock(&ei->truncate_mutex);
                goto cleanup;
+       }
 
        if (ext2_use_xip(inode->i_sb)) {
                /*
@@ -607,16 +666,28 @@ out:
                 */
                err = ext2_clear_xip_target (inode,
                        le32_to_cpu(chain[depth-1].key));
-               if (err)
+               if (err) {
+                       mutex_unlock(&ei->truncate_mutex);
                        goto cleanup;
+               }
        }
 
-       if (ext2_splice_branch(inode, iblock, chain, partial, left) < 0)
-               goto changed;
-
+       ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
+       mutex_unlock(&ei->truncate_mutex);
        set_buffer_new(bh_result);
-       goto got_it;
-
+got_it:
+       map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key));
+       if (count > blocks_to_boundary)
+               set_buffer_boundary(bh_result);
+       err = count;
+       /* Clean up and exit */
+       partial = chain + depth - 1;    /* the whole chain */
+cleanup:
+       while (partial > chain) {
+               brelse(partial->bh);
+               partial--;
+       }
+       return err;
 changed:
        while (partial > chain) {
                brelse(partial->bh);
@@ -625,6 +696,19 @@ changed:
        goto reread;
 }
 
+int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
+{
+       unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
+       int ret = ext2_get_blocks(inode, iblock, max_blocks,
+                             bh_result, create);
+       if (ret > 0) {
+               bh_result->b_size = (ret << inode->i_blkbits);
+               ret = 0;
+       }
+       return ret;
+
+}
+
 static int ext2_writepage(struct page *page, struct writeback_control *wbc)
 {
        return block_write_full_page(page, ext2_get_block, wbc);
@@ -913,9 +997,10 @@ static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int de
                ext2_free_data(inode, p, q);
 }
 
-void ext2_truncate (struct inode * inode)
+void ext2_truncate(struct inode *inode)
 {
        __le32 *i_data = EXT2_I(inode)->i_data;
+       struct ext2_inode_info *ei = EXT2_I(inode);
        int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb);
        int offsets[4];
        Indirect chain[4];
@@ -933,8 +1018,6 @@ void ext2_truncate (struct inode * inode)
        if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
                return;
 
-       ext2_discard_prealloc(inode);
-
        blocksize = inode->i_sb->s_blocksize;
        iblock = (inode->i_size + blocksize-1)
                                        >> EXT2_BLOCK_SIZE_BITS(inode->i_sb);
@@ -952,6 +1035,12 @@ void ext2_truncate (struct inode * inode)
        if (n == 0)
                return;
 
+       /*
+        * From here we block out all ext2_get_block() callers who want to
+        * modify the block allocation tree.
+        */
+       mutex_lock(&ei->truncate_mutex);
+
        if (n == 1) {
                ext2_free_data(inode, i_data+offsets[0],
                                        i_data + EXT2_NDIR_BLOCKS);
@@ -1004,6 +1093,10 @@ do_indirects:
                case EXT2_TIND_BLOCK:
                        ;
        }
+
+       ext2_discard_reservation(inode);
+
+       mutex_unlock(&ei->truncate_mutex);
        inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
        if (inode_needs_sync(inode)) {
                sync_mapping_buffers(inode->i_mapping);
@@ -1028,7 +1121,7 @@ static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino,
                goto Einval;
 
        block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb);
-       gdp = ext2_get_group_desc(sb, block_group, &bh);
+       gdp = ext2_get_group_desc(sb, block_group, NULL);
        if (!gdp)
                goto Egdp;
        /*
@@ -1104,6 +1197,8 @@ void ext2_read_inode (struct inode * inode)
        ei->i_acl = EXT2_ACL_NOT_CACHED;
        ei->i_default_acl = EXT2_ACL_NOT_CACHED;
 #endif
+       ei->i_block_alloc_info = NULL;
+
        if (IS_ERR(raw_inode))
                goto bad_inode;
 
@@ -1145,9 +1240,6 @@ void ext2_read_inode (struct inode * inode)
        ei->i_dtime = 0;
        inode->i_generation = le32_to_cpu(raw_inode->i_generation);
        ei->i_state = 0;
-       ei->i_next_alloc_block = 0;
-       ei->i_next_alloc_goal = 0;
-       ei->i_prealloc_count = 0;
        ei->i_block_group = (ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb);
        ei->i_dir_start_lookup = 0;
 
index 3bcd25422ee4879781a2785ec92a0f512e0c2567..c2324d5fe4ac149a5672bad13134d4775c815100 100644 (file)
@@ -22,6 +22,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
 {
        struct ext2_inode_info *ei = EXT2_I(inode);
        unsigned int flags;
+       unsigned short rsv_window_size;
 
        ext2_debug ("cmd = %u, arg = %lu\n", cmd, arg);
 
@@ -83,6 +84,50 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
                inode->i_ctime = CURRENT_TIME_SEC;
                mark_inode_dirty(inode);
                return 0;
+       case EXT2_IOC_GETRSVSZ:
+               if (test_opt(inode->i_sb, RESERVATION)
+                       && S_ISREG(inode->i_mode)
+                       && ei->i_block_alloc_info) {
+                       rsv_window_size = ei->i_block_alloc_info->rsv_window_node.rsv_goal_size;
+                       return put_user(rsv_window_size, (int __user *)arg);
+               }
+               return -ENOTTY;
+       case EXT2_IOC_SETRSVSZ: {
+
+               if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
+                       return -ENOTTY;
+
+               if (IS_RDONLY(inode))
+                       return -EROFS;
+
+               if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+                       return -EACCES;
+
+               if (get_user(rsv_window_size, (int __user *)arg))
+                       return -EFAULT;
+
+               if (rsv_window_size > EXT2_MAX_RESERVE_BLOCKS)
+                       rsv_window_size = EXT2_MAX_RESERVE_BLOCKS;
+
+               /*
+                * need to allocate reservation structure for this inode
+                * before set the window size
+                */
+               /*
+                * XXX What lock should protect the rsv_goal_size?
+                * Accessed in ext2_get_block only.  ext3 uses i_truncate.
+                */
+               mutex_lock(&ei->truncate_mutex);
+               if (!ei->i_block_alloc_info)
+                       ext2_init_block_alloc_info(inode);
+
+               if (ei->i_block_alloc_info){
+                       struct ext2_reserve_window_node *rsv = &ei->i_block_alloc_info->rsv_window_node;
+                       rsv->rsv_goal_size = rsv_window_size;
+               }
+               mutex_unlock(&ei->truncate_mutex);
+               return 0;
+       }
        default:
                return -ENOTTY;
        }
index 639a32c3c9c1cea8a3da126c334284bd5be4e21d..77bd5f9262f94c4e2da4a012c5f89b50af357dd1 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/vfs.h>
 #include <linux/seq_file.h>
 #include <linux/mount.h>
+#include <linux/log2.h>
 #include <asm/uaccess.h>
 #include "ext2.h"
 #include "xattr.h"
@@ -148,6 +149,7 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
        ei->i_acl = EXT2_ACL_NOT_CACHED;
        ei->i_default_acl = EXT2_ACL_NOT_CACHED;
 #endif
+       ei->i_block_alloc_info = NULL;
        ei->vfs_inode.i_version = 1;
        return &ei->vfs_inode;
 }
@@ -157,7 +159,7 @@ static void ext2_destroy_inode(struct inode *inode)
        kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
 
@@ -165,6 +167,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
 #ifdef CONFIG_EXT2_FS_XATTR
        init_rwsem(&ei->xattr_sem);
 #endif
+       mutex_init(&ei->truncate_mutex);
        inode_init_once(&ei->vfs_inode);
 }
 
@@ -187,6 +190,7 @@ static void destroy_inodecache(void)
 
 static void ext2_clear_inode(struct inode *inode)
 {
+       struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info;
 #ifdef CONFIG_EXT2_FS_POSIX_ACL
        struct ext2_inode_info *ei = EXT2_I(inode);
 
@@ -199,14 +203,74 @@ static void ext2_clear_inode(struct inode *inode)
                ei->i_default_acl = EXT2_ACL_NOT_CACHED;
        }
 #endif
+       ext2_discard_reservation(inode);
+       EXT2_I(inode)->i_block_alloc_info = NULL;
+       if (unlikely(rsv))
+               kfree(rsv);
 }
 
 static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs)
 {
-       struct ext2_sb_info *sbi = EXT2_SB(vfs->mnt_sb);
+       struct super_block *sb = vfs->mnt_sb;
+       struct ext2_sb_info *sbi = EXT2_SB(sb);
+       struct ext2_super_block *es = sbi->s_es;
+       unsigned long def_mount_opts;
+
+       def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
 
-       if (sbi->s_mount_opt & EXT2_MOUNT_GRPID)
+       if (sbi->s_sb_block != 1)
+               seq_printf(seq, ",sb=%lu", sbi->s_sb_block);
+       if (test_opt(sb, MINIX_DF))
+               seq_puts(seq, ",minixdf");
+       if (test_opt(sb, GRPID))
                seq_puts(seq, ",grpid");
+       if (!test_opt(sb, GRPID) && (def_mount_opts & EXT2_DEFM_BSDGROUPS))
+               seq_puts(seq, ",nogrpid");
+       if (sbi->s_resuid != EXT2_DEF_RESUID ||
+           le16_to_cpu(es->s_def_resuid) != EXT2_DEF_RESUID) {
+               seq_printf(seq, ",resuid=%u", sbi->s_resuid);
+       }
+       if (sbi->s_resgid != EXT2_DEF_RESGID ||
+           le16_to_cpu(es->s_def_resgid) != EXT2_DEF_RESGID) {
+               seq_printf(seq, ",resgid=%u", sbi->s_resgid);
+       }
+       if (test_opt(sb, ERRORS_CONT)) {
+               int def_errors = le16_to_cpu(es->s_errors);
+
+               if (def_errors == EXT2_ERRORS_PANIC ||
+                   def_errors == EXT2_ERRORS_RO) {
+                       seq_puts(seq, ",errors=continue");
+               }
+       }
+       if (test_opt(sb, ERRORS_RO))
+               seq_puts(seq, ",errors=remount-ro");
+       if (test_opt(sb, ERRORS_PANIC))
+               seq_puts(seq, ",errors=panic");
+       if (test_opt(sb, NO_UID32))
+               seq_puts(seq, ",nouid32");
+       if (test_opt(sb, DEBUG))
+               seq_puts(seq, ",debug");
+       if (test_opt(sb, OLDALLOC))
+               seq_puts(seq, ",oldalloc");
+
+#ifdef CONFIG_EXT2_FS_XATTR
+       if (test_opt(sb, XATTR_USER))
+               seq_puts(seq, ",user_xattr");
+       if (!test_opt(sb, XATTR_USER) &&
+           (def_mount_opts & EXT2_DEFM_XATTR_USER)) {
+               seq_puts(seq, ",nouser_xattr");
+       }
+#endif
+
+#ifdef CONFIG_EXT2_FS_POSIX_ACL
+       if (test_opt(sb, POSIX_ACL))
+               seq_puts(seq, ",acl");
+       if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT2_DEFM_ACL))
+               seq_puts(seq, ",noacl");
+#endif
+
+       if (test_opt(sb, NOBH))
+               seq_puts(seq, ",nobh");
 
 #if defined(CONFIG_QUOTA)
        if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA)
@@ -234,7 +298,6 @@ static const struct super_operations ext2_sops = {
        .destroy_inode  = ext2_destroy_inode,
        .read_inode     = ext2_read_inode,
        .write_inode    = ext2_write_inode,
-       .put_inode      = ext2_put_inode,
        .delete_inode   = ext2_delete_inode,
        .put_super      = ext2_put_super,
        .write_super    = ext2_write_super,
@@ -322,7 +385,7 @@ enum {
        Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
        Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
        Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
-       Opt_usrquota, Opt_grpquota
+       Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
 };
 
 static match_table_t tokens = {
@@ -354,6 +417,8 @@ static match_table_t tokens = {
        {Opt_ignore, "noquota"},
        {Opt_quota, "quota"},
        {Opt_usrquota, "usrquota"},
+       {Opt_reservation, "reservation"},
+       {Opt_noreservation, "noreservation"},
        {Opt_err, NULL}
 };
 
@@ -486,6 +551,14 @@ static int parse_options (char * options,
                        break;
 #endif
 
+               case Opt_reservation:
+                       set_opt(sbi->s_mount_opt, RESERVATION);
+                       printk("reservations ON\n");
+                       break;
+               case Opt_noreservation:
+                       clear_opt(sbi->s_mount_opt, RESERVATION);
+                       printk("reservations OFF\n");
+                       break;
                case Opt_ignore:
                        break;
                default:
@@ -653,11 +726,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
        int db_count;
        int i, j;
        __le32 features;
+       int err;
 
        sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
+       sbi->s_sb_block = sb_block;
 
        /*
         * See what the current blocksize for the device is, and
@@ -725,6 +800,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
        sbi->s_resuid = le16_to_cpu(es->s_def_resuid);
        sbi->s_resgid = le16_to_cpu(es->s_def_resgid);
        
+       set_opt(sbi->s_mount_opt, RESERVATION);
+
        if (!parse_options ((char *) data, sbi))
                goto failed_mount;
 
@@ -804,7 +881,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
                sbi->s_inode_size = le16_to_cpu(es->s_inode_size);
                sbi->s_first_ino = le32_to_cpu(es->s_first_ino);
                if ((sbi->s_inode_size < EXT2_GOOD_OLD_INODE_SIZE) ||
-                   (sbi->s_inode_size & (sbi->s_inode_size - 1)) ||
+                   !is_power_of_2(sbi->s_inode_size) ||
                    (sbi->s_inode_size > blocksize)) {
                        printk ("EXT2-fs: unsupported inode size: %d\n",
                                sbi->s_inode_size);
@@ -906,12 +983,35 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
        get_random_bytes(&sbi->s_next_generation, sizeof(u32));
        spin_lock_init(&sbi->s_next_gen_lock);
 
-       percpu_counter_init(&sbi->s_freeblocks_counter,
+       /* per fileystem reservation list head & lock */
+       spin_lock_init(&sbi->s_rsv_window_lock);
+       sbi->s_rsv_window_root = RB_ROOT;
+       /*
+        * Add a single, static dummy reservation to the start of the
+        * reservation window list --- it gives us a placeholder for
+        * append-at-start-of-list which makes the allocation logic
+        * _much_ simpler.
+        */
+       sbi->s_rsv_window_head.rsv_start = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
+       sbi->s_rsv_window_head.rsv_end = EXT2_RESERVE_WINDOW_NOT_ALLOCATED;
+       sbi->s_rsv_window_head.rsv_alloc_hit = 0;
+       sbi->s_rsv_window_head.rsv_goal_size = 0;
+       ext2_rsv_window_add(sb, &sbi->s_rsv_window_head);
+
+       err = percpu_counter_init(&sbi->s_freeblocks_counter,
                                ext2_count_free_blocks(sb));
-       percpu_counter_init(&sbi->s_freeinodes_counter,
+       if (!err) {
+               err = percpu_counter_init(&sbi->s_freeinodes_counter,
                                ext2_count_free_inodes(sb));
-       percpu_counter_init(&sbi->s_dirs_counter,
+       }
+       if (!err) {
+               err = percpu_counter_init(&sbi->s_dirs_counter,
                                ext2_count_dirs(sb));
+       }
+       if (err) {
+               printk(KERN_ERR "EXT2-fs: insufficient memory\n");
+               goto failed_mount3;
+       }
        /*
         * set up enough so that it can read an inode
         */
@@ -1193,7 +1293,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data,
 
                tmp_bh.b_state = 0;
                err = ext2_get_block(inode, blk, &tmp_bh, 0);
-               if (err)
+               if (err < 0)
                        return err;
                if (!buffer_mapped(&tmp_bh))    /* A hole? */
                        memset(data, 0, tocopy);
@@ -1232,7 +1332,7 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
 
                tmp_bh.b_state = 0;
                err = ext2_get_block(inode, blk, &tmp_bh, 1);
-               if (err)
+               if (err < 0)
                        goto out;
                if (offset || tocopy != EXT2_BLOCK_SIZE(sb))
                        bh = sb_bread(sb, tmp_bh.b_blocknr);
index 247efd0b51d694e1206709672d8234e40b5405ed..3e8683dbb13fb0d5cfa12ffbc9bccf560fe63d52 100644 (file)
@@ -664,8 +664,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
                                                           s_first_data_block) +
                                   EXT2_I(inode)->i_block_group *
                                   EXT2_BLOCKS_PER_GROUP(sb);
-                       int block = ext2_new_block(inode, goal,
-                                                  NULL, NULL, &error);
+                       int block = ext2_new_block(inode, goal, &error);
                        if (error)
                                goto cleanup;
                        ea_idebug(inode, "creating block %d", block);
index ca8aee6efe3720aefc617d9d8c8c1e9b49359359..7a87d15523be62f1d33c72c4d8a2eba359d45237 100644 (file)
@@ -80,6 +80,14 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
        return desc + offset;
 }
 
+static inline int
+block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map)
+{
+       return ext3_test_bit ((block -
+               le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
+                        EXT3_BLOCKS_PER_GROUP(sb), map);
+}
+
 /**
  * read_block_bitmap()
  * @sb:                        super block
@@ -93,20 +101,51 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
 static struct buffer_head *
 read_block_bitmap(struct super_block *sb, unsigned int block_group)
 {
+       int i;
        struct ext3_group_desc * desc;
        struct buffer_head * bh = NULL;
+       ext3_fsblk_t bitmap_blk;
 
        desc = ext3_get_group_desc (sb, block_group, NULL);
        if (!desc)
-               goto error_out;
-       bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap));
+               return NULL;
+       bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
+       bh = sb_bread(sb, bitmap_blk);
        if (!bh)
-               ext3_error (sb, "read_block_bitmap",
+               ext3_error (sb, __FUNCTION__,
                            "Cannot read block bitmap - "
                            "block_group = %d, block_bitmap = %u",
                            block_group, le32_to_cpu(desc->bg_block_bitmap));
-error_out:
+
+       /* check whether block bitmap block number is set */
+       if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+               /* bad block bitmap */
+               goto error_out;
+       }
+       /* check whether the inode bitmap block number is set */
+       bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
+       if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+               /* bad block bitmap */
+               goto error_out;
+       }
+       /* check whether the inode table block number is set */
+       bitmap_blk = le32_to_cpu(desc->bg_inode_table);
+       for (i = 0; i < EXT3_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
+               if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+                       /* bad block bitmap */
+                       goto error_out;
+               }
+       }
+
        return bh;
+
+error_out:
+       brelse(bh);
+       ext3_error(sb, __FUNCTION__,
+                       "Invalid block bitmap - "
+                       "block_group = %d, block = %lu",
+                       block_group, bitmap_blk);
+       return NULL;
 }
 /*
  * The reservation window structure operations
@@ -570,7 +609,7 @@ do_more:
                cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
                        group_freed);
        spin_unlock(sb_bgl_lock(sbi, block_group));
-       percpu_counter_mod(&sbi->s_freeblocks_counter, count);
+       percpu_counter_add(&sbi->s_freeblocks_counter, count);
 
        /* We dirtied the bitmap block */
        BUFFER_TRACE(bitmap_bh, "dirtied bitmap block");
@@ -1633,7 +1672,7 @@ allocated:
        gdp->bg_free_blocks_count =
                        cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
        spin_unlock(sb_bgl_lock(sbi, group_no));
-       percpu_counter_mod(&sbi->s_freeblocks_counter, -num);
+       percpu_counter_sub(&sbi->s_freeblocks_counter, num);
 
        BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor");
        err = ext3_journal_dirty_metadata(handle, gdp_bh);
@@ -1733,13 +1772,6 @@ ext3_fsblk_t ext3_count_free_blocks(struct super_block *sb)
 #endif
 }
 
-static inline int
-block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map)
-{
-       return ext3_test_bit ((block -
-               le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
-                        EXT3_BLOCKS_PER_GROUP(sb), map);
-}
 
 static inline int test_root(int a, int b)
 {
index b9176eed98d1258518bd9cebfbbdb071baa458fc..6afc39d80253cf4560ce69b9a4b1983d1df3871b 100644 (file)
@@ -13,7 +13,7 @@
 
 #ifdef EXT3FS_DEBUG
 
-static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
+static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
 
 unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars)
 {
index c2c3491b18cf147df1e7341b89749ded292d36c0..c8e4ee3af1d0a7ead446bb5dcf34040db7690138 100644 (file)
@@ -47,9 +47,7 @@ const struct file_operations ext3_dir_operations = {
        .compat_ioctl   = ext3_compat_ioctl,
 #endif
        .fsync          = ext3_sync_file,       /* BKL held */
-#ifdef CONFIG_EXT3_INDEX
        .release        = ext3_release_dir,
-#endif
 };
 
 
@@ -107,7 +105,6 @@ static int ext3_readdir(struct file * filp,
 
        sb = inode->i_sb;
 
-#ifdef CONFIG_EXT3_INDEX
        if (EXT3_HAS_COMPAT_FEATURE(inode->i_sb,
                                    EXT3_FEATURE_COMPAT_DIR_INDEX) &&
            ((EXT3_I(inode)->i_flags & EXT3_INDEX_FL) ||
@@ -123,7 +120,6 @@ static int ext3_readdir(struct file * filp,
                 */
                EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
        }
-#endif
        stored = 0;
        offset = filp->f_pos & (sb->s_blocksize - 1);
 
@@ -210,7 +206,7 @@ revalidate:
                                 * not the directory has been modified
                                 * during the copy operation.
                                 */
-                               unsigned long version = filp->f_version;
+                               u64 version = filp->f_version;
 
                                error = filldir(dirent, de->name,
                                                de->name_len,
@@ -232,7 +228,6 @@ out:
        return ret;
 }
 
-#ifdef CONFIG_EXT3_INDEX
 /*
  * These functions convert from the major/minor hash to an f_pos
  * value.
@@ -518,5 +513,3 @@ static int ext3_release_dir (struct inode * inode, struct file * filp)
 
        return 0;
 }
-
-#endif
index e45dbd65173624c10796655baa0566c98ece4f29..1bc8cd89c51d33b7f57607003d06b3fe4036a1ce 100644 (file)
@@ -204,14 +204,13 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
        int ngroups = EXT3_SB(sb)->s_groups_count;
        unsigned int freei, avefreei;
        struct ext3_group_desc *desc, *best_desc = NULL;
-       struct buffer_head *bh;
        int group, best_group = -1;
 
        freei = percpu_counter_read_positive(&EXT3_SB(sb)->s_freeinodes_counter);
        avefreei = freei / ngroups;
 
        for (group = 0; group < ngroups; group++) {
-               desc = ext3_get_group_desc (sb, group, &bh);
+               desc = ext3_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei)
@@ -269,7 +268,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
        ext3_grpblk_t min_blocks;
        int group = -1, i;
        struct ext3_group_desc *desc;
-       struct buffer_head *bh;
 
        freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter);
        avefreei = freei / ngroups;
@@ -286,7 +284,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
                parent_group = (unsigned)group % ngroups;
                for (i = 0; i < ngroups; i++) {
                        group = (parent_group + i) % ngroups;
-                       desc = ext3_get_group_desc (sb, group, &bh);
+                       desc = ext3_get_group_desc (sb, group, NULL);
                        if (!desc || !desc->bg_free_inodes_count)
                                continue;
                        if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir)
@@ -319,7 +317,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 
        for (i = 0; i < ngroups; i++) {
                group = (parent_group + i) % ngroups;
-               desc = ext3_get_group_desc (sb, group, &bh);
+               desc = ext3_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs)
@@ -334,7 +332,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 fallback:
        for (i = 0; i < ngroups; i++) {
                group = (parent_group + i) % ngroups;
-               desc = ext3_get_group_desc (sb, group, &bh);
+               desc = ext3_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei)
@@ -358,14 +356,13 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
        int parent_group = EXT3_I(parent)->i_block_group;
        int ngroups = EXT3_SB(sb)->s_groups_count;
        struct ext3_group_desc *desc;
-       struct buffer_head *bh;
        int group, i;
 
        /*
         * Try to place the inode in its parent directory
         */
        group = parent_group;
-       desc = ext3_get_group_desc (sb, group, &bh);
+       desc = ext3_get_group_desc (sb, group, NULL);
        if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
                        le16_to_cpu(desc->bg_free_blocks_count))
                return group;
@@ -389,7 +386,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
                group += i;
                if (group >= ngroups)
                        group -= ngroups;
-               desc = ext3_get_group_desc (sb, group, &bh);
+               desc = ext3_get_group_desc (sb, group, NULL);
                if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
                                le16_to_cpu(desc->bg_free_blocks_count))
                        return group;
@@ -403,7 +400,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
        for (i = 0; i < ngroups; i++) {
                if (++group >= ngroups)
                        group = 0;
-               desc = ext3_get_group_desc (sb, group, &bh);
+               desc = ext3_get_group_desc (sb, group, NULL);
                if (desc && le16_to_cpu(desc->bg_free_inodes_count))
                        return group;
        }
index c1fa1908dba05137158d0e9f40b991a983a4c9d8..ec8170adac5397de65b862fa549e27acdc9ab294 100644 (file)
@@ -144,7 +144,6 @@ struct dx_map_entry
        u16 size;
 };
 
-#ifdef CONFIG_EXT3_INDEX
 static inline unsigned dx_get_block (struct dx_entry *entry);
 static void dx_set_block (struct dx_entry *entry, unsigned value);
 static inline unsigned dx_get_hash (struct dx_entry *entry);
@@ -768,8 +767,6 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, u32 block)
        dx_set_block(new, block);
        dx_set_count(entries, count + 1);
 }
-#endif
-
 
 static void ext3_update_dx_flag(struct inode *inode)
 {
@@ -871,7 +868,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry,
        name = dentry->d_name.name;
        if (namelen > EXT3_NAME_LEN)
                return NULL;
-#ifdef CONFIG_EXT3_INDEX
        if (is_dx(dir)) {
                bh = ext3_dx_find_entry(dentry, res_dir, &err);
                /*
@@ -883,7 +879,6 @@ static struct buffer_head * ext3_find_entry (struct dentry *dentry,
                        return bh;
                dxtrace(printk("ext3_find_entry: dx failed, falling back\n"));
        }
-#endif
        nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb);
        start = EXT3_I(dir)->i_dir_start_lookup;
        if (start >= nblocks)
@@ -959,7 +954,6 @@ cleanup_and_exit:
        return ret;
 }
 
-#ifdef CONFIG_EXT3_INDEX
 static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry,
                       struct ext3_dir_entry_2 **res_dir, int *err)
 {
@@ -1027,7 +1021,6 @@ errout:
        dx_release (frames);
        return NULL;
 }
-#endif
 
 static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd)
 {
@@ -1123,7 +1116,6 @@ static inline void ext3_set_de_type(struct super_block *sb,
                de->file_type = ext3_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
 }
 
-#ifdef CONFIG_EXT3_INDEX
 /*
  * Move count entries from end of map between two memory locations.
  * Returns pointer to last entry moved.
@@ -1268,7 +1260,6 @@ errout:
        *error = err;
        return NULL;
 }
-#endif
 
 
 /*
@@ -1366,7 +1357,6 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
        return 0;
 }
 
-#ifdef CONFIG_EXT3_INDEX
 /*
  * This converts a one block unindexed directory to a 3 block indexed
  * directory, and adds the dentry to the indexed directory.
@@ -1445,7 +1435,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
 
        return add_dirent_to_buf(handle, dentry, inode, de, bh);
 }
-#endif
 
 /*
  *     ext3_add_entry()
@@ -1466,9 +1455,7 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
        struct ext3_dir_entry_2 *de;
        struct super_block * sb;
        int     retval;
-#ifdef CONFIG_EXT3_INDEX
        int     dx_fallback=0;
-#endif
        unsigned blocksize;
        u32 block, blocks;
 
@@ -1476,7 +1463,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
        blocksize = sb->s_blocksize;
        if (!dentry->d_name.len)
                return -EINVAL;
-#ifdef CONFIG_EXT3_INDEX
        if (is_dx(dir)) {
                retval = ext3_dx_add_entry(handle, dentry, inode);
                if (!retval || (retval != ERR_BAD_DX_DIR))
@@ -1485,7 +1471,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
                dx_fallback++;
                ext3_mark_inode_dirty(handle, dir);
        }
-#endif
        blocks = dir->i_size >> sb->s_blocksize_bits;
        for (block = 0, offset = 0; block < blocks; block++) {
                bh = ext3_bread(handle, dir, block, 0, &retval);
@@ -1495,11 +1480,9 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
                if (retval != -ENOSPC)
                        return retval;
 
-#ifdef CONFIG_EXT3_INDEX
                if (blocks == 1 && !dx_fallback &&
                    EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX))
                        return make_indexed_dir(handle, dentry, inode, bh);
-#endif
                brelse(bh);
        }
        bh = ext3_append(handle, dir, &block, &retval);
@@ -1511,7 +1494,6 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
        return add_dirent_to_buf(handle, dentry, inode, de, bh);
 }
 
-#ifdef CONFIG_EXT3_INDEX
 /*
  * Returns 0 for success, or a negative error value
  */
@@ -1646,7 +1628,6 @@ cleanup:
        dx_release(frames);
        return err;
 }
-#endif
 
 /*
  * ext3_delete_entry deletes a directory entry by merging it with the
index 2c97e09c6c6b2a3048898f69d76cb0522061f389..771f7ada15d9a9b516fd0782f8ab3ee793cba48d 100644 (file)
@@ -153,6 +153,34 @@ static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
                memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
 }
 
+/*
+ * If we have fewer than thresh credits, extend by EXT3_MAX_TRANS_DATA.
+ * If that fails, restart the transaction & regain write access for the
+ * buffer head which is used for block_bitmap modifications.
+ */
+static int extend_or_restart_transaction(handle_t *handle, int thresh,
+                                        struct buffer_head *bh)
+{
+       int err;
+
+       if (handle->h_buffer_credits >= thresh)
+               return 0;
+
+       err = ext3_journal_extend(handle, EXT3_MAX_TRANS_DATA);
+       if (err < 0)
+               return err;
+       if (err) {
+               err = ext3_journal_restart(handle, EXT3_MAX_TRANS_DATA);
+               if (err)
+                       return err;
+               err = ext3_journal_get_write_access(handle, bh);
+               if (err)
+                       return err;
+       }
+
+       return 0;
+}
+
 /*
  * Set up the block and inode bitmaps, and the inode table for the new group.
  * This doesn't need to be part of the main transaction, since we are only
@@ -175,8 +203,9 @@ static int setup_new_group_blocks(struct super_block *sb,
        int i;
        int err = 0, err2;
 
-       handle = ext3_journal_start_sb(sb, reserved_gdb + gdblocks +
-                                      2 + sbi->s_itb_per_group);
+       /* This transaction may be extended/restarted along the way */
+       handle = ext3_journal_start_sb(sb, EXT3_MAX_TRANS_DATA);
+
        if (IS_ERR(handle))
                return PTR_ERR(handle);
 
@@ -203,6 +232,10 @@ static int setup_new_group_blocks(struct super_block *sb,
 
                ext3_debug("update backup group %#04lx (+%d)\n", block, bit);
 
+               err = extend_or_restart_transaction(handle, 1, bh);
+               if (err)
+                       goto exit_bh;
+
                gdb = sb_getblk(sb, block);
                if (!gdb) {
                        err = -EIO;
@@ -228,6 +261,10 @@ static int setup_new_group_blocks(struct super_block *sb,
 
                ext3_debug("clear reserved block %#04lx (+%d)\n", block, bit);
 
+               err = extend_or_restart_transaction(handle, 1, bh);
+               if (err)
+                       goto exit_bh;
+
                if (IS_ERR(gdb = bclean(handle, sb, block))) {
                        err = PTR_ERR(bh);
                        goto exit_bh;
@@ -249,6 +286,11 @@ static int setup_new_group_blocks(struct super_block *sb,
                struct buffer_head *it;
 
                ext3_debug("clear inode block %#04lx (+%d)\n", block, bit);
+
+               err = extend_or_restart_transaction(handle, 1, bh);
+               if (err)
+                       goto exit_bh;
+
                if (IS_ERR(it = bclean(handle, sb, block))) {
                        err = PTR_ERR(it);
                        goto exit_bh;
@@ -257,6 +299,11 @@ static int setup_new_group_blocks(struct super_block *sb,
                brelse(it);
                ext3_set_bit(bit, bh->b_data);
        }
+
+       err = extend_or_restart_transaction(handle, 2, bh);
+       if (err)
+               goto exit_bh;
+
        mark_bitmap_end(input->blocks_count, EXT3_BLOCKS_PER_GROUP(sb),
                        bh->b_data);
        ext3_journal_dirty_metadata(handle, bh);
@@ -884,9 +931,9 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
                input->reserved_blocks);
 
        /* Update the free space counts */
-       percpu_counter_mod(&sbi->s_freeblocks_counter,
+       percpu_counter_add(&sbi->s_freeblocks_counter,
                           input->free_blocks_count);
-       percpu_counter_mod(&sbi->s_freeinodes_counter,
+       percpu_counter_add(&sbi->s_freeinodes_counter,
                           EXT3_INODES_PER_GROUP(sb));
 
        ext3_journal_dirty_metadata(handle, sbi->s_sbh);
index 9537316a0714eeca51f97c67442ccc36bfa2c539..141573de7a9a4ca69416c24c0a84aa00e8e1674d 100644 (file)
@@ -472,7 +472,7 @@ static void ext3_destroy_inode(struct inode *inode)
        kmem_cache_free(ext3_inode_cachep, EXT3_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct ext3_inode_info *ei = (struct ext3_inode_info *) foo;
 
@@ -545,9 +545,78 @@ static inline void ext3_show_quota_options(struct seq_file *seq, struct super_bl
 #endif
 }
 
+/*
+ * Show an option if
+ *  - it's set to a non-default value OR
+ *  - if the per-sb default is different from the global default
+ */
 static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
 {
        struct super_block *sb = vfs->mnt_sb;
+       struct ext3_sb_info *sbi = EXT3_SB(sb);
+       struct ext3_super_block *es = sbi->s_es;
+       unsigned long def_mount_opts;
+
+       def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
+
+       if (sbi->s_sb_block != 1)
+               seq_printf(seq, ",sb=%lu", sbi->s_sb_block);
+       if (test_opt(sb, MINIX_DF))
+               seq_puts(seq, ",minixdf");
+       if (test_opt(sb, GRPID))
+               seq_puts(seq, ",grpid");
+       if (!test_opt(sb, GRPID) && (def_mount_opts & EXT3_DEFM_BSDGROUPS))
+               seq_puts(seq, ",nogrpid");
+       if (sbi->s_resuid != EXT3_DEF_RESUID ||
+           le16_to_cpu(es->s_def_resuid) != EXT3_DEF_RESUID) {
+               seq_printf(seq, ",resuid=%u", sbi->s_resuid);
+       }
+       if (sbi->s_resgid != EXT3_DEF_RESGID ||
+           le16_to_cpu(es->s_def_resgid) != EXT3_DEF_RESGID) {
+               seq_printf(seq, ",resgid=%u", sbi->s_resgid);
+       }
+       if (test_opt(sb, ERRORS_CONT)) {
+               int def_errors = le16_to_cpu(es->s_errors);
+
+               if (def_errors == EXT3_ERRORS_PANIC ||
+                   def_errors == EXT3_ERRORS_RO) {
+                       seq_puts(seq, ",errors=continue");
+               }
+       }
+       if (test_opt(sb, ERRORS_RO))
+               seq_puts(seq, ",errors=remount-ro");
+       if (test_opt(sb, ERRORS_PANIC))
+               seq_puts(seq, ",errors=panic");
+       if (test_opt(sb, NO_UID32))
+               seq_puts(seq, ",nouid32");
+       if (test_opt(sb, DEBUG))
+               seq_puts(seq, ",debug");
+       if (test_opt(sb, OLDALLOC))
+               seq_puts(seq, ",oldalloc");
+#ifdef CONFIG_EXT3_FS_XATTR
+       if (test_opt(sb, XATTR_USER))
+               seq_puts(seq, ",user_xattr");
+       if (!test_opt(sb, XATTR_USER) &&
+           (def_mount_opts & EXT3_DEFM_XATTR_USER)) {
+               seq_puts(seq, ",nouser_xattr");
+       }
+#endif
+#ifdef CONFIG_EXT3_FS_POSIX_ACL
+       if (test_opt(sb, POSIX_ACL))
+               seq_puts(seq, ",acl");
+       if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT3_DEFM_ACL))
+               seq_puts(seq, ",noacl");
+#endif
+       if (!test_opt(sb, RESERVATION))
+               seq_puts(seq, ",noreservation");
+       if (sbi->s_commit_interval) {
+               seq_printf(seq, ",commit=%u",
+                          (unsigned) (sbi->s_commit_interval / HZ));
+       }
+       if (test_opt(sb, BARRIER))
+               seq_puts(seq, ",barrier=1");
+       if (test_opt(sb, NOBH))
+               seq_puts(seq, ",nobh");
 
        if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
                seq_puts(seq, ",data=journal");
@@ -1416,6 +1485,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
        int i;
        int needs_recovery;
        __le32 features;
+       int err;
 
        sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
@@ -1424,6 +1494,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
        sbi->s_mount_opt = 0;
        sbi->s_resuid = EXT3_DEF_RESUID;
        sbi->s_resgid = EXT3_DEF_RESGID;
+       sbi->s_sb_block = sb_block;
 
        unlock_kernel();
 
@@ -1675,12 +1746,20 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
        get_random_bytes(&sbi->s_next_generation, sizeof(u32));
        spin_lock_init(&sbi->s_next_gen_lock);
 
-       percpu_counter_init(&sbi->s_freeblocks_counter,
-               ext3_count_free_blocks(sb));
-       percpu_counter_init(&sbi->s_freeinodes_counter,
-               ext3_count_free_inodes(sb));
-       percpu_counter_init(&sbi->s_dirs_counter,
-               ext3_count_dirs(sb));
+       err = percpu_counter_init(&sbi->s_freeblocks_counter,
+                       ext3_count_free_blocks(sb));
+       if (!err) {
+               err = percpu_counter_init(&sbi->s_freeinodes_counter,
+                               ext3_count_free_inodes(sb));
+       }
+       if (!err) {
+               err = percpu_counter_init(&sbi->s_dirs_counter,
+                               ext3_count_dirs(sb));
+       }
+       if (err) {
+               printk(KERN_ERR "EXT3-fs: insufficient memory\n");
+               goto failed_mount3;
+       }
 
        /* per fileystem reservation list head & lock */
        spin_lock_init(&sbi->s_rsv_window_lock);
@@ -2472,13 +2551,13 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
        buf->f_type = EXT3_SUPER_MAGIC;
        buf->f_bsize = sb->s_blocksize;
        buf->f_blocks = le32_to_cpu(es->s_blocks_count) - sbi->s_overhead_last;
-       buf->f_bfree = percpu_counter_sum(&sbi->s_freeblocks_counter);
+       buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter);
        es->s_free_blocks_count = cpu_to_le32(buf->f_bfree);
        buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count);
        if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count))
                buf->f_bavail = 0;
        buf->f_files = le32_to_cpu(es->s_inodes_count);
-       buf->f_ffree = percpu_counter_sum(&sbi->s_freeinodes_counter);
+       buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter);
        es->s_free_inodes_count = cpu_to_le32(buf->f_ffree);
        buf->f_namelen = EXT3_NAME_LEN;
        fsid = le64_to_cpup((void *)es->s_uuid) ^
index e53b4af52f1119ddf54b6b8c316c62ca429edc65..b74bf436844187c32cce9cc31ecdce1031a1cc1e 100644 (file)
@@ -100,6 +100,15 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
        return desc;
 }
 
+static inline int
+block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map)
+{
+       ext4_grpblk_t offset;
+
+       ext4_get_group_no_and_offset(sb, block, NULL, &offset);
+       return ext4_test_bit (offset, map);
+}
+
 /**
  * read_block_bitmap()
  * @sb:                        super block
@@ -113,21 +122,53 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
 static struct buffer_head *
 read_block_bitmap(struct super_block *sb, unsigned int block_group)
 {
+       int i;
        struct ext4_group_desc * desc;
        struct buffer_head * bh = NULL;
+       ext4_fsblk_t bitmap_blk;
 
        desc = ext4_get_group_desc (sb, block_group, NULL);
        if (!desc)
-               goto error_out;
-       bh = sb_bread(sb, ext4_block_bitmap(sb, desc));
+               return NULL;
+       bitmap_blk = ext4_block_bitmap(sb, desc);
+       bh = sb_bread(sb, bitmap_blk);
        if (!bh)
-               ext4_error (sb, "read_block_bitmap",
+               ext4_error (sb, __FUNCTION__,
                            "Cannot read block bitmap - "
                            "block_group = %d, block_bitmap = %llu",
-                           block_group,
-                           ext4_block_bitmap(sb, desc));
-error_out:
+                           block_group, bitmap_blk);
+
+       /* check whether block bitmap block number is set */
+       if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+               /* bad block bitmap */
+               goto error_out;
+       }
+
+       /* check whether the inode bitmap block number is set */
+       bitmap_blk = ext4_inode_bitmap(sb, desc);
+       if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+               /* bad block bitmap */
+               goto error_out;
+       }
+       /* check whether the inode table block number is set */
+       bitmap_blk = ext4_inode_table(sb, desc);
+       for (i = 0; i < EXT4_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
+               if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
+                       /* bad block bitmap */
+                       goto error_out;
+               }
+       }
+
        return bh;
+
+error_out:
+       brelse(bh);
+       ext4_error(sb, __FUNCTION__,
+                       "Invalid block bitmap - "
+                       "block_group = %d, block = %llu",
+                       block_group, bitmap_blk);
+       return NULL;
+
 }
 /*
  * The reservation window structure operations
@@ -587,7 +628,7 @@ do_more:
                cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
                        group_freed);
        spin_unlock(sb_bgl_lock(sbi, block_group));
-       percpu_counter_mod(&sbi->s_freeblocks_counter, count);
+       percpu_counter_add(&sbi->s_freeblocks_counter, count);
 
        /* We dirtied the bitmap block */
        BUFFER_TRACE(bitmap_bh, "dirtied bitmap block");
@@ -1647,7 +1688,7 @@ allocated:
        gdp->bg_free_blocks_count =
                        cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
        spin_unlock(sb_bgl_lock(sbi, group_no));
-       percpu_counter_mod(&sbi->s_freeblocks_counter, -num);
+       percpu_counter_sub(&sbi->s_freeblocks_counter, num);
 
        BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor");
        err = ext4_journal_dirty_metadata(handle, gdp_bh);
@@ -1747,15 +1788,6 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
 #endif
 }
 
-static inline int
-block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map)
-{
-       ext4_grpblk_t offset;
-
-       ext4_get_group_no_and_offset(sb, block, NULL, &offset);
-       return ext4_test_bit (offset, map);
-}
-
 static inline int test_root(int a, int b)
 {
        int num = b;
index 11e93c169bcfdf5474b2bbcb76a8fed2af61e66e..420554f8f79d8f4fb4a99a95bec9539e6c78f8bc 100644 (file)
@@ -13,7 +13,7 @@
 
 #ifdef EXT4FS_DEBUG
 
-static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
+static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
 
 unsigned long ext4_count_free (struct buffer_head * map, unsigned int numchars)
 {
index e11890acfa21e5199a425eacb2e662c2402ab9bf..0fb1e62b20d09e25d89c9cfbf00495212f051afe 100644 (file)
@@ -210,7 +210,7 @@ revalidate:
                                 * not the directory has been modified
                                 * during the copy operation.
                                 */
-                               unsigned long version = filp->f_version;
+                               u64 version = filp->f_version;
 
                                error = filldir(dirent, de->name,
                                                de->name_len,
index 427f83066a0da425b75757c68430768bba7428ea..d0c7793d939395c2500def60e7aa01a680cf2704 100644 (file)
@@ -204,14 +204,13 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
        int ngroups = EXT4_SB(sb)->s_groups_count;
        unsigned int freei, avefreei;
        struct ext4_group_desc *desc, *best_desc = NULL;
-       struct buffer_head *bh;
        int group, best_group = -1;
 
        freei = percpu_counter_read_positive(&EXT4_SB(sb)->s_freeinodes_counter);
        avefreei = freei / ngroups;
 
        for (group = 0; group < ngroups; group++) {
-               desc = ext4_get_group_desc (sb, group, &bh);
+               desc = ext4_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei)
@@ -269,7 +268,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
        ext4_grpblk_t min_blocks;
        int group = -1, i;
        struct ext4_group_desc *desc;
-       struct buffer_head *bh;
 
        freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter);
        avefreei = freei / ngroups;
@@ -287,7 +285,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
                parent_group = (unsigned)group % ngroups;
                for (i = 0; i < ngroups; i++) {
                        group = (parent_group + i) % ngroups;
-                       desc = ext4_get_group_desc (sb, group, &bh);
+                       desc = ext4_get_group_desc (sb, group, NULL);
                        if (!desc || !desc->bg_free_inodes_count)
                                continue;
                        if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir)
@@ -322,7 +320,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 
        for (i = 0; i < ngroups; i++) {
                group = (parent_group + i) % ngroups;
-               desc = ext4_get_group_desc (sb, group, &bh);
+               desc = ext4_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs)
@@ -337,7 +335,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 fallback:
        for (i = 0; i < ngroups; i++) {
                group = (parent_group + i) % ngroups;
-               desc = ext4_get_group_desc (sb, group, &bh);
+               desc = ext4_get_group_desc (sb, group, NULL);
                if (!desc || !desc->bg_free_inodes_count)
                        continue;
                if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei)
@@ -361,14 +359,13 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
        int parent_group = EXT4_I(parent)->i_block_group;
        int ngroups = EXT4_SB(sb)->s_groups_count;
        struct ext4_group_desc *desc;
-       struct buffer_head *bh;
        int group, i;
 
        /*
         * Try to place the inode in its parent directory
         */
        group = parent_group;
-       desc = ext4_get_group_desc (sb, group, &bh);
+       desc = ext4_get_group_desc (sb, group, NULL);
        if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
                        le16_to_cpu(desc->bg_free_blocks_count))
                return group;
@@ -392,7 +389,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
                group += i;
                if (group >= ngroups)
                        group -= ngroups;
-               desc = ext4_get_group_desc (sb, group, &bh);
+               desc = ext4_get_group_desc (sb, group, NULL);
                if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
                                le16_to_cpu(desc->bg_free_blocks_count))
                        return group;
@@ -406,7 +403,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
        for (i = 0; i < ngroups; i++) {
                if (++group >= ngroups)
                        group = 0;
-               desc = ext4_get_group_desc (sb, group, &bh);
+               desc = ext4_get_group_desc (sb, group, NULL);
                if (desc && le16_to_cpu(desc->bg_free_inodes_count))
                        return group;
        }
index aa11d7dbe9700106725f79c682aebda39a97bc9f..472fc0d3e1c0776de5e4594321e66b69795bd1ed 100644 (file)
@@ -893,9 +893,9 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
                input->reserved_blocks);
 
        /* Update the free space counts */
-       percpu_counter_mod(&sbi->s_freeblocks_counter,
+       percpu_counter_add(&sbi->s_freeblocks_counter,
                           input->free_blocks_count);
-       percpu_counter_mod(&sbi->s_freeinodes_counter,
+       percpu_counter_add(&sbi->s_freeinodes_counter,
                           EXT4_INODES_PER_GROUP(sb));
 
        ext4_journal_dirty_metadata(handle, sbi->s_sbh);
index 3c1397fa83df075a6c3e6cfb7df3929a7ebbd563..4c8d31c6145442e3236aa9785b2b6889100bdcad 100644 (file)
@@ -523,7 +523,7 @@ static void ext4_destroy_inode(struct inode *inode)
        kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct ext4_inode_info *ei = (struct ext4_inode_info *) foo;
 
@@ -596,9 +596,80 @@ static inline void ext4_show_quota_options(struct seq_file *seq, struct super_bl
 #endif
 }
 
+/*
+ * Show an option if
+ *  - it's set to a non-default value OR
+ *  - if the per-sb default is different from the global default
+ */
 static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
 {
        struct super_block *sb = vfs->mnt_sb;
+       struct ext4_sb_info *sbi = EXT4_SB(sb);
+       struct ext4_super_block *es = sbi->s_es;
+       unsigned long def_mount_opts;
+
+       def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
+
+       if (sbi->s_sb_block != 1)
+               seq_printf(seq, ",sb=%llu", sbi->s_sb_block);
+       if (test_opt(sb, MINIX_DF))
+               seq_puts(seq, ",minixdf");
+       if (test_opt(sb, GRPID))
+               seq_puts(seq, ",grpid");
+       if (!test_opt(sb, GRPID) && (def_mount_opts & EXT4_DEFM_BSDGROUPS))
+               seq_puts(seq, ",nogrpid");
+       if (sbi->s_resuid != EXT4_DEF_RESUID ||
+           le16_to_cpu(es->s_def_resuid) != EXT4_DEF_RESUID) {
+               seq_printf(seq, ",resuid=%u", sbi->s_resuid);
+       }
+       if (sbi->s_resgid != EXT4_DEF_RESGID ||
+           le16_to_cpu(es->s_def_resgid) != EXT4_DEF_RESGID) {
+               seq_printf(seq, ",resgid=%u", sbi->s_resgid);
+       }
+       if (test_opt(sb, ERRORS_CONT)) {
+               int def_errors = le16_to_cpu(es->s_errors);
+
+               if (def_errors == EXT4_ERRORS_PANIC ||
+                   def_errors == EXT4_ERRORS_RO) {
+                       seq_puts(seq, ",errors=continue");
+               }
+       }
+       if (test_opt(sb, ERRORS_RO))
+               seq_puts(seq, ",errors=remount-ro");
+       if (test_opt(sb, ERRORS_PANIC))
+               seq_puts(seq, ",errors=panic");
+       if (test_opt(sb, NO_UID32))
+               seq_puts(seq, ",nouid32");
+       if (test_opt(sb, DEBUG))
+               seq_puts(seq, ",debug");
+       if (test_opt(sb, OLDALLOC))
+               seq_puts(seq, ",oldalloc");
+#ifdef CONFIG_EXT4_FS_XATTR
+       if (test_opt(sb, XATTR_USER))
+               seq_puts(seq, ",user_xattr");
+       if (!test_opt(sb, XATTR_USER) &&
+           (def_mount_opts & EXT4_DEFM_XATTR_USER)) {
+               seq_puts(seq, ",nouser_xattr");
+       }
+#endif
+#ifdef CONFIG_EXT4_FS_POSIX_ACL
+       if (test_opt(sb, POSIX_ACL))
+               seq_puts(seq, ",acl");
+       if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL))
+               seq_puts(seq, ",noacl");
+#endif
+       if (!test_opt(sb, RESERVATION))
+               seq_puts(seq, ",noreservation");
+       if (sbi->s_commit_interval) {
+               seq_printf(seq, ",commit=%u",
+                          (unsigned) (sbi->s_commit_interval / HZ));
+       }
+       if (test_opt(sb, BARRIER))
+               seq_puts(seq, ",barrier=1");
+       if (test_opt(sb, NOBH))
+               seq_puts(seq, ",nobh");
+       if (!test_opt(sb, EXTENTS))
+               seq_puts(seq, ",noextents");
 
        if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
                seq_puts(seq, ",data=journal");
@@ -1415,8 +1486,6 @@ static void ext4_orphan_cleanup (struct super_block * sb,
        sb->s_flags = s_flags; /* Restore MS_RDONLY status */
 }
 
-#define log2(n) ffz(~(n))
-
 /*
  * Maximal file size.  There is a direct, and {,double-,triple-}indirect
  * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks.
@@ -1479,6 +1548,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        int needs_recovery;
        __le32 features;
        __u64 blocks_count;
+       int err;
 
        sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
@@ -1487,6 +1557,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        sbi->s_mount_opt = 0;
        sbi->s_resuid = EXT4_DEF_RESUID;
        sbi->s_resgid = EXT4_DEF_RESGID;
+       sbi->s_sb_block = sb_block;
 
        unlock_kernel();
 
@@ -1667,7 +1738,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) {
                if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
                    sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||
-                   sbi->s_desc_size & (sbi->s_desc_size - 1)) {
+                   !is_power_of_2(sbi->s_desc_size)) {
                        printk(KERN_ERR
                               "EXT4-fs: unsupported descriptor size %lu\n",
                               sbi->s_desc_size);
@@ -1688,8 +1759,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);
        sbi->s_sbh = bh;
        sbi->s_mount_state = le16_to_cpu(es->s_state);
-       sbi->s_addr_per_block_bits = log2(EXT4_ADDR_PER_BLOCK(sb));
-       sbi->s_desc_per_block_bits = log2(EXT4_DESC_PER_BLOCK(sb));
+       sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));
+       sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));
        for (i=0; i < 4; i++)
                sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);
        sbi->s_def_hash_version = es->s_def_hash_version;
@@ -1759,12 +1830,20 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
        get_random_bytes(&sbi->s_next_generation, sizeof(u32));
        spin_lock_init(&sbi->s_next_gen_lock);
 
-       percpu_counter_init(&sbi->s_freeblocks_counter,
-               ext4_count_free_blocks(sb));
-       percpu_counter_init(&sbi->s_freeinodes_counter,
-               ext4_count_free_inodes(sb));
-       percpu_counter_init(&sbi->s_dirs_counter,
-               ext4_count_dirs(sb));
+       err = percpu_counter_init(&sbi->s_freeblocks_counter,
+                       ext4_count_free_blocks(sb));
+       if (!err) {
+               err = percpu_counter_init(&sbi->s_freeinodes_counter,
+                               ext4_count_free_inodes(sb));
+       }
+       if (!err) {
+               err = percpu_counter_init(&sbi->s_dirs_counter,
+                               ext4_count_dirs(sb));
+       }
+       if (err) {
+               printk(KERN_ERR "EXT4-fs: insufficient memory\n");
+               goto failed_mount3;
+       }
 
        /* per fileystem reservation list head & lock */
        spin_lock_init(&sbi->s_rsv_window_lock);
@@ -2592,13 +2671,13 @@ static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf)
        buf->f_type = EXT4_SUPER_MAGIC;
        buf->f_bsize = sb->s_blocksize;
        buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last;
-       buf->f_bfree = percpu_counter_sum(&sbi->s_freeblocks_counter);
+       buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter);
        es->s_free_blocks_count = cpu_to_le32(buf->f_bfree);
        buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es);
        if (buf->f_bfree < ext4_r_blocks_count(es))
                buf->f_bavail = 0;
        buf->f_files = le32_to_cpu(es->s_inodes_count);
-       buf->f_ffree = percpu_counter_sum(&sbi->s_freeinodes_counter);
+       buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter);
        es->s_free_inodes_count = cpu_to_le32(buf->f_ffree);
        buf->f_namelen = EXT4_NAME_LEN;
        fsid = le64_to_cpup((void *)es->s_uuid) ^
index be6f89b152caf6e69d3afb160eb508c65e46bd26..639b3b4f86d15a8a17a331a3fabdbb16d0bc8048 100644 (file)
@@ -36,7 +36,7 @@ static inline int fat_max_cache(struct inode *inode)
 
 static struct kmem_cache *fat_cache_cachep;
 
-static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct fat_cache *cache = (struct fat_cache *)foo;
 
index 46b8a67f55c6ae9235f507f1b587922702327c96..c0c5e9c55b588c37264deb5be91bb42c64d1f2a0 100644 (file)
@@ -501,7 +501,7 @@ static void fat_destroy_inode(struct inode *inode)
        kmem_cache_free(fat_inode_cachep, MSDOS_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct msdos_inode_info *ei = (struct msdos_inode_info *)foo;
 
index 78b2ff04405400c724c9aff18a0f000be577c908..c9db73fc5e3d2d2e137bab66724d4c91f3d7544c 100644 (file)
@@ -110,7 +110,7 @@ out:
        return error;
 }
 
-static int dupfd(struct file *file, unsigned int start)
+static int dupfd(struct file *file, unsigned int start, int cloexec)
 {
        struct files_struct * files = current->files;
        struct fdtable *fdt;
@@ -122,7 +122,10 @@ static int dupfd(struct file *file, unsigned int start)
                /* locate_fd() may have expanded fdtable, load the ptr */
                fdt = files_fdtable(files);
                FD_SET(fd, fdt->open_fds);
-               FD_CLR(fd, fdt->close_on_exec);
+               if (cloexec)
+                       FD_SET(fd, fdt->close_on_exec);
+               else
+                       FD_CLR(fd, fdt->close_on_exec);
                spin_unlock(&files->file_lock);
                fd_install(fd, file);
        } else {
@@ -195,7 +198,7 @@ asmlinkage long sys_dup(unsigned int fildes)
        struct file * file = fget(fildes);
 
        if (file)
-               ret = dupfd(file, 0);
+               ret = dupfd(file, 0, 0);
        return ret;
 }
 
@@ -319,8 +322,9 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
 
        switch (cmd) {
        case F_DUPFD:
+       case F_DUPFD_CLOEXEC:
                get_file(filp);
-               err = dupfd(filp, arg);
+               err = dupfd(filp, arg, cmd == F_DUPFD_CLOEXEC);
                break;
        case F_GETFD:
                err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;
index d17fd691b8325c8dab7c4ab086bfb1900687b1e0..3176fefc92e139771a9c9065524c26e8e437e7fa 100644 (file)
@@ -98,16 +98,15 @@ struct file *get_empty_filp(void)
                 * percpu_counters are inaccurate.  Do an expensive check before
                 * we go and fail.
                 */
-               if (percpu_counter_sum(&nr_files) >= files_stat.max_files)
+               if (percpu_counter_sum_positive(&nr_files) >= files_stat.max_files)
                        goto over;
        }
 
-       f = kmem_cache_alloc(filp_cachep, GFP_KERNEL);
+       f = kmem_cache_zalloc(filp_cachep, GFP_KERNEL);
        if (f == NULL)
                goto fail;
 
        percpu_counter_inc(&nr_files);
-       memset(f, 0, sizeof(*f));
        if (security_file_alloc(f))
                goto fail_sec;
 
@@ -138,6 +137,66 @@ fail:
 
 EXPORT_SYMBOL(get_empty_filp);
 
+/**
+ * alloc_file - allocate and initialize a 'struct file'
+ * @mnt: the vfsmount on which the file will reside
+ * @dentry: the dentry representing the new file
+ * @mode: the mode with which the new file will be opened
+ * @fop: the 'struct file_operations' for the new file
+ *
+ * Use this instead of get_empty_filp() to get a new
+ * 'struct file'.  Do so because of the same initialization
+ * pitfalls reasons listed for init_file().  This is a
+ * preferred interface to using init_file().
+ *
+ * If all the callers of init_file() are eliminated, its
+ * code should be moved into this function.
+ */
+struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
+               mode_t mode, const struct file_operations *fop)
+{
+       struct file *file;
+       struct path;
+
+       file = get_empty_filp();
+       if (!file)
+               return NULL;
+
+       init_file(file, mnt, dentry, mode, fop);
+       return file;
+}
+EXPORT_SYMBOL(alloc_file);
+
+/**
+ * init_file - initialize a 'struct file'
+ * @file: the already allocated 'struct file' to initialized
+ * @mnt: the vfsmount on which the file resides
+ * @dentry: the dentry representing this file
+ * @mode: the mode the file is opened with
+ * @fop: the 'struct file_operations' for this file
+ *
+ * Use this instead of setting the members directly.  Doing so
+ * avoids making mistakes like forgetting the mntget() or
+ * forgetting to take a write on the mnt.
+ *
+ * Note: This is a crappy interface.  It is here to make
+ * merging with the existing users of get_empty_filp()
+ * who have complex failure logic easier.  All users
+ * of this should be moving to alloc_file().
+ */
+int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry,
+          mode_t mode, const struct file_operations *fop)
+{
+       int error = 0;
+       file->f_path.dentry = dentry;
+       file->f_path.mnt = mntget(mnt);
+       file->f_mapping = dentry->d_inode->i_mapping;
+       file->f_mode = mode;
+       file->f_op = fop;
+       return error;
+}
+EXPORT_SYMBOL(init_file);
+
 void fastcall fput(struct file *file)
 {
        if (atomic_dec_and_test(&file->f_count))
index 8d23b0b3871744a9fad98f3fcbdf5470083fb20d..686734ff973d947f6f393d2e5fe14427040e978c 100644 (file)
@@ -100,11 +100,11 @@ void __mark_inode_dirty(struct inode *inode, int flags)
                inode->i_state |= flags;
 
                /*
-                * If the inode is locked, just update its dirty state. 
+                * If the inode is being synced, just update its dirty state.
                 * The unlocker will place the inode on the appropriate
                 * superblock list, based upon its state.
                 */
-               if (inode->i_state & I_LOCK)
+               if (inode->i_state & I_SYNC)
                        goto out;
 
                /*
@@ -119,7 +119,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
                        goto out;
 
                /*
-                * If the inode was already on s_dirty or s_io, don't
+                * If the inode was already on s_dirty/s_io/s_more_io, don't
                 * reposition it (that would break s_dirty time-ordering).
                 */
                if (!was_dirty) {
@@ -140,6 +140,82 @@ static int write_inode(struct inode *inode, int sync)
        return 0;
 }
 
+/*
+ * Redirty an inode: set its when-it-was dirtied timestamp and move it to the
+ * furthest end of its superblock's dirty-inode list.
+ *
+ * Before stamping the inode's ->dirtied_when, we check to see whether it is
+ * already the most-recently-dirtied inode on the s_dirty list.  If that is
+ * the case then the inode must have been redirtied while it was being written
+ * out and we don't reset its dirtied_when.
+ */
+static void redirty_tail(struct inode *inode)
+{
+       struct super_block *sb = inode->i_sb;
+
+       if (!list_empty(&sb->s_dirty)) {
+               struct inode *tail_inode;
+
+               tail_inode = list_entry(sb->s_dirty.next, struct inode, i_list);
+               if (!time_after_eq(inode->dirtied_when,
+                               tail_inode->dirtied_when))
+                       inode->dirtied_when = jiffies;
+       }
+       list_move(&inode->i_list, &sb->s_dirty);
+}
+
+/*
+ * requeue inode for re-scanning after sb->s_io list is exhausted.
+ */
+static void requeue_io(struct inode *inode)
+{
+       list_move(&inode->i_list, &inode->i_sb->s_more_io);
+}
+
+static void inode_sync_complete(struct inode *inode)
+{
+       /*
+        * Prevent speculative execution through spin_unlock(&inode_lock);
+        */
+       smp_mb();
+       wake_up_bit(&inode->i_state, __I_SYNC);
+}
+
+/*
+ * Move expired dirty inodes from @delaying_queue to @dispatch_queue.
+ */
+static void move_expired_inodes(struct list_head *delaying_queue,
+                              struct list_head *dispatch_queue,
+                               unsigned long *older_than_this)
+{
+       while (!list_empty(delaying_queue)) {
+               struct inode *inode = list_entry(delaying_queue->prev,
+                                               struct inode, i_list);
+               if (older_than_this &&
+                       time_after(inode->dirtied_when, *older_than_this))
+                       break;
+               list_move(&inode->i_list, dispatch_queue);
+       }
+}
+
+/*
+ * Queue all expired dirty inodes for io, eldest first.
+ */
+static void queue_io(struct super_block *sb,
+                               unsigned long *older_than_this)
+{
+       list_splice_init(&sb->s_more_io, sb->s_io.prev);
+       move_expired_inodes(&sb->s_dirty, &sb->s_io, older_than_this);
+}
+
+int sb_has_dirty_inodes(struct super_block *sb)
+{
+       return !list_empty(&sb->s_dirty) ||
+              !list_empty(&sb->s_io) ||
+              !list_empty(&sb->s_more_io);
+}
+EXPORT_SYMBOL(sb_has_dirty_inodes);
+
 /*
  * Write a single inode's dirty pages and inode data out to disk.
  * If `wait' is set, wait on the writeout.
@@ -155,15 +231,14 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
 {
        unsigned dirty;
        struct address_space *mapping = inode->i_mapping;
-       struct super_block *sb = inode->i_sb;
        int wait = wbc->sync_mode == WB_SYNC_ALL;
        int ret;
 
-       BUG_ON(inode->i_state & I_LOCK);
+       BUG_ON(inode->i_state & I_SYNC);
 
-       /* Set I_LOCK, reset I_DIRTY */
+       /* Set I_SYNC, reset I_DIRTY */
        dirty = inode->i_state & I_DIRTY;
-       inode->i_state |= I_LOCK;
+       inode->i_state |= I_SYNC;
        inode->i_state &= ~I_DIRTY;
 
        spin_unlock(&inode_lock);
@@ -184,24 +259,32 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
        }
 
        spin_lock(&inode_lock);
-       inode->i_state &= ~I_LOCK;
+       inode->i_state &= ~I_SYNC;
        if (!(inode->i_state & I_FREEING)) {
                if (!(inode->i_state & I_DIRTY) &&
                    mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
                        /*
                         * We didn't write back all the pages.  nfs_writepages()
                         * sometimes bales out without doing anything. Redirty
-                        * the inode.  It is still on sb->s_io.
+                        * the inode; Move it from s_io onto s_more_io/s_dirty.
+                        */
+                       /*
+                        * akpm: if the caller was the kupdate function we put
+                        * this inode at the head of s_dirty so it gets first
+                        * consideration.  Otherwise, move it to the tail, for
+                        * the reasons described there.  I'm not really sure
+                        * how much sense this makes.  Presumably I had a good
+                        * reasons for doing it this way, and I'd rather not
+                        * muck with it at present.
                         */
                        if (wbc->for_kupdate) {
                                /*
-                                * For the kupdate function we leave the inode
-                                * at the head of sb_dirty so it will get more
-                                * writeout as soon as the queue becomes
-                                * uncongested.
+                                * For the kupdate function we move the inode
+                                * to s_more_io so it will get more writeout as
+                                * soon as the queue becomes uncongested.
                                 */
                                inode->i_state |= I_DIRTY_PAGES;
-                               list_move_tail(&inode->i_list, &sb->s_dirty);
+                               requeue_io(inode);
                        } else {
                                /*
                                 * Otherwise fully redirty the inode so that
@@ -211,15 +294,14 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
                                 * all the other files.
                                 */
                                inode->i_state |= I_DIRTY_PAGES;
-                               inode->dirtied_when = jiffies;
-                               list_move(&inode->i_list, &sb->s_dirty);
+                               redirty_tail(inode);
                        }
                } else if (inode->i_state & I_DIRTY) {
                        /*
                         * Someone redirtied the inode while were writing back
                         * the pages.
                         */
-                       list_move(&inode->i_list, &sb->s_dirty);
+                       redirty_tail(inode);
                } else if (atomic_read(&inode->i_count)) {
                        /*
                         * The inode is clean, inuse
@@ -232,7 +314,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
                        list_move(&inode->i_list, &inode_unused);
                }
        }
-       wake_up_inode(inode);
+       inode_sync_complete(inode);
        return ret;
 }
 
@@ -251,11 +333,18 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
        else
                WARN_ON(inode->i_state & I_WILL_FREE);
 
-       if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_LOCK)) {
+       if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_SYNC)) {
                struct address_space *mapping = inode->i_mapping;
                int ret;
 
-               list_move(&inode->i_list, &inode->i_sb->s_dirty);
+               /*
+                * We're skipping this inode because it's locked, and we're not
+                * doing writeback-for-data-integrity.  Move it to s_more_io so
+                * that writeback can proceed with the other inodes on s_io.
+                * We'll have another go at writing back this inode when we
+                * completed a full scan of s_io.
+                */
+               requeue_io(inode);
 
                /*
                 * Even if we don't actually write the inode itself here,
@@ -270,16 +359,16 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
        /*
         * It's a data-integrity sync.  We must wait.
         */
-       if (inode->i_state & I_LOCK) {
-               DEFINE_WAIT_BIT(wq, &inode->i_state, __I_LOCK);
+       if (inode->i_state & I_SYNC) {
+               DEFINE_WAIT_BIT(wq, &inode->i_state, __I_SYNC);
 
-               wqh = bit_waitqueue(&inode->i_state, __I_LOCK);
+               wqh = bit_waitqueue(&inode->i_state, __I_SYNC);
                do {
                        spin_unlock(&inode_lock);
                        __wait_on_bit(wqh, &wq, inode_wait,
                                                        TASK_UNINTERRUPTIBLE);
                        spin_lock(&inode_lock);
-               } while (inode->i_state & I_LOCK);
+               } while (inode->i_state & I_SYNC);
        }
        return __sync_single_inode(inode, wbc);
 }
@@ -312,7 +401,7 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
  * The inodes to be written are parked on sb->s_io.  They are moved back onto
  * sb->s_dirty as they are selected for writing.  This way, none can be missed
  * on the writer throttling path, and we get decent balancing between many
- * throttled threads: we don't want them all piling up on __wait_on_inode.
+ * throttled threads: we don't want them all piling up on inode_sync_wait.
  */
 static void
 sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
@@ -320,7 +409,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
        const unsigned long start = jiffies;    /* livelock avoidance */
 
        if (!wbc->for_kupdate || list_empty(&sb->s_io))
-               list_splice_init(&sb->s_dirty, &sb->s_io);
+               queue_io(sb, wbc->older_than_this);
 
        while (!list_empty(&sb->s_io)) {
                struct inode *inode = list_entry(sb->s_io.prev,
@@ -330,7 +419,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
                long pages_skipped;
 
                if (!bdi_cap_writeback_dirty(bdi)) {
-                       list_move(&inode->i_list, &sb->s_dirty);
+                       redirty_tail(inode);
                        if (sb_is_blkdev_sb(sb)) {
                                /*
                                 * Dirty memory-backed blockdev: the ramdisk
@@ -350,14 +439,14 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
                        wbc->encountered_congestion = 1;
                        if (!sb_is_blkdev_sb(sb))
                                break;          /* Skip a congested fs */
-                       list_move(&inode->i_list, &sb->s_dirty);
+                       requeue_io(inode);
                        continue;               /* Skip a congested blockdev */
                }
 
                if (wbc->bdi && bdi != wbc->bdi) {
                        if (!sb_is_blkdev_sb(sb))
                                break;          /* fs has the wrong queue */
-                       list_move(&inode->i_list, &sb->s_dirty);
+                       requeue_io(inode);
                        continue;               /* blockdev has wrong queue */
                }
 
@@ -365,11 +454,6 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
                if (time_after(inode->dirtied_when, start))
                        break;
 
-               /* Was this inode dirtied too recently? */
-               if (wbc->older_than_this && time_after(inode->dirtied_when,
-                                               *wbc->older_than_this))
-                       break;
-
                /* Is another pdflush already flushing this queue? */
                if (current_is_pdflush() && !writeback_acquire(bdi))
                        break;
@@ -389,7 +473,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
                         * writeback is not making progress due to locked
                         * buffers.  Skip this inode for now.
                         */
-                       list_move(&inode->i_list, &sb->s_dirty);
+                       redirty_tail(inode);
                }
                spin_unlock(&inode_lock);
                iput(inode);
@@ -398,6 +482,8 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
                if (wbc->nr_to_write <= 0)
                        break;
        }
+       if (!list_empty(&sb->s_more_io))
+               wbc->more_io = 1;
        return;         /* Leave any unwritten inodes on s_io */
 }
 
@@ -407,7 +493,7 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
  * Note:
  * We don't need to grab a reference to superblock here. If it has non-empty
  * ->s_dirty it's hadn't been killed yet and kill_super() won't proceed
- * past sync_inodes_sb() until both the ->s_dirty and ->s_io lists are
+ * past sync_inodes_sb() until the ->s_dirty/s_io/s_more_io lists are all
  * empty. Since __sync_single_inode() regains inode_lock before it finally moves
  * inode from superblock lists we are OK.
  *
@@ -430,7 +516,7 @@ writeback_inodes(struct writeback_control *wbc)
 restart:
        sb = sb_entry(super_blocks.prev);
        for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) {
-               if (!list_empty(&sb->s_dirty) || !list_empty(&sb->s_io)) {
+               if (sb_has_dirty_inodes(sb)) {
                        /* we're making our own get_super here */
                        sb->s_count++;
                        spin_unlock(&sb_lock);
@@ -584,7 +670,7 @@ int write_inode_now(struct inode *inode, int sync)
        ret = __writeback_single_inode(inode, &wbc);
        spin_unlock(&inode_lock);
        if (sync)
-               wait_on_inode(inode);
+               inode_sync_wait(inode);
        return ret;
 }
 EXPORT_SYMBOL(write_inode_now);
@@ -659,7 +745,7 @@ int generic_osync_inode(struct inode *inode, struct address_space *mapping, int
                        err = err2;
        }
        else
-               wait_on_inode(inode);
+               inode_sync_wait(inode);
 
        return err;
 }
index 3ad22beb24c2ed3adf973099e4ed8dc87c9e48be..db534bcde45f6ff52a7cbfb44fcb8b49ea9bbb9d 100644 (file)
@@ -129,7 +129,7 @@ static struct fuse_req *get_reserved_req(struct fuse_conn *fc,
        struct fuse_file *ff = file->private_data;
 
        do {
-               wait_event(fc->blocked_waitq, ff->reserved_req);
+               wait_event(fc->reserved_req_waitq, ff->reserved_req);
                spin_lock(&fc->lock);
                if (ff->reserved_req) {
                        req = ff->reserved_req;
@@ -155,7 +155,7 @@ static void put_reserved_req(struct fuse_conn *fc, struct fuse_req *req)
        fuse_request_init(req);
        BUG_ON(ff->reserved_req);
        ff->reserved_req = req;
-       wake_up(&fc->blocked_waitq);
+       wake_up_all(&fc->reserved_req_waitq);
        spin_unlock(&fc->lock);
        fput(file);
 }
@@ -224,13 +224,13 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)
                        fc->blocked = 0;
                        wake_up_all(&fc->blocked_waitq);
                }
+               if (fc->num_background == FUSE_CONGESTION_THRESHOLD) {
+                       clear_bdi_congested(&fc->bdi, READ);
+                       clear_bdi_congested(&fc->bdi, WRITE);
+               }
                fc->num_background--;
        }
        spin_unlock(&fc->lock);
-       dput(req->dentry);
-       mntput(req->vfsmount);
-       if (req->file)
-               fput(req->file);
        wake_up(&req->waitq);
        if (end)
                end(fc, req);
@@ -273,28 +273,41 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
                        queue_interrupt(fc, req);
        }
 
-       if (req->force) {
-               spin_unlock(&fc->lock);
-               wait_event(req->waitq, req->state == FUSE_REQ_FINISHED);
-               spin_lock(&fc->lock);
-       } else {
+       if (!req->force) {
                sigset_t oldset;
 
                /* Only fatal signals may interrupt this */
                block_sigs(&oldset);
                wait_answer_interruptible(fc, req);
                restore_sigs(&oldset);
+
+               if (req->aborted)
+                       goto aborted;
+               if (req->state == FUSE_REQ_FINISHED)
+                       return;
+
+               /* Request is not yet in userspace, bail out */
+               if (req->state == FUSE_REQ_PENDING) {
+                       list_del(&req->list);
+                       __fuse_put_request(req);
+                       req->out.h.error = -EINTR;
+                       return;
+               }
        }
 
-       if (req->aborted)
-               goto aborted;
-       if (req->state == FUSE_REQ_FINISHED)
-               return;
+       /*
+        * Either request is already in userspace, or it was forced.
+        * Wait it out.
+        */
+       spin_unlock(&fc->lock);
+       wait_event(req->waitq, req->state == FUSE_REQ_FINISHED);
+       spin_lock(&fc->lock);
 
-       req->out.h.error = -EINTR;
-       req->aborted = 1;
+       if (!req->aborted)
+               return;
 
  aborted:
+       BUG_ON(req->state != FUSE_REQ_FINISHED);
        if (req->locked) {
                /* This is uninterruptible sleep, because data is
                   being copied to/from the buffers of req.  During
@@ -305,14 +318,6 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
                wait_event(req->waitq, !req->locked);
                spin_lock(&fc->lock);
        }
-       if (req->state == FUSE_REQ_PENDING) {
-               list_del(&req->list);
-               __fuse_put_request(req);
-       } else if (req->state == FUSE_REQ_SENT) {
-               spin_unlock(&fc->lock);
-               wait_event(req->waitq, req->state == FUSE_REQ_FINISHED);
-               spin_lock(&fc->lock);
-       }
 }
 
 static unsigned len_args(unsigned numargs, struct fuse_arg *args)
@@ -378,6 +383,10 @@ static void request_send_nowait(struct fuse_conn *fc, struct fuse_req *req)
                fc->num_background++;
                if (fc->num_background == FUSE_MAX_BACKGROUND)
                        fc->blocked = 1;
+               if (fc->num_background == FUSE_CONGESTION_THRESHOLD) {
+                       set_bdi_congested(&fc->bdi, READ);
+                       set_bdi_congested(&fc->bdi, WRITE);
+               }
 
                queue_request(fc, req);
                spin_unlock(&fc->lock);
@@ -738,11 +747,12 @@ static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov,
        fuse_copy_finish(&cs);
        spin_lock(&fc->lock);
        req->locked = 0;
-       if (!err && req->aborted)
-               err = -ENOENT;
+       if (req->aborted) {
+               request_end(fc, req);
+               return -ENODEV;
+       }
        if (err) {
-               if (!req->aborted)
-                       req->out.h.error = -EIO;
+               req->out.h.error = -EIO;
                request_end(fc, req);
                return err;
        }
index bd5a772d8ccf09f09eee4310c4ce2174095f1314..d1acab931330ba8744058482c1ff5a50e753c62d 100644 (file)
@@ -288,12 +288,11 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
 static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff,
                              u64 nodeid, int flags)
 {
-       struct fuse_req *req;
-
-       req = fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE);
-       req->force = 1;
-       request_send(fc, req);
-       fuse_put_request(fc, req);
+       fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE);
+       ff->reserved_req->force = 1;
+       request_send(fc, ff->reserved_req);
+       fuse_put_request(fc, ff->reserved_req);
+       kfree(ff);
 }
 
 /*
@@ -664,7 +663,7 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
        return err;
 }
 
-int fuse_do_getattr(struct inode *inode)
+static int fuse_do_getattr(struct inode *inode)
 {
        int err;
        struct fuse_attr_out arg;
@@ -695,6 +694,20 @@ int fuse_do_getattr(struct inode *inode)
        return err;
 }
 
+/*
+ * Check if attributes are still valid, and if not send a GETATTR
+ * request to refresh them.
+ */
+static int fuse_refresh_attributes(struct inode *inode)
+{
+       struct fuse_inode *fi = get_fuse_inode(inode);
+
+       if (fi->i_time < get_jiffies_64())
+               return fuse_do_getattr(inode);
+       else
+               return 0;
+}
+
 /*
  * Calling into a user-controlled filesystem gives the filesystem
  * daemon ptrace-like capabilities over the requester process.  This
@@ -724,30 +737,6 @@ static int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task)
        return 0;
 }
 
-/*
- * Check whether the inode attributes are still valid
- *
- * If the attribute validity timeout has expired, then fetch the fresh
- * attributes with a 'getattr' request
- *
- * I'm not sure why cached attributes are never returned for the root
- * inode, this is probably being too cautious.
- */
-static int fuse_revalidate(struct dentry *entry)
-{
-       struct inode *inode = entry->d_inode;
-       struct fuse_inode *fi = get_fuse_inode(inode);
-       struct fuse_conn *fc = get_fuse_conn(inode);
-
-       if (!fuse_allow_task(fc, current))
-               return -EACCES;
-       if (get_node_id(inode) != FUSE_ROOT_ID &&
-           fi->i_time >= get_jiffies_64())
-               return 0;
-
-       return fuse_do_getattr(inode);
-}
-
 static int fuse_access(struct inode *inode, int mask)
 {
        struct fuse_conn *fc = get_fuse_conn(inode);
@@ -795,16 +784,31 @@ static int fuse_access(struct inode *inode, int mask)
 static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
 {
        struct fuse_conn *fc = get_fuse_conn(inode);
+       bool refreshed = false;
+       int err = 0;
 
        if (!fuse_allow_task(fc, current))
                return -EACCES;
-       else if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
+
+       /*
+        * If attributes are needed, refresh them before proceeding
+        */
+       if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) ||
+           ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
+               err = fuse_refresh_attributes(inode);
+               if (err)
+                       return err;
+
+               refreshed = true;
+       }
+
+       if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
                int err = generic_permission(inode, mask, NULL);
 
                /* If permission is denied, try to refresh file
                   attributes.  This is also needed, because the root
                   node will at first have no permissions */
-               if (err == -EACCES) {
+               if (err == -EACCES && !refreshed) {
                        err = fuse_do_getattr(inode);
                        if (!err)
                                err = generic_permission(inode, mask, NULL);
@@ -814,17 +818,19 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
                   exist.  So if permissions are revoked this won't be
                   noticed immediately, only after the attribute
                   timeout has expired */
-
-               return err;
-       } else {
-               int mode = inode->i_mode;
-               if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO))
-                       return -EACCES;
-
-               if (nd && (nd->flags & (LOOKUP_ACCESS | LOOKUP_CHDIR)))
-                       return fuse_access(inode, mask);
-               return 0;
+       } else if (nd && (nd->flags & (LOOKUP_ACCESS | LOOKUP_CHDIR))) {
+               err = fuse_access(inode, mask);
+       } else if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) {
+               if (!(inode->i_mode & S_IXUGO)) {
+                       if (refreshed)
+                               return -EACCES;
+
+                       err = fuse_do_getattr(inode);
+                       if (!err && !(inode->i_mode & S_IXUGO))
+                               return -EACCES;
+               }
        }
+       return err;
 }
 
 static int parse_dirfile(char *buf, size_t nbytes, struct file *file,
@@ -859,6 +865,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
        struct page *page;
        struct inode *inode = file->f_path.dentry->d_inode;
        struct fuse_conn *fc = get_fuse_conn(inode);
+       struct fuse_file *ff = file->private_data;
        struct fuse_req *req;
 
        if (is_bad_inode(inode))
@@ -875,7 +882,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
        }
        req->num_pages = 1;
        req->pages[0] = page;
-       fuse_read_fill(req, file, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR);
+       fuse_read_fill(req, ff, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR);
        request_send(fc, req);
        nbytes = req->out.args[0].size;
        err = req->out.h.error;
@@ -980,23 +987,6 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg)
        }
 }
 
-static void fuse_vmtruncate(struct inode *inode, loff_t offset)
-{
-       struct fuse_conn *fc = get_fuse_conn(inode);
-       int need_trunc;
-
-       spin_lock(&fc->lock);
-       need_trunc = inode->i_size > offset;
-       i_size_write(inode, offset);
-       spin_unlock(&fc->lock);
-
-       if (need_trunc) {
-               struct address_space *mapping = inode->i_mapping;
-               unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
-               truncate_inode_pages(mapping, offset);
-       }
-}
-
 /*
  * Set attributes, and at the same time refresh them.
  *
@@ -1014,7 +1004,6 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
        struct fuse_setattr_in inarg;
        struct fuse_attr_out outarg;
        int err;
-       int is_truncate = 0;
 
        if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
                err = inode_change_ok(inode, attr);
@@ -1024,7 +1013,6 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
 
        if (attr->ia_valid & ATTR_SIZE) {
                unsigned long limit;
-               is_truncate = 1;
                if (IS_SWAPFILE(inode))
                        return -ETXTBSY;
                limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;
@@ -1051,30 +1039,38 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
        request_send(fc, req);
        err = req->out.h.error;
        fuse_put_request(fc, req);
-       if (!err) {
-               if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) {
-                       make_bad_inode(inode);
-                       err = -EIO;
-               } else {
-                       if (is_truncate)
-                               fuse_vmtruncate(inode, outarg.attr.size);
-                       fuse_change_attributes(inode, &outarg.attr);
-                       fi->i_time = time_to_jiffies(outarg.attr_valid,
-                                                    outarg.attr_valid_nsec);
-               }
-       } else if (err == -EINTR)
-               fuse_invalidate_attr(inode);
+       if (err) {
+               if (err == -EINTR)
+                       fuse_invalidate_attr(inode);
+               return err;
+       }
 
-       return err;
+       if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) {
+               make_bad_inode(inode);
+               return -EIO;
+       }
+
+       fuse_change_attributes(inode, &outarg.attr);
+       fi->i_time = time_to_jiffies(outarg.attr_valid, outarg.attr_valid_nsec);
+       return 0;
 }
 
 static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
                        struct kstat *stat)
 {
        struct inode *inode = entry->d_inode;
-       int err = fuse_revalidate(entry);
-       if (!err)
+       struct fuse_inode *fi = get_fuse_inode(inode);
+       struct fuse_conn *fc = get_fuse_conn(inode);
+       int err;
+
+       if (!fuse_allow_task(fc, current))
+               return -EACCES;
+
+       err = fuse_refresh_attributes(inode);
+       if (!err) {
                generic_fillattr(inode, stat);
+               stat->mode = fi->orig_i_mode;
+       }
 
        return err;
 }
index 11f22a3d728a747212066c107533313f1eaf9f01..c4b98c03a46ef7c24761e70a723486067e3a9806 100644 (file)
@@ -54,6 +54,7 @@ struct fuse_file *fuse_file_alloc(void)
                        kfree(ff);
                        ff = NULL;
                }
+               atomic_set(&ff->count, 0);
        }
        return ff;
 }
@@ -64,15 +65,39 @@ void fuse_file_free(struct fuse_file *ff)
        kfree(ff);
 }
 
+static struct fuse_file *fuse_file_get(struct fuse_file *ff)
+{
+       atomic_inc(&ff->count);
+       return ff;
+}
+
+static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req)
+{
+       dput(req->dentry);
+       mntput(req->vfsmount);
+       fuse_put_request(fc, req);
+}
+
+static void fuse_file_put(struct fuse_file *ff)
+{
+       if (atomic_dec_and_test(&ff->count)) {
+               struct fuse_req *req = ff->reserved_req;
+               struct fuse_conn *fc = get_fuse_conn(req->dentry->d_inode);
+               req->end = fuse_release_end;
+               request_send_background(fc, req);
+               kfree(ff);
+       }
+}
+
 void fuse_finish_open(struct inode *inode, struct file *file,
                      struct fuse_file *ff, struct fuse_open_out *outarg)
 {
        if (outarg->open_flags & FOPEN_DIRECT_IO)
                file->f_op = &fuse_direct_io_file_operations;
        if (!(outarg->open_flags & FOPEN_KEEP_CACHE))
-               invalidate_mapping_pages(inode->i_mapping, 0, -1);
+               invalidate_inode_pages2(inode->i_mapping);
        ff->fh = outarg->fh;
-       file->private_data = ff;
+       file->private_data = fuse_file_get(ff);
 }
 
 int fuse_open_common(struct inode *inode, struct file *file, int isdir)
@@ -89,14 +114,6 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir)
        if (err)
                return err;
 
-       /* If opening the root node, no lookup has been performed on
-          it, so the attributes must be refreshed */
-       if (get_node_id(inode) == FUSE_ROOT_ID) {
-               err = fuse_do_getattr(inode);
-               if (err)
-                       return err;
-       }
-
        ff = fuse_file_alloc();
        if (!ff)
                return -ENOMEM;
@@ -113,8 +130,7 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir)
        return err;
 }
 
-struct fuse_req *fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags,
-                                  int opcode)
+void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode)
 {
        struct fuse_req *req = ff->reserved_req;
        struct fuse_release_in *inarg = &req->misc.release_in;
@@ -126,25 +142,24 @@ struct fuse_req *fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags,
        req->in.numargs = 1;
        req->in.args[0].size = sizeof(struct fuse_release_in);
        req->in.args[0].value = inarg;
-       kfree(ff);
-
-       return req;
 }
 
 int fuse_release_common(struct inode *inode, struct file *file, int isdir)
 {
        struct fuse_file *ff = file->private_data;
        if (ff) {
-               struct fuse_conn *fc = get_fuse_conn(inode);
-               struct fuse_req *req;
-
-               req = fuse_release_fill(ff, get_node_id(inode), file->f_flags,
-                                       isdir ? FUSE_RELEASEDIR : FUSE_RELEASE);
+               fuse_release_fill(ff, get_node_id(inode), file->f_flags,
+                                 isdir ? FUSE_RELEASEDIR : FUSE_RELEASE);
 
                /* Hold vfsmount and dentry until release is finished */
-               req->vfsmount = mntget(file->f_path.mnt);
-               req->dentry = dget(file->f_path.dentry);
-               request_send_background(fc, req);
+               ff->reserved_req->vfsmount = mntget(file->f_path.mnt);
+               ff->reserved_req->dentry = dget(file->f_path.dentry);
+               /*
+                * Normally this will send the RELEASE request,
+                * however if some asynchronous READ or WRITE requests
+                * are outstanding, the sending will be delayed
+                */
+               fuse_file_put(ff);
        }
 
        /* Return value is ignored by VFS */
@@ -264,10 +279,9 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync)
        return fuse_fsync_common(file, de, datasync, 0);
 }
 
-void fuse_read_fill(struct fuse_req *req, struct file *file,
+void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff,
                    struct inode *inode, loff_t pos, size_t count, int opcode)
 {
-       struct fuse_file *ff = file->private_data;
        struct fuse_read_in *inarg = &req->misc.read_in;
 
        inarg->fh = ff->fh;
@@ -288,7 +302,8 @@ static size_t fuse_send_read(struct fuse_req *req, struct file *file,
                             struct inode *inode, loff_t pos, size_t count)
 {
        struct fuse_conn *fc = get_fuse_conn(inode);
-       fuse_read_fill(req, file, inode, pos, count, FUSE_READ);
+       struct fuse_file *ff = file->private_data;
+       fuse_read_fill(req, ff, inode, pos, count, FUSE_READ);
        request_send(fc, req);
        return req->out.args[0].size;
 }
@@ -337,20 +352,21 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req)
                        SetPageError(page);
                unlock_page(page);
        }
+       if (req->ff)
+               fuse_file_put(req->ff);
        fuse_put_request(fc, req);
 }
 
-static void fuse_send_readpages(struct fuse_req *req, struct file *file,
+static void fuse_send_readpages(struct fuse_req *req, struct fuse_file *ff,
                                struct inode *inode)
 {
        struct fuse_conn *fc = get_fuse_conn(inode);
        loff_t pos = page_offset(req->pages[0]);
        size_t count = req->num_pages << PAGE_CACHE_SHIFT;
        req->out.page_zeroing = 1;
-       fuse_read_fill(req, file, inode, pos, count, FUSE_READ);
+       fuse_read_fill(req, ff, inode, pos, count, FUSE_READ);
        if (fc->async_read) {
-               get_file(file);
-               req->file = file;
+               req->ff = fuse_file_get(ff);
                req->end = fuse_readpages_end;
                request_send_background(fc, req);
        } else {
@@ -359,15 +375,15 @@ static void fuse_send_readpages(struct fuse_req *req, struct file *file,
        }
 }
 
-struct fuse_readpages_data {
+struct fuse_fill_data {
        struct fuse_req *req;
-       struct file *file;
+       struct fuse_file *ff;
        struct inode *inode;
 };
 
 static int fuse_readpages_fill(void *_data, struct page *page)
 {
-       struct fuse_readpages_data *data = _data;
+       struct fuse_fill_data *data = _data;
        struct fuse_req *req = data->req;
        struct inode *inode = data->inode;
        struct fuse_conn *fc = get_fuse_conn(inode);
@@ -376,7 +392,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
            (req->num_pages == FUSE_MAX_PAGES_PER_REQ ||
             (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read ||
             req->pages[req->num_pages - 1]->index + 1 != page->index)) {
-               fuse_send_readpages(req, data->file, inode);
+               fuse_send_readpages(req, data->ff, inode);
                data->req = req = fuse_get_req(fc);
                if (IS_ERR(req)) {
                        unlock_page(page);
@@ -393,14 +409,14 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
 {
        struct inode *inode = mapping->host;
        struct fuse_conn *fc = get_fuse_conn(inode);
-       struct fuse_readpages_data data;
+       struct fuse_fill_data data;
        int err;
 
        err = -EIO;
        if (is_bad_inode(inode))
                goto out;
 
-       data.file = file;
+       data.ff = file->private_data;
        data.inode = inode;
        data.req = fuse_get_req(fc);
        err = PTR_ERR(data.req);
@@ -410,7 +426,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
        err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
        if (!err) {
                if (data.req->num_pages)
-                       fuse_send_readpages(data.req, file, inode);
+                       fuse_send_readpages(data.req, data.ff, inode);
                else
                        fuse_put_request(fc, data.req);
        }
index 68ae87cbafab556a8b3843681274f7ac911ceae8..1764506fdd11bc4da0e89a658c9a0bbdaa2a51b0 100644 (file)
 #define FUSE_MAX_PAGES_PER_REQ 32
 
 /** Maximum number of outstanding background requests */
-#define FUSE_MAX_BACKGROUND 10
+#define FUSE_MAX_BACKGROUND 12
+
+/** Congestion starts at 75% of maximum */
+#define FUSE_CONGESTION_THRESHOLD (FUSE_MAX_BACKGROUND * 75 / 100)
 
 /** It could be as large as PATH_MAX, but would that have any uses? */
 #define FUSE_NAME_MAX 1024
@@ -60,6 +63,10 @@ struct fuse_inode {
 
        /** Time in jiffies until the file attributes are valid */
        u64 i_time;
+
+       /** The sticky bit in inode->i_mode may have been removed, so
+           preserve the original mode */
+       mode_t orig_i_mode;
 };
 
 /** FUSE specific file data */
@@ -69,6 +76,9 @@ struct fuse_file {
 
        /** File handle used by userspace */
        u64 fh;
+
+       /** Refcount */
+       atomic_t count;
 };
 
 /** One input argument of a request */
@@ -213,7 +223,7 @@ struct fuse_req {
        unsigned page_offset;
 
        /** File used in the request (or NULL) */
-       struct file *file;
+       struct fuse_file *ff;
 
        /** vfsmount used in release */
        struct vfsmount *vfsmount;
@@ -286,6 +296,9 @@ struct fuse_conn {
        /** waitq for blocked connection */
        wait_queue_head_t blocked_waitq;
 
+       /** waitq for reserved requests */
+       wait_queue_head_t reserved_req_waitq;
+
        /** The next unique request id */
        u64 reqctr;
 
@@ -414,7 +427,7 @@ void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req,
 /**
  * Initialize READ or READDIR request
  */
-void fuse_read_fill(struct fuse_req *req, struct file *file,
+void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff,
                    struct inode *inode, loff_t pos, size_t count, int opcode);
 
 /**
@@ -427,9 +440,9 @@ void fuse_file_free(struct fuse_file *ff);
 void fuse_finish_open(struct inode *inode, struct file *file,
                      struct fuse_file *ff, struct fuse_open_out *outarg);
 
-/** */
-struct fuse_req *fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags,
-                                  int opcode);
+/** Fill in ff->reserved_req with a RELEASE request */
+void fuse_release_fill(struct fuse_file *ff, u64 nodeid, int flags, int opcode);
+
 /**
  * Send RELEASE or RELEASEDIR request
  */
@@ -523,11 +536,6 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req);
 /* Abort all requests */
 void fuse_abort_conn(struct fuse_conn *fc);
 
-/**
- * Get the attributes of a file
- */
-int fuse_do_getattr(struct inode *inode);
-
 /**
  * Invalidate inode attributes
  */
index 5448f625ab567730b89cf5dd7ac58e1939185e82..fd0735715c14e7f1943c905cb104f101fac73139 100644 (file)
@@ -109,20 +109,25 @@ static int fuse_remount_fs(struct super_block *sb, int *flags, char *data)
        return 0;
 }
 
+static void fuse_truncate(struct address_space *mapping, loff_t offset)
+{
+       /* See vmtruncate() */
+       unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
+       truncate_inode_pages(mapping, offset);
+       unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
+}
+
 void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
 {
        struct fuse_conn *fc = get_fuse_conn(inode);
-       if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size)
-               invalidate_mapping_pages(inode->i_mapping, 0, -1);
+       struct fuse_inode *fi = get_fuse_inode(inode);
+       loff_t oldsize;
 
        inode->i_ino     = attr->ino;
-       inode->i_mode    = (inode->i_mode & S_IFMT) + (attr->mode & 07777);
+       inode->i_mode    = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
        inode->i_nlink   = attr->nlink;
        inode->i_uid     = attr->uid;
        inode->i_gid     = attr->gid;
-       spin_lock(&fc->lock);
-       i_size_write(inode, attr->size);
-       spin_unlock(&fc->lock);
        inode->i_blocks  = attr->blocks;
        inode->i_atime.tv_sec   = attr->atime;
        inode->i_atime.tv_nsec  = attr->atimensec;
@@ -130,6 +135,26 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
        inode->i_mtime.tv_nsec  = attr->mtimensec;
        inode->i_ctime.tv_sec   = attr->ctime;
        inode->i_ctime.tv_nsec  = attr->ctimensec;
+
+       /*
+        * Don't set the sticky bit in i_mode, unless we want the VFS
+        * to check permissions.  This prevents failures due to the
+        * check in may_delete().
+        */
+       fi->orig_i_mode = inode->i_mode;
+       if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
+               inode->i_mode &= ~S_ISVTX;
+
+       spin_lock(&fc->lock);
+       oldsize = inode->i_size;
+       i_size_write(inode, attr->size);
+       spin_unlock(&fc->lock);
+
+       if (S_ISREG(inode->i_mode) && oldsize != attr->size) {
+               if (attr->size < oldsize)
+                       fuse_truncate(inode->i_mapping, attr->size);
+               invalidate_inode_pages2(inode->i_mapping);
+       }
 }
 
 static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr)
@@ -232,6 +257,7 @@ static void fuse_put_super(struct super_block *sb)
        kill_fasync(&fc->fasync, SIGIO, POLL_IN);
        wake_up_all(&fc->waitq);
        wake_up_all(&fc->blocked_waitq);
+       wake_up_all(&fc->reserved_req_waitq);
        mutex_lock(&fuse_mutex);
        list_del(&fc->entry);
        fuse_ctl_remove_conn(fc);
@@ -401,6 +427,7 @@ static int fuse_show_options(struct seq_file *m, struct vfsmount *mnt)
 static struct fuse_conn *new_conn(void)
 {
        struct fuse_conn *fc;
+       int err;
 
        fc = kzalloc(sizeof(*fc), GFP_KERNEL);
        if (fc) {
@@ -409,6 +436,7 @@ static struct fuse_conn *new_conn(void)
                atomic_set(&fc->count, 1);
                init_waitqueue_head(&fc->waitq);
                init_waitqueue_head(&fc->blocked_waitq);
+               init_waitqueue_head(&fc->reserved_req_waitq);
                INIT_LIST_HEAD(&fc->pending);
                INIT_LIST_HEAD(&fc->processing);
                INIT_LIST_HEAD(&fc->io);
@@ -416,10 +444,17 @@ static struct fuse_conn *new_conn(void)
                atomic_set(&fc->num_waiting, 0);
                fc->bdi.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE;
                fc->bdi.unplug_io_fn = default_unplug_io_fn;
+               err = bdi_init(&fc->bdi);
+               if (err) {
+                       kfree(fc);
+                       fc = NULL;
+                       goto out;
+               }
                fc->reqctr = 0;
                fc->blocked = 1;
                get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
        }
+out:
        return fc;
 }
 
@@ -429,6 +464,7 @@ void fuse_conn_put(struct fuse_conn *fc)
                if (fc->destroy_req)
                        fuse_request_free(fc->destroy_req);
                mutex_destroy(&fc->inst_mutex);
+               bdi_destroy(&fc->bdi);
                kfree(fc);
        }
 }
@@ -446,6 +482,7 @@ static struct inode *get_root_inode(struct super_block *sb, unsigned mode)
 
        attr.mode = mode;
        attr.ino = FUSE_ROOT_ID;
+       attr.nlink = 1;
        return fuse_iget(sb, 1, 0, &attr);
 }
 
@@ -683,8 +720,7 @@ static inline void unregister_fuseblk(void)
 static decl_subsys(fuse, NULL, NULL);
 static decl_subsys(connections, NULL, NULL);
 
-static void fuse_inode_init_once(void *foo, struct kmem_cache *cachep,
-                                unsigned long flags)
+static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo)
 {
        struct inode * inode = foo;
 
index 79c91fd8381bc11d61bba006daba21a1cf713f81..7ecfe0d3a4913e7d5dc2396599526cb2f781527f 100644 (file)
@@ -24,7 +24,7 @@
 #include "util.h"
 #include "glock.h"
 
-static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void gfs2_init_inode_once(struct kmem_cache *cachep, void *foo)
 {
        struct gfs2_inode *ip = foo;
 
@@ -34,7 +34,7 @@ static void gfs2_init_inode_once(void *foo, struct kmem_cache *cachep, unsigned
        memset(ip->i_cache, 0, sizeof(ip->i_cache));
 }
 
-static void gfs2_init_glock_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void gfs2_init_glock_once(struct kmem_cache *cachep, void *foo)
 {
        struct gfs2_glock *gl = foo;
 
index 7eb4b280ac665f43db21b0d646beda04fb5b8357..bb11fd6752d3d47e0f50eaeae330e2ecad391f1b 100644 (file)
@@ -406,7 +406,7 @@ static int gfs2_open(struct inode *inode, struct file *file)
 
                if (!(file->f_flags & O_LARGEFILE) &&
                    ip->i_di.di_size > MAX_NON_LFS) {
-                       error = -EFBIG;
+                       error = -EOVERFLOW;
                        goto fail_gunlock;
                }
 
index 6c5f92dfb50036105ba5de2739572a5036cf23b0..16cbd902f8b9569a6874710832d7ab1316010063 100644 (file)
@@ -430,7 +430,7 @@ static struct file_system_type hfs_fs_type = {
        .fs_flags       = FS_REQUIRES_DEV,
 };
 
-static void hfs_init_once(void *p, struct kmem_cache *cachep, unsigned long flags)
+static void hfs_init_once(struct kmem_cache *cachep, void *p)
 {
        struct hfs_inode_info *i = p;
 
index 7b0f2e5a44e2bce847c9c3e59c141c4a4821639f..ecf70dafb643718e7a91c1c8238290aa16c2fc5a 100644 (file)
@@ -466,7 +466,7 @@ static struct file_system_type hfsplus_fs_type = {
        .fs_flags       = FS_REQUIRES_DEV,
 };
 
-static void hfsplus_init_once(void *p, struct kmem_cache *cachep, unsigned long flags)
+static void hfsplus_init_once(struct kmem_cache *cachep, void *p)
 {
        struct hfsplus_inode_info *i = p;
 
index 89612ee7c80d6d9ffb5370ecb83f7716e1427f05..00971d999964848884187593fb744ef16888620a 100644 (file)
@@ -173,7 +173,7 @@ static void hpfs_destroy_inode(struct inode *inode)
        kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;
 
index 04598e12c489ebd20ee6bb9b81217dc2f954d74b..12aca8ed605f1616b1f1deda3867464780fcf66d 100644 (file)
@@ -384,7 +384,7 @@ static void hugetlbfs_forget_inode(struct inode *inode) __releases(inode_lock)
        struct super_block *sb = inode->i_sb;
 
        if (!hlist_unhashed(&inode->i_hash)) {
-               if (!(inode->i_state & (I_DIRTY|I_LOCK)))
+               if (!(inode->i_state & (I_DIRTY|I_SYNC)))
                        list_move(&inode->i_list, &inode_unused);
                inodes_stat.nr_unused++;
                if (!sb || (sb->s_flags & MS_ACTIVE)) {
@@ -697,7 +697,7 @@ static const struct address_space_operations hugetlbfs_aops = {
 };
 
 
-static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo;
 
@@ -933,16 +933,11 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
        if (!dentry)
                goto out_shm_unlock;
 
-       error = -ENFILE;
-       file = get_empty_filp();
-       if (!file)
-               goto out_dentry;
-
        error = -ENOSPC;
        inode = hugetlbfs_get_inode(root->d_sb, current->fsuid,
                                current->fsgid, S_IFREG | S_IRWXUGO, 0);
        if (!inode)
-               goto out_file;
+               goto out_dentry;
 
        error = -ENOMEM;
        if (hugetlb_reserve_pages(inode, 0, size >> HPAGE_SHIFT))
@@ -951,17 +946,18 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
        d_instantiate(dentry, inode);
        inode->i_size = size;
        inode->i_nlink = 0;
-       file->f_path.mnt = mntget(hugetlbfs_vfsmount);
-       file->f_path.dentry = dentry;
-       file->f_mapping = inode->i_mapping;
-       file->f_op = &hugetlbfs_file_operations;
-       file->f_mode = FMODE_WRITE | FMODE_READ;
+
+       error = -ENFILE;
+       file = alloc_file(hugetlbfs_vfsmount, dentry,
+                       FMODE_WRITE | FMODE_READ,
+                       &hugetlbfs_file_operations);
+       if (!file)
+               goto out_inode;
+
        return file;
 
 out_inode:
        iput(inode);
-out_file:
-       put_filp(file);
 out_dentry:
        dput(dentry);
 out_shm_unlock:
@@ -974,11 +970,15 @@ static int __init init_hugetlbfs_fs(void)
        int error;
        struct vfsmount *vfsmount;
 
+       error = bdi_init(&hugetlbfs_backing_dev_info);
+       if (error)
+               return error;
+
        hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
                                        sizeof(struct hugetlbfs_inode_info),
                                        0, 0, init_once);
        if (hugetlbfs_inode_cachep == NULL)
-               return -ENOMEM;
+               goto out2;
 
        error = register_filesystem(&hugetlbfs_fs_type);
        if (error)
@@ -996,6 +996,8 @@ static int __init init_hugetlbfs_fs(void)
  out:
        if (error)
                kmem_cache_destroy(hugetlbfs_inode_cachep);
+ out2:
+       bdi_destroy(&hugetlbfs_backing_dev_info);
        return error;
 }
 
@@ -1003,6 +1005,7 @@ static void __exit exit_hugetlbfs_fs(void)
 {
        kmem_cache_destroy(hugetlbfs_inode_cachep);
        unregister_filesystem(&hugetlbfs_fs_type);
+       bdi_destroy(&hugetlbfs_backing_dev_info);
 }
 
 module_init(init_hugetlbfs_fs)
index 21dab18b2f18641ba24cd119f99be6391fb615bb..ed35383d0b6c4f9b53fcc536da045cacfaf6c123 100644 (file)
@@ -99,6 +99,15 @@ struct inodes_stat_t inodes_stat;
 
 static struct kmem_cache * inode_cachep __read_mostly;
 
+static void wake_up_inode(struct inode *inode)
+{
+       /*
+        * Prevent speculative execution through spin_unlock(&inode_lock);
+        */
+       smp_mb();
+       wake_up_bit(&inode->i_state, __I_LOCK);
+}
+
 static struct inode *alloc_inode(struct super_block *sb)
 {
        static const struct address_space_operations empty_aops;
@@ -215,7 +224,7 @@ void inode_init_once(struct inode *inode)
 
 EXPORT_SYMBOL(inode_init_once);
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct inode * inode = (struct inode *) foo;
 
@@ -232,7 +241,7 @@ void __iget(struct inode * inode)
                return;
        }
        atomic_inc(&inode->i_count);
-       if (!(inode->i_state & (I_DIRTY|I_LOCK)))
+       if (!(inode->i_state & (I_DIRTY|I_SYNC)))
                list_move(&inode->i_list, &inode_in_use);
        inodes_stat.nr_unused--;
 }
@@ -253,7 +262,7 @@ void clear_inode(struct inode *inode)
        BUG_ON(inode->i_data.nrpages);
        BUG_ON(!(inode->i_state & I_FREEING));
        BUG_ON(inode->i_state & I_CLEAR);
-       wait_on_inode(inode);
+       inode_sync_wait(inode);
        DQUOT_DROP(inode);
        if (inode->i_sb->s_op->clear_inode)
                inode->i_sb->s_op->clear_inode(inode);
@@ -1071,7 +1080,7 @@ static void generic_forget_inode(struct inode *inode)
        struct super_block *sb = inode->i_sb;
 
        if (!hlist_unhashed(&inode->i_hash)) {
-               if (!(inode->i_state & (I_DIRTY|I_LOCK)))
+               if (!(inode->i_state & (I_DIRTY|I_SYNC)))
                        list_move(&inode->i_list, &inode_unused);
                inodes_stat.nr_unused++;
                if (sb->s_flags & MS_ACTIVE) {
@@ -1314,15 +1323,6 @@ static void __wait_on_freeing_inode(struct inode *inode)
        spin_lock(&inode_lock);
 }
 
-void wake_up_inode(struct inode *inode)
-{
-       /*
-        * Prevent speculative execution through spin_unlock(&inode_lock);
-        */
-       smp_mb();
-       wake_up_bit(&inode->i_state, __I_LOCK);
-}
-
 /*
  * We rarely want to lock two inodes that do not have a parent/child
  * relationship (such as directory, child inode) simultaneously. The
@@ -1396,7 +1396,7 @@ void __init inode_init_early(void)
                INIT_HLIST_HEAD(&inode_hashtable[loop]);
 }
 
-void __init inode_init(unsigned long mempages)
+void __init inode_init(void)
 {
        int loop;
 
index 9bf2f6c09df64932bba2f88e838a240f7e4e2eea..5e009331c01ff5fbe1a453f735e906e54645368f 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/list.h>
 #include <linux/inotify.h>
 #include <linux/syscalls.h>
+#include <linux/magic.h>
 
 #include <asm/ioctls.h>
 
@@ -684,7 +685,8 @@ static int
 inotify_get_sb(struct file_system_type *fs_type, int flags,
               const char *dev_name, void *data, struct vfsmount *mnt)
 {
-       return get_sb_pseudo(fs_type, "inotify", NULL, 0xBAD1DEA, mnt);
+       return get_sb_pseudo(fs_type, "inotify", NULL,
+                       INOTIFYFS_SUPER_MAGIC, mnt);
 }
 
 static struct file_system_type inotify_fs_type = {
index 6bbbdb53581d1bb42b1db87f88a4de9799b82808..37dbd6404787b72c94513e66e7634166f2ebaa92 100644 (file)
@@ -33,7 +33,7 @@ static char zisofs_sink_page[PAGE_CACHE_SIZE];
  * allocation; this avoids failures at block-decompression time.
  */
 static void *zisofs_zlib_workspace;
-static struct semaphore zisofs_zlib_semaphore;
+static DEFINE_MUTEX(zisofs_zlib_lock);
 
 /*
  * When decompressing, we typically obtain more than one page
@@ -180,9 +180,9 @@ static int zisofs_readpage(struct file *file, struct page *page)
 
                /* First block is special since it may be fractional.
                   We also wait for it before grabbing the zlib
-                  semaphore; odds are that the subsequent blocks are
+                  mutex; odds are that the subsequent blocks are
                   going to come in in short order so we don't hold
-                  the zlib semaphore longer than necessary. */
+                  the zlib mutex longer than necessary. */
 
                if ( !bh || (wait_on_buffer(bh), !buffer_uptodate(bh)) ) {
                        printk(KERN_DEBUG "zisofs: Hit null buffer, fpage = %d, xpage = %d, csize = %ld\n",
@@ -194,7 +194,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
                csize -= stream.avail_in;
 
                stream.workspace = zisofs_zlib_workspace;
-               down(&zisofs_zlib_semaphore);
+               mutex_lock(&zisofs_zlib_lock);
                
                zerr = zlib_inflateInit(&stream);
                if ( zerr != Z_OK ) {
@@ -281,7 +281,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
                zlib_inflateEnd(&stream);
 
        z_eio:
-               up(&zisofs_zlib_semaphore);
+               mutex_unlock(&zisofs_zlib_lock);
 
        b_eio:
                for ( i = 0 ; i < haveblocks ; i++ ) {
@@ -317,31 +317,16 @@ const struct address_space_operations zisofs_aops = {
        /* No bmap operation supported */
 };
 
-static int initialized;
-
 int __init zisofs_init(void)
 {
-       if ( initialized ) {
-               printk("zisofs_init: called more than once\n");
-               return 0;
-       }
-
        zisofs_zlib_workspace = vmalloc(zlib_inflate_workspacesize());
        if ( !zisofs_zlib_workspace )
                return -ENOMEM;
-       init_MUTEX(&zisofs_zlib_semaphore);
 
-       initialized = 1;
        return 0;
 }
 
 void zisofs_cleanup(void)
 {
-       if ( !initialized ) {
-               printk("zisofs_cleanup: called without initialization\n");
-               return;
-       }
-
        vfree(zisofs_zlib_workspace);
-       initialized = 0;
 }
index 043b470fd3b67f42c325dbb90997730b2a38c84d..aa359a2e4ce613cb49710e94f248846789fbde4f 100644 (file)
@@ -73,7 +73,7 @@ static void isofs_destroy_inode(struct inode *inode)
        kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
 }
 
-static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct iso_inode_info *ei = foo;
 
index c8c7e5138a017da3085d1cbfdd4f0ab6ee4f03b7..e2b4dad39ca9d34641846284f43e51dc2715a095 100644 (file)
@@ -158,7 +158,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
 struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
 {
        int found;
-       unsigned long block, offset;
+       unsigned long uninitialized_var(block);
+       unsigned long uninitialized_var(offset);
        struct inode *inode;
        struct page *page;
 
index be2b70c2ec1653890df1c08aae864293e47a6b50..ffa447511e6a38d5cb6f194eb8c64a51878b91fd 100644 (file)
@@ -43,7 +43,7 @@ static void jffs2_destroy_inode(struct inode *inode)
        kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode));
 }
 
-static void jffs2_i_init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo)
 {
        struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo;
 
index 941369c1ac8dcd5ab20f93736b02494202c9e974..f5cd8d38af7a9ff7af5ac2f4627d73964ccd5814 100644 (file)
@@ -180,7 +180,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp)
 
 #endif
 
-static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct metapage *mp = (struct metapage *)foo;
 
index 7aa1f7004eaf9f54aded2f394e8e0bcda21057fe..e7c60ae6b5b21c92f724220d6c6fdf39456425af 100644 (file)
@@ -1289,7 +1289,14 @@ int txCommit(tid_t tid,          /* transaction identifier */
                 * commit the transaction synchronously, so the last iput
                 * will be done by the calling thread (or later)
                 */
-               if (tblk->u.ip->i_state & I_LOCK)
+               /*
+                * I believe this code is no longer needed.  Splitting I_LOCK
+                * into two bits, I_LOCK and I_SYNC should prevent this
+                * deadlock as well.  But since I don't have a JFS testload
+                * to verify this, only a trivial s/I_LOCK/I_SYNC/ was done.
+                * Joern
+                */
+               if (tblk->u.ip->i_state & I_SYNC)
                        tblk->xflag &= ~COMMIT_LAZY;
        }
 
index 4b372f550652686f5202af80e481f948ba3dba20..cff60c171943b9b23334428bd650ac829fc19b7b 100644 (file)
@@ -750,7 +750,7 @@ static struct file_system_type jfs_fs_type = {
        .fs_flags       = FS_REQUIRES_DEV,
 };
 
-static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
 
index f2b32d3a9093a58eba69fabdbbbf0bf5ea1ae7a3..ae51481e45e5f679e240d64e5f8e1f39e7c0e2c7 100644 (file)
@@ -371,8 +371,8 @@ int simple_write_begin(struct file *file, struct address_space *mapping,
        return simple_prepare_write(file, page, from, from+len);
 }
 
-int simple_commit_write(struct file *file, struct page *page,
-                       unsigned from, unsigned to)
+static int simple_commit_write(struct file *file, struct page *page,
+                              unsigned from, unsigned to)
 {
        struct inode *inode = page->mapping->host;
        loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
@@ -686,7 +686,6 @@ EXPORT_SYMBOL(generic_read_dir);
 EXPORT_SYMBOL(get_sb_pseudo);
 EXPORT_SYMBOL(simple_write_begin);
 EXPORT_SYMBOL(simple_write_end);
-EXPORT_SYMBOL(simple_commit_write);
 EXPORT_SYMBOL(simple_dir_inode_operations);
 EXPORT_SYMBOL(simple_dir_operations);
 EXPORT_SYMBOL(simple_empty);
index 7f9a3ea47418cf598b3084be4efd96b9884a10bf..0127a2846819148df5b9a8722118e11ed60e253b 100644 (file)
@@ -199,7 +199,7 @@ EXPORT_SYMBOL(locks_init_lock);
  * Initialises the fields of the file lock which are invariant for
  * free file_locks.
  */
-static void init_once(void *foo, struct kmem_cache *cache, unsigned long flags)
+static void init_once(struct kmem_cache *cache, void *foo)
 {
        struct file_lock *lock = (struct file_lock *) foo;
 
index 99a12f12776965e622a547030018bcf47a46d153..703cc35e04b94ce6126ae390f03f066c0fb26618 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/bitops.h>
 #include <linux/sched.h>
 
-static int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 };
+static const int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 };
 
 static unsigned long count_free(struct buffer_head *map[], unsigned numblocks, __u32 numbits)
 {
index f4f3343b1800fa816e4e1d0e08e13fb1b36e2310..bf4cd316af81cb91b602d2a06895756461becc5e 100644 (file)
@@ -69,7 +69,7 @@ static void minix_destroy_inode(struct inode *inode)
        kmem_cache_free(minix_inode_cachep, minix_i(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct minix_inode_info *ei = (struct minix_inode_info *) foo;
 
index 1a5f3bf0bcecde761fc78da91ea49a439ed44d99..82d6554b02fec5a9f813ee9c026831c9db310455 100644 (file)
@@ -23,11 +23,16 @@ static inline block_t *i_data(struct inode *inode)
 static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
 {
        int n = 0;
+       char b[BDEVNAME_SIZE];
 
        if (block < 0) {
-               printk("minix_bmap: block<0\n");
+               printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
+                       block, bdevname(inode->i_sb->s_bdev, b));
        } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) {
-               printk("minix_bmap: block>big\n");
+               if (printk_ratelimit())
+                       printk("MINIX-fs: block_to_path: "
+                              "block %ld too big on dev %s\n",
+                               block, bdevname(inode->i_sb->s_bdev, b));
        } else if (block < 7) {
                offsets[n++] = block;
        } else if ((block -= 7) < 512) {
index ad8f0dec4ef46e2b3e6201dea67ddf6a0182ac94..f2301096936923d3d17f01332484e7b2866e7b4f 100644 (file)
@@ -23,12 +23,17 @@ static inline block_t *i_data(struct inode *inode)
 static int block_to_path(struct inode * inode, long block, int offsets[DEPTH])
 {
        int n = 0;
+       char b[BDEVNAME_SIZE];
        struct super_block *sb = inode->i_sb;
 
        if (block < 0) {
-               printk("minix_bmap: block<0\n");
+               printk("MINIX-fs: block_to_path: block %ld < 0 on dev %s\n",
+                       block, bdevname(sb->s_bdev, b));
        } else if (block >= (minix_sb(inode->i_sb)->s_max_size/sb->s_blocksize)) {
-               printk("minix_bmap: block>big\n");
+               if (printk_ratelimit())
+                       printk("MINIX-fs: block_to_path: "
+                              "block %ld too big on dev %s\n",
+                               block, bdevname(sb->s_bdev, b));
        } else if (block < 7) {
                offsets[n++] = block;
        } else if ((block -= 7) < 256) {
index b40b8084eefc000f922d32e918bc2ebf8d97de14..464eeccb675be82378a7d9d7a69b7498cf5b106a 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/capability.h>
 #include <linux/file.h>
 #include <linux/fcntl.h>
-#include <linux/namei.h>
 #include <asm/namei.h>
 #include <asm/uaccess.h>
 
@@ -228,10 +227,14 @@ int generic_permission(struct inode *inode, int mask,
 
 int permission(struct inode *inode, int mask, struct nameidata *nd)
 {
-       umode_t mode = inode->i_mode;
        int retval, submask;
+       struct vfsmount *mnt = NULL;
+
+       if (nd)
+               mnt = nd->mnt;
 
        if (mask & MAY_WRITE) {
+               umode_t mode = inode->i_mode;
 
                /*
                 * Nobody gets write access to a read-only fs.
@@ -247,22 +250,34 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
                        return -EACCES;
        }
 
-
-       /*
-        * MAY_EXEC on regular files requires special handling: We override
-        * filesystem execute permissions if the mode bits aren't set or
-        * the fs is mounted with the "noexec" flag.
-        */
-       if ((mask & MAY_EXEC) && S_ISREG(mode) && (!(mode & S_IXUGO) ||
-                       (nd && nd->mnt && (nd->mnt->mnt_flags & MNT_NOEXEC))))
-               return -EACCES;
+       if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) {
+               /*
+                * MAY_EXEC on regular files is denied if the fs is mounted
+                * with the "noexec" flag.
+                */
+               if (mnt && (mnt->mnt_flags & MNT_NOEXEC))
+                       return -EACCES;
+       }
 
        /* Ordinary permission routines do not understand MAY_APPEND. */
        submask = mask & ~MAY_APPEND;
-       if (inode->i_op && inode->i_op->permission)
+       if (inode->i_op && inode->i_op->permission) {
                retval = inode->i_op->permission(inode, submask, nd);
-       else
+               if (!retval) {
+                       /*
+                        * Exec permission on a regular file is denied if none
+                        * of the execute bits are set.
+                        *
+                        * This check should be done by the ->permission()
+                        * method.
+                        */
+                       if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode) &&
+                           !(inode->i_mode & S_IXUGO))
+                               return -EACCES;
+               }
+       } else {
                retval = generic_permission(inode, submask, NULL);
+       }
        if (retval)
                return retval;
 
@@ -1273,7 +1288,8 @@ int __user_path_lookup_open(const char __user *name, unsigned int lookup_flags,
        return err;
 }
 
-static inline struct dentry *__lookup_hash_kern(struct qstr *name, struct dentry *base, struct nameidata *nd)
+static struct dentry *__lookup_hash(struct qstr *name,
+               struct dentry *base, struct nameidata *nd)
 {
        struct dentry *dentry;
        struct inode *inode;
@@ -1313,31 +1329,18 @@ out:
  * needs parent already locked. Doesn't follow mounts.
  * SMP-safe.
  */
-static inline struct dentry * __lookup_hash(struct qstr *name, struct dentry *base, struct nameidata *nd)
+static struct dentry *lookup_hash(struct nameidata *nd)
 {
-       struct dentry *dentry;
-       struct inode *inode;
        int err;
 
-       inode = base->d_inode;
-
-       err = permission(inode, MAY_EXEC, nd);
-       dentry = ERR_PTR(err);
+       err = permission(nd->dentry->d_inode, MAY_EXEC, nd);
        if (err)
-               goto out;
-
-       dentry = __lookup_hash_kern(name, base, nd);
-out:
-       return dentry;
-}
-
-static struct dentry *lookup_hash(struct nameidata *nd)
-{
+               return ERR_PTR(err);
        return __lookup_hash(&nd->last, nd->dentry, nd);
 }
 
-/* SMP-safe */
-static inline int __lookup_one_len(const char *name, struct qstr *this, struct dentry *base, int len)
+static int __lookup_one_len(const char *name, struct qstr *this,
+               struct dentry *base, int len)
 {
        unsigned long hash;
        unsigned int c;
@@ -1358,26 +1361,52 @@ static inline int __lookup_one_len(const char *name, struct qstr *this, struct d
        return 0;
 }
 
+/**
+ * lookup_one_len:  filesystem helper to lookup single pathname component
+ * @name:      pathname component to lookup
+ * @base:      base directory to lookup from
+ * @len:       maximum length @len should be interpreted to
+ *
+ * Note that this routine is purely a helper for filesystem useage and should
+ * not be called by generic code.  Also note that by using this function to
+ * nameidata argument is passed to the filesystem methods and a filesystem
+ * using this helper needs to be prepared for that.
+ */
 struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
 {
        int err;
        struct qstr this;
 
        err = __lookup_one_len(name, &this, base, len);
+       if (err)
+               return ERR_PTR(err);
+
+       err = permission(base->d_inode, MAY_EXEC, NULL);
        if (err)
                return ERR_PTR(err);
        return __lookup_hash(&this, base, NULL);
 }
 
-struct dentry *lookup_one_len_kern(const char *name, struct dentry *base, int len)
+/**
+ * lookup_one_noperm - bad hack for sysfs
+ * @name:      pathname component to lookup
+ * @base:      base directory to lookup from
+ *
+ * This is a variant of lookup_one_len that doesn't perform any permission
+ * checks.   It's a horrible hack to work around the braindead sysfs
+ * architecture and should not be used anywhere else.
+ *
+ * DON'T USE THIS FUNCTION EVER, thanks.
+ */
+struct dentry *lookup_one_noperm(const char *name, struct dentry *base)
 {
        int err;
        struct qstr this;
 
-       err = __lookup_one_len(name, &this, base, len);
+       err = __lookup_one_len(name, &this, base, strlen(name));
        if (err)
                return ERR_PTR(err);
-       return __lookup_hash_kern(&this, base, NULL);
+       return __lookup_hash(&this, base, NULL);
 }
 
 int fastcall __user_walk_fd(int dfd, const char __user *name, unsigned flags,
@@ -1579,10 +1608,6 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
        if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE))
                return -EISDIR;
 
-       error = vfs_permission(nd, acc_mode);
-       if (error)
-               return error;
-
        /*
         * FIFO's, sockets and device files are special: they don't
         * actually live on the filesystem itself, and as such you
@@ -1597,6 +1622,10 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
                flag &= ~O_TRUNC;
        } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE))
                return -EROFS;
+
+       error = vfs_permission(nd, acc_mode);
+       if (error)
+               return error;
        /*
         * An append-only file must be opened in append mode for writing.
         */
index ddbda13c2d317dc79bb6bffa41e688a250dd1ccf..07daa797259184f1c4cd181cf09f04156bd4dabe 100644 (file)
@@ -1791,7 +1791,7 @@ static void __init init_mount_tree(void)
        set_fs_root(current->fs, ns->root, ns->root->mnt_root);
 }
 
-void __init mnt_init(unsigned long mempages)
+void __init mnt_init(void)
 {
        struct list_head *d;
        unsigned int nr_hash;
index 7f8536dbdedcfeb794d716539aa33cefc9b93e8d..e1cb70c643f8f81f599ad1da0c76cc9080aba332 100644 (file)
@@ -56,7 +56,7 @@ static void ncp_destroy_inode(struct inode *inode)
        kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct ncp_inode_info *ei = (struct ncp_inode_info *) foo;
 
index a532ee12740acd34ffdea0f139c619ae097a1308..70587f383f10708ba33b5f0d7b3492fc20359487 100644 (file)
@@ -627,6 +627,7 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, struct nfs_fsinfo *
        if (server->rsize > NFS_MAX_FILE_IO_SIZE)
                server->rsize = NFS_MAX_FILE_IO_SIZE;
        server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+
        server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD;
 
        if (server->wsize > max_rpc_payload)
@@ -677,6 +678,10 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
                goto out_error;
 
        nfs_server_set_fsinfo(server, &fsinfo);
+       error = bdi_init(&server->backing_dev_info);
+       if (error)
+               goto out_error;
+
 
        /* Get some general file system info */
        if (server->namelen == 0) {
@@ -756,6 +761,7 @@ void nfs_free_server(struct nfs_server *server)
        nfs_put_client(server->nfs_client);
 
        nfs_free_iostats(server->io_stats);
+       bdi_destroy(&server->backing_dev_info);
        kfree(server);
        nfs_release_automount_timer();
        dprintk("<-- nfs_free_server()\n");
index 035c769b715e8e256693402b260663fd17945514..6c22453d77aea6071622f6d2d104d1b6c258d223 100644 (file)
@@ -1154,7 +1154,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)
 #endif
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct nfs_inode *nfsi = (struct nfs_inode *) foo;
 
index e2bb66c34406d7cc6dc61b0557e0017166575dc8..0cf9d1cd9bd256c1f1ff4928f523fb48788b3b41 100644 (file)
@@ -242,10 +242,8 @@ static void nfs_end_page_writeback(struct page *page)
        struct nfs_server *nfss = NFS_SERVER(inode);
 
        end_page_writeback(page);
-       if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) {
+       if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH)
                clear_bdi_congested(&nfss->backing_dev_info, WRITE);
-               congestion_end(WRITE);
-       }
 }
 
 /*
@@ -449,6 +447,7 @@ nfs_mark_request_commit(struct nfs_page *req)
                        NFS_PAGE_TAG_COMMIT);
        spin_unlock(&inode->i_lock);
        inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+       inc_bdi_stat(req->wb_page->mapping->backing_dev_info, BDI_RECLAIMABLE);
        __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
 }
 
@@ -535,6 +534,8 @@ static void nfs_cancel_commit_list(struct list_head *head)
        while(!list_empty(head)) {
                req = nfs_list_entry(head->next);
                dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+               dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
+                               BDI_RECLAIMABLE);
                nfs_list_remove_request(req);
                clear_bit(PG_NEED_COMMIT, &(req)->wb_flags);
                nfs_inode_remove_request(req);
@@ -1195,6 +1196,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how)
                nfs_list_remove_request(req);
                nfs_mark_request_commit(req);
                dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+               dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
+                               BDI_RECLAIMABLE);
                nfs_clear_page_tag_locked(req);
        }
        return -ENOMEM;
@@ -1220,6 +1223,8 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
                nfs_list_remove_request(req);
                clear_bit(PG_NEED_COMMIT, &(req)->wb_flags);
                dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
+               dec_bdi_stat(req->wb_page->mapping->backing_dev_info,
+                               BDI_RECLAIMABLE);
 
                dprintk("NFS: commit (%s/%Ld %d@%Ld)",
                        req->wb_context->path.dentry->d_inode->i_sb->s_id,
index 2a8d665b134ba09785850aa662c43aff1d24d201..819545d216706be7447392a482328b37d4d3cb5c 100644 (file)
@@ -368,7 +368,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
 
        /* Revoke setuid/setgid bit on chown/chgrp */
        if ((iap->ia_valid & ATTR_UID) && iap->ia_uid != inode->i_uid)
-               iap->ia_valid |= ATTR_KILL_SUID;
+               iap->ia_valid |= ATTR_KILL_SUID | ATTR_KILL_PRIV;
        if ((iap->ia_valid & ATTR_GID) && iap->ia_gid != inode->i_gid)
                iap->ia_valid |= ATTR_KILL_SGID;
 
@@ -865,6 +865,15 @@ static int nfsd_direct_splice_actor(struct pipe_inode_info *pipe,
        return __splice_from_pipe(pipe, sd, nfsd_splice_actor);
 }
 
+static inline int svc_msnfs(struct svc_fh *ffhp)
+{
+#ifdef MSNFS
+       return (ffhp->fh_export->ex_flags & NFSEXP_MSNFS);
+#else
+       return 0;
+#endif
+}
+
 static __be32
 nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
               loff_t offset, struct kvec *vec, int vlen, unsigned long *count)
@@ -877,11 +886,9 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 
        err = nfserr_perm;
        inode = file->f_path.dentry->d_inode;
-#ifdef MSNFS
-       if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
-               (!lock_may_read(inode, offset, *count)))
+
+       if (svc_msnfs(fhp) && !lock_may_read(inode, offset, *count))
                goto out;
-#endif
 
        /* Get readahead parameters */
        ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino);
@@ -930,7 +937,7 @@ out:
 static void kill_suid(struct dentry *dentry)
 {
        struct iattr    ia;
-       ia.ia_valid = ATTR_KILL_SUID | ATTR_KILL_SGID;
+       ia.ia_valid = ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
 
        mutex_lock(&dentry->d_inode->i_mutex);
        notify_change(dentry, &ia);
index 976ecccd6f5613814bdc2eaa0ceb1bcddcfd4997..a39edc41becc29e76c67b366de2032ad3314268a 100644 (file)
@@ -2,10 +2,8 @@
 # Native language support configuration
 #
 
-menu "Native Language Support"
-
-config NLS
-       tristate "Base native language support"
+menuconfig NLS
+       tristate "Native language support"
        ---help---
          The base Native Language Support. A number of filesystems
          depend on it (e.g. FAT, JOLIET, NT, BEOS filesystems), as well
@@ -17,9 +15,10 @@ config NLS
          To compile this code as a module, choose M here: the module
          will be called nls_base.
 
+if NLS
+
 config NLS_DEFAULT
        string "Default NLS Option"
-       depends on NLS
        default "iso8859-1"
        ---help---
          The default NLS used when mounting file system. Note, that this is
@@ -39,7 +38,6 @@ config NLS_DEFAULT
 
 config NLS_CODEPAGE_437
        tristate "Codepage 437 (United States, Canada)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored
@@ -52,7 +50,6 @@ config NLS_CODEPAGE_437
 
 config NLS_CODEPAGE_737
        tristate "Codepage 737 (Greek)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored
@@ -65,7 +62,6 @@ config NLS_CODEPAGE_737
 
 config NLS_CODEPAGE_775
        tristate "Codepage 775 (Baltic Rim)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored
@@ -79,7 +75,6 @@ config NLS_CODEPAGE_775
 
 config NLS_CODEPAGE_850
        tristate "Codepage 850 (Europe)"
-       depends on NLS
        ---help---
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -96,7 +91,6 @@ config NLS_CODEPAGE_850
 
 config NLS_CODEPAGE_852
        tristate "Codepage 852 (Central/Eastern Europe)"
-       depends on NLS
        ---help---
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -112,7 +106,6 @@ config NLS_CODEPAGE_852
 
 config NLS_CODEPAGE_855
        tristate "Codepage 855 (Cyrillic)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -124,7 +117,6 @@ config NLS_CODEPAGE_855
 
 config NLS_CODEPAGE_857
        tristate "Codepage 857 (Turkish)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -136,7 +128,6 @@ config NLS_CODEPAGE_857
 
 config NLS_CODEPAGE_860
        tristate "Codepage 860 (Portuguese)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -148,7 +139,6 @@ config NLS_CODEPAGE_860
 
 config NLS_CODEPAGE_861
        tristate "Codepage 861 (Icelandic)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -160,7 +150,6 @@ config NLS_CODEPAGE_861
 
 config NLS_CODEPAGE_862
        tristate "Codepage 862 (Hebrew)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -172,7 +161,6 @@ config NLS_CODEPAGE_862
 
 config NLS_CODEPAGE_863
        tristate "Codepage 863 (Canadian French)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -185,7 +173,6 @@ config NLS_CODEPAGE_863
 
 config NLS_CODEPAGE_864
        tristate "Codepage 864 (Arabic)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -197,7 +184,6 @@ config NLS_CODEPAGE_864
 
 config NLS_CODEPAGE_865
        tristate "Codepage 865 (Norwegian, Danish)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -210,7 +196,6 @@ config NLS_CODEPAGE_865
 
 config NLS_CODEPAGE_866
        tristate "Codepage 866 (Cyrillic/Russian)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -223,7 +208,6 @@ config NLS_CODEPAGE_866
 
 config NLS_CODEPAGE_869
        tristate "Codepage 869 (Greek)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -235,7 +219,6 @@ config NLS_CODEPAGE_869
 
 config NLS_CODEPAGE_936
        tristate "Simplified Chinese charset (CP936, GB2312)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -248,7 +231,6 @@ config NLS_CODEPAGE_936
 
 config NLS_CODEPAGE_950
        tristate "Traditional Chinese charset (Big5)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -261,7 +243,6 @@ config NLS_CODEPAGE_950
 
 config NLS_CODEPAGE_932
        tristate "Japanese charsets (Shift-JIS, EUC-JP)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -275,7 +256,6 @@ config NLS_CODEPAGE_932
 
 config NLS_CODEPAGE_949
        tristate "Korean charset (CP949, EUC-KR)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -287,7 +267,6 @@ config NLS_CODEPAGE_949
 
 config NLS_CODEPAGE_874
        tristate "Thai charset (CP874, TIS-620)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -299,7 +278,6 @@ config NLS_CODEPAGE_874
 
 config NLS_ISO8859_8
        tristate "Hebrew charsets (ISO-8859-8, CP1255)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -309,7 +287,6 @@ config NLS_ISO8859_8
 
 config NLS_CODEPAGE_1250
        tristate "Windows CP1250 (Slavic/Central European Languages)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CDROMs
@@ -321,7 +298,6 @@ config NLS_CODEPAGE_1250
 
 config NLS_CODEPAGE_1251
        tristate "Windows CP1251 (Bulgarian, Belarusian)"
-       depends on NLS
        help
          The Microsoft FAT file system family can deal with filenames in
          native language character sets. These character sets are stored in
@@ -334,7 +310,6 @@ config NLS_CODEPAGE_1251
 
 config NLS_ASCII
        tristate "ASCII (United States)"
-       depends on NLS
        help
          An ASCII NLS module is needed if you want to override the
          DEFAULT NLS with this very basic charset and don't want any
@@ -342,7 +317,6 @@ config NLS_ASCII
 
 config NLS_ISO8859_1
        tristate "NLS ISO 8859-1  (Latin 1; Western European Languages)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -355,7 +329,6 @@ config NLS_ISO8859_1
 
 config NLS_ISO8859_2
        tristate "NLS ISO 8859-2  (Latin 2; Slavic/Central European Languages)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -367,7 +340,6 @@ config NLS_ISO8859_2
 
 config NLS_ISO8859_3
        tristate "NLS ISO 8859-3  (Latin 3; Esperanto, Galician, Maltese, Turkish)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -378,7 +350,6 @@ config NLS_ISO8859_3
 
 config NLS_ISO8859_4
        tristate "NLS ISO 8859-4  (Latin 4; old Baltic charset)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -389,7 +360,6 @@ config NLS_ISO8859_4
 
 config NLS_ISO8859_5
        tristate "NLS ISO 8859-5  (Cyrillic)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -401,7 +371,6 @@ config NLS_ISO8859_5
 
 config NLS_ISO8859_6
        tristate "NLS ISO 8859-6  (Arabic)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -411,7 +380,6 @@ config NLS_ISO8859_6
 
 config NLS_ISO8859_7
        tristate "NLS ISO 8859-7  (Modern Greek)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -421,7 +389,6 @@ config NLS_ISO8859_7
 
 config NLS_ISO8859_9
        tristate "NLS ISO 8859-9  (Latin 5; Turkish)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -432,7 +399,6 @@ config NLS_ISO8859_9
 
 config NLS_ISO8859_13
        tristate "NLS ISO 8859-13 (Latin 7; Baltic)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -443,7 +409,6 @@ config NLS_ISO8859_13
 
 config NLS_ISO8859_14
        tristate "NLS ISO 8859-14 (Latin 8; Celtic)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -455,7 +420,6 @@ config NLS_ISO8859_14
 
 config NLS_ISO8859_15
        tristate "NLS ISO 8859-15 (Latin 9; Western European Languages with Euro)"
-       depends on NLS
        ---help---
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -472,7 +436,6 @@ config NLS_ISO8859_15
 
 config NLS_KOI8_R
        tristate "NLS KOI8-R (Russian)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -482,7 +445,6 @@ config NLS_KOI8_R
 
 config NLS_KOI8_U
        tristate "NLS KOI8-U/RU (Ukrainian, Belarusian)"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -492,7 +454,6 @@ config NLS_KOI8_U
 
 config NLS_UTF8
        tristate "NLS UTF-8"
-       depends on NLS
        help
          If you want to display filenames with native language characters
          from the Microsoft FAT file system family or from JOLIET CD-ROMs
@@ -500,5 +461,4 @@ config NLS_UTF8
          input/output character sets. Say Y here for the UTF-8 encoding of
          the Unicode/ISO9646 universal character set.
 
-endmenu
-
+endif # NLS
index 6993faea28acfab649e9b868814e64031d83883c..7020e940f74e9dbcb4f7a420d67391fa6532f779 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -56,7 +56,7 @@ static wchar_t charset2uni[256] = {
        0x007c, 0x007d, 0x007e, 0x007f,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -75,11 +75,11 @@ static unsigned char page00[256] = {
        0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00,
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -98,7 +98,7 @@ static unsigned char charset2lower[256] = {
        0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -119,7 +119,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 7dfdab98729bfd30666e71f8a34ad4ea375a7543..e7905816c4caa1dce9b471bced589051e53da3e7 100644 (file)
@@ -34,7 +34,7 @@ struct utf8_table {
        long    lval;
 };
 
-static struct utf8_table utf8_table[] =
+static const struct utf8_table utf8_table[] =
 {
     {0x80,  0x00,   0*6,    0x7F,           0,         /* 1 byte sequence */},
     {0xE0,  0xC0,   1*6,    0x7FF,          0x80,      /* 2 byte sequence */},
@@ -50,7 +50,7 @@ utf8_mbtowc(wchar_t *p, const __u8 *s, int n)
 {
        long l;
        int c0, c, nc;
-       struct utf8_table *t;
+       const struct utf8_table *t;
   
        nc = 0;
        c0 = *s;
@@ -109,7 +109,7 @@ utf8_wctomb(__u8 *s, wchar_t wc, int maxlen)
 {
        long l;
        int c, nc;
-       struct utf8_table *t;
+       const struct utf8_table *t;
   
        if (s == 0)
                return 0;
@@ -240,7 +240,7 @@ void unload_nls(struct nls_table *nls)
        module_put(nls->owner);
 }
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -323,7 +323,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x00fd, 0x00fe, 0x00ff,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -359,11 +359,11 @@ static unsigned char page00[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -399,7 +399,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -438,7 +438,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 570aa69846a0343a85770bfcd5ecce0ba5010976..c8471fe78e4e5893dade5b391b2d60dda9197bc6 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003, 
        0x0004, 0x0005, 0x0006, 0x0007, 
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x00fd, 0x0163, 0x02d9, 
        };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */
        };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0xc3, 0xe3, 0xa5, 0xb9, 0xc6, 0xe6, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */
        0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -152,7 +152,7 @@ static unsigned char page01[256] = {
 
        };
 
-static unsigned char page02[256] = {
+static const unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page02[256] = {
        0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */
        };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -210,7 +210,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
        };
 
-static unsigned char page21[256] = {
+static const unsigned char page21[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -218,7 +218,7 @@ static unsigned char page21[256] = {
        0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
        };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
@@ -226,7 +226,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, page21, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -262,7 +262,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
        };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -300,7 +300,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-        unsigned char *uni2charset;
+        const unsigned char *uni2charset;
         unsigned char cl = uni & 0x00ff;
         unsigned char ch = (uni & 0xff00) >> 8;
 
index f114afa069dbd2289fcc50f63331de50bb938021..1939b46e772f42a6c5ba0377bd6b8c1939030aa9 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003, 
        0x0004, 0x0005, 0x0006, 0x0007, 
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x044c, 0x044d, 0x044e, 0x044f, 
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page04[256] = {
+static const unsigned char page04[256] = {
        0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */
        0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */
        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page04[256] = {
        0x00, 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -166,7 +166,7 @@ static unsigned char page20[256] = {
        0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
 };
 
-static unsigned char page21[256] = {
+static const unsigned char page21[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */
@@ -174,7 +174,7 @@ static unsigned char page21[256] = {
        0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   page04, NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -182,7 +182,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, page21, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -217,7 +217,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -254,7 +254,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index e57f2cbf5bc070e1a46cc96993f181be1efb9b52..8120ae2e091a78ebe3ee240c0bf35133ceff9a54 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -94,7 +94,7 @@ static wchar_t charset2uni[256] = {
        0x0000, 0x0000, 0x0000, 0x0000,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -129,7 +129,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -152,7 +152,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page02[256] = {
+static const unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
 };
 
-static unsigned char page05[256] = {
+static const unsigned char page05[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -219,7 +219,7 @@ static unsigned char page05[256] = {
        0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -245,7 +245,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0xa4, 0x00, 0x80, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
 };
 
-static unsigned char page21[256] = {
+static const unsigned char page21[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */
@@ -253,7 +253,7 @@ static unsigned char page21[256] = {
        0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   page05, NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -261,7 +261,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, page21, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -297,7 +297,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -335,7 +335,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index d41930ce4a44429f097f86602dd506806a0f58a5..ff37a4628ce48e5c9e86d4febdeea81565dec65b 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x207f, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x98, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
        0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -209,7 +209,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char page22[256] = {
        0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page23[256] = {
+static const unsigned char page23[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -233,7 +233,7 @@ static unsigned char page23[256] = {
        0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -258,7 +258,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   page03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -266,7 +266,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -302,7 +302,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -340,7 +340,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index d21f8790aa19660e3667a0b78a4b7955813cf992..f5576b8be1b92bb3e43f6a01226f5acae3e641e2 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x207f, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -131,7 +131,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, /* 0xf0-0xf7 */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -161,7 +161,7 @@ static unsigned char page03[256] = {
        0xaf, 0xe0, 0xe4, 0xe8, 0xe6, 0xe7, 0xe9, 0x00, /* 0xc8-0xcf */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -180,7 +180,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, /* 0x78-0x7f */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -196,7 +196,7 @@ static unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -221,7 +221,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   page03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -229,7 +229,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -265,7 +265,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -303,7 +303,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index c97714c38a90600e83b0887c79c36143ad6e3e6a..4905635d1c00986735d49df059cb0f2efab5b1c0 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00b3, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x9b, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0xa0, 0x83, 0x00, 0x00, 0xb5, 0xd0, 0x80, 0x87, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xb6, 0xd1, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0xed, 0x89, 0x00, 0x00, 0xb8, 0xd3, /* 0x10-0x17 */
@@ -151,21 +151,21 @@ static unsigned char page01[256] = {
        0x00, 0x8d, 0xa5, 0xa3, 0xa4, 0xcf, 0xd8, 0x00, /* 0x78-0x7f */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
        0x00, 0xef, 0x00, 0x00, 0xf2, 0xa6, 0xf7, 0x00, /* 0x18-0x1f */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
        0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -190,7 +190,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -198,7 +198,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -234,7 +234,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -272,7 +272,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 843b7d975ba27365e7df7332371ce050409871be..fe5bdad50e2b39ac4783653e8666b1c2be9a92de 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00b3, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x9b, 0x97, 0xa3, 0x96, 0x81, 0xec, 0xe7, 0x98, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,13 +155,13 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, /* 0x10-0x17 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -186,7 +186,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -194,7 +194,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -230,7 +230,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -268,7 +268,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 83cfd844d5ca5fa03d179a8325254a906a5d18a0..ceb1c0166dd8988909cfee453b79d94ab30213ff 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x0158, 0x0159, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0xa3, 0x00, 0x81, 0xec, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0xc6, 0xc7, 0xa4, 0xa5, 0x8f, 0x86, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xac, 0x9f, 0xd2, 0xd4, /* 0x08-0x0f */
        0xd1, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -151,7 +151,7 @@ static unsigned char page01[256] = {
        0x00, 0x8d, 0xab, 0xbd, 0xbe, 0xa6, 0xa7, 0x00, /* 0x78-0x7f */
 };
 
-static unsigned char page02[256] = {
+static const unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -183,7 +183,7 @@ static unsigned char page02[256] = {
        0xf4, 0xfa, 0x00, 0xf2, 0x00, 0xf1, 0x00, 0x00, /* 0xd8-0xdf */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -208,7 +208,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -216,7 +216,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -252,7 +252,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfd, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -290,7 +290,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 9190b7b574ffeff4654ab7fc5d3d18c7d3666800..cc7f5fb2e0c24849f401b47018270609d29ee5ab 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x0427, 0x00a7, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -124,7 +124,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
 };
 
-static unsigned char page04[256] = {
+static const unsigned char page04[256] = {
        0x00, 0x85, 0x81, 0x83, 0x87, 0x89, 0x8b, 0x8d, /* 0x00-0x07 */
        0x8f, 0x91, 0x93, 0x95, 0x97, 0x00, 0x99, 0x9b, /* 0x08-0x0f */
        0xa1, 0xa3, 0xec, 0xad, 0xa7, 0xa9, 0xea, 0xf4, /* 0x10-0x17 */
@@ -139,13 +139,13 @@ static unsigned char page04[256] = {
        0x8e, 0x90, 0x92, 0x94, 0x96, 0x00, 0x98, 0x9a, /* 0x58-0x5f */
 };
 
-static unsigned char page21[256] = {
+static const unsigned char page21[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, /* 0x10-0x17 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -170,7 +170,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   page04, NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -178,7 +178,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   page21, NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -214,7 +214,7 @@ static unsigned char charset2lower[256] = {
        0xf7, 0xf9, 0xf9, 0xfb, 0xfb, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -252,7 +252,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index ef3d36db808245f956c8706f7655e4817320303f..e418e198e8d866586e8317f7327dfdfc924c8188 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00b3, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x9b, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0xed, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -147,7 +147,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x9f, /* 0x58-0x5f */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -172,7 +172,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -180,7 +180,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -216,7 +216,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -254,7 +254,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 7e2fb6645893b75982900683950b1a84049da82f..a86c97d1aa3484747df369573918cbf01aa97a88 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x207f, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0x97, 0xa3, 0x00, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -161,7 +161,7 @@ static unsigned char page03[256] = {
        0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -186,7 +186,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -202,7 +202,7 @@ static unsigned char page22[256] = {
        0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page23[256] = {
+static const unsigned char page23[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -210,7 +210,7 @@ static unsigned char page23[256] = {
        0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -235,7 +235,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   page03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -243,7 +243,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -279,7 +279,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -317,7 +317,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 66d8d808ccf1400120a2f8d94329aa8cf2f4cc16..bd920227acdfd0869b450c8d0b58105cf9ae5037 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x207f, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x9b, 0x00, 0xa3, 0x96, 0x81, 0x98, 0x95, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
        0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -209,7 +209,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char page22[256] = {
        0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page23[256] = {
+static const unsigned char page23[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -233,7 +233,7 @@ static unsigned char page23[256] = {
        0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -258,7 +258,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   page03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -266,7 +266,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -302,7 +302,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -340,7 +340,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 360ba388485fbe31a8825672e23ba242a99b1648..e9b68eb3daf04d21cb39ed60ab1d4b6120bbf24d 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x207f, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
        0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
 };
 
-static unsigned char page05[256] = {
+static const unsigned char page05[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -218,7 +218,7 @@ static unsigned char page05[256] = {
        0x98, 0x99, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -243,7 +243,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -259,7 +259,7 @@ static unsigned char page22[256] = {
        0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page23[256] = {
+static const unsigned char page23[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -267,7 +267,7 @@ static unsigned char page23[256] = {
        0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -292,7 +292,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   page03, NULL,   page05, NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -300,7 +300,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -336,7 +336,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -374,7 +374,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 656a93113e37bac396574ccc965b656a3917f4ca..f8a9b07ab4e2f64cc80d247b567250d90b034fea 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x207f, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
        0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, /* 0x10-0x17 */
@@ -203,7 +203,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, /* 0x78-0x7f */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -219,7 +219,7 @@ static unsigned char page22[256] = {
        0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page23[256] = {
+static const unsigned char page23[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -227,7 +227,7 @@ static unsigned char page23[256] = {
        0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -252,7 +252,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   page03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -260,7 +260,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -296,7 +296,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -334,7 +334,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 01ca7309753e9036da17bd6cec51c6cbd4186343..8d31f435fc6f9a31f662d929d6870402766688af 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0xfed9, 0xfef1, 0x25a0, 0x0000,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -131,7 +131,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, /* 0xf0-0xf7 */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -160,7 +160,7 @@ static unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x00, /* 0xc0-0xc7 */
 };
 
-static unsigned char page06[256] = {
+static const unsigned char page06[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -177,7 +177,7 @@ static unsigned char page06[256] = {
        0xb8, 0xb9, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -190,7 +190,7 @@ static unsigned char page22[256] = {
        0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0x85, 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x8c, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -215,7 +215,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char pagefe[256] = {
+static const unsigned char pagefe[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -251,7 +251,7 @@ static unsigned char pagefe[256] = {
        0x9a, 0x00, 0x00, 0x9d, 0x9e, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   page03, NULL,   NULL,   page06, NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -286,7 +286,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   pagefe, NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -322,7 +322,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -360,7 +360,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 5ba6ee13e109e043d8e265feb5c01e88c663fef9..4bd902fe3ec94065d05f3ab36515efac885f3e13 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x207f, 0x00b2, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x9b, 0x97, 0xa3, 0x96, 0x81, 0x00, 0x00, 0x98, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -155,7 +155,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -184,7 +184,7 @@ static unsigned char page03[256] = {
        0xe3, 0x00, 0x00, 0xe5, 0xe7, 0x00, 0xed, 0x00, /* 0xc0-0xc7 */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -209,7 +209,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xa0-0xa7 */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char page22[256] = {
        0x00, 0xf0, 0x00, 0x00, 0xf3, 0xf2, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page23[256] = {
+static const unsigned char page23[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xa9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -233,7 +233,7 @@ static unsigned char page23[256] = {
        0xf4, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -258,7 +258,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   page03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -266,7 +266,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -302,7 +302,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -340,7 +340,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index c5f82221c9fe4139eec88013d7d7582dc55c1eb3..bdc7cb391398828330db1cfedb8c47d7174f3d3b 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x2116, 0x00a4, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -123,7 +123,7 @@ static unsigned char page00[256] = {
        0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, /* 0xb0-0xb7 */
 };
 
-static unsigned char page04[256] = {
+static const unsigned char page04[256] = {
        0x00, 0xf0, 0x00, 0x00, 0xf2, 0x00, 0x00, 0xf4, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x00, /* 0x08-0x0f */
        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x10-0x17 */
@@ -138,20 +138,20 @@ static unsigned char page04[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, /* 0x58-0x5f */
 };
 
-static unsigned char page21[256] = {
+static const unsigned char page21[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, /* 0x10-0x17 */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
        0x00, 0xf9, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -176,7 +176,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   page04, NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -184,7 +184,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   page21, page22, NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -220,7 +220,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -258,7 +258,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 8d4015124d11e00ad39b3f8752191c5d7941a36b..9f283a2b151a2c2f7004ecdfceae58b5f3c53a06 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x03b0, 0x03ce, 0x25a0, 0x00a0,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -124,7 +124,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0xaf, 0x00, 0xab, 0x00, 0x00, /* 0xb8-0xbf */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -154,14 +154,14 @@ static unsigned char page03[256] = {
        0xf6, 0xfa, 0xa0, 0xfb, 0xa2, 0xa3, 0xfd, 0x00, /* 0xc8-0xcf */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, /* 0x10-0x17 */
        0x8b, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0xc4, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xbf, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -186,7 +186,7 @@ static unsigned char page25[256] = {
        0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   page03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -194,7 +194,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -230,7 +230,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -268,7 +268,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index df042052c2db15bb902d020a53ec65d82effb4c4..0b3c4886f8c03d2927ecd9a16a13d964f5cb97e4 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x0000, 0x0000, 0x0000, 0x0000,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -121,7 +121,7 @@ static unsigned char page00[256] = {
        0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char page0e[256] = {
+static const unsigned char page0e[256] = {
        0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */
@@ -136,7 +136,7 @@ static unsigned char page0e[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -144,7 +144,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   page0e, NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -152,7 +152,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -188,7 +188,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -226,7 +226,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 2a9ccf3bc7efae1d0e6e464ca62467bc890433e3..0ffed6f1cebb6cb8d9c5618cc4876c6f053457d3 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t c2u_81[256] = {
+static const wchar_t c2u_81[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -49,7 +49,7 @@ static wchar_t c2u_81[256] = {
        0x0000,0x0000,0x0000,0x0000,0x25EF,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_82[256] = {
+static const wchar_t c2u_82[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -84,7 +84,7 @@ static wchar_t c2u_82[256] = {
        0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
 };
 
-static wchar_t c2u_83[256] = {
+static const wchar_t c2u_83[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -115,7 +115,7 @@ static wchar_t c2u_83[256] = {
        0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9,0x0000,/* 0xD0-0xD7 */
 };
 
-static wchar_t c2u_84[256] = {
+static const wchar_t c2u_84[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -143,7 +143,7 @@ static wchar_t c2u_84[256] = {
        0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542,0x0000,/* 0xB8-0xBF */
 };
 
-static wchar_t c2u_87[256] = {
+static const wchar_t c2u_87[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -167,7 +167,7 @@ static wchar_t c2u_87[256] = {
        0x221F,0x22BF,0x2235,0x2229,0x222A,0x0000,0x0000,0x0000,/* 0x98-0x9F */
 };
 
-static wchar_t c2u_88[256] = {
+static const wchar_t c2u_88[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -203,7 +203,7 @@ static wchar_t c2u_88[256] = {
        0x5F15,0x98F2,0x6DEB,0x80E4,0x852D,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_89[256] = {
+static const wchar_t c2u_89[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -239,7 +239,7 @@ static wchar_t c2u_89[256] = {
        0x6062,0x61D0,0x6212,0x62D0,0x6539,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8A[256] = {
+static const wchar_t c2u_8A[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -275,7 +275,7 @@ static wchar_t c2u_8A[256] = {
        0x65D7,0x65E2,0x671F,0x68CB,0x68C4,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8B[256] = {
+static const wchar_t c2u_8B[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -311,7 +311,7 @@ static wchar_t c2u_8B[256] = {
        0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8C[256] = {
+static const wchar_t c2u_8C[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -347,7 +347,7 @@ static wchar_t c2u_8C[256] = {
        0x52B9,0x52FE,0x539A,0x53E3,0x5411,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8D[256] = {
+static const wchar_t c2u_8D[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -383,7 +383,7 @@ static wchar_t c2u_8D[256] = {
        0x9BAD,0x7B39,0x5319,0x518A,0x5237,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8E[256] = {
+static const wchar_t c2u_8E[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -419,7 +419,7 @@ static wchar_t c2u_8E[256] = {
        0x7DAC,0x9700,0x56DA,0x53CE,0x5468,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8F[256] = {
+static const wchar_t c2u_8F[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -455,7 +455,7 @@ static wchar_t c2u_8F[256] = {
        0x91B8,0x9320,0x5631,0x57F4,0x98FE,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_90[256] = {
+static const wchar_t c2u_90[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -491,7 +491,7 @@ static wchar_t c2u_90[256] = {
        0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_91[256] = {
+static const wchar_t c2u_91[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -527,7 +527,7 @@ static wchar_t c2u_91[256] = {
        0x8AFE,0x8338,0x51E7,0x86F8,0x53EA,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_92[256] = {
+static const wchar_t c2u_92[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -563,7 +563,7 @@ static wchar_t c2u_92[256] = {
        0x8247,0x8A02,0x8AE6,0x8E44,0x9013,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_93[256] = {
+static const wchar_t c2u_93[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -599,7 +599,7 @@ static wchar_t c2u_93[256] = {
        0x8679,0x5EFF,0x65E5,0x4E73,0x5165,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_94[256] = {
+static const wchar_t c2u_94[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -635,7 +635,7 @@ static wchar_t c2u_94[256] = {
        0x6787,0x6BD8,0x7435,0x7709,0x7F8E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_95[256] = {
+static const wchar_t c2u_95[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -671,7 +671,7 @@ static wchar_t c2u_95[256] = {
        0x62B1,0x6367,0x653E,0x65B9,0x670B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_96[256] = {
+static const wchar_t c2u_96[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -707,7 +707,7 @@ static wchar_t c2u_96[256] = {
        0x9453,0x6109,0x6108,0x6CB9,0x7652,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_97[256] = {
+static const wchar_t c2u_97[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -743,7 +743,7 @@ static wchar_t c2u_97[256] = {
        0x6F23,0x7149,0x7C3E,0x7DF4,0x806F,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_98[256] = {
+static const wchar_t c2u_98[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -779,7 +779,7 @@ static wchar_t c2u_98[256] = {
        0x5080,0x509A,0x5085,0x50B4,0x50B2,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_99[256] = {
+static const wchar_t c2u_99[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -815,7 +815,7 @@ static wchar_t c2u_99[256] = {
        0x54A5,0x54AC,0x54C4,0x54C8,0x54A8,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9A[256] = {
+static const wchar_t c2u_9A[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -851,7 +851,7 @@ static wchar_t c2u_9A[256] = {
        0x5962,0x5960,0x5967,0x596C,0x5969,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9B[256] = {
+static const wchar_t c2u_9B[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -887,7 +887,7 @@ static wchar_t c2u_9B[256] = {
        0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9C[256] = {
+static const wchar_t c2u_9C[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -923,7 +923,7 @@ static wchar_t c2u_9C[256] = {
        0x6209,0x620D,0x620C,0x6214,0x621B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9D[256] = {
+static const wchar_t c2u_9D[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -959,7 +959,7 @@ static wchar_t c2u_9D[256] = {
        0x66C1,0x66B9,0x66C9,0x66BE,0x66BC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9E[256] = {
+static const wchar_t c2u_9E[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -995,7 +995,7 @@ static wchar_t c2u_9E[256] = {
        0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9F[256] = {
+static const wchar_t c2u_9F[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1031,7 +1031,7 @@ static wchar_t c2u_9F[256] = {
        0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E0[256] = {
+static const wchar_t c2u_E0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1067,7 +1067,7 @@ static wchar_t c2u_E0[256] = {
        0x74A7,0x74CA,0x74CF,0x74D4,0x73F1,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E1[256] = {
+static const wchar_t c2u_E1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1103,7 +1103,7 @@ static wchar_t c2u_E1[256] = {
        0x78BE,0x78BC,0x78C5,0x78CA,0x78EC,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E2[256] = {
+static const wchar_t c2u_E2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1139,7 +1139,7 @@ static wchar_t c2u_E2[256] = {
        0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E3[256] = {
+static const wchar_t c2u_E3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1175,7 +1175,7 @@ static wchar_t c2u_E3[256] = {
        0x811B,0x8129,0x8123,0x812F,0x814B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E4[256] = {
+static const wchar_t c2u_E4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1211,7 +1211,7 @@ static wchar_t c2u_E4[256] = {
        0x84FC,0x8540,0x8563,0x8558,0x8548,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E5[256] = {
+static const wchar_t c2u_E5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1247,7 +1247,7 @@ static wchar_t c2u_E5[256] = {
        0x8938,0x894C,0x891D,0x8960,0x895E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E6[256] = {
+static const wchar_t c2u_E6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1283,7 +1283,7 @@ static wchar_t c2u_E6[256] = {
        0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E7[256] = {
+static const wchar_t c2u_E7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1319,7 +1319,7 @@ static wchar_t c2u_E7[256] = {
        0x92E9,0x930F,0x92FA,0x9344,0x932E,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E8[256] = {
+static const wchar_t c2u_E8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1355,7 +1355,7 @@ static wchar_t c2u_E8[256] = {
        0x984F,0x984B,0x986B,0x986F,0x9870,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E9[256] = {
+static const wchar_t c2u_E9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1391,7 +1391,7 @@ static wchar_t c2u_E9[256] = {
        0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EA[256] = {
+static const wchar_t c2u_EA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1416,7 +1416,7 @@ static wchar_t c2u_EA[256] = {
        0x69C7,0x9059,0x7464,0x51DC,0x7199,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_ED[256] = {
+static const wchar_t c2u_ED[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1452,7 +1452,7 @@ static wchar_t c2u_ED[256] = {
        0x7147,0xFA15,0x71C1,0x71FE,0x72B1,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EE[256] = {
+static const wchar_t c2u_EE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1488,7 +1488,7 @@ static wchar_t c2u_EE[256] = {
        0x2179,0xFFE2,0xFFE4,0xFF07,0xFF02,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_FA[256] = {
+static const wchar_t c2u_FA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1524,7 +1524,7 @@ static wchar_t c2u_FA[256] = {
        0x6C6F,0x6CDA,0x6D04,0x6D87,0x6D6F,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_FB[256] = {
+static const wchar_t c2u_FB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1560,7 +1560,7 @@ static wchar_t c2u_FB[256] = {
        0x9927,0xFA2C,0x999E,0x9A4E,0x9AD9,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_FC[256] = {
+static const wchar_t c2u_FC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1573,7 +1573,7 @@ static wchar_t c2u_FC[256] = {
        0x9D6B,0xFA2D,0x9E19,0x9ED1,0x0000,0x0000,0x0000,0x0000,/* 0x48-0x4F */
 };
 
-static wchar_t *page_charset2uni[256] = {
+static const wchar_t *page_charset2uni[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -1608,7 +1608,7 @@ static wchar_t *page_charset2uni[256] = {
        NULL,   NULL,   c2u_FA, c2u_FB, c2u_FC, NULL,   NULL,   NULL,   
 };
 
-static unsigned char u2c_00hi[256 - 0xA0][2] = {
+static const unsigned char u2c_00hi[256 - 0xA0][2] = {
        {0x00, 0x00}, {0x00, 0x00}, {0x81, 0x91}, {0x81, 0x92},/* 0xA0-0xA3 */
        {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00}, {0x81, 0x98},/* 0xA4-0xA7 */
        {0x81, 0x4E}, {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00},/* 0xA8-0xAB */
@@ -1635,7 +1635,7 @@ static unsigned char u2c_00hi[256 - 0xA0][2] = {
        {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00}, {0x00, 0x00},/* 0xFC-0xFF */
 };
 
-static unsigned char u2c_03[512] = {
+static const unsigned char u2c_03[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1690,7 +1690,7 @@ static unsigned char u2c_03[512] = {
        0x83, 0xD5, 0x83, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */
 };
 
-static unsigned char u2c_04[512] = {
+static const unsigned char u2c_04[512] = {
        0x00, 0x00, 0x84, 0x46, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1714,7 +1714,7 @@ static unsigned char u2c_04[512] = {
        0x00, 0x00, 0x84, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */
 };
 
-static unsigned char u2c_20[512] = {
+static const unsigned char u2c_20[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1732,7 +1732,7 @@ static unsigned char u2c_20[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xA6, /* 0x38-0x3B */
 };
 
-static unsigned char u2c_21[512] = {
+static const unsigned char u2c_21[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x8E, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1790,7 +1790,7 @@ static unsigned char u2c_21[512] = {
        0x81, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */
 };
 
-static unsigned char u2c_22[512] = {
+static const unsigned char u2c_22[512] = {
        0x81, 0xCD, 0x00, 0x00, 0x81, 0xDD, 0x81, 0xCE, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xDE, /* 0x04-0x07 */
        0x81, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x81, 0xB9, /* 0x08-0x0B */
@@ -1842,7 +1842,7 @@ static unsigned char u2c_22[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x99, /* 0xBC-0xBF */
 };
 
-static unsigned char u2c_23[512] = {
+static const unsigned char u2c_23[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1850,7 +1850,7 @@ static unsigned char u2c_23[512] = {
        0x00, 0x00, 0x00, 0x00, 0x81, 0xDC, 0x00, 0x00, /* 0x10-0x13 */
 };
 
-static unsigned char u2c_24[512] = {
+static const unsigned char u2c_24[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1882,7 +1882,7 @@ static unsigned char u2c_24[512] = {
        0x87, 0x50, 0x87, 0x51, 0x87, 0x52, 0x87, 0x53, /* 0x70-0x73 */
 };
 
-static unsigned char u2c_25[512] = {
+static const unsigned char u2c_25[512] = {
        0x84, 0x9F, 0x84, 0xAA, 0x84, 0xA0, 0x84, 0xAB, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1946,7 +1946,7 @@ static unsigned char u2c_25[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFC, /* 0xEC-0xEF */
 };
 
-static unsigned char u2c_26[512] = {
+static const unsigned char u2c_26[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x81, 0x9A, 0x81, 0x99, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -1977,7 +1977,7 @@ static unsigned char u2c_26[512] = {
        0x00, 0x00, 0x81, 0xF3, 0x00, 0x00, 0x81, 0xF2, /* 0x6C-0x6F */
 };
 
-static unsigned char u2c_30[512] = {
+static const unsigned char u2c_30[512] = {
        0x81, 0x40, 0x81, 0x41, 0x81, 0x42, 0x81, 0x56, /* 0x00-0x03 */
        0x00, 0x00, 0x81, 0x58, 0x81, 0x59, 0x81, 0x5A, /* 0x04-0x07 */
        0x81, 0x71, 0x81, 0x72, 0x81, 0x73, 0x81, 0x74, /* 0x08-0x0B */
@@ -2045,7 +2045,7 @@ static unsigned char u2c_30[512] = {
        0x81, 0x5B, 0x81, 0x52, 0x81, 0x53, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_32[512] = {
+static const unsigned char u2c_32[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2092,7 +2092,7 @@ static unsigned char u2c_32[512] = {
        0x87, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA8-0xAB */
 };
 
-static unsigned char u2c_33[512] = {
+static const unsigned char u2c_33[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x65, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2148,7 +2148,7 @@ static unsigned char u2c_33[512] = {
        0x00, 0x00, 0x87, 0x83, 0x00, 0x00, 0x00, 0x00, /* 0xCC-0xCF */
 };
 
-static unsigned char u2c_4E[512] = {
+static const unsigned char u2c_4E[512] = {
        0x88, 0xEA, 0x92, 0x9A, 0x00, 0x00, 0x8E, 0xB5, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x9C, /* 0x04-0x07 */
        0x8F, 0xE4, 0x8E, 0x4F, 0x8F, 0xE3, 0x89, 0xBA, /* 0x08-0x0B */
@@ -2216,7 +2216,7 @@ static unsigned char u2c_4E[512] = {
        0xED, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_4F[512] = {
+static const unsigned char u2c_4F[512] = {
        0xED, 0x4F, 0x8A, 0xE9, 0x00, 0x00, 0xED, 0x50, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x98, 0xC2, 0x88, 0xC9, 0x00, 0x00, /* 0x08-0x0B */
@@ -2284,7 +2284,7 @@ static unsigned char u2c_4F[512] = {
        0x00, 0x00, 0x00, 0x00, 0x98, 0xEA, 0xED, 0x5A, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_50[512] = {
+static const unsigned char u2c_50[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x98, 0xE4, 0x98, 0xED, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x91, 0x71, 0x00, 0x00, 0x8C, 0xC2, /* 0x08-0x0B */
@@ -2351,7 +2351,7 @@ static unsigned char u2c_50[512] = {
        0x00, 0x00, 0x99, 0x4A, 0x00, 0x00, 0x95, 0xC6, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_51[512] = {
+static const unsigned char u2c_51[512] = {
        0x8B, 0x56, 0x99, 0x4D, 0x99, 0x4E, 0x00, 0x00, /* 0x00-0x03 */
        0x89, 0xAD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x99, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2419,7 +2419,7 @@ static unsigned char u2c_51[512] = {
        0x00, 0x00, 0x94, 0x9F, 0x99, 0x82, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_52[512] = {
+static const unsigned char u2c_52[512] = {
        0x93, 0x81, 0x00, 0x00, 0x00, 0x00, 0x90, 0x6E, /* 0x00-0x03 */
        0x99, 0x83, 0x00, 0x00, 0x95, 0xAA, 0x90, 0xD8, /* 0x04-0x07 */
        0x8A, 0xA0, 0x00, 0x00, 0x8A, 0xA7, 0x99, 0x84, /* 0x08-0x0B */
@@ -2487,7 +2487,7 @@ static unsigned char u2c_52[512] = {
        0x00, 0x00, 0x00, 0x00, 0x8C, 0xF9, 0x96, 0xDC, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_53[512] = {
+static const unsigned char u2c_53[512] = {
        0xED, 0x6C, 0x96, 0xE6, 0x93, 0xF5, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x95, 0xEF, 0x99, 0xB0, 0xED, 0x6D, /* 0x04-0x07 */
        0x99, 0xB1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2554,7 +2554,7 @@ static unsigned char u2c_53[512] = {
        0x8E, 0x69, 0x00, 0x00, 0x99, 0xDB, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_54[512] = {
+static const unsigned char u2c_54[512] = {
        0x00, 0x00, 0x99, 0xDC, 0x00, 0x00, 0x8B, 0x68, /* 0x00-0x03 */
        0x8A, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x8D, 0x87, 0x8B, 0x67, 0x92, 0xDD, 0x89, 0x44, /* 0x08-0x0B */
@@ -2622,7 +2622,7 @@ static unsigned char u2c_54[512] = {
        0x00, 0x00, 0x9A, 0x4A, 0x00, 0x00, 0xED, 0x77, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_55[512] = {
+static const unsigned char u2c_55[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x89, 0x53, 0x00, 0x00, 0x8D, 0xB4, 0x90, 0x4F, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2690,7 +2690,7 @@ static unsigned char u2c_55[512] = {
        0x00, 0x00, 0x9A, 0x75, 0x9A, 0x74, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_56[512] = {
+static const unsigned char u2c_56[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x92, 0x51, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x89, 0xC3, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -2758,7 +2758,7 @@ static unsigned char u2c_56[512] = {
        0x00, 0x00, 0x8D, 0x91, 0x00, 0x00, 0x9A, 0x9C, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_57[512] = {
+static const unsigned char u2c_57[512] = {
        0x9A, 0x9B, 0x00, 0x00, 0x00, 0x00, 0x95, 0xDE, /* 0x00-0x03 */
        0x9A, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x9A, 0x9F, 0x9A, 0x9E, 0x00, 0x00, 0x9A, 0xA0, /* 0x08-0x0B */
@@ -2826,7 +2826,7 @@ static unsigned char u2c_57[512] = {
        0x8D, 0xE9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_58[512] = {
+static const unsigned char u2c_58[512] = {
        0x96, 0x78, 0x00, 0x00, 0x93, 0xB0, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x8C, 0x98, 0x91, 0xCD, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x9A, 0xBF, 0x9A, 0xC2, /* 0x08-0x0B */
@@ -2894,7 +2894,7 @@ static unsigned char u2c_58[512] = {
        0x9A, 0xE5, 0x9A, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_59[512] = {
+static const unsigned char u2c_59[512] = {
        0x00, 0x00, 0x00, 0x00, 0x9A, 0xE7, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x95, 0xCF, 0x9A, 0xE8, 0xED, 0x83, /* 0x08-0x0B */
@@ -2962,7 +2962,7 @@ static unsigned char u2c_59[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x70, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5A[512] = {
+static const unsigned char u2c_5A[512] = {
        0x00, 0x00, 0x88, 0xD0, 0x00, 0x00, 0x88, 0xA1, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x9B, 0x51, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3029,7 +3029,7 @@ static unsigned char u2c_5A[512] = {
        0x00, 0x00, 0x00, 0x00, 0x9B, 0x65, 0x9B, 0x66, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_5B[512] = {
+static const unsigned char u2c_5B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x8A, 0xF0, 0x00, 0x00, 0x9B, 0x68, /* 0x08-0x0B */
@@ -3097,7 +3097,7 @@ static unsigned char u2c_5B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x91, 0xCE, 0x8E, 0xF5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5C[512] = {
+static const unsigned char u2c_5C[512] = {
        0x00, 0x00, 0x95, 0x95, 0x90, 0xEA, 0x00, 0x00, /* 0x00-0x03 */
        0x8E, 0xCB, 0x9B, 0x91, 0x8F, 0xAB, 0x9B, 0x92, /* 0x04-0x07 */
        0x9B, 0x93, 0x88, 0xD1, 0x91, 0xB8, 0x90, 0x71, /* 0x08-0x0B */
@@ -3165,7 +3165,7 @@ static unsigned char u2c_5C[512] = {
        0x00, 0x00, 0x9B, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5D[512] = {
+static const unsigned char u2c_5D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x92, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9B, 0xBA, /* 0x08-0x0B */
@@ -3233,7 +3233,7 @@ static unsigned char u2c_5D[512] = {
        0x00, 0x00, 0x92, 0x46, 0x8B, 0xD0, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5E[512] = {
+static const unsigned char u2c_5E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x8E, 0x73, 0x95, 0x7A, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x94, 0xBF, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9B, 0xE1, /* 0x08-0x0B */
@@ -3301,7 +3301,7 @@ static unsigned char u2c_5E[512] = {
        0x94, 0x55, 0x00, 0x00, 0x9C, 0x4F, 0x93, 0xF9, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5F[512] = {
+static const unsigned char u2c_5F[512] = {
        0x00, 0x00, 0x95, 0xD9, 0x00, 0x00, 0x9C, 0x50, /* 0x00-0x03 */
        0x98, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x9C, 0x51, 0x95, 0xBE, 0x9C, 0x54, /* 0x08-0x0B */
@@ -3369,7 +3369,7 @@ static unsigned char u2c_5F[512] = {
        0x00, 0x00, 0x8D, 0x9A, 0x00, 0x00, 0x9C, 0x7C, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_60[512] = {
+static const unsigned char u2c_60[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3436,7 +3436,7 @@ static unsigned char u2c_60[512] = {
        0x00, 0x00, 0x8E, 0xE4, 0x9C, 0xB7, 0x9C, 0xBA, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_61[512] = {
+static const unsigned char u2c_61[512] = {
        0x9C, 0xB5, 0x8F, 0x44, 0x00, 0x00, 0x9C, 0xB8, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x9C, 0xB2, 0x00, 0x00, /* 0x04-0x07 */
        0x96, 0xFA, 0x96, 0xF9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3504,7 +3504,7 @@ static unsigned char u2c_61[512] = {
        0x9C, 0xF4, 0x9C, 0xF3, 0x9C, 0xF5, 0x9C, 0xF2, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_62[512] = {
+static const unsigned char u2c_62[512] = {
        0x9C, 0xF6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x9C, 0xF7, 0x9C, 0xF8, 0x95, 0xE8, 0x00, 0x00, /* 0x08-0x0B */
@@ -3572,7 +3572,7 @@ static unsigned char u2c_62[512] = {
        0x00, 0x00, 0x00, 0x00, 0x8F, 0x45, 0x9D, 0x5C, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_63[512] = {
+static const unsigned char u2c_63[512] = {
        0x00, 0x00, 0x8E, 0x9D, 0x9D, 0x6B, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8E, 0x77, /* 0x04-0x07 */
        0x9D, 0x6C, 0x88, 0xC2, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3639,7 +3639,7 @@ static unsigned char u2c_63[512] = {
        0x00, 0x00, 0x00, 0x00, 0x97, 0x68, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_64[512] = {
+static const unsigned char u2c_64[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x9D, 0x8C, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3707,7 +3707,7 @@ static unsigned char u2c_64[512] = {
        0x00, 0x00, 0x9D, 0xB4, 0x8F, 0xEF, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_65[512] = {
+static const unsigned char u2c_65[512] = {
        0x9D, 0xB3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x9D, 0xB7, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3774,7 +3774,7 @@ static unsigned char u2c_65[512] = {
        0x00, 0x00, 0x00, 0x00, 0x89, 0xA0, 0x9D, 0xDF, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_66[512] = {
+static const unsigned char u2c_66[512] = {
        0xED, 0xB2, 0x00, 0x00, 0x8D, 0x56, 0x9D, 0xDE, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x8D, 0xA9, 0x8F, 0xB8, /* 0x04-0x07 */
        0x00, 0x00, 0xED, 0xB5, 0x9D, 0xDD, 0x00, 0x00, /* 0x08-0x0B */
@@ -3842,7 +3842,7 @@ static unsigned char u2c_66[512] = {
        0x99, 0xD6, 0x91, 0x5D, 0x91, 0x5C, 0x91, 0xD6, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_67[512] = {
+static const unsigned char u2c_67[512] = {
        0x8D, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x98, 0xF0, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x8C, 0x8E, 0x97, 0x4C, 0x00, 0x00, 0x95, 0xFC, /* 0x08-0x0B */
@@ -3910,7 +3910,7 @@ static unsigned char u2c_67[512] = {
        0x00, 0x00, 0x00, 0x00, 0x96, 0x8F, 0x8A, 0x60, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_68[512] = {
+static const unsigned char u2c_68[512] = {
        0x00, 0x00, 0xED, 0xC9, 0x92, 0xCC, 0x93, 0xC8, /* 0x00-0x03 */
        0x89, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3977,7 +3977,7 @@ static unsigned char u2c_68[512] = {
        0x00, 0x00, 0x9E, 0xA8, 0x8A, 0xBB, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_69[512] = {
+static const unsigned char u2c_69[512] = {
        0x98, 0x6F, 0x9E, 0x96, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x9E, 0xA4, 0x88, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x9E, 0x98, 0x00, 0x00, 0x00, 0x00, 0x96, 0xB8, /* 0x08-0x0B */
@@ -4045,7 +4045,7 @@ static unsigned char u2c_69[512] = {
        0x00, 0x00, 0x91, 0x85, 0x00, 0x00, 0x9E, 0xDB, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6A[512] = {
+static const unsigned char u2c_6A[512] = {
        0x00, 0x00, 0x00, 0x00, 0x9E, 0xD9, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x9E, 0xE0, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x9E, 0xE6, 0x94, 0xF3, /* 0x08-0x0B */
@@ -4112,7 +4112,7 @@ static unsigned char u2c_6A[512] = {
        0x00, 0x00, 0x00, 0x00, 0x9F, 0x51, 0x9F, 0x4E, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_6B[512] = {
+static const unsigned char u2c_6B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x97, 0x93, 0x9F, 0x4F, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x9E, 0xDC, 0x00, 0x00, /* 0x08-0x0B */
@@ -4177,7 +4177,7 @@ static unsigned char u2c_6B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9F, 0x7D, /* 0xF0-0xF3 */
 };
 
-static unsigned char u2c_6C[512] = {
+static const unsigned char u2c_6C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x9F, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4242,7 +4242,7 @@ static unsigned char u2c_6C[512] = {
        0x91, 0xD7, 0x9F, 0x96, 0x00, 0x00, 0x89, 0x6A, /* 0xF0-0xF3 */
 };
 
-static unsigned char u2c_6D[512] = {
+static const unsigned char u2c_6D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xED, 0xDE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x6D, /* 0x08-0x0B */
@@ -4310,7 +4310,7 @@ static unsigned char u2c_6D[512] = {
        0xED, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6E[512] = {
+static const unsigned char u2c_6E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x90, 0xB4, 0x00, 0x00, 0x8A, 0x89, /* 0x04-0x07 */
        0x8D, 0xCF, 0x8F, 0xC2, 0x9F, 0xBB, 0x8F, 0x61, /* 0x08-0x0B */
@@ -4378,7 +4378,7 @@ static unsigned char u2c_6E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x9F, 0xF6, 0x9F, 0xDE, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6F[512] = {
+static const unsigned char u2c_6F[512] = {
        0x00, 0x00, 0x8B, 0x99, 0x95, 0x59, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x8E, 0xBD, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x8D, 0x97, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4446,7 +4446,7 @@ static unsigned char u2c_6F[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE0, 0x68, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_70[512] = {
+static const unsigned char u2c_70[512] = {
        0x00, 0x00, 0xE0, 0x66, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xED, 0xEF, 0x00, 0x00, 0xED, 0xF0, /* 0x04-0x07 */
        0x00, 0x00, 0xE0, 0x62, 0x00, 0x00, 0xE0, 0x63, /* 0x08-0x0B */
@@ -4514,7 +4514,7 @@ static unsigned char u2c_70[512] = {
        0x00, 0x00, 0xE0, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_71[512] = {
+static const unsigned char u2c_71[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xED, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xE0, 0x81, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4582,7 +4582,7 @@ static unsigned char u2c_71[512] = {
        0xE0, 0x9E, 0x00, 0x00, 0xED, 0xFB, 0xE0, 0xA0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_72[512] = {
+static const unsigned char u2c_72[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x94, 0x9A, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4650,7 +4650,7 @@ static unsigned char u2c_72[512] = {
        0x98, 0x54, 0x94, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_73[512] = {
+static const unsigned char u2c_73[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xE0, 0xC7, 0x00, 0x00, /* 0x08-0x0B */
@@ -4718,7 +4718,7 @@ static unsigned char u2c_73[512] = {
        0x00, 0x00, 0x00, 0x00, 0x8C, 0xBB, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_74[512] = {
+static const unsigned char u2c_74[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x85, /* 0x00-0x03 */
        0x00, 0x00, 0xE0, 0xE4, 0x97, 0x9D, 0xEE, 0x49, /* 0x04-0x07 */
        0x00, 0x00, 0x97, 0xAE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4785,7 +4785,7 @@ static unsigned char u2c_74[512] = {
        0xE1, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_75[512] = {
+static const unsigned char u2c_75[512] = {
        0x00, 0x00, 0xEE, 0x52, 0x00, 0x00, 0xE1, 0x4B, /* 0x00-0x03 */
        0xE1, 0x4A, 0xE1, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4853,7 +4853,7 @@ static unsigned char u2c_75[512] = {
        0xE1, 0x80, 0x00, 0x00, 0xE1, 0x7D, 0xE1, 0x7E, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_76[512] = {
+static const unsigned char u2c_76[512] = {
        0x00, 0x00, 0xE1, 0x81, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xE1, 0x88, 0x00, 0x00, 0xE1, 0x86, /* 0x08-0x0B */
@@ -4921,7 +4921,7 @@ static unsigned char u2c_76[512] = {
        0x00, 0x00, 0x00, 0x00, 0x8F, 0x82, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_77[512] = {
+static const unsigned char u2c_77[512] = {
        0x00, 0x00, 0x8F, 0xC8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xE1, 0xBE, 0x00, 0x00, 0x00, 0x00, 0xE1, 0xBD, /* 0x04-0x07 */
        0xE1, 0xBC, 0x94, 0xFB, 0x00, 0x00, 0x8A, 0xC5, /* 0x08-0x0B */
@@ -4989,7 +4989,7 @@ static unsigned char u2c_77[512] = {
        0xE1, 0xE3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_78[512] = {
+static const unsigned char u2c_78[512] = {
        0x00, 0x00, 0x00, 0x00, 0x8D, 0xBB, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5057,7 +5057,7 @@ static unsigned char u2c_78[512] = {
        0x00, 0x00, 0xE2, 0x42, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_79[512] = {
+static const unsigned char u2c_79[512] = {
        0x00, 0x00, 0x8F, 0xCA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0x44, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5124,7 +5124,7 @@ static unsigned char u2c_79[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xDA, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_7A[512] = {
+static const unsigned char u2c_7A[512] = {
        0x8B, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xE2, 0x62, 0x00, 0x00, 0x00, 0x00, 0x92, 0xF6, /* 0x08-0x0B */
@@ -5192,7 +5192,7 @@ static unsigned char u2c_7A[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0xC6, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7B[512] = {
+static const unsigned char u2c_7B[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE2, 0x93, 0x00, 0x00, /* 0x00-0x03 */
        0xE2, 0xA0, 0x00, 0x00, 0xE2, 0x96, 0x00, 0x00, /* 0x04-0x07 */
        0x8B, 0x88, 0x00, 0x00, 0xE2, 0x95, 0xE2, 0xA2, /* 0x08-0x0B */
@@ -5258,7 +5258,7 @@ static unsigned char u2c_7B[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE2, 0xCC, 0xE2, 0xC9, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_7C[512] = {
+static const unsigned char u2c_7C[512] = {
        0xE2, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xC6, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5326,7 +5326,7 @@ static unsigned char u2c_7C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x8B, 0x8A, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7D[512] = {
+static const unsigned char u2c_7D[512] = {
        0x8B, 0x49, 0x00, 0x00, 0xE3, 0x40, 0x00, 0x00, /* 0x00-0x03 */
        0x96, 0xF1, 0x8D, 0x67, 0xE2, 0xFC, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xE3, 0x43, 0x96, 0xE4, /* 0x08-0x0B */
@@ -5393,7 +5393,7 @@ static unsigned char u2c_7D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0x6B, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_7E[512] = {
+static const unsigned char u2c_7E[512] = {
        0x00, 0x00, 0x89, 0x8F, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x93, 0xEA, 0xE3, 0x6E, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xE3, 0x75, 0xE3, 0x6F, 0xE3, 0x76, /* 0x08-0x0B */
@@ -5437,7 +5437,7 @@ static unsigned char u2c_7E[512] = {
        0xE3, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */
 };
 
-static unsigned char u2c_7F[512] = {
+static const unsigned char u2c_7F[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5505,7 +5505,7 @@ static unsigned char u2c_7F[512] = {
        0x97, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_80[512] = {
+static const unsigned char u2c_80[512] = {
        0x97, 0x73, 0x98, 0x56, 0x00, 0x00, 0x8D, 0x6C, /* 0x00-0x03 */
        0xE3, 0xCC, 0x8E, 0xD2, 0xE3, 0xCB, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0xCD, /* 0x08-0x0B */
@@ -5573,7 +5573,7 @@ static unsigned char u2c_80[512] = {
        0xE4, 0x45, 0x94, 0x5C, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_81[512] = {
+static const unsigned char u2c_81[512] = {
        0x00, 0x00, 0x00, 0x00, 0x8E, 0x89, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x8B, 0xBA, 0x90, 0xC6, 0x98, 0x65, /* 0x04-0x07 */
        0x96, 0xAC, 0xE3, 0xF5, 0x90, 0xD2, 0x00, 0x00, /* 0x08-0x0B */
@@ -5641,7 +5641,7 @@ static unsigned char u2c_81[512] = {
        0x89, 0x50, 0x00, 0x00, 0xE4, 0x6B, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_82[512] = {
+static const unsigned char u2c_82[512] = {
        0x00, 0x00, 0xE4, 0x6C, 0xE4, 0x6D, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xE4, 0x6E, 0x00, 0x00, 0xE4, 0x6F, /* 0x04-0x07 */
        0x8B, 0xBB, 0x9D, 0xA8, 0xE4, 0x70, 0x00, 0x00, /* 0x08-0x0B */
@@ -5708,7 +5708,7 @@ static unsigned char u2c_82[512] = {
        0x00, 0x00, 0xE4, 0x99, 0xE4, 0x95, 0xE4, 0x98, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_83[512] = {
+static const unsigned char u2c_83[512] = {
        0x00, 0x00, 0xEE, 0x76, 0x96, 0xCE, 0xE4, 0x97, /* 0x00-0x03 */
        0x89, 0xD6, 0x8A, 0x9D, 0xE4, 0x9B, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xE4, 0x9D, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5776,7 +5776,7 @@ static unsigned char u2c_83[512] = {
        0x00, 0x00, 0xE4, 0xC1, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_84[512] = {
+static const unsigned char u2c_84[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC2, /* 0x00-0x03 */
        0x93, 0xB8, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC7, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xC4, /* 0x08-0x0B */
@@ -5844,7 +5844,7 @@ static unsigned char u2c_84[512] = {
        0xE4, 0xF8, 0x00, 0x00, 0x00, 0x00, 0xE4, 0xF0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_85[512] = {
+static const unsigned char u2c_85[512] = {
        0x8E, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xE4, 0xCF, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5912,7 +5912,7 @@ static unsigned char u2c_85[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE5, 0x60, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_86[512] = {
+static const unsigned char u2c_86[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE5, 0x41, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xE5, 0x62, 0x91, 0x68, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xE5, 0x5D, 0xE5, 0x5F, /* 0x08-0x0B */
@@ -5980,7 +5980,7 @@ static unsigned char u2c_86[512] = {
        0x00, 0x00, 0x00, 0x00, 0x89, 0xE9, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_87[512] = {
+static const unsigned char u2c_87[512] = {
        0xE5, 0x86, 0x00, 0x00, 0x96, 0x49, 0xE5, 0x87, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xE5, 0x84, 0x00, 0x00, /* 0x04-0x07 */
        0xE5, 0x85, 0xE5, 0x8A, 0xE5, 0x8D, 0x00, 0x00, /* 0x08-0x0B */
@@ -6048,7 +6048,7 @@ static unsigned char u2c_87[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE5, 0xB7, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_88[512] = {
+static const unsigned char u2c_88[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xE5, 0xA2, 0x00, 0x00, 0xEE, 0x85, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6116,7 +6116,7 @@ static unsigned char u2c_88[512] = {
        0xE5, 0xE7, 0x90, 0xBB, 0x90, 0x9E, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_89[512] = {
+static const unsigned char u2c_89[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE5, 0xE6, 0x00, 0x00, /* 0x00-0x03 */
        0xE5, 0xEB, 0x00, 0x00, 0x00, 0x00, 0x95, 0xA1, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xE5, 0xED, 0x00, 0x00, /* 0x08-0x0B */
@@ -6183,7 +6183,7 @@ static unsigned char u2c_89[512] = {
        0xE6, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_8A[512] = {
+static const unsigned char u2c_8A[512] = {
        0x8C, 0xBE, 0x00, 0x00, 0x92, 0xF9, 0xE6, 0x5D, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x8C, 0x76, 0x00, 0x00, 0x90, 0x75, 0x00, 0x00, /* 0x08-0x0B */
@@ -6251,7 +6251,7 @@ static unsigned char u2c_8A[512] = {
        0x00, 0x00, 0x00, 0x00, 0x91, 0xF8, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8B[512] = {
+static const unsigned char u2c_8B[512] = {
        0x96, 0x64, 0x89, 0x79, 0x88, 0xE0, 0x00, 0x00, /* 0x00-0x03 */
        0x93, 0xA3, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x89, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6294,7 +6294,7 @@ static unsigned char u2c_8B[512] = {
        0x00, 0x00, 0xE6, 0xAA, 0xE6, 0xAB, 0x00, 0x00, /* 0x98-0x9B */
 };
 
-static unsigned char u2c_8C[512] = {
+static const unsigned char u2c_8C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6362,7 +6362,7 @@ static unsigned char u2c_8C[512] = {
        0x8D, 0x77, 0xE6, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8D[512] = {
+static const unsigned char u2c_8D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xE6, 0xD1, 0xE6, 0xD2, 0x00, 0x00, 0xE6, 0xD4, /* 0x04-0x07 */
        0x91, 0xA1, 0x00, 0x00, 0xE6, 0xD3, 0x8A, 0xE4, /* 0x08-0x0B */
@@ -6430,7 +6430,7 @@ static unsigned char u2c_8D[512] = {
        0xE6, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xF3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8E[512] = {
+static const unsigned char u2c_8E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xE6, 0xF1, 0xE6, 0xF2, 0x97, 0x78, 0x00, 0x00, /* 0x08-0x0B */
@@ -6498,7 +6498,7 @@ static unsigned char u2c_8E[512] = {
        0xE7, 0x64, 0x8C, 0x79, 0xE7, 0x67, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8F[512] = {
+static const unsigned char u2c_8F[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x72, /* 0x00-0x03 */
        0x00, 0x00, 0xE7, 0x69, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x8D, 0xDA, 0xE7, 0x68, 0x00, 0x00, /* 0x08-0x0B */
@@ -6566,7 +6566,7 @@ static unsigned char u2c_8F[512] = {
        0x00, 0x00, 0x92, 0xC7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_90[512] = {
+static const unsigned char u2c_90[512] = {
        0x91, 0xDE, 0x91, 0x97, 0x00, 0x00, 0x93, 0xA6, /* 0x00-0x03 */
        0x00, 0x00, 0xE7, 0x90, 0x8B, 0x74, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE7, 0x99, /* 0x08-0x0B */
@@ -6634,7 +6634,7 @@ static unsigned char u2c_90[512] = {
        0x00, 0x00, 0x93, 0x73, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_91[512] = {
+static const unsigned char u2c_91[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE7, 0xBD, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6702,7 +6702,7 @@ static unsigned char u2c_91[512] = {
        0xE7, 0xDD, 0x00, 0x00, 0x00, 0x00, 0xE7, 0xE1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_92[512] = {
+static const unsigned char u2c_92[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xEE, 0xA5, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xEE, 0xA7, 0x00, 0x00, /* 0x08-0x0B */
@@ -6770,7 +6770,7 @@ static unsigned char u2c_92[512] = {
        0x8D, 0x7C, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_93[512] = {
+static const unsigned char u2c_93[512] = {
        0x00, 0x00, 0x00, 0x00, 0xEE, 0xC2, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x8E, 0x4B, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6837,7 +6837,7 @@ static unsigned char u2c_93[512] = {
        0xEE, 0xC8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_94[512] = {
+static const unsigned char u2c_94[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x5E, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x5F, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6874,7 +6874,7 @@ static unsigned char u2c_94[512] = {
        0x00, 0x00, 0xE8, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x83 */
 };
 
-static unsigned char u2c_95[512] = {
+static const unsigned char u2c_95[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6936,7 +6936,7 @@ static unsigned char u2c_95[512] = {
        0x00, 0x00, 0xE8, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
 };
 
-static unsigned char u2c_96[512] = {
+static const unsigned char u2c_96[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7003,7 +7003,7 @@ static unsigned char u2c_96[512] = {
        0x00, 0x00, 0xE8, 0xB9, 0x00, 0x00, 0x93, 0x64, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_97[512] = {
+static const unsigned char u2c_97[512] = {
        0x8E, 0xF9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xE8, 0xBA, 0x00, 0x00, 0xE8, 0xBB, 0x90, 0x6B, /* 0x04-0x07 */
        0xE8, 0xBC, 0x00, 0x00, 0x97, 0xEC, 0x00, 0x00, /* 0x08-0x0B */
@@ -7071,7 +7071,7 @@ static unsigned char u2c_97[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0xBF, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_98[512] = {
+static const unsigned char u2c_98[512] = {
        0x00, 0x00, 0x95, 0xC5, 0x92, 0xB8, 0x8D, 0xA0, /* 0x00-0x03 */
        0x00, 0x00, 0x8D, 0x80, 0x8F, 0x87, 0x00, 0x00, /* 0x04-0x07 */
        0x90, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7139,7 +7139,7 @@ static unsigned char u2c_98[512] = {
        0x8E, 0x94, 0x96, 0x4F, 0x8F, 0xFC, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_99[512] = {
+static const unsigned char u2c_99[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x4C, /* 0x00-0x03 */
        0x00, 0x00, 0x96, 0xDD, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xE9, 0x4D, 0x97, 0x7B, 0x00, 0x00, /* 0x08-0x0B */
@@ -7207,7 +7207,7 @@ static unsigned char u2c_99[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x78, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9A[512] = {
+static const unsigned char u2c_9A[512] = {
        0x00, 0x00, 0xE9, 0x74, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xE9, 0x76, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7274,7 +7274,7 @@ static unsigned char u2c_9A[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x9F, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_9B[512] = {
+static const unsigned char u2c_9B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xE9, 0xA0, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7340,7 +7340,7 @@ static unsigned char u2c_9B[512] = {
        0x00, 0x00, 0x88, 0xB1, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_9C[512] = {
+static const unsigned char u2c_9C[512] = {
        0xEE, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xE9, 0xD8, 0x00, 0x00, 0xE9, 0xD4, 0x00, 0x00, /* 0x04-0x07 */
        0xE9, 0xD5, 0xE9, 0xD1, 0xE9, 0xD7, 0x00, 0x00, /* 0x08-0x0B */
@@ -7406,7 +7406,7 @@ static unsigned char u2c_9C[512] = {
        0x96, 0xC2, 0x00, 0x00, 0x93, 0xCE, 0x00, 0x00, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_9D[512] = {
+static const unsigned char u2c_9D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE9, 0xEE, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xE9, 0xEF, 0x93, 0xBC, /* 0x04-0x07 */
        0xE9, 0xEC, 0xE9, 0xEB, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7474,7 +7474,7 @@ static unsigned char u2c_9D[512] = {
        0x00, 0x00, 0xEA, 0x5E, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9E[512] = {
+static const unsigned char u2c_9E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7542,7 +7542,7 @@ static unsigned char u2c_9E[512] = {
        0xEA, 0x85, 0xEA, 0x86, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9F[512] = {
+static const unsigned char u2c_9F[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEA, 0x87, /* 0x04-0x07 */
        0xEA, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7587,11 +7587,11 @@ static unsigned char u2c_9F[512] = {
        0xEA, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA0-0xA3 */
 };
 
-static unsigned char u2c_DC[512] = {
+static const unsigned char u2c_DC[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
 };
 
-static unsigned char u2c_F9[512] = {
+static const unsigned char u2c_F9[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7651,7 +7651,7 @@ static unsigned char u2c_F9[512] = {
        0xEE, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */
 };
 
-static unsigned char u2c_FA[512] = {
+static const unsigned char u2c_FA[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7666,7 +7666,7 @@ static unsigned char u2c_FA[512] = {
        0xEE, 0xDD, 0xEE, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */
 };
 
-static unsigned char u2c_FF[512] = {
+static const unsigned char u2c_FF[512] = {
        0x00, 0x00, 0x81, 0x49, 0xEE, 0xFC, 0x81, 0x94, /* 0x00-0x03 */
        0x81, 0x90, 0x81, 0x93, 0x81, 0x95, 0xEE, 0xFB, /* 0x04-0x07 */
        0x81, 0x69, 0x81, 0x6A, 0x81, 0x96, 0x81, 0x7B, /* 0x08-0x0B */
@@ -7728,7 +7728,7 @@ static unsigned char u2c_FF[512] = {
        0xEE, 0xFA, 0x81, 0x8F, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        NULL,   NULL,   NULL,   u2c_03, u2c_04, NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -7762,7 +7762,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   u2c_F9, u2c_FA, NULL,   NULL,   NULL,   NULL,   u2c_FF, };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -7798,7 +7798,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -7837,7 +7837,7 @@ static unsigned char charset2upper[256] = {
 static int uni2char(const wchar_t uni,
                    unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni&0xFF;
        unsigned char ch = (uni>>8)&0xFF;
 
@@ -7878,7 +7878,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
                    wchar_t *uni)
 {
        unsigned char ch, cl;
-       wchar_t *charset2uni;
+       const wchar_t *charset2uni;
 
        if (boundlen <= 0)
                return -ENAMETOOLONG;
index 65e640c61c8bb29f1b879d4d3898b3939462cfdc..82770301bc3da82849a2118db40aaeb1e4b92d7c 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t c2u_81[256] = {
+static const wchar_t c2u_81[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -49,7 +49,7 @@ static wchar_t c2u_81[256] = {
        0x4F99,0x4F9A,0x4F9C,0x4F9E,0x4F9F,0x4FA1,0x4FA2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_82[256] = {
+static const wchar_t c2u_82[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -85,7 +85,7 @@ static wchar_t c2u_82[256] = {
        0x50B4,0x50B5,0x50B6,0x50B7,0x50B8,0x50B9,0x50BC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_83[256] = {
+static const wchar_t c2u_83[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -121,7 +121,7 @@ static wchar_t c2u_83[256] = {
        0x51D0,0x51D2,0x51D3,0x51D4,0x51D5,0x51D6,0x51D7,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_84[256] = {
+static const wchar_t c2u_84[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -157,7 +157,7 @@ static wchar_t c2u_84[256] = {
        0x5304,0x5307,0x5309,0x530A,0x530B,0x530C,0x530E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_85[256] = {
+static const wchar_t c2u_85[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -193,7 +193,7 @@ static wchar_t c2u_85[256] = {
        0x5497,0x5498,0x549C,0x549E,0x549F,0x54A0,0x54A1,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_86[256] = {
+static const wchar_t c2u_86[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -229,7 +229,7 @@ static wchar_t c2u_86[256] = {
        0x55FB,0x55FC,0x55FF,0x5602,0x5603,0x5604,0x5605,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_87[256] = {
+static const wchar_t c2u_87[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -265,7 +265,7 @@ static wchar_t c2u_87[256] = {
        0x570B,0x570C,0x570D,0x570E,0x570F,0x5710,0x5711,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_88[256] = {
+static const wchar_t c2u_88[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -301,7 +301,7 @@ static wchar_t c2u_88[256] = {
        0x5837,0x5838,0x5839,0x583A,0x583B,0x583C,0x583D,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_89[256] = {
+static const wchar_t c2u_89[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -337,7 +337,7 @@ static wchar_t c2u_89[256] = {
        0x592C,0x5930,0x5932,0x5933,0x5935,0x5936,0x593B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8A[256] = {
+static const wchar_t c2u_8A[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -373,7 +373,7 @@ static wchar_t c2u_8A[256] = {
        0x5A59,0x5A5B,0x5A5C,0x5A5D,0x5A5E,0x5A5F,0x5A60,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8B[256] = {
+static const wchar_t c2u_8B[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -409,7 +409,7 @@ static wchar_t c2u_8B[256] = {
        0x5B41,0x5B42,0x5B43,0x5B44,0x5B45,0x5B46,0x5B47,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8C[256] = {
+static const wchar_t c2u_8C[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -445,7 +445,7 @@ static wchar_t c2u_8C[256] = {
        0x5CA0,0x5CA1,0x5CA4,0x5CA5,0x5CA6,0x5CA7,0x5CA8,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8D[256] = {
+static const wchar_t c2u_8D[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -481,7 +481,7 @@ static wchar_t c2u_8D[256] = {
        0x5D98,0x5D9A,0x5D9B,0x5D9C,0x5D9E,0x5D9F,0x5DA0,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8E[256] = {
+static const wchar_t c2u_8E[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -517,7 +517,7 @@ static wchar_t c2u_8E[256] = {
        0x5EBF,0x5EC0,0x5EC1,0x5EC2,0x5EC3,0x5EC4,0x5EC5,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8F[256] = {
+static const wchar_t c2u_8F[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -553,7 +553,7 @@ static wchar_t c2u_8F[256] = {
        0x5FF4,0x5FF6,0x5FF7,0x5FF9,0x5FFA,0x5FFC,0x6007,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_90[256] = {
+static const wchar_t c2u_90[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -589,7 +589,7 @@ static wchar_t c2u_90[256] = {
        0x6140,0x6141,0x6142,0x6143,0x6144,0x6145,0x6146,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_91[256] = {
+static const wchar_t c2u_91[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -625,7 +625,7 @@ static wchar_t c2u_91[256] = {
        0x623B,0x623C,0x6242,0x6244,0x6245,0x6246,0x624A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_92[256] = {
+static const wchar_t c2u_92[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -661,7 +661,7 @@ static wchar_t c2u_92[256] = {
        0x63B5,0x63B6,0x63B9,0x63BB,0x63BD,0x63BF,0x63C0,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_93[256] = {
+static const wchar_t c2u_93[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -697,7 +697,7 @@ static wchar_t c2u_93[256] = {
        0x64D1,0x64D3,0x64D4,0x64D5,0x64D6,0x64D9,0x64DA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_94[256] = {
+static const wchar_t c2u_94[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -733,7 +733,7 @@ static wchar_t c2u_94[256] = {
        0x65DE,0x65DF,0x65E1,0x65E3,0x65E4,0x65EA,0x65EB,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_95[256] = {
+static const wchar_t c2u_95[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -769,7 +769,7 @@ static wchar_t c2u_95[256] = {
        0x66F8,0x66FA,0x66FB,0x66FD,0x6701,0x6702,0x6703,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_96[256] = {
+static const wchar_t c2u_96[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -805,7 +805,7 @@ static wchar_t c2u_96[256] = {
        0x6852,0x6856,0x6857,0x6858,0x6859,0x685A,0x685B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_97[256] = {
+static const wchar_t c2u_97[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -841,7 +841,7 @@ static wchar_t c2u_97[256] = {
        0x6955,0x6956,0x6958,0x6959,0x695B,0x695C,0x695F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_98[256] = {
+static const wchar_t c2u_98[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -877,7 +877,7 @@ static wchar_t c2u_98[256] = {
        0x6A52,0x6A53,0x6A54,0x6A55,0x6A56,0x6A57,0x6A5A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_99[256] = {
+static const wchar_t c2u_99[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -913,7 +913,7 @@ static wchar_t c2u_99[256] = {
        0x6B28,0x6B29,0x6B2A,0x6B2B,0x6B2C,0x6B2D,0x6B2E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9A[256] = {
+static const wchar_t c2u_9A[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -949,7 +949,7 @@ static wchar_t c2u_9A[256] = {
        0x6C4E,0x6C4F,0x6C51,0x6C52,0x6C53,0x6C56,0x6C58,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9B[256] = {
+static const wchar_t c2u_9B[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -985,7 +985,7 @@ static wchar_t c2u_9B[256] = {
        0x6DBE,0x6DC1,0x6DC2,0x6DC3,0x6DC8,0x6DC9,0x6DCA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9C[256] = {
+static const wchar_t c2u_9C[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1021,7 +1021,7 @@ static wchar_t c2u_9C[256] = {
        0x6EE7,0x6EEA,0x6EEB,0x6EEC,0x6EED,0x6EEE,0x6EEF,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9D[256] = {
+static const wchar_t c2u_9D[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1057,7 +1057,7 @@ static wchar_t c2u_9D[256] = {
        0x6FDC,0x6FDD,0x6FDF,0x6FE2,0x6FE3,0x6FE4,0x6FE5,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9E[256] = {
+static const wchar_t c2u_9E[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1093,7 +1093,7 @@ static wchar_t c2u_9E[256] = {
        0x70D2,0x70D3,0x70D4,0x70D5,0x70D6,0x70D7,0x70DA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9F[256] = {
+static const wchar_t c2u_9F[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1129,7 +1129,7 @@ static wchar_t c2u_9F[256] = {
        0x71CC,0x71CD,0x71CF,0x71D0,0x71D1,0x71D2,0x71D3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A0[256] = {
+static const wchar_t c2u_A0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1165,7 +1165,7 @@ static wchar_t c2u_A0[256] = {
        0x72D3,0x72D4,0x72D5,0x72D6,0x72D8,0x72DA,0x72DB,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A1[256] = {
+static const wchar_t c2u_A1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1201,7 +1201,7 @@ static wchar_t c2u_A1[256] = {
        0x25B2,0x203B,0x2192,0x2190,0x2191,0x2193,0x3013,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A2[256] = {
+static const wchar_t c2u_A2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1237,7 +1237,7 @@ static wchar_t c2u_A2[256] = {
        0x2167,0x2168,0x2169,0x216A,0x216B,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A3[256] = {
+static const wchar_t c2u_A3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1273,7 +1273,7 @@ static wchar_t c2u_A3[256] = {
        0xFF58,0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A4[256] = {
+static const wchar_t c2u_A4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1308,7 +1308,7 @@ static wchar_t c2u_A4[256] = {
        0x3090,0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
 };
 
-static wchar_t c2u_A5[256] = {
+static const wchar_t c2u_A5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1343,7 +1343,7 @@ static wchar_t c2u_A5[256] = {
        0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6,0x0000,/* 0xF0-0xF7 */
 };
 
-static wchar_t c2u_A6[256] = {
+static const wchar_t c2u_A6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1378,7 +1378,7 @@ static wchar_t c2u_A6[256] = {
        0xFE37,0xFE38,0xFE31,0x0000,0xFE33,0xFE34,0x0000,0x0000,/* 0xF0-0xF7 */
 };
 
-static wchar_t c2u_A7[256] = {
+static const wchar_t c2u_A7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1413,7 +1413,7 @@ static wchar_t c2u_A7[256] = {
        0x044E,0x044F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
 };
 
-static wchar_t c2u_A8[256] = {
+static const wchar_t c2u_A8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1447,7 +1447,7 @@ static wchar_t c2u_A8[256] = {
        0x3128,0x3129,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xE8-0xEF */
 };
 
-static wchar_t c2u_A9[256] = {
+static const wchar_t c2u_A9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1481,7 +1481,7 @@ static wchar_t c2u_A9[256] = {
        0x2544,0x2545,0x2546,0x2547,0x2548,0x2549,0x254A,0x254B,/* 0xE8-0xEF */
 };
 
-static wchar_t c2u_AA[256] = {
+static const wchar_t c2u_AA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1506,7 +1506,7 @@ static wchar_t c2u_AA[256] = {
        0x7371,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_AB[256] = {
+static const wchar_t c2u_AB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1531,7 +1531,7 @@ static wchar_t c2u_AB[256] = {
        0x73F7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_AC[256] = {
+static const wchar_t c2u_AC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1556,7 +1556,7 @@ static wchar_t c2u_AC[256] = {
        0x747A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_AD[256] = {
+static const wchar_t c2u_AD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1581,7 +1581,7 @@ static wchar_t c2u_AD[256] = {
        0x74F2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_AE[256] = {
+static const wchar_t c2u_AE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1606,7 +1606,7 @@ static wchar_t c2u_AE[256] = {
        0x7587,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_AF[256] = {
+static const wchar_t c2u_AF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1631,7 +1631,7 @@ static wchar_t c2u_AF[256] = {
        0x7644,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_B0[256] = {
+static const wchar_t c2u_B0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1667,7 +1667,7 @@ static wchar_t c2u_B0[256] = {
        0x508D,0x8C24,0x82DE,0x80DE,0x5305,0x8912,0x5265,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B1[256] = {
+static const wchar_t c2u_B1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1703,7 +1703,7 @@ static wchar_t c2u_B1[256] = {
        0x5175,0x51B0,0x67C4,0x4E19,0x79C9,0x997C,0x70B3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B2[256] = {
+static const wchar_t c2u_B2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1739,7 +1739,7 @@ static wchar_t c2u_B2[256] = {
        0x7F20,0x94F2,0x4EA7,0x9610,0x98A4,0x660C,0x7316,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B3[256] = {
+static const wchar_t c2u_B3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1775,7 +1775,7 @@ static wchar_t c2u_B3[256] = {
        0x53A8,0x8E87,0x9504,0x96CF,0x6EC1,0x9664,0x695A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B4[256] = {
+static const wchar_t c2u_B4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1811,7 +1811,7 @@ static wchar_t c2u_B4[256] = {
        0x5E26,0x6B86,0x4EE3,0x8D37,0x888B,0x5F85,0x902E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B5[256] = {
+static const wchar_t c2u_B5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1847,7 +1847,7 @@ static wchar_t c2u_B5[256] = {
        0x8DCC,0x7239,0x789F,0x8776,0x8FED,0x8C0D,0x53E0,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B6[256] = {
+static const wchar_t c2u_B6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1883,7 +1883,7 @@ static wchar_t c2u_B6[256] = {
        0x800C,0x513F,0x8033,0x5C14,0x9975,0x6D31,0x4E8C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B7[256] = {
+static const wchar_t c2u_B7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1919,7 +1919,7 @@ static wchar_t c2u_B7[256] = {
        0x8F90,0x5E45,0x6C1F,0x7B26,0x4F0F,0x4FD8,0x670D,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B8[256] = {
+static const wchar_t c2u_B8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1955,7 +1955,7 @@ static wchar_t c2u_B8[256] = {
        0x7ED9,0x6839,0x8DDF,0x8015,0x66F4,0x5E9A,0x7FB9,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B9[256] = {
+static const wchar_t c2u_B9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1991,7 +1991,7 @@ static wchar_t c2u_B9[256] = {
        0x9505,0x90ED,0x56FD,0x679C,0x88F9,0x8FC7,0x54C8,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BA[256] = {
+static const wchar_t c2u_BA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2027,7 +2027,7 @@ static wchar_t c2u_BA[256] = {
        0x58F6,0x846B,0x80E1,0x8774,0x72D0,0x7CCA,0x6E56,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BB[256] = {
+static const wchar_t c2u_BB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2063,7 +2063,7 @@ static wchar_t c2u_BB[256] = {
        0x573E,0x57FA,0x673A,0x7578,0x7A3D,0x79EF,0x7B95,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BC[256] = {
+static const wchar_t c2u_BC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2099,7 +2099,7 @@ static wchar_t c2u_BC[256] = {
        0x9274,0x8DF5,0x8D31,0x89C1,0x952E,0x7BAD,0x4EF6,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BD[256] = {
+static const wchar_t c2u_BD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2135,7 +2135,7 @@ static wchar_t c2u_BD[256] = {
        0x8FDB,0x9773,0x664B,0x7981,0x8FD1,0x70EC,0x6D78,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BE[256] = {
+static const wchar_t c2u_BE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2171,7 +2171,7 @@ static wchar_t c2u_BE[256] = {
        0x7EDD,0x5747,0x83CC,0x94A7,0x519B,0x541B,0x5CFB,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BF[256] = {
+static const wchar_t c2u_BF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2207,7 +2207,7 @@ static wchar_t c2u_BF[256] = {
        0x76D4,0x5CBF,0x7AA5,0x8475,0x594E,0x9B41,0x5080,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C0[256] = {
+static const wchar_t c2u_C0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2243,7 +2243,7 @@ static wchar_t c2u_C0[256] = {
        0x52B1,0x783E,0x5386,0x5229,0x5088,0x4F8B,0x4FD0,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C1[256] = {
+static const wchar_t c2u_C1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2279,7 +2279,7 @@ static wchar_t c2u_C1[256] = {
        0x67F3,0x516D,0x9F99,0x804B,0x5499,0x7B3C,0x7ABF,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C2[256] = {
+static const wchar_t c2u_C2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2315,7 +2315,7 @@ static wchar_t c2u_C2[256] = {
        0x9992,0x86EE,0x6EE1,0x8513,0x66FC,0x6162,0x6F2B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C3[256] = {
+static const wchar_t c2u_C3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2351,7 +2351,7 @@ static wchar_t c2u_C3[256] = {
        0x879F,0x9E23,0x94ED,0x540D,0x547D,0x8C2C,0x6478,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C4[256] = {
+static const wchar_t c2u_C4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2387,7 +2387,7 @@ static wchar_t c2u_C4[256] = {
        0x954D,0x6D85,0x60A8,0x67E0,0x72DE,0x51DD,0x5B81,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C5[256] = {
+static const wchar_t c2u_C5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2423,7 +2423,7 @@ static wchar_t c2u_C5[256] = {
        0x7812,0x9739,0x6279,0x62AB,0x5288,0x7435,0x6BD7,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C6[256] = {
+static const wchar_t c2u_C6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2459,7 +2459,7 @@ static wchar_t c2u_C6[256] = {
        0x6C14,0x8FC4,0x5F03,0x6C7D,0x6CE3,0x8BAB,0x6390,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C7[256] = {
+static const wchar_t c2u_C7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2495,7 +2495,7 @@ static wchar_t c2u_C7[256] = {
        0x533A,0x86C6,0x66F2,0x8EAF,0x5C48,0x9A71,0x6E20,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C8[256] = {
+static const wchar_t c2u_C8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2531,7 +2531,7 @@ static wchar_t c2u_C8[256] = {
        0x8428,0x816E,0x9CC3,0x585E,0x8D5B,0x4E09,0x53C1,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C9[256] = {
+static const wchar_t c2u_C9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2567,7 +2567,7 @@ static wchar_t c2u_C9[256] = {
        0x6E17,0x58F0,0x751F,0x7525,0x7272,0x5347,0x7EF3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CA[256] = {
+static const wchar_t c2u_CA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2603,7 +2603,7 @@ static wchar_t c2u_CA[256] = {
        0x675F,0x620D,0x7AD6,0x5885,0x5EB6,0x6570,0x6F31,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CB[256] = {
+static const wchar_t c2u_CB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2639,7 +2639,7 @@ static wchar_t c2u_CB[256] = {
        0x9501,0x6240,0x584C,0x4ED6,0x5B83,0x5979,0x5854,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CC[256] = {
+static const wchar_t c2u_CC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2675,7 +2675,7 @@ static wchar_t c2u_CC[256] = {
        0x8DF3,0x8D34,0x94C1,0x5E16,0x5385,0x542C,0x70C3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CD[256] = {
+static const wchar_t c2u_CD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2711,7 +2711,7 @@ static wchar_t c2u_CD[256] = {
        0x7F51,0x5F80,0x65FA,0x671B,0x5FD8,0x5984,0x5A01,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CE[256] = {
+static const wchar_t c2u_CE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2747,7 +2747,7 @@ static wchar_t c2u_CE[256] = {
        0x7852,0x77FD,0x6670,0x563B,0x5438,0x9521,0x727A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CF[256] = {
+static const wchar_t c2u_CF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2783,7 +2783,7 @@ static wchar_t c2u_CF[256] = {
        0x54EE,0x56A3,0x9500,0x6D88,0x5BB5,0x6DC6,0x6653,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D0[256] = {
+static const wchar_t c2u_D0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2819,7 +2819,7 @@ static wchar_t c2u_D0[256] = {
        0x7EED,0x8F69,0x55A7,0x5BA3,0x60AC,0x65CB,0x7384,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D1[256] = {
+static const wchar_t c2u_D1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2855,7 +2855,7 @@ static wchar_t c2u_D1[256] = {
        0x517B,0x6837,0x6F3E,0x9080,0x8170,0x5996,0x7476,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D2[256] = {
+static const wchar_t c2u_D2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2891,7 +2891,7 @@ static wchar_t c2u_D2[256] = {
        0x94F6,0x6DEB,0x5BC5,0x996E,0x5C39,0x5F15,0x9690,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D3[256] = {
+static const wchar_t c2u_D3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2927,7 +2927,7 @@ static wchar_t c2u_D3[256] = {
        0x5CEA,0x5FA1,0x6108,0x6B32,0x72F1,0x80B2,0x8A89,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D4[256] = {
+static const wchar_t c2u_D4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2963,7 +2963,7 @@ static wchar_t c2u_D4[256] = {
        0x66FE,0x8D60,0x624E,0x55B3,0x6E23,0x672D,0x8F67,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D5[256] = {
+static const wchar_t c2u_D5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2999,7 +2999,7 @@ static wchar_t c2u_D5[256] = {
        0x72F0,0x4E89,0x6014,0x6574,0x62EF,0x6B63,0x653F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D6[256] = {
+static const wchar_t c2u_D6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3035,7 +3035,7 @@ static wchar_t c2u_D6[256] = {
        0x8457,0x67F1,0x52A9,0x86C0,0x8D2E,0x94F8,0x7B51,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D7[256] = {
+static const wchar_t c2u_D7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3071,7 +3071,7 @@ static wchar_t c2u_D7[256] = {
        0x5750,0x5EA7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D8[256] = {
+static const wchar_t c2u_D8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3107,7 +3107,7 @@ static wchar_t c2u_D8[256] = {
        0x4F09,0x4F2B,0x4F5E,0x4F67,0x6538,0x4F5A,0x4F5D,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D9[256] = {
+static const wchar_t c2u_D9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3143,7 +3143,7 @@ static wchar_t c2u_D9[256] = {
        0x5B34,0x8803,0x7FB8,0x51AB,0x51B1,0x51BD,0x51BC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DA[256] = {
+static const wchar_t c2u_DA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3179,7 +3179,7 @@ static wchar_t c2u_DA[256] = {
        0x9099,0x90AC,0x90A1,0x90B4,0x90B3,0x90B6,0x90BA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DB[256] = {
+static const wchar_t c2u_DB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3215,7 +3215,7 @@ static wchar_t c2u_DB[256] = {
        0x57D2,0x57B8,0x57F4,0x57EF,0x57F8,0x57E4,0x57DD,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DC[256] = {
+static const wchar_t c2u_DC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3251,7 +3251,7 @@ static wchar_t c2u_DC[256] = {
        0x8317,0x8360,0x832D,0x833A,0x8333,0x8366,0x8365,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DD[256] = {
+static const wchar_t c2u_DD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3287,7 +3287,7 @@ static wchar_t c2u_DD[256] = {
        0x850C,0x750D,0x8538,0x84F0,0x8539,0x851F,0x853A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DE[256] = {
+static const wchar_t c2u_DE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3323,7 +3323,7 @@ static wchar_t c2u_DE[256] = {
        0x640C,0x6426,0x6421,0x645E,0x6484,0x646D,0x6496,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DF[256] = {
+static const wchar_t c2u_DF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3359,7 +3359,7 @@ static wchar_t c2u_DF[256] = {
        0x5549,0x556D,0x5541,0x5555,0x553F,0x5550,0x553C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E0[256] = {
+static const wchar_t c2u_E0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3395,7 +3395,7 @@ static wchar_t c2u_E0[256] = {
        0x5E0F,0x5E19,0x5E14,0x5E11,0x5E31,0x5E3B,0x5E3C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E1[256] = {
+static const wchar_t c2u_E1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3431,7 +3431,7 @@ static wchar_t c2u_E1[256] = {
        0x72F2,0x72F4,0x72F7,0x7301,0x72F3,0x7303,0x72FA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E2[256] = {
+static const wchar_t c2u_E2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3467,7 +3467,7 @@ static wchar_t c2u_E2[256] = {
        0x603F,0x6021,0x6078,0x6079,0x607B,0x607A,0x6042,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E3[256] = {
+static const wchar_t c2u_E3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3503,7 +3503,7 @@ static wchar_t c2u_E3[256] = {
        0x6CFA,0x6CEB,0x6CEE,0x6CB1,0x6CD3,0x6CEF,0x6CFE,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E4[256] = {
+static const wchar_t c2u_E4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3539,7 +3539,7 @@ static wchar_t c2u_E4[256] = {
        0x6F8D,0x6F8C,0x6F78,0x6F72,0x6F7C,0x6F7A,0x6FD1,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E5[256] = {
+static const wchar_t c2u_E5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3575,7 +3575,7 @@ static wchar_t c2u_E5[256] = {
        0x5C6E,0x5981,0x5983,0x598D,0x59A9,0x59AA,0x59A3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E6[256] = {
+static const wchar_t c2u_E6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3611,7 +3611,7 @@ static wchar_t c2u_E6[256] = {
        0x9AA7,0x7E9F,0x7EA1,0x7EA3,0x7EA5,0x7EA8,0x7EA9,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E7[256] = {
+static const wchar_t c2u_E7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3647,7 +3647,7 @@ static wchar_t c2u_E7[256] = {
        0x745B,0x7426,0x7425,0x7428,0x7430,0x742E,0x742C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E8[256] = {
+static const wchar_t c2u_E8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3683,7 +3683,7 @@ static wchar_t c2u_E8[256] = {
        0x686B,0x68C2,0x696E,0x68FC,0x691F,0x6920,0x68F9,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E9[256] = {
+static const wchar_t c2u_E9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3719,7 +3719,7 @@ static wchar_t c2u_E9[256] = {
        0x8F7C,0x8F7E,0x8F81,0x8F82,0x8F84,0x8F87,0x8F8B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EA[256] = {
+static const wchar_t c2u_EA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3755,7 +3755,7 @@ static wchar_t c2u_EA[256] = {
        0x728B,0x728D,0x728F,0x7292,0x6308,0x6332,0x63B0,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EB[256] = {
+static const wchar_t c2u_EB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3791,7 +3791,7 @@ static wchar_t c2u_EB[256] = {
        0x6ED5,0x81A3,0x81AA,0x81CC,0x6726,0x81CA,0x81BB,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EC[256] = {
+static const wchar_t c2u_EC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3827,7 +3827,7 @@ static wchar_t c2u_EC[256] = {
        0x7985,0x798A,0x799A,0x79A7,0x79B3,0x5FD1,0x5FD0,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_ED[256] = {
+static const wchar_t c2u_ED[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3863,7 +3863,7 @@ static wchar_t c2u_ED[256] = {
        0x7738,0x7750,0x7751,0x7747,0x7743,0x775A,0x7768,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EE[256] = {
+static const wchar_t c2u_EE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3899,7 +3899,7 @@ static wchar_t c2u_EE[256] = {
        0x94E0,0x94E2,0x94E4,0x94E5,0x94E7,0x94E8,0x94EA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EF[256] = {
+static const wchar_t c2u_EF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3935,7 +3935,7 @@ static wchar_t c2u_EF[256] = {
        0x79EB,0x7A06,0x5D47,0x7A03,0x7A02,0x7A1E,0x7A14,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F0[256] = {
+static const wchar_t c2u_F0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3971,7 +3971,7 @@ static wchar_t c2u_F0[256] = {
        0x760C,0x7617,0x760A,0x7625,0x7618,0x7615,0x7619,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F1[256] = {
+static const wchar_t c2u_F1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4007,7 +4007,7 @@ static wchar_t c2u_F1[256] = {
        0x8052,0x8069,0x8071,0x8983,0x9878,0x9880,0x9883,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F2[256] = {
+static const wchar_t c2u_F2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4043,7 +4043,7 @@ static wchar_t c2u_F2[256] = {
        0x8764,0x8759,0x8765,0x8793,0x87AF,0x87A8,0x87D2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F3[256] = {
+static const wchar_t c2u_F3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4079,7 +4079,7 @@ static wchar_t c2u_F3[256] = {
        0x7BEA,0x7C0C,0x7BFE,0x7BFC,0x7C0F,0x7C16,0x7C0B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F4[256] = {
+static const wchar_t c2u_F4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4115,7 +4115,7 @@ static wchar_t c2u_F4[256] = {
        0x8C47,0x8C49,0x914A,0x9150,0x914E,0x914F,0x9164,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F5[256] = {
+static const wchar_t c2u_F5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4151,7 +4151,7 @@ static wchar_t c2u_F5[256] = {
        0x8C98,0x8C94,0x659B,0x89D6,0x89DE,0x89DA,0x89DC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F6[256] = {
+static const wchar_t c2u_F6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4187,7 +4187,7 @@ static wchar_t c2u_F6[256] = {
        0x9CBD,0x9CC4,0x9CC5,0x9CC6,0x9CC7,0x9CCA,0x9CCB,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F7[256] = {
+static const wchar_t c2u_F7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4223,7 +4223,7 @@ static wchar_t c2u_F7[256] = {
        0x9F2C,0x9F2F,0x9F39,0x9F37,0x9F3D,0x9F3E,0x9F44,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F8[256] = {
+static const wchar_t c2u_F8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4248,7 +4248,7 @@ static wchar_t c2u_F8[256] = {
        0x9D42,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_F9[256] = {
+static const wchar_t c2u_F9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4273,7 +4273,7 @@ static wchar_t c2u_F9[256] = {
        0x9DA2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_FA[256] = {
+static const wchar_t c2u_FA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4298,7 +4298,7 @@ static wchar_t c2u_FA[256] = {
        0x9E02,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_FB[256] = {
+static const wchar_t c2u_FB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4323,7 +4323,7 @@ static wchar_t c2u_FB[256] = {
        0x9EAA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_FC[256] = {
+static const wchar_t c2u_FC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4348,7 +4348,7 @@ static wchar_t c2u_FC[256] = {
        0x9F31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_FD[256] = {
+static const wchar_t c2u_FD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4373,7 +4373,7 @@ static wchar_t c2u_FD[256] = {
        0xF9F1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_FE[256] = {
+static const wchar_t c2u_FE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4386,7 +4386,7 @@ static wchar_t c2u_FE[256] = {
        0xFA1F,0xFA20,0xFA21,0xFA23,0xFA24,0xFA27,0xFA28,0xFA29,/* 0x48-0x4F */
 };
 
-static wchar_t *page_charset2uni[256] = {
+static const wchar_t *page_charset2uni[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -4421,7 +4421,7 @@ static wchar_t *page_charset2uni[256] = {
        c2u_F8, c2u_F9, c2u_FA, c2u_FB, c2u_FC, c2u_FD, c2u_FE, NULL,   
 };
 
-static unsigned char u2c_00[512] = {
+static const unsigned char u2c_00[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4488,7 +4488,7 @@ static unsigned char u2c_00[512] = {
        0xA8, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_01[512] = {
+static const unsigned char u2c_01[512] = {
        0xA8, 0xA1, 0xA8, 0xA1, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4548,7 +4548,7 @@ static unsigned char u2c_01[512] = {
        0xA8, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */
 };
 
-static unsigned char u2c_02[512] = {
+static const unsigned char u2c_02[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4607,7 +4607,7 @@ static unsigned char u2c_02[512] = {
        0x00, 0x00, 0xA8, 0x42, 0x00, 0x00, 0x00, 0x00, /* 0xD8-0xDB */
 };
 
-static unsigned char u2c_03[512] = {
+static const unsigned char u2c_03[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4662,7 +4662,7 @@ static unsigned char u2c_03[512] = {
        0xA6, 0xD7, 0xA6, 0xD8, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */
 };
 
-static unsigned char u2c_04[512] = {
+static const unsigned char u2c_04[512] = {
        0x00, 0x00, 0xA7, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4686,7 +4686,7 @@ static unsigned char u2c_04[512] = {
        0x00, 0x00, 0xA7, 0xD7, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */
 };
 
-static unsigned char u2c_20[512] = {
+static const unsigned char u2c_20[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4705,7 +4705,7 @@ static unsigned char u2c_20[512] = {
        0x00, 0x00, 0x00, 0x00, 0xA3, 0xFE, 0x00, 0x00, /* 0x3C-0x3F */
 };
 
-static unsigned char u2c_21[512] = {
+static const unsigned char u2c_21[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xE6, /* 0x00-0x03 */
        0x00, 0x00, 0xA8, 0x47, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xA8, 0x48, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4748,7 +4748,7 @@ static unsigned char u2c_21[512] = {
        0xA8, 0x4B, 0xA8, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9B */
 };
 
-static unsigned char u2c_22[512] = {
+static const unsigned char u2c_22[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xA1, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4800,7 +4800,7 @@ static unsigned char u2c_22[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x53, /* 0xBC-0xBF */
 };
 
-static unsigned char u2c_23[512] = {
+static const unsigned char u2c_23[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4808,7 +4808,7 @@ static unsigned char u2c_23[512] = {
        0x00, 0x00, 0x00, 0x00, 0xA1, 0xD0, 0x00, 0x00, /* 0x10-0x13 */
 };
 
-static unsigned char u2c_24[512] = {
+static const unsigned char u2c_24[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4851,7 +4851,7 @@ static unsigned char u2c_24[512] = {
        0xA2, 0xC1, 0xA2, 0xC2, 0xA2, 0xC3, 0xA2, 0xC4, /* 0x98-0x9B */
 };
 
-static unsigned char u2c_25[512] = {
+static const unsigned char u2c_25[512] = {
        0xA9, 0xA4, 0xA9, 0xA5, 0xA9, 0xA6, 0xA9, 0xA7, /* 0x00-0x03 */
        0xA9, 0xA8, 0xA9, 0xA9, 0xA9, 0xAA, 0xA9, 0xAB, /* 0x04-0x07 */
        0xA9, 0xAC, 0xA9, 0xAD, 0xA9, 0xAE, 0xA9, 0xAF, /* 0x08-0x0B */
@@ -4919,7 +4919,7 @@ static unsigned char u2c_25[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_26[512] = {
+static const unsigned char u2c_26[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xA1, 0xEF, 0xA1, 0xEE, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xA8, 0x91, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4939,7 +4939,7 @@ static unsigned char u2c_26[512] = {
        0xA1, 0xE2, 0x00, 0x00, 0xA1, 0xE1, 0x00, 0x00, /* 0x40-0x43 */
 };
 
-static unsigned char u2c_30[512] = {
+static const unsigned char u2c_30[512] = {
        0xA1, 0xA1, 0xA1, 0xA2, 0xA1, 0xA3, 0xA1, 0xA8, /* 0x00-0x03 */
        0x00, 0x00, 0xA1, 0xA9, 0xA9, 0x65, 0xA9, 0x96, /* 0x04-0x07 */
        0xA1, 0xB4, 0xA1, 0xB5, 0xA1, 0xB6, 0xA1, 0xB7, /* 0x08-0x0B */
@@ -5007,7 +5007,7 @@ static unsigned char u2c_30[512] = {
        0xA9, 0x60, 0xA9, 0x63, 0xA9, 0x64, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_31[512] = {
+static const unsigned char u2c_31[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xA8, 0xC5, 0xA8, 0xC6, 0xA8, 0xC7, /* 0x04-0x07 */
        0xA8, 0xC8, 0xA8, 0xC9, 0xA8, 0xCA, 0xA8, 0xCB, /* 0x08-0x0B */
@@ -5051,7 +5051,7 @@ static unsigned char u2c_31[512] = {
        0xB6, 0xA1, 0xCC, 0xEC, 0xB5, 0xD8, 0xC8, 0xCB, /* 0x9C-0x9F */
 };
 
-static unsigned char u2c_32[512] = {
+static const unsigned char u2c_32[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5100,7 +5100,7 @@ static unsigned char u2c_32[512] = {
        0xD2, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */
 };
 
-static unsigned char u2c_33[512] = {
+static const unsigned char u2c_33[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5158,7 +5158,7 @@ static unsigned char u2c_33[512] = {
        0x00, 0x00, 0xA9, 0x54, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */
 };
 
-static unsigned char u2c_4E[512] = {
+static const unsigned char u2c_4E[512] = {
        0xD2, 0xBB, 0xB6, 0xA1, 0x81, 0x40, 0xC6, 0xDF, /* 0x00-0x03 */
        0x81, 0x41, 0x81, 0x42, 0x81, 0x43, 0xCD, 0xF2, /* 0x04-0x07 */
        0xD5, 0xC9, 0xC8, 0xFD, 0xC9, 0xCF, 0xCF, 0xC2, /* 0x08-0x0B */
@@ -5226,7 +5226,7 @@ static unsigned char u2c_4E[512] = {
        0x81, 0xA9, 0xB7, 0xDD, 0x81, 0xAA, 0xB7, 0xC2, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_4F[512] = {
+static const unsigned char u2c_4F[512] = {
        0x81, 0xAB, 0xC6, 0xF3, 0x81, 0xAC, 0x81, 0xAD, /* 0x00-0x03 */
        0x81, 0xAE, 0x81, 0xAF, 0x81, 0xB0, 0x81, 0xB1, /* 0x04-0x07 */
        0x81, 0xB2, 0xD8, 0xF8, 0xD2, 0xC1, 0x81, 0xB3, /* 0x08-0x0B */
@@ -5294,7 +5294,7 @@ static unsigned char u2c_4F[512] = {
        0x82, 0x71, 0x82, 0x72, 0xD9, 0xC2, 0x82, 0x73, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_50[512] = {
+static const unsigned char u2c_50[512] = {
        0x82, 0x74, 0x82, 0x75, 0x82, 0x76, 0x82, 0x77, /* 0x00-0x03 */
        0x82, 0x78, 0x82, 0x79, 0x82, 0x7A, 0x82, 0x7B, /* 0x04-0x07 */
        0x82, 0x7C, 0x82, 0x7D, 0x82, 0x7E, 0x82, 0x80, /* 0x08-0x0B */
@@ -5362,7 +5362,7 @@ static unsigned char u2c_50[512] = {
        0x83, 0x74, 0x83, 0x75, 0x83, 0x76, 0x83, 0x77, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_51[512] = {
+static const unsigned char u2c_51[512] = {
        0x83, 0x78, 0x83, 0x79, 0x83, 0x7A, 0x83, 0x7B, /* 0x00-0x03 */
        0x83, 0x7C, 0x83, 0x7D, 0xD9, 0xD3, 0xD9, 0xD8, /* 0x04-0x07 */
        0x83, 0x7E, 0x83, 0x80, 0x83, 0x81, 0xD9, 0xD9, /* 0x08-0x0B */
@@ -5430,7 +5430,7 @@ static unsigned char u2c_51[512] = {
        0xDB, 0xCA, 0xBA, 0xAF, 0x84, 0x54, 0xD4, 0xE4, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_52[512] = {
+static const unsigned char u2c_52[512] = {
        0xB5, 0xB6, 0xB5, 0xF3, 0xD8, 0xD6, 0xC8, 0xD0, /* 0x00-0x03 */
        0x84, 0x55, 0x84, 0x56, 0xB7, 0xD6, 0xC7, 0xD0, /* 0x04-0x07 */
        0xD8, 0xD7, 0x84, 0x57, 0xBF, 0xAF, 0x84, 0x58, /* 0x08-0x0B */
@@ -5498,7 +5498,7 @@ static unsigned char u2c_52[512] = {
        0x84, 0xF3, 0x84, 0xF4, 0xB9, 0xB4, 0xCE, 0xF0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_53[512] = {
+static const unsigned char u2c_53[512] = {
        0xD4, 0xC8, 0x84, 0xF5, 0x84, 0xF6, 0x84, 0xF7, /* 0x00-0x03 */
        0x84, 0xF8, 0xB0, 0xFC, 0xB4, 0xD2, 0x84, 0xF9, /* 0x04-0x07 */
        0xD0, 0xD9, 0x84, 0xFA, 0x84, 0xFB, 0x84, 0xFC, /* 0x08-0x0B */
@@ -5566,7 +5566,7 @@ static unsigned char u2c_53[512] = {
        0xB5, 0xF0, 0xDF, 0xB4, 0x85, 0xB6, 0x85, 0xB7, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_54[512] = {
+static const unsigned char u2c_54[512] = {
        0x85, 0xB8, 0xD3, 0xF5, 0x85, 0xB9, 0xB3, 0xD4, /* 0x00-0x03 */
        0xB8, 0xF7, 0x85, 0xBA, 0xDF, 0xBA, 0x85, 0xBB, /* 0x04-0x07 */
        0xBA, 0xCF, 0xBC, 0xAA, 0xB5, 0xF5, 0x85, 0xBC, /* 0x08-0x0B */
@@ -5634,7 +5634,7 @@ static unsigned char u2c_54[512] = {
        0xBA, 0xDF, 0xDF, 0xEC, 0x86, 0x64, 0xDB, 0xC1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_55[512] = {
+static const unsigned char u2c_55[512] = {
        0x86, 0x65, 0xD1, 0xE4, 0x86, 0x66, 0x86, 0x67, /* 0x00-0x03 */
        0x86, 0x68, 0x86, 0x69, 0xCB, 0xF4, 0xB4, 0xBD, /* 0x04-0x07 */
        0x86, 0x6A, 0xB0, 0xA6, 0x86, 0x6B, 0x86, 0x6C, /* 0x08-0x0B */
@@ -5702,7 +5702,7 @@ static unsigned char u2c_55[512] = {
        0x86, 0xF9, 0xCB, 0xD4, 0xE0, 0xD5, 0x86, 0xFA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_56[512] = {
+static const unsigned char u2c_56[512] = {
        0xE0, 0xD6, 0xE0, 0xD2, 0x86, 0xFB, 0x86, 0xFC, /* 0x00-0x03 */
        0x86, 0xFD, 0x86, 0xFE, 0x87, 0x40, 0x87, 0x41, /* 0x04-0x07 */
        0xE0, 0xD0, 0xBC, 0xCE, 0x87, 0x42, 0x87, 0x43, /* 0x08-0x0B */
@@ -5770,7 +5770,7 @@ static unsigned char u2c_56[512] = {
        0x87, 0xF2, 0xB9, 0xFA, 0xCD, 0xBC, 0xE0, 0xF3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_57[512] = {
+static const unsigned char u2c_57[512] = {
        0x87, 0xF3, 0x87, 0xF4, 0x87, 0xF5, 0xC6, 0xD4, /* 0x00-0x03 */
        0xE0, 0xF4, 0x87, 0xF6, 0xD4, 0xB2, 0x87, 0xF7, /* 0x04-0x07 */
        0xC8, 0xA6, 0xE0, 0xF6, 0xE0, 0xF5, 0x87, 0xF8, /* 0x08-0x0B */
@@ -5838,7 +5838,7 @@ static unsigned char u2c_57[512] = {
        0x88, 0xCE, 0xDC, 0xA3, 0x88, 0xCF, 0x88, 0xD0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_58[512] = {
+static const unsigned char u2c_58[512] = {
        0xDC, 0xA5, 0x88, 0xD1, 0xCC, 0xC3, 0x88, 0xD2, /* 0x00-0x03 */
        0x88, 0xD3, 0x88, 0xD4, 0xB6, 0xD1, 0xDD, 0xC0, /* 0x04-0x07 */
        0x88, 0xD5, 0x88, 0xD6, 0x88, 0xD7, 0xDC, 0xA1, /* 0x08-0x0B */
@@ -5906,7 +5906,7 @@ static unsigned char u2c_58[512] = {
        0x89, 0xDA, 0x89, 0xDB, 0x89, 0xDC, 0x89, 0xDD, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_59[512] = {
+static const unsigned char u2c_59[512] = {
        0x89, 0xDE, 0x89, 0xDF, 0xE2, 0xBA, 0x89, 0xE0, /* 0x00-0x03 */
        0xB4, 0xA6, 0x89, 0xE1, 0x89, 0xE2, 0xB1, 0xB8, /* 0x04-0x07 */
        0x89, 0xE3, 0x89, 0xE4, 0x89, 0xE5, 0x89, 0xE6, /* 0x08-0x0B */
@@ -5974,7 +5974,7 @@ static unsigned char u2c_59[512] = {
        0x8A, 0xB8, 0x8A, 0xB9, 0x8A, 0xBA, 0xD7, 0xCB, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5A[512] = {
+static const unsigned char u2c_5A[512] = {
        0x8A, 0xBB, 0xCD, 0xFE, 0x8A, 0xBC, 0xCD, 0xDE, /* 0x00-0x03 */
        0xC2, 0xA6, 0xE6, 0xAB, 0xE6, 0xAC, 0xBD, 0xBF, /* 0x04-0x07 */
        0xE6, 0xAE, 0xE6, 0xB3, 0x8A, 0xBD, 0x8A, 0xBE, /* 0x08-0x0B */
@@ -6042,7 +6042,7 @@ static unsigned char u2c_5A[512] = {
        0x8B, 0xBA, 0x8B, 0xBB, 0x8B, 0xBC, 0x8B, 0xBD, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5B[512] = {
+static const unsigned char u2c_5B[512] = {
        0x8B, 0xBE, 0x8B, 0xBF, 0x8B, 0xC0, 0x8B, 0xC1, /* 0x00-0x03 */
        0x8B, 0xC2, 0x8B, 0xC3, 0x8B, 0xC4, 0x8B, 0xC5, /* 0x04-0x07 */
        0x8B, 0xC6, 0xE6, 0xD2, 0x8B, 0xC7, 0x8B, 0xC8, /* 0x08-0x0B */
@@ -6110,7 +6110,7 @@ static unsigned char u2c_5B[512] = {
        0xB5, 0xBC, 0x8C, 0x9C, 0x8C, 0x9D, 0xCA, 0xD9, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5C[512] = {
+static const unsigned char u2c_5C[512] = {
        0x8C, 0x9E, 0xB7, 0xE2, 0x8C, 0x9F, 0x8C, 0xA0, /* 0x00-0x03 */
        0xC9, 0xE4, 0x8C, 0xA1, 0xBD, 0xAB, 0x8C, 0xA2, /* 0x04-0x07 */
        0x8C, 0xA3, 0xCE, 0xBE, 0xD7, 0xF0, 0x8C, 0xA4, /* 0x08-0x0B */
@@ -6178,7 +6178,7 @@ static unsigned char u2c_5C[512] = {
        0x8D, 0x7A, 0x8D, 0x7B, 0x8D, 0x7C, 0x8D, 0x7D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5D[512] = {
+static const unsigned char u2c_5D[512] = {
        0x8D, 0x7E, 0x8D, 0x80, 0xE1, 0xC0, 0xE1, 0xC1, /* 0x00-0x03 */
        0x8D, 0x81, 0x8D, 0x82, 0xE1, 0xC7, 0xB3, 0xE7, /* 0x04-0x07 */
        0x8D, 0x83, 0x8D, 0x84, 0x8D, 0x85, 0x8D, 0x86, /* 0x08-0x0B */
@@ -6246,7 +6246,7 @@ static unsigned char u2c_5D[512] = {
        0x8E, 0x87, 0xD9, 0xE3, 0xBD, 0xED, 0x8E, 0x88, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5E[512] = {
+static const unsigned char u2c_5E[512] = {
        0x8E, 0x89, 0xB1, 0xD2, 0xCA, 0xD0, 0xB2, 0xBC, /* 0x00-0x03 */
        0x8E, 0x8A, 0xCB, 0xA7, 0xB7, 0xAB, 0x8E, 0x8B, /* 0x04-0x07 */
        0xCA, 0xA6, 0x8E, 0x8C, 0x8E, 0x8D, 0x8E, 0x8E, /* 0x08-0x0B */
@@ -6314,7 +6314,7 @@ static unsigned char u2c_5E[512] = {
        0x8F, 0x69, 0x8F, 0x6A, 0xDE, 0xC3, 0xD8, 0xA5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5F[512] = {
+static const unsigned char u2c_5F[512] = {
        0xBF, 0xAA, 0xDB, 0xCD, 0xD2, 0xEC, 0xC6, 0xFA, /* 0x00-0x03 */
        0xC5, 0xAA, 0x8F, 0x6B, 0x8F, 0x6C, 0x8F, 0x6D, /* 0x04-0x07 */
        0xDE, 0xC4, 0x8F, 0x6E, 0xB1, 0xD7, 0xDF, 0xAE, /* 0x08-0x0B */
@@ -6382,7 +6382,7 @@ static unsigned char u2c_5F[512] = {
        0x8F, 0xFD, 0xBA, 0xF6, 0xE2, 0xE9, 0xB7, 0xDE, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_60[512] = {
+static const unsigned char u2c_60[512] = {
        0xBB, 0xB3, 0xCC, 0xAC, 0xCB, 0xCB, 0xE2, 0xE4, /* 0x00-0x03 */
        0xE2, 0xE6, 0xE2, 0xEA, 0xE2, 0xEB, 0x8F, 0xFE, /* 0x04-0x07 */
        0x90, 0x40, 0x90, 0x41, 0xE2, 0xF7, 0x90, 0x42, /* 0x08-0x0B */
@@ -6450,7 +6450,7 @@ static unsigned char u2c_60[512] = {
        0x90, 0xC6, 0x90, 0xC7, 0x90, 0xC8, 0x90, 0xC9, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_61[512] = {
+static const unsigned char u2c_61[512] = {
        0xE3, 0xB8, 0xB3, 0xEE, 0x90, 0xCA, 0x90, 0xCB, /* 0x00-0x03 */
        0x90, 0xCC, 0x90, 0xCD, 0xED, 0xA9, 0x90, 0xCE, /* 0x04-0x07 */
        0xD3, 0xFA, 0xD3, 0xE4, 0x90, 0xCF, 0x90, 0xD0, /* 0x08-0x0B */
@@ -6518,7 +6518,7 @@ static unsigned char u2c_61[512] = {
        0x91, 0xD6, 0x91, 0xD7, 0x91, 0xD8, 0xDC, 0xB2, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_62[512] = {
+static const unsigned char u2c_62[512] = {
        0x91, 0xD9, 0x91, 0xDA, 0x91, 0xDB, 0x91, 0xDC, /* 0x00-0x03 */
        0x91, 0xDD, 0x91, 0xDE, 0xED, 0xB0, 0x91, 0xDF, /* 0x04-0x07 */
        0xB8, 0xEA, 0x91, 0xE0, 0xCE, 0xEC, 0xEA, 0xA7, /* 0x08-0x0B */
@@ -6586,7 +6586,7 @@ static unsigned char u2c_62[512] = {
        0xC6, 0xB4, 0xD7, 0xA7, 0xCA, 0xB0, 0xC4, 0xC3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_63[512] = {
+static const unsigned char u2c_63[512] = {
        0x92, 0x93, 0xB3, 0xD6, 0xB9, 0xD2, 0x92, 0x94, /* 0x00-0x03 */
        0x92, 0x95, 0x92, 0x96, 0x92, 0x97, 0xD6, 0xB8, /* 0x04-0x07 */
        0xEA, 0xFC, 0xB0, 0xB4, 0x92, 0x98, 0x92, 0x99, /* 0x08-0x0B */
@@ -6654,7 +6654,7 @@ static unsigned char u2c_63[512] = {
        0x93, 0x67, 0xC0, 0xBF, 0x93, 0x68, 0xDE, 0xEC, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_64[512] = {
+static const unsigned char u2c_64[512] = {
        0xB2, 0xF3, 0xB8, 0xE9, 0xC2, 0xA7, 0x93, 0x69, /* 0x00-0x03 */
        0x93, 0x6A, 0xBD, 0xC1, 0x93, 0x6B, 0x93, 0x6C, /* 0x04-0x07 */
        0x93, 0x6D, 0x93, 0x6E, 0x93, 0x6F, 0xDE, 0xF5, /* 0x08-0x0B */
@@ -6722,7 +6722,7 @@ static unsigned char u2c_64[512] = {
        0x94, 0x5D, 0x94, 0x5E, 0x94, 0x5F, 0x94, 0x60, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_65[512] = {
+static const unsigned char u2c_65[512] = {
        0xC5, 0xCA, 0x94, 0x61, 0x94, 0x62, 0x94, 0x63, /* 0x00-0x03 */
        0x94, 0x64, 0x94, 0x65, 0x94, 0x66, 0x94, 0x67, /* 0x04-0x07 */
        0x94, 0x68, 0xDF, 0xAB, 0x94, 0x69, 0x94, 0x6A, /* 0x08-0x0B */
@@ -6790,7 +6790,7 @@ static unsigned char u2c_65[512] = {
        0x95, 0x47, 0x95, 0x48, 0x95, 0x49, 0x95, 0x4A, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_66[512] = {
+static const unsigned char u2c_66[512] = {
        0xEA, 0xC0, 0x95, 0x4B, 0xB0, 0xBA, 0xEA, 0xBE, /* 0x00-0x03 */
        0x95, 0x4C, 0x95, 0x4D, 0xC0, 0xA5, 0x95, 0x4E, /* 0x04-0x07 */
        0x95, 0x4F, 0x95, 0x50, 0xEA, 0xBB, 0x95, 0x51, /* 0x08-0x0B */
@@ -6858,7 +6858,7 @@ static unsigned char u2c_66[512] = {
        0xC2, 0xFC, 0x95, 0xFB, 0xD4, 0xF8, 0xCC, 0xE6, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_67[512] = {
+static const unsigned char u2c_67[512] = {
        0xD7, 0xEE, 0x95, 0xFC, 0x95, 0xFD, 0x95, 0xFE, /* 0x00-0x03 */
        0x96, 0x40, 0x96, 0x41, 0x96, 0x42, 0x96, 0x43, /* 0x04-0x07 */
        0xD4, 0xC2, 0xD3, 0xD0, 0xEB, 0xC3, 0xC5, 0xF3, /* 0x08-0x0B */
@@ -6926,7 +6926,7 @@ static unsigned char u2c_67[512] = {
        0x96, 0xCC, 0xE8, 0xDF, 0x96, 0xCD, 0xCA, 0xC1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_68[512] = {
+static const unsigned char u2c_68[512] = {
        0xE8, 0xD9, 0x96, 0xCE, 0x96, 0xCF, 0x96, 0xD0, /* 0x00-0x03 */
        0x96, 0xD1, 0xD5, 0xA4, 0x96, 0xD2, 0xB1, 0xEA, /* 0x04-0x07 */
        0xD5, 0xBB, 0xE8, 0xCE, 0xE8, 0xD0, 0xB6, 0xB0, /* 0x08-0x0B */
@@ -6994,7 +6994,7 @@ static unsigned char u2c_68[512] = {
        0xE8, 0xFB, 0x97, 0xB2, 0x97, 0xB3, 0x97, 0xB4, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_69[512] = {
+static const unsigned char u2c_69[512] = {
        0x97, 0xB5, 0xE9, 0xA4, 0x97, 0xB6, 0x97, 0xB7, /* 0x00-0x03 */
        0x97, 0xB8, 0xD2, 0xCE, 0x97, 0xB9, 0x97, 0xBA, /* 0x04-0x07 */
        0x97, 0xBB, 0x97, 0xBC, 0x97, 0xBD, 0xE9, 0xA3, /* 0x08-0x0B */
@@ -7062,7 +7062,7 @@ static unsigned char u2c_69[512] = {
        0x98, 0xB3, 0xB2, 0xDB, 0x98, 0xB4, 0xE9, 0xC8, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6A[512] = {
+static const unsigned char u2c_6A[512] = {
        0x98, 0xB5, 0x98, 0xB6, 0x98, 0xB7, 0x98, 0xB8, /* 0x00-0x03 */
        0x98, 0xB9, 0x98, 0xBA, 0x98, 0xBB, 0x98, 0xBC, /* 0x04-0x07 */
        0x98, 0xBD, 0x98, 0xBE, 0xB7, 0xAE, 0x98, 0xBF, /* 0x08-0x0B */
@@ -7130,7 +7130,7 @@ static unsigned char u2c_6A[512] = {
        0x99, 0xD2, 0x99, 0xD3, 0x99, 0xD4, 0x99, 0xD5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6B[512] = {
+static const unsigned char u2c_6B[512] = {
        0x99, 0xD6, 0x99, 0xD7, 0x99, 0xD8, 0x99, 0xD9, /* 0x00-0x03 */
        0x99, 0xDA, 0x99, 0xDB, 0x99, 0xDC, 0x99, 0xDD, /* 0x04-0x07 */
        0x99, 0xDE, 0x99, 0xDF, 0x99, 0xE0, 0x99, 0xE1, /* 0x08-0x0B */
@@ -7198,7 +7198,7 @@ static unsigned char u2c_6B[512] = {
        0x9A, 0xCE, 0xEB, 0xA6, 0x9A, 0xCF, 0x9A, 0xD0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6C[512] = {
+static const unsigned char u2c_6C[512] = {
        0x9A, 0xD1, 0x9A, 0xD2, 0x9A, 0xD3, 0x9A, 0xD4, /* 0x00-0x03 */
        0x9A, 0xD5, 0xEB, 0xA9, 0xEB, 0xAB, 0xEB, 0xAA, /* 0x04-0x07 */
        0x9A, 0xD6, 0x9A, 0xD7, 0x9A, 0xD8, 0x9A, 0xD9, /* 0x08-0x0B */
@@ -7266,7 +7266,7 @@ static unsigned char u2c_6C[512] = {
        0xC6, 0xC3, 0xD4, 0xF3, 0xE3, 0xFE, 0x9B, 0x8E, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6D[512] = {
+static const unsigned char u2c_6D[512] = {
        0x9B, 0x8F, 0xBD, 0xE0, 0x9B, 0x90, 0x9B, 0x91, /* 0x00-0x03 */
        0xE4, 0xA7, 0x9B, 0x92, 0x9B, 0x93, 0xE4, 0xA6, /* 0x04-0x07 */
        0x9B, 0x94, 0x9B, 0x95, 0x9B, 0x96, 0xD1, 0xF3, /* 0x08-0x0B */
@@ -7334,7 +7334,7 @@ static unsigned char u2c_6D[512] = {
        0xED, 0xB5, 0x9C, 0x5D, 0x9C, 0x5E, 0x9C, 0x5F, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6E[512] = {
+static const unsigned char u2c_6E[512] = {
        0x9C, 0x60, 0x9C, 0x61, 0x9C, 0x62, 0x9C, 0x63, /* 0x00-0x03 */
        0x9C, 0x64, 0xC7, 0xE5, 0x9C, 0x65, 0x9C, 0x66, /* 0x04-0x07 */
        0x9C, 0x67, 0x9C, 0x68, 0xD4, 0xA8, 0x9C, 0x69, /* 0x08-0x0B */
@@ -7402,7 +7402,7 @@ static unsigned char u2c_6E[512] = {
        0x9D, 0x4A, 0x9D, 0x4B, 0x9D, 0x4C, 0x9D, 0x4D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6F[512] = {
+static const unsigned char u2c_6F[512] = {
        0x9D, 0x4E, 0x9D, 0x4F, 0xC6, 0xAF, 0x9D, 0x50, /* 0x00-0x03 */
        0x9D, 0x51, 0x9D, 0x52, 0xC6, 0xE1, 0x9D, 0x53, /* 0x04-0x07 */
        0x9D, 0x54, 0xE4, 0xF5, 0x9D, 0x55, 0x9D, 0x56, /* 0x08-0x0B */
@@ -7470,7 +7470,7 @@ static unsigned char u2c_6F[512] = {
        0x9E, 0x54, 0x9E, 0x55, 0x9E, 0x56, 0x9E, 0x57, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_70[512] = {
+static const unsigned char u2c_70[512] = {
        0x9E, 0x58, 0x9E, 0x59, 0x9E, 0x5A, 0x9E, 0x5B, /* 0x00-0x03 */
        0x9E, 0x5C, 0x9E, 0x5D, 0x9E, 0x5E, 0x9E, 0x5F, /* 0x04-0x07 */
        0x9E, 0x60, 0x9E, 0x61, 0x9E, 0x62, 0x9E, 0x63, /* 0x08-0x0B */
@@ -7538,7 +7538,7 @@ static unsigned char u2c_70[512] = {
        0x9F, 0x54, 0xB7, 0xE9, 0x9F, 0x55, 0x9F, 0x56, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_71[512] = {
+static const unsigned char u2c_71[512] = {
        0x9F, 0x57, 0x9F, 0x58, 0x9F, 0x59, 0x9F, 0x5A, /* 0x00-0x03 */
        0x9F, 0x5B, 0x9F, 0x5C, 0x9F, 0x5D, 0x9F, 0x5E, /* 0x04-0x07 */
        0x9F, 0x5F, 0xD1, 0xC9, 0xBA, 0xB8, 0x9F, 0x60, /* 0x08-0x0B */
@@ -7606,7 +7606,7 @@ static unsigned char u2c_71[512] = {
        0xA0, 0x61, 0xA0, 0x62, 0xA0, 0x63, 0xA0, 0x64, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_72[512] = {
+static const unsigned char u2c_72[512] = {
        0xA0, 0x65, 0xA0, 0x66, 0xA0, 0x67, 0xA0, 0x68, /* 0x00-0x03 */
        0xA0, 0x69, 0xA0, 0x6A, 0xB1, 0xAC, 0xA0, 0x6B, /* 0x04-0x07 */
        0xA0, 0x6C, 0xA0, 0x6D, 0xA0, 0x6E, 0xA0, 0x6F, /* 0x08-0x0B */
@@ -7674,7 +7674,7 @@ static unsigned char u2c_72[512] = {
        0xC0, 0xC7, 0xAA, 0x4E, 0xAA, 0x4F, 0xAA, 0x50, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_73[512] = {
+static const unsigned char u2c_73[512] = {
        0xAA, 0x51, 0xE1, 0xFB, 0xAA, 0x52, 0xE1, 0xFD, /* 0x00-0x03 */
        0xAA, 0x53, 0xAA, 0x54, 0xAA, 0x55, 0xAA, 0x56, /* 0x04-0x07 */
        0xAA, 0x57, 0xAA, 0x58, 0xE2, 0xA5, 0xAA, 0x59, /* 0x08-0x0B */
@@ -7742,7 +7742,7 @@ static unsigned char u2c_73[512] = {
        0xAC, 0x44, 0xAC, 0x45, 0xAC, 0x46, 0xAC, 0x47, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_74[512] = {
+static const unsigned char u2c_74[512] = {
        0xAC, 0x48, 0xAC, 0x49, 0xAC, 0x4A, 0xC7, 0xF2, /* 0x00-0x03 */
        0xAC, 0x4B, 0xC0, 0xC5, 0xC0, 0xED, 0xAC, 0x4C, /* 0x04-0x07 */
        0xAC, 0x4D, 0xC1, 0xF0, 0xE7, 0xF0, 0xAC, 0x4E, /* 0x08-0x0B */
@@ -7810,7 +7810,7 @@ static unsigned char u2c_74[512] = {
        0xAE, 0x46, 0xAE, 0x47, 0xAE, 0x48, 0xEA, 0xB3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_75[512] = {
+static const unsigned char u2c_75[512] = {
        0xAE, 0x49, 0xAE, 0x4A, 0xAE, 0x4B, 0xAE, 0x4C, /* 0x00-0x03 */
        0xD5, 0xE7, 0xAE, 0x4D, 0xAE, 0x4E, 0xAE, 0x4F, /* 0x04-0x07 */
        0xAE, 0x50, 0xAE, 0x51, 0xAE, 0x52, 0xAE, 0x53, /* 0x08-0x0B */
@@ -7878,7 +7878,7 @@ static unsigned char u2c_75[512] = {
        0xF0, 0xF3, 0xAF, 0x79, 0xAF, 0x7A, 0xF0, 0xF4, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_76[512] = {
+static const unsigned char u2c_76[512] = {
        0xF0, 0xF6, 0xB4, 0xE1, 0xAF, 0x7B, 0xF0, 0xF1, /* 0x00-0x03 */
        0xAF, 0x7C, 0xF0, 0xF7, 0xAF, 0x7D, 0xAF, 0x7E, /* 0x04-0x07 */
        0xAF, 0x80, 0xAF, 0x81, 0xF0, 0xFA, 0xAF, 0x82, /* 0x08-0x0B */
@@ -7946,7 +7946,7 @@ static unsigned char u2c_76[512] = {
        0xC5, 0xCE, 0xB1, 0x60, 0xB6, 0xDC, 0xB1, 0x61, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_77[512] = {
+static const unsigned char u2c_77[512] = {
        0xB1, 0x62, 0xCA, 0xA1, 0xB1, 0x63, 0xB1, 0x64, /* 0x00-0x03 */
        0xED, 0xED, 0xB1, 0x65, 0xB1, 0x66, 0xED, 0xF0, /* 0x04-0x07 */
        0xED, 0xF1, 0xC3, 0xBC, 0xB1, 0x67, 0xBF, 0xB4, /* 0x08-0x0B */
@@ -8014,7 +8014,7 @@ static unsigned char u2c_77[512] = {
        0xB3, 0x4D, 0xCE, 0xF9, 0xB7, 0xAF, 0xBF, 0xF3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_78[512] = {
+static const unsigned char u2c_78[512] = {
        0xED, 0xB8, 0xC2, 0xEB, 0xC9, 0xB0, 0xB3, 0x4E, /* 0x00-0x03 */
        0xB3, 0x4F, 0xB3, 0x50, 0xB3, 0x51, 0xB3, 0x52, /* 0x04-0x07 */
        0xB3, 0x53, 0xED, 0xB9, 0xB3, 0x54, 0xB3, 0x55, /* 0x08-0x0B */
@@ -8082,7 +8082,7 @@ static unsigned char u2c_78[512] = {
        0xB4, 0x92, 0xB4, 0x93, 0xB4, 0x94, 0xB4, 0x95, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_79[512] = {
+static const unsigned char u2c_79[512] = {
        0xB4, 0x96, 0xBD, 0xB8, 0xB4, 0x97, 0xB4, 0x98, /* 0x00-0x03 */
        0xB4, 0x99, 0xED, 0xE2, 0xB4, 0x9A, 0xB4, 0x9B, /* 0x04-0x07 */
        0xB4, 0x9C, 0xB4, 0x9D, 0xB4, 0x9E, 0xB4, 0x9F, /* 0x08-0x0B */
@@ -8150,7 +8150,7 @@ static unsigned char u2c_79[512] = {
        0xB6, 0x8B, 0xBB, 0xE0, 0xB6, 0x8C, 0xB6, 0x8D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7A[512] = {
+static const unsigned char u2c_7A[512] = {
        0xCF, 0xA1, 0xB6, 0x8E, 0xEF, 0xFC, 0xEF, 0xFB, /* 0x00-0x03 */
        0xB6, 0x8F, 0xB6, 0x90, 0xEF, 0xF9, 0xB6, 0x91, /* 0x04-0x07 */
        0xB6, 0x92, 0xB6, 0x93, 0xB6, 0x94, 0xB3, 0xCC, /* 0x08-0x0B */
@@ -8218,7 +8218,7 @@ static unsigned char u2c_7A[512] = {
        0xB8, 0x86, 0xF3, 0xC4, 0xB8, 0x87, 0xB8, 0xCD, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7B[512] = {
+static const unsigned char u2c_7B[512] = {
        0xB8, 0x88, 0xB8, 0x89, 0xB8, 0x8A, 0xF3, 0xC6, /* 0x00-0x03 */
        0xF3, 0xC7, 0xB8, 0x8B, 0xB0, 0xCA, 0xB8, 0x8C, /* 0x04-0x07 */
        0xF3, 0xC5, 0xB8, 0x8D, 0xF3, 0xC9, 0xCB, 0xF1, /* 0x08-0x0B */
@@ -8286,7 +8286,7 @@ static unsigned char u2c_7B[512] = {
        0xF3, 0xFB, 0xBA, 0x68, 0xF3, 0xFA, 0xBA, 0x69, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7C[512] = {
+static const unsigned char u2c_7C[512] = {
        0xBA, 0x6A, 0xBA, 0x6B, 0xBA, 0x6C, 0xBA, 0x6D, /* 0x00-0x03 */
        0xBA, 0x6E, 0xBA, 0x6F, 0xBA, 0x70, 0xB4, 0xD8, /* 0x04-0x07 */
        0xBA, 0x71, 0xBA, 0x72, 0xBA, 0x73, 0xF3, 0xFE, /* 0x08-0x0B */
@@ -8354,7 +8354,7 @@ static unsigned char u2c_7C[512] = {
        0xBC, 0x6B, 0xBC, 0x6C, 0xBC, 0x6D, 0xBC, 0x6E, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7D[512] = {
+static const unsigned char u2c_7D[512] = {
        0xBC, 0x6F, 0xBC, 0x70, 0xBC, 0x71, 0xBC, 0x72, /* 0x00-0x03 */
        0xBC, 0x73, 0xBC, 0x74, 0xBC, 0x75, 0xBC, 0x76, /* 0x04-0x07 */
        0xBC, 0x77, 0xBC, 0x78, 0xCE, 0xC9, 0xBC, 0x79, /* 0x08-0x0B */
@@ -8422,7 +8422,7 @@ static unsigned char u2c_7D[512] = {
        0xBF, 0x41, 0xBF, 0x42, 0xBF, 0x43, 0xBF, 0x44, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7E[512] = {
+static const unsigned char u2c_7E[512] = {
        0xBF, 0x45, 0xBF, 0x46, 0xBF, 0x47, 0xBF, 0x48, /* 0x00-0x03 */
        0xBF, 0x49, 0xBF, 0x4A, 0xBF, 0x4B, 0xBF, 0x4C, /* 0x04-0x07 */
        0xBF, 0x4D, 0xBF, 0x4E, 0xBF, 0x4F, 0xBF, 0x50, /* 0x08-0x0B */
@@ -8490,7 +8490,7 @@ static unsigned char u2c_7E[512] = {
        0xD7, 0xDB, 0xD5, 0xC0, 0xE7, 0xBA, 0xC2, 0xCC, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7F[512] = {
+static const unsigned char u2c_7F[512] = {
        0xD7, 0xBA, 0xE7, 0xBB, 0xE7, 0xBC, 0xE7, 0xBD, /* 0x00-0x03 */
        0xBC, 0xEA, 0xC3, 0xE5, 0xC0, 0xC2, 0xE7, 0xBE, /* 0x04-0x07 */
        0xE7, 0xBF, 0xBC, 0xA9, 0xC0, 0x88, 0xE7, 0xC0, /* 0x08-0x0B */
@@ -8558,7 +8558,7 @@ static unsigned char u2c_7F[512] = {
        0xD2, 0xED, 0xC2, 0x50, 0xC2, 0x51, 0xC2, 0x52, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_80[512] = {
+static const unsigned char u2c_80[512] = {
        0xD2, 0xAB, 0xC0, 0xCF, 0xC2, 0x53, 0xBF, 0xBC, /* 0x00-0x03 */
        0xEB, 0xA3, 0xD5, 0xDF, 0xEA, 0xC8, 0xC2, 0x54, /* 0x04-0x07 */
        0xC2, 0x55, 0xC2, 0x56, 0xC2, 0x57, 0xF1, 0xF3, /* 0x08-0x0B */
@@ -8626,7 +8626,7 @@ static unsigned char u2c_80[512] = {
        0xEB, 0xDD, 0xC4, 0xDC, 0xC3, 0x75, 0xC3, 0x76, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_81[512] = {
+static const unsigned char u2c_81[512] = {
        0xC3, 0x77, 0xC3, 0x78, 0xD6, 0xAC, 0xC3, 0x79, /* 0x00-0x03 */
        0xC3, 0x7A, 0xC3, 0x7B, 0xB4, 0xE0, 0xC3, 0x7C, /* 0x04-0x07 */
        0xC3, 0x7D, 0xC2, 0xF6, 0xBC, 0xB9, 0xC3, 0x7E, /* 0x08-0x0B */
@@ -8694,7 +8694,7 @@ static unsigned char u2c_81[512] = {
        0xBE, 0xCA, 0xC5, 0x60, 0xF4, 0xA7, 0xC5, 0x61, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_82[512] = {
+static const unsigned char u2c_82[512] = {
        0xD2, 0xA8, 0xF4, 0xA8, 0xF4, 0xA9, 0xC5, 0x62, /* 0x00-0x03 */
        0xF4, 0xAA, 0xBE, 0xCB, 0xD3, 0xDF, 0xC5, 0x63, /* 0x04-0x07 */
        0xC5, 0x64, 0xC5, 0x65, 0xC5, 0x66, 0xC5, 0x67, /* 0x08-0x0B */
@@ -8762,7 +8762,7 @@ static unsigned char u2c_82[512] = {
        0xC6, 0x81, 0xC6, 0x82, 0xC6, 0x83, 0xC6, 0x84, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_83[512] = {
+static const unsigned char u2c_83[512] = {
        0xC6, 0x85, 0xD7, 0xC2, 0xC3, 0xAF, 0xB7, 0xB6, /* 0x00-0x03 */
        0xC7, 0xD1, 0xC3, 0xA9, 0xDC, 0xE2, 0xDC, 0xD8, /* 0x04-0x07 */
        0xDC, 0xEB, 0xDC, 0xD4, 0xC6, 0x86, 0xC6, 0x87, /* 0x08-0x0B */
@@ -8830,7 +8830,7 @@ static unsigned char u2c_83[512] = {
        0xC8, 0x49, 0xDD, 0xC4, 0xC8, 0x4A, 0xC8, 0x4B, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_84[512] = {
+static const unsigned char u2c_84[512] = {
        0xC8, 0x4C, 0xDD, 0xBD, 0xC8, 0x4D, 0xDD, 0xCD, /* 0x00-0x03 */
        0xCC, 0xD1, 0xC8, 0x4E, 0xDD, 0xC9, 0xC8, 0x4F, /* 0x04-0x07 */
        0xC8, 0x50, 0xC8, 0x51, 0xC8, 0x52, 0xDD, 0xC2, /* 0x08-0x0B */
@@ -8898,7 +8898,7 @@ static unsigned char u2c_84[512] = {
        0xDE, 0xA4, 0xC9, 0x9C, 0xC9, 0x9D, 0xDE, 0xA3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_85[512] = {
+static const unsigned char u2c_85[512] = {
        0xC9, 0x9E, 0xC9, 0x9F, 0xC9, 0xA0, 0xCA, 0x40, /* 0x00-0x03 */
        0xCA, 0x41, 0xCA, 0x42, 0xCA, 0x43, 0xCA, 0x44, /* 0x04-0x07 */
        0xCA, 0x45, 0xCA, 0x46, 0xCA, 0x47, 0xCA, 0x48, /* 0x08-0x0B */
@@ -8966,7 +8966,7 @@ static unsigned char u2c_85[512] = {
        0xCC, 0x42, 0xCC, 0x43, 0xCC, 0x44, 0xDE, 0xBD, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_86[512] = {
+static const unsigned char u2c_86[512] = {
        0xCC, 0x45, 0xCC, 0x46, 0xCC, 0x47, 0xCC, 0x48, /* 0x00-0x03 */
        0xCC, 0x49, 0xDE, 0xBF, 0xCC, 0x4A, 0xCC, 0x4B, /* 0x04-0x07 */
        0xCC, 0x4C, 0xCC, 0x4D, 0xCC, 0x4E, 0xCC, 0x4F, /* 0x08-0x0B */
@@ -9034,7 +9034,7 @@ static unsigned char u2c_86[512] = {
        0xCD, 0x92, 0xCD, 0x93, 0xB6, 0xEA, 0xCD, 0x94, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_87[512] = {
+static const unsigned char u2c_87[512] = {
        0xCA, 0xF1, 0xCD, 0x95, 0xB7, 0xE4, 0xF2, 0xD7, /* 0x00-0x03 */
        0xCD, 0x96, 0xCD, 0x97, 0xCD, 0x98, 0xF2, 0xD8, /* 0x04-0x07 */
        0xF2, 0xDA, 0xF2, 0xDD, 0xF2, 0xDB, 0xCD, 0x99, /* 0x08-0x0B */
@@ -9102,7 +9102,7 @@ static unsigned char u2c_87[512] = {
        0xCF, 0x82, 0xCF, 0x83, 0xF3, 0xB8, 0xCF, 0x84, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_88[512] = {
+static const unsigned char u2c_88[512] = {
        0xCF, 0x85, 0xCF, 0x86, 0xCF, 0x87, 0xD9, 0xF9, /* 0x00-0x03 */
        0xCF, 0x88, 0xCF, 0x89, 0xCF, 0x8A, 0xCF, 0x8B, /* 0x04-0x07 */
        0xCF, 0x8C, 0xCF, 0x8D, 0xF3, 0xB9, 0xCF, 0x8E, /* 0x08-0x0B */
@@ -9170,7 +9170,7 @@ static unsigned char u2c_88[512] = {
        0xF1, 0xD3, 0xD1, 0x75, 0xF1, 0xD5, 0xD1, 0x76, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_89[512] = {
+static const unsigned char u2c_89[512] = {
        0xD1, 0x77, 0xD1, 0x78, 0xB9, 0xD3, 0xD1, 0x79, /* 0x00-0x03 */
        0xD1, 0x7A, 0xD1, 0x7B, 0xD1, 0x7C, 0xD1, 0x7D, /* 0x04-0x07 */
        0xD1, 0x7E, 0xD1, 0x80, 0xF1, 0xDB, 0xD1, 0x81, /* 0x08-0x0B */
@@ -9238,7 +9238,7 @@ static unsigned char u2c_89[512] = {
        0xD3, 0x81, 0xD3, 0x82, 0xD3, 0x83, 0xD3, 0x84, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8A[512] = {
+static const unsigned char u2c_8A[512] = {
        0xD1, 0xD4, 0xD3, 0x85, 0xD3, 0x86, 0xD3, 0x87, /* 0x00-0x03 */
        0xD3, 0x88, 0xD3, 0x89, 0xD3, 0x8A, 0xD9, 0xEA, /* 0x04-0x07 */
        0xD3, 0x8B, 0xD3, 0x8C, 0xD3, 0x8D, 0xD3, 0x8E, /* 0x08-0x0B */
@@ -9306,7 +9306,7 @@ static unsigned char u2c_8A[512] = {
        0xD6, 0x58, 0xD6, 0x59, 0xD6, 0x5A, 0xD6, 0x5B, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8B[512] = {
+static const unsigned char u2c_8B[512] = {
        0xD6, 0x5C, 0xD6, 0x5D, 0xD6, 0x5E, 0xD6, 0x5F, /* 0x00-0x03 */
        0xD6, 0x60, 0xD6, 0x61, 0xD6, 0x62, 0xE5, 0xC0, /* 0x04-0x07 */
        0xD6, 0x63, 0xD6, 0x64, 0xD6, 0x65, 0xD6, 0x66, /* 0x08-0x0B */
@@ -9374,7 +9374,7 @@ static unsigned char u2c_8B[512] = {
        0xDA, 0xC2, 0xB7, 0xCC, 0xBF, 0xCE, 0xDA, 0xC3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8C[512] = {
+static const unsigned char u2c_8C[512] = {
        0xDA, 0xC4, 0xCB, 0xAD, 0xDA, 0xC5, 0xB5, 0xF7, /* 0x00-0x03 */
        0xDA, 0xC6, 0xC1, 0xC2, 0xD7, 0xBB, 0xDA, 0xC7, /* 0x04-0x07 */
        0xCC, 0xB8, 0xD7, 0x9F, 0xD2, 0xEA, 0xC4, 0xB1, /* 0x08-0x0B */
@@ -9442,7 +9442,7 @@ static unsigned char u2c_8C[512] = {
        0xD9, 0x8F, 0xD9, 0x90, 0xD9, 0x91, 0xD9, 0x92, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8D[512] = {
+static const unsigned char u2c_8D[512] = {
        0xD9, 0x93, 0xD9, 0x94, 0xD9, 0x95, 0xD9, 0x96, /* 0x00-0x03 */
        0xD9, 0x97, 0xD9, 0x98, 0xD9, 0x99, 0xD9, 0x9A, /* 0x04-0x07 */
        0xD9, 0x9B, 0xD9, 0x9C, 0xD9, 0x9D, 0xD9, 0x9E, /* 0x08-0x0B */
@@ -9510,7 +9510,7 @@ static unsigned char u2c_8D[512] = {
        0xDB, 0x52, 0xF5, 0xD5, 0xDB, 0x53, 0xDB, 0x54, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8E[512] = {
+static const unsigned char u2c_8E[512] = {
        0xDB, 0x55, 0xDB, 0x56, 0xDB, 0x57, 0xDB, 0x58, /* 0x00-0x03 */
        0xDB, 0x59, 0xF5, 0xBD, 0xDB, 0x5A, 0xDB, 0x5B, /* 0x04-0x07 */
        0xDB, 0x5C, 0xF5, 0xD4, 0xD3, 0xBB, 0xDB, 0x5D, /* 0x08-0x0B */
@@ -9578,7 +9578,7 @@ static unsigned char u2c_8E[512] = {
        0xDD, 0x57, 0xDD, 0x58, 0xDD, 0x59, 0xDD, 0x5A, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8F[512] = {
+static const unsigned char u2c_8F[512] = {
        0xDD, 0x5B, 0xDD, 0x5C, 0xDD, 0x5D, 0xDD, 0x5E, /* 0x00-0x03 */
        0xDD, 0x5F, 0xDD, 0x60, 0xDD, 0x61, 0xDD, 0x62, /* 0x04-0x07 */
        0xDD, 0x63, 0xDD, 0x64, 0xDD, 0x65, 0xDD, 0x66, /* 0x08-0x0B */
@@ -9646,7 +9646,7 @@ static unsigned char u2c_8F[512] = {
        0xDE, 0x97, 0xD7, 0xB7, 0xDE, 0x98, 0xDE, 0x99, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_90[512] = {
+static const unsigned char u2c_90[512] = {
        0xCD, 0xCB, 0xCB, 0xCD, 0xCA, 0xCA, 0xCC, 0xD3, /* 0x00-0x03 */
        0xE5, 0xCC, 0xE5, 0xCB, 0xC4, 0xE6, 0xDE, 0x9A, /* 0x04-0x07 */
        0xDE, 0x9B, 0xD1, 0xA1, 0xD1, 0xB7, 0xE5, 0xCD, /* 0x08-0x0B */
@@ -9714,7 +9714,7 @@ static unsigned char u2c_90[512] = {
        0xE0, 0x63, 0xB6, 0xBC, 0xDB, 0xB1, 0xE0, 0x64, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_91[512] = {
+static const unsigned char u2c_91[512] = {
        0xE0, 0x65, 0xE0, 0x66, 0xB6, 0xF5, 0xE0, 0x67, /* 0x00-0x03 */
        0xDB, 0xB2, 0xE0, 0x68, 0xE0, 0x69, 0xE0, 0x6A, /* 0x04-0x07 */
        0xE0, 0x6B, 0xE0, 0x6C, 0xE0, 0x6D, 0xE0, 0x6E, /* 0x08-0x0B */
@@ -9782,7 +9782,7 @@ static unsigned char u2c_91[512] = {
        0xE2, 0x56, 0xE2, 0x57, 0xE2, 0x58, 0xE2, 0x59, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_92[512] = {
+static const unsigned char u2c_92[512] = {
        0xE2, 0x5A, 0xE2, 0x5B, 0xE2, 0x5C, 0xE2, 0x5D, /* 0x00-0x03 */
        0xE2, 0x5E, 0xE2, 0x5F, 0xE2, 0x60, 0xE2, 0x61, /* 0x04-0x07 */
        0xE2, 0x62, 0xE2, 0x63, 0xE2, 0x64, 0xE2, 0x65, /* 0x08-0x0B */
@@ -9850,7 +9850,7 @@ static unsigned char u2c_92[512] = {
        0xE4, 0x93, 0xE4, 0x94, 0xE4, 0x95, 0xE4, 0x96, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_93[512] = {
+static const unsigned char u2c_93[512] = {
        0xE4, 0x97, 0xE4, 0x98, 0xE4, 0x99, 0xE4, 0x9A, /* 0x00-0x03 */
        0xE4, 0x9B, 0xE4, 0x9C, 0xE4, 0x9D, 0xE4, 0x9E, /* 0x04-0x07 */
        0xE4, 0x9F, 0xE4, 0xA0, 0xE5, 0x40, 0xE5, 0x41, /* 0x08-0x0B */
@@ -9918,7 +9918,7 @@ static unsigned char u2c_93[512] = {
        0xE7, 0x6D, 0xE7, 0x6E, 0xE7, 0x6F, 0xE7, 0x70, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_94[512] = {
+static const unsigned char u2c_94[512] = {
        0xE7, 0x71, 0xE7, 0x72, 0xE7, 0x73, 0xE7, 0x74, /* 0x00-0x03 */
        0xE7, 0x75, 0xE7, 0x76, 0xE7, 0x77, 0xE7, 0x78, /* 0x04-0x07 */
        0xE7, 0x79, 0xE7, 0x7A, 0xE7, 0x7B, 0xE7, 0x7C, /* 0x08-0x0B */
@@ -9986,7 +9986,7 @@ static unsigned char u2c_94[512] = {
        0xEF, 0xAA, 0xEF, 0xAB, 0xC1, 0xB4, 0xEF, 0xAC, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_95[512] = {
+static const unsigned char u2c_95[512] = {
        0xCF, 0xFA, 0xCB, 0xF8, 0xEF, 0xAE, 0xEF, 0xAD, /* 0x00-0x03 */
        0xB3, 0xFA, 0xB9, 0xF8, 0xEF, 0xAF, 0xEF, 0xB0, /* 0x04-0x07 */
        0xD0, 0xE2, 0xEF, 0xB1, 0xEF, 0xB2, 0xB7, 0xE6, /* 0x08-0x0B */
@@ -10054,7 +10054,7 @@ static unsigned char u2c_95[512] = {
        0xE3, 0xCB, 0xC3, 0xF6, 0xE3, 0xCC, 0xEA, 0x5D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_96[512] = {
+static const unsigned char u2c_96[512] = {
        0xB7, 0xA7, 0xB8, 0xF3, 0xBA, 0xD2, 0xE3, 0xCD, /* 0x00-0x03 */
        0xE3, 0xCE, 0xD4, 0xC4, 0xE3, 0xCF, 0xEA, 0x5E, /* 0x04-0x07 */
        0xE3, 0xD0, 0xD1, 0xCB, 0xE3, 0xD1, 0xE3, 0xD2, /* 0x08-0x0B */
@@ -10122,7 +10122,7 @@ static unsigned char u2c_96[512] = {
        0xEB, 0x8B, 0xEB, 0x8C, 0xCE, 0xED, 0xEB, 0x8D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_97[512] = {
+static const unsigned char u2c_97[512] = {
        0xD0, 0xE8, 0xF6, 0xAB, 0xEB, 0x8E, 0xEB, 0x8F, /* 0x00-0x03 */
        0xCF, 0xF6, 0xEB, 0x90, 0xF6, 0xAA, 0xD5, 0xF0, /* 0x04-0x07 */
        0xF6, 0xAC, 0xC3, 0xB9, 0xEB, 0x91, 0xEB, 0x92, /* 0x08-0x0B */
@@ -10190,7 +10190,7 @@ static unsigned char u2c_97[512] = {
        0xED, 0x8E, 0xED, 0x8F, 0xED, 0x90, 0xED, 0x91, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_98[512] = {
+static const unsigned char u2c_98[512] = {
        0xED, 0x92, 0xED, 0x93, 0xED, 0x94, 0xED, 0x95, /* 0x00-0x03 */
        0xED, 0x96, 0xED, 0x97, 0xED, 0x98, 0xED, 0x99, /* 0x04-0x07 */
        0xED, 0x9A, 0xED, 0x9B, 0xED, 0x9C, 0xED, 0x9D, /* 0x08-0x0B */
@@ -10258,7 +10258,7 @@ static unsigned char u2c_98[512] = {
        0xEF, 0x95, 0xEF, 0x96, 0xEF, 0x97, 0xEF, 0x98, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_99[512] = {
+static const unsigned char u2c_99[512] = {
        0xEF, 0x99, 0xEF, 0x9A, 0xEF, 0x9B, 0xEF, 0x9C, /* 0x00-0x03 */
        0xEF, 0x9D, 0xEF, 0x9E, 0xEF, 0x9F, 0xEF, 0xA0, /* 0x04-0x07 */
        0xF0, 0x40, 0xF0, 0x41, 0xF0, 0x42, 0xF0, 0x43, /* 0x08-0x0B */
@@ -10326,7 +10326,7 @@ static unsigned char u2c_99[512] = {
        0xF2, 0x42, 0xF2, 0x43, 0xF2, 0x44, 0xF2, 0x45, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9A[512] = {
+static const unsigned char u2c_9A[512] = {
        0xF2, 0x46, 0xF2, 0x47, 0xF2, 0x48, 0xF2, 0x49, /* 0x00-0x03 */
        0xF2, 0x4A, 0xF2, 0x4B, 0xF2, 0x4C, 0xF2, 0x4D, /* 0x04-0x07 */
        0xF2, 0x4E, 0xF2, 0x4F, 0xF2, 0x50, 0xF2, 0x51, /* 0x08-0x0B */
@@ -10394,7 +10394,7 @@ static unsigned char u2c_9A[512] = {
        0xF3, 0x97, 0xF3, 0x98, 0xF3, 0x99, 0xF3, 0x9A, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9B[512] = {
+static const unsigned char u2c_9B[512] = {
        0xF3, 0x9B, 0xF3, 0x9C, 0xF3, 0x9D, 0xD7, 0xD7, /* 0x00-0x03 */
        0xF3, 0x9E, 0xF3, 0x9F, 0xF3, 0xA0, 0xF4, 0x40, /* 0x04-0x07 */
        0xF7, 0xDC, 0xF4, 0x41, 0xF4, 0x42, 0xF4, 0x43, /* 0x08-0x0B */
@@ -10462,7 +10462,7 @@ static unsigned char u2c_9B[512] = {
        0xF6, 0x60, 0xF6, 0x61, 0xF6, 0x62, 0xF6, 0x63, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9C[512] = {
+static const unsigned char u2c_9C[512] = {
        0xF6, 0x64, 0xF6, 0x65, 0xF6, 0x66, 0xF6, 0x67, /* 0x00-0x03 */
        0xF6, 0x68, 0xF6, 0x69, 0xF6, 0x6A, 0xF6, 0x6B, /* 0x04-0x07 */
        0xF6, 0x6C, 0xF6, 0x6D, 0xF6, 0x6E, 0xF6, 0x6F, /* 0x08-0x0B */
@@ -10530,7 +10530,7 @@ static unsigned char u2c_9C[512] = {
        0xF8, 0x59, 0xF8, 0x5A, 0xF8, 0x5B, 0xF8, 0x5C, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9D[512] = {
+static const unsigned char u2c_9D[512] = {
        0xF8, 0x5D, 0xF8, 0x5E, 0xF8, 0x5F, 0xF8, 0x60, /* 0x00-0x03 */
        0xF8, 0x61, 0xF8, 0x62, 0xF8, 0x63, 0xF8, 0x64, /* 0x04-0x07 */
        0xF8, 0x65, 0xF8, 0x66, 0xF8, 0x67, 0xF8, 0x68, /* 0x08-0x0B */
@@ -10598,7 +10598,7 @@ static unsigned char u2c_9D[512] = {
        0xFA, 0x9A, 0xFA, 0x9B, 0xFA, 0x9C, 0xFA, 0x9D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9E[512] = {
+static const unsigned char u2c_9E[512] = {
        0xFA, 0x9E, 0xFA, 0x9F, 0xFA, 0xA0, 0xFB, 0x40, /* 0x00-0x03 */
        0xFB, 0x41, 0xFB, 0x42, 0xFB, 0x43, 0xFB, 0x44, /* 0x04-0x07 */
        0xFB, 0x45, 0xFB, 0x46, 0xFB, 0x47, 0xFB, 0x48, /* 0x08-0x0B */
@@ -10666,7 +10666,7 @@ static unsigned char u2c_9E[512] = {
        0xED, 0xEB, 0xFC, 0x77, 0xF6, 0xBC, 0xFC, 0x78, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9F[512] = {
+static const unsigned char u2c_9F[512] = {
        0xFC, 0x79, 0xFC, 0x7A, 0xFC, 0x7B, 0xFC, 0x7C, /* 0x00-0x03 */
        0xFC, 0x7D, 0xFC, 0x7E, 0xFC, 0x80, 0xFC, 0x81, /* 0x04-0x07 */
        0xFC, 0x82, 0xFC, 0x83, 0xFC, 0x84, 0xF6, 0xBD, /* 0x08-0x0B */
@@ -10712,11 +10712,11 @@ static unsigned char u2c_9F[512] = {
        0xFD, 0x9A, 0xFD, 0x9B, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */
 };
 
-static unsigned char u2c_DC[512] = {
+static const unsigned char u2c_DC[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
 };
 
-static unsigned char u2c_F9[512] = {
+static const unsigned char u2c_F9[512] = {
        0xD8, 0x4D, 0xB8, 0xFC, 0xDC, 0x87, 0xD9, 0x5A, /* 0x00-0x03 */
        0xBB, 0xAC, 0xB4, 0xAE, 0xBE, 0xE4, 0xFD, 0x94, /* 0x04-0x07 */
        0xFD, 0x94, 0xC6, 0xF5, 0xBD, 0xF0, 0xC0, 0xAE, /* 0x08-0x0B */
@@ -10784,7 +10784,7 @@ static unsigned char u2c_F9[512] = {
        0xD7, 0x52, 0xCA, 0xB2, 0xB2, 0xE8, 0xB4, 0xCC, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_FA[512] = {
+static const unsigned char u2c_FA[512] = {
        0xC7, 0xD0, 0xB6, 0xC8, 0xCD, 0xD8, 0xCC, 0xC7, /* 0x00-0x03 */
        0xD5, 0xAC, 0xB6, 0xB4, 0xB1, 0xA9, 0xDD, 0x97, /* 0x04-0x07 */
        0xD0, 0xD0, 0xBD, 0xB5, 0xD2, 0x8A, 0xC0, 0xAA, /* 0x08-0x0B */
@@ -10799,7 +10799,7 @@ static unsigned char u2c_FA[512] = {
        0xF0, 0x5E, 0xFA, 0x51, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */
 };
 
-static unsigned char u2c_FE[512] = {
+static const unsigned char u2c_FE[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10829,7 +10829,7 @@ static unsigned char u2c_FE[512] = {
        0xA9, 0x85, 0xA9, 0x86, 0xA9, 0x87, 0xA9, 0x88, /* 0x68-0x6B */
 };
 
-static unsigned char u2c_FF[512] = {
+static const unsigned char u2c_FF[512] = {
        0x00, 0x00, 0xA3, 0xA1, 0xA3, 0xA2, 0xA3, 0xA3, /* 0x00-0x03 */
        0xA1, 0xE7, 0xA3, 0xA5, 0xA3, 0xA6, 0xA3, 0xA7, /* 0x04-0x07 */
        0xA3, 0xA8, 0xA3, 0xA9, 0xA3, 0xAA, 0xA3, 0xAB, /* 0x08-0x0B */
@@ -10891,7 +10891,7 @@ static unsigned char u2c_FF[512] = {
        0xA9, 0x57, 0xA3, 0xA4, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        u2c_00, u2c_01, u2c_02, u2c_03, u2c_04, NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -10925,7 +10925,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   u2c_F9, u2c_FA, NULL,   NULL,   NULL,   u2c_FE, u2c_FF, };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -10961,7 +10961,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -11000,7 +11000,7 @@ static unsigned char charset2upper[256] = {
 static int uni2char(const wchar_t uni,
                        unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni&0xFF;
        unsigned char ch = (uni>>8)&0xFF;
        unsigned char out0,out1;
@@ -11050,7 +11050,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
                        wchar_t *uni)
 {
        unsigned char ch, cl;
-       wchar_t *charset2uni;
+       const wchar_t *charset2uni;
        int n;
 
        if (boundlen <= 0)
index 92ae19372f0f08177ad1f619bb11febfe1e1a51c..8a7a2fe85c65a7ca551f6417e0a3d181d9aa7e46 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t c2u_81[256] = {
+static const wchar_t c2u_81[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -49,7 +49,7 @@ static wchar_t c2u_81[256] = {
        0xAD09,0xAD0A,0xAD0B,0xAD0E,0xAD10,0xAD12,0xAD13,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_82[256] = {
+static const wchar_t c2u_82[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -85,7 +85,7 @@ static wchar_t c2u_82[256] = {
        0xADF1,0xADF2,0xADF3,0xADF4,0xADF5,0xADF6,0xADF7,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_83[256] = {
+static const wchar_t c2u_83[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -121,7 +121,7 @@ static wchar_t c2u_83[256] = {
        0xAEDF,0xAEE0,0xAEE1,0xAEE2,0xAEE3,0xAEE4,0xAEE5,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_84[256] = {
+static const wchar_t c2u_84[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -157,7 +157,7 @@ static wchar_t c2u_84[256] = {
        0xAFB5,0xAFB6,0xAFB7,0xAFBA,0xAFBB,0xAFBD,0xAFBE,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_85[256] = {
+static const wchar_t c2u_85[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -193,7 +193,7 @@ static wchar_t c2u_85[256] = {
        0xB096,0xB097,0xB09B,0xB09D,0xB09E,0xB0A3,0xB0A4,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_86[256] = {
+static const wchar_t c2u_86[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -229,7 +229,7 @@ static wchar_t c2u_86[256] = {
        0xB195,0xB196,0xB197,0xB199,0xB19A,0xB19B,0xB19D,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_87[256] = {
+static const wchar_t c2u_87[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -265,7 +265,7 @@ static wchar_t c2u_87[256] = {
        0xB266,0xB267,0xB26A,0xB26B,0xB26C,0xB26D,0xB26E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_88[256] = {
+static const wchar_t c2u_88[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -301,7 +301,7 @@ static wchar_t c2u_88[256] = {
        0xB359,0xB35A,0xB35D,0xB360,0xB361,0xB362,0xB363,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_89[256] = {
+static const wchar_t c2u_89[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -337,7 +337,7 @@ static wchar_t c2u_89[256] = {
        0xB43E,0xB43F,0xB440,0xB441,0xB442,0xB443,0xB444,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8A[256] = {
+static const wchar_t c2u_8A[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -373,7 +373,7 @@ static wchar_t c2u_8A[256] = {
        0xB512,0xB513,0xB516,0xB517,0xB519,0xB51A,0xB51D,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8B[256] = {
+static const wchar_t c2u_8B[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -409,7 +409,7 @@ static wchar_t c2u_8B[256] = {
        0xB5F9,0xB5FA,0xB5FB,0xB5FC,0xB5FD,0xB5FE,0xB5FF,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8C[256] = {
+static const wchar_t c2u_8C[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -445,7 +445,7 @@ static wchar_t c2u_8C[256] = {
        0xB6BC,0xB6BD,0xB6BE,0xB6BF,0xB6C0,0xB6C1,0xB6C2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8D[256] = {
+static const wchar_t c2u_8D[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -481,7 +481,7 @@ static wchar_t c2u_8D[256] = {
        0xB793,0xB794,0xB795,0xB79A,0xB79B,0xB79D,0xB79E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8E[256] = {
+static const wchar_t c2u_8E[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -517,7 +517,7 @@ static wchar_t c2u_8E[256] = {
        0xB87E,0xB87F,0xB880,0xB881,0xB882,0xB883,0xB884,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_8F[256] = {
+static const wchar_t c2u_8F[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -553,7 +553,7 @@ static wchar_t c2u_8F[256] = {
        0xB950,0xB952,0xB953,0xB954,0xB955,0xB956,0xB957,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_90[256] = {
+static const wchar_t c2u_90[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -589,7 +589,7 @@ static wchar_t c2u_90[256] = {
        0xBA3E,0xBA3F,0xBA41,0xBA43,0xBA44,0xBA45,0xBA46,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_91[256] = {
+static const wchar_t c2u_91[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -625,7 +625,7 @@ static wchar_t c2u_91[256] = {
        0xBB21,0xBB22,0xBB23,0xBB24,0xBB25,0xBB26,0xBB27,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_92[256] = {
+static const wchar_t c2u_92[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -661,7 +661,7 @@ static wchar_t c2u_92[256] = {
        0xBBF6,0xBBF7,0xBBFA,0xBBFB,0xBBFD,0xBBFE,0xBC01,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_93[256] = {
+static const wchar_t c2u_93[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -697,7 +697,7 @@ static wchar_t c2u_93[256] = {
        0xBCF2,0xBCF3,0xBCF7,0xBCF9,0xBCFA,0xBCFB,0xBCFD,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_94[256] = {
+static const wchar_t c2u_94[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -733,7 +733,7 @@ static wchar_t c2u_94[256] = {
        0xBDCB,0xBDCC,0xBDCD,0xBDCE,0xBDCF,0xBDD0,0xBDD1,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_95[256] = {
+static const wchar_t c2u_95[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -769,7 +769,7 @@ static wchar_t c2u_95[256] = {
        0xBEB1,0xBEB2,0xBEB3,0xBEB4,0xBEB5,0xBEB6,0xBEB7,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_96[256] = {
+static const wchar_t c2u_96[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -805,7 +805,7 @@ static wchar_t c2u_96[256] = {
        0xBF7C,0xBF7D,0xBF7E,0xBF7F,0xBF80,0xBF81,0xBF82,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_97[256] = {
+static const wchar_t c2u_97[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -841,7 +841,7 @@ static wchar_t c2u_97[256] = {
        0xC038,0xC039,0xC03A,0xC03B,0xC03D,0xC03E,0xC03F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_98[256] = {
+static const wchar_t c2u_98[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -877,7 +877,7 @@ static wchar_t c2u_98[256] = {
        0xC122,0xC125,0xC128,0xC129,0xC12A,0xC12B,0xC12E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_99[256] = {
+static const wchar_t c2u_99[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -913,7 +913,7 @@ static wchar_t c2u_99[256] = {
        0xC21A,0xC21B,0xC21D,0xC21E,0xC221,0xC222,0xC223,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9A[256] = {
+static const wchar_t c2u_9A[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -949,7 +949,7 @@ static wchar_t c2u_9A[256] = {
        0xC305,0xC306,0xC307,0xC30A,0xC30B,0xC30E,0xC30F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9B[256] = {
+static const wchar_t c2u_9B[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -985,7 +985,7 @@ static wchar_t c2u_9B[256] = {
        0xC3D2,0xC3D3,0xC3D4,0xC3D5,0xC3D6,0xC3D7,0xC3DA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9C[256] = {
+static const wchar_t c2u_9C[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1021,7 +1021,7 @@ static wchar_t c2u_9C[256] = {
        0xC4A3,0xC4A4,0xC4A5,0xC4A6,0xC4A7,0xC4A8,0xC4A9,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9D[256] = {
+static const wchar_t c2u_9D[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1057,7 +1057,7 @@ static wchar_t c2u_9D[256] = {
        0xC58A,0xC58B,0xC58E,0xC590,0xC592,0xC593,0xC594,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9E[256] = {
+static const wchar_t c2u_9E[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1093,7 +1093,7 @@ static wchar_t c2u_9E[256] = {
        0xC69E,0xC69F,0xC6A0,0xC6A1,0xC6A2,0xC6A3,0xC6A6,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_9F[256] = {
+static const wchar_t c2u_9F[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1129,7 +1129,7 @@ static wchar_t c2u_9F[256] = {
        0xC7AF,0xC7B1,0xC7B2,0xC7B3,0xC7B5,0xC7B6,0xC7B7,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A0[256] = {
+static const wchar_t c2u_A0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1165,7 +1165,7 @@ static wchar_t c2u_A0[256] = {
        0xC89B,0xC89C,0xC89E,0xC8A0,0xC8A2,0xC8A3,0xC8A4,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A1[256] = {
+static const wchar_t c2u_A1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1201,7 +1201,7 @@ static wchar_t c2u_A1[256] = {
        0x2282,0x2283,0x222A,0x2229,0x2227,0x2228,0xFFE2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A2[256] = {
+static const wchar_t c2u_A2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1234,7 +1234,7 @@ static wchar_t c2u_A2[256] = {
        0x2116,0x33C7,0x2122,0x33C2,0x33D8,0x2121,0x20AC,0x00AE,/* 0xE0-0xE7 */
 };
 
-static wchar_t c2u_A3[256] = {
+static const wchar_t c2u_A3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1270,7 +1270,7 @@ static wchar_t c2u_A3[256] = {
        0xFF58,0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A4[256] = {
+static const wchar_t c2u_A4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1306,7 +1306,7 @@ static wchar_t c2u_A4[256] = {
        0x3188,0x3189,0x318A,0x318B,0x318C,0x318D,0x318E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A5[256] = {
+static const wchar_t c2u_A5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1342,7 +1342,7 @@ static wchar_t c2u_A5[256] = {
        0x03C9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A6[256] = {
+static const wchar_t c2u_A6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1375,7 +1375,7 @@ static wchar_t c2u_A6[256] = {
        0x2546,0x2547,0x2548,0x2549,0x254A,0x0000,0x0000,0x0000,/* 0xE0-0xE7 */
 };
 
-static wchar_t c2u_A7[256] = {
+static const wchar_t c2u_A7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1409,7 +1409,7 @@ static wchar_t c2u_A7[256] = {
        0x33AC,0x33DD,0x33D0,0x33D3,0x33C3,0x33C9,0x33DC,0x33C6,/* 0xE8-0xEF */
 };
 
-static wchar_t c2u_A8[256] = {
+static const wchar_t c2u_A8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1445,7 +1445,7 @@ static wchar_t c2u_A8[256] = {
        0x2154,0x00BC,0x00BE,0x215B,0x215C,0x215D,0x215E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A9[256] = {
+static const wchar_t c2u_A9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1481,7 +1481,7 @@ static wchar_t c2u_A9[256] = {
        0x00B3,0x2074,0x207F,0x2081,0x2082,0x2083,0x2084,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_AA[256] = {
+static const wchar_t c2u_AA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1516,7 +1516,7 @@ static wchar_t c2u_AA[256] = {
        0x3090,0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
 };
 
-static wchar_t c2u_AB[256] = {
+static const wchar_t c2u_AB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1551,7 +1551,7 @@ static wchar_t c2u_AB[256] = {
        0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6,0x0000,/* 0xF0-0xF7 */
 };
 
-static wchar_t c2u_AC[256] = {
+static const wchar_t c2u_AC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1586,7 +1586,7 @@ static wchar_t c2u_AC[256] = {
        0x044E,0x044F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xF0-0xF7 */
 };
 
-static wchar_t c2u_AD[256] = {
+static const wchar_t c2u_AD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1611,7 +1611,7 @@ static wchar_t c2u_AD[256] = {
        0xCDC5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_AE[256] = {
+static const wchar_t c2u_AE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1636,7 +1636,7 @@ static wchar_t c2u_AE[256] = {
        0xCE2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_AF[256] = {
+static const wchar_t c2u_AF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1661,7 +1661,7 @@ static wchar_t c2u_AF[256] = {
        0xCE99,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xA0-0xA7 */
 };
 
-static wchar_t c2u_B0[256] = {
+static const wchar_t c2u_B0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1697,7 +1697,7 @@ static wchar_t c2u_B0[256] = {
        0xACF5,0xACF6,0xACFC,0xACFD,0xAD00,0xAD04,0xAD06,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B1[256] = {
+static const wchar_t c2u_B1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1733,7 +1733,7 @@ static wchar_t c2u_B1[256] = {
        0xAE61,0xAE65,0xAE68,0xAE69,0xAE6C,0xAE70,0xAE78,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B2[256] = {
+static const wchar_t c2u_B2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1769,7 +1769,7 @@ static wchar_t c2u_B2[256] = {
        0xB04C,0xB04E,0xB053,0xB054,0xB055,0xB057,0xB059,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B3[256] = {
+static const wchar_t c2u_B3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1805,7 +1805,7 @@ static wchar_t c2u_B3[256] = {
        0xB19C,0xB1A8,0xB1CC,0xB1D0,0xB1D4,0xB1DC,0xB1DD,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B4[256] = {
+static const wchar_t c2u_B4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1841,7 +1841,7 @@ static wchar_t c2u_B4[256] = {
        0xB358,0xB35B,0xB35C,0xB35E,0xB35F,0xB364,0xB365,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B5[256] = {
+static const wchar_t c2u_B5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1877,7 +1877,7 @@ static wchar_t c2u_B5[256] = {
        0xB528,0xB529,0xB52A,0xB530,0xB531,0xB534,0xB538,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B6[256] = {
+static const wchar_t c2u_B6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1913,7 +1913,7 @@ static wchar_t c2u_B6[256] = {
        0xB78D,0xB78F,0xB790,0xB791,0xB792,0xB796,0xB797,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B7[256] = {
+static const wchar_t c2u_B7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1949,7 +1949,7 @@ static wchar_t c2u_B7[256] = {
        0xB951,0xB958,0xB959,0xB95C,0xB960,0xB968,0xB969,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B8[256] = {
+static const wchar_t c2u_B8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1985,7 +1985,7 @@ static wchar_t c2u_B8[256] = {
        0xBABB,0xBABD,0xBAC4,0xBAC8,0xBAD8,0xBAD9,0xBAFC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B9[256] = {
+static const wchar_t c2u_B9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2021,7 +2021,7 @@ static wchar_t c2u_B9[256] = {
        0xBC88,0xBC8B,0xBC8C,0xBC8E,0xBC94,0xBC95,0xBC97,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BA[256] = {
+static const wchar_t c2u_BA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2057,7 +2057,7 @@ static wchar_t c2u_BA[256] = {
        0xBE57,0xBE59,0xBE5A,0xBE5B,0xBE60,0xBE61,0xBE64,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BB[256] = {
+static const wchar_t c2u_BB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2093,7 +2093,7 @@ static wchar_t c2u_BB[256] = {
        0xC0D0,0xC0D8,0xC0D9,0xC0DB,0xC0DC,0xC0DD,0xC0E4,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BC[256] = {
+static const wchar_t c2u_BC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2129,7 +2129,7 @@ static wchar_t c2u_BC[256] = {
        0xC21C,0xC21F,0xC220,0xC228,0xC229,0xC22B,0xC22D,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BD[256] = {
+static const wchar_t c2u_BD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2165,7 +2165,7 @@ static wchar_t c2u_BD[256] = {
        0xC3F5,0xC3F8,0xC408,0xC410,0xC424,0xC42C,0xC430,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BE[256] = {
+static const wchar_t c2u_BE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2201,7 +2201,7 @@ static wchar_t c2u_BE[256] = {
        0xC5C6,0xC5C7,0xC5C8,0xC5C9,0xC5CA,0xC5CC,0xC5CE,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BF[256] = {
+static const wchar_t c2u_BF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2237,7 +2237,7 @@ static wchar_t c2u_BF[256] = {
        0xC6D0,0xC6D4,0xC6DC,0xC6DD,0xC6E0,0xC6E1,0xC6E8,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C0[256] = {
+static const wchar_t c2u_C0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2273,7 +2273,7 @@ static wchar_t c2u_C0[256] = {
        0xC7E8,0xC7EC,0xC800,0xC801,0xC804,0xC808,0xC80A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C1[256] = {
+static const wchar_t c2u_C1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2309,7 +2309,7 @@ static wchar_t c2u_C1[256] = {
        0xC9C4,0xC9C7,0xC9C8,0xC9CA,0xC9D0,0xC9D1,0xC9D3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C2[256] = {
+static const wchar_t c2u_C2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2345,7 +2345,7 @@ static wchar_t c2u_C2[256] = {
        0xCC29,0xCC2C,0xCC2E,0xCC30,0xCC38,0xCC39,0xCC3B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C3[256] = {
+static const wchar_t c2u_C3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2381,7 +2381,7 @@ static wchar_t c2u_C3[256] = {
        0xCE21,0xCE24,0xCE28,0xCE30,0xCE31,0xCE33,0xCE35,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C4[256] = {
+static const wchar_t c2u_C4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2417,7 +2417,7 @@ static wchar_t c2u_C4[256] = {
        0xD011,0xD018,0xD02D,0xD034,0xD035,0xD038,0xD03C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C5[256] = {
+static const wchar_t c2u_C5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2453,7 +2453,7 @@ static wchar_t c2u_C5[256] = {
        0xD234,0xD23C,0xD23D,0xD23F,0xD241,0xD248,0xD25C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C6[256] = {
+static const wchar_t c2u_C6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2489,7 +2489,7 @@ static wchar_t c2u_C6[256] = {
        0xD3ED,0xD3F0,0xD3F4,0xD3FC,0xD3FD,0xD3FF,0xD401,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C7[256] = {
+static const wchar_t c2u_C7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2525,7 +2525,7 @@ static wchar_t c2u_C7[256] = {
        0xD610,0xD611,0xD613,0xD614,0xD615,0xD61C,0xD620,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C8[256] = {
+static const wchar_t c2u_C8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2561,7 +2561,7 @@ static wchar_t c2u_C8[256] = {
        0xD789,0xD78C,0xD790,0xD798,0xD799,0xD79B,0xD79D,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CA[256] = {
+static const wchar_t c2u_CA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2597,7 +2597,7 @@ static wchar_t c2u_CA[256] = {
        0x76E3,0x77B0,0x7D3A,0x90AF,0x9451,0x9452,0x9F95,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CB[256] = {
+static const wchar_t c2u_CB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2633,7 +2633,7 @@ static wchar_t c2u_CB[256] = {
        0x5091,0x6770,0x6840,0x5109,0x528D,0x5292,0x6AA2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CC[256] = {
+static const wchar_t c2u_CC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2669,7 +2669,7 @@ static wchar_t c2u_CC[256] = {
        0x5951,0x5B63,0x5C46,0x60B8,0x6212,0x6842,0x68B0,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CD[256] = {
+static const wchar_t c2u_CD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2705,7 +2705,7 @@ static wchar_t c2u_CD[256] = {
        0x8CA2,0x978F,0x4E32,0x5BE1,0x6208,0x679C,0x74DC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CE[256] = {
+static const wchar_t c2u_CE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2741,7 +2741,7 @@ static wchar_t c2u_CE[256] = {
        0x4E18,0x4E45,0x4E5D,0x4EC7,0x4FF1,0x5177,0x52FE,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CF[256] = {
+static const wchar_t c2u_CF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2777,7 +2777,7 @@ static wchar_t c2u_CF[256] = {
        0x8A6D,0x8ECC,0x994B,0xF906,0x6677,0x6B78,0x8CB4,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D0[256] = {
+static const wchar_t c2u_D0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2813,7 +2813,7 @@ static wchar_t c2u_D0[256] = {
        0x5D0E,0x5DF1,0x5E7E,0x5FCC,0x6280,0x65D7,0x65E3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D1[256] = {
+static const wchar_t c2u_D1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2849,7 +2849,7 @@ static wchar_t c2u_D1[256] = {
        0x6960,0x6E73,0xF922,0x7537,0xF923,0xF924,0xF925,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D2[256] = {
+static const wchar_t c2u_D2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2885,7 +2885,7 @@ static wchar_t c2u_D2[256] = {
        0xF959,0x5C3C,0x6CE5,0x533F,0x6EBA,0x591A,0x8336,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D3[256] = {
+static const wchar_t c2u_D3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2921,7 +2921,7 @@ static wchar_t c2u_D3[256] = {
        0x5EA6,0x5F92,0x60BC,0x6311,0x6389,0x6417,0x6843,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D4[256] = {
+static const wchar_t c2u_D4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2957,7 +2957,7 @@ static wchar_t c2u_D4[256] = {
        0x9127,0x9A30,0x5587,0x61F6,0xF95B,0x7669,0x7F85,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D5[256] = {
+static const wchar_t c2u_D5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2993,7 +2993,7 @@ static wchar_t c2u_D5[256] = {
        0x792B,0x8F62,0x9742,0x6190,0x6200,0x6523,0x6F23,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D6[256] = {
+static const wchar_t c2u_D6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3029,7 +3029,7 @@ static wchar_t c2u_D6[256] = {
        0x5ED6,0x6599,0x71CE,0x7642,0x77AD,0x804A,0x84FC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D7[256] = {
+static const wchar_t c2u_D7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3065,7 +3065,7 @@ static wchar_t c2u_D7[256] = {
        0x9E9F,0x6797,0x6DCB,0x7433,0x81E8,0x9716,0x782C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D8[256] = {
+static const wchar_t c2u_D8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3101,7 +3101,7 @@ static wchar_t c2u_D8[256] = {
        0x7704,0x7720,0x7DBF,0x7DEC,0x9762,0x9EB5,0x6EC5,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D9[256] = {
+static const wchar_t c2u_D9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3137,7 +3137,7 @@ static wchar_t c2u_D9[256] = {
        0x58A8,0x9ED8,0x5011,0x520E,0x543B,0x554F,0x6587,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DA[256] = {
+static const wchar_t c2u_DA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3173,7 +3173,7 @@ static wchar_t c2u_DA[256] = {
        0x9812,0x98EF,0x52C3,0x62D4,0x64A5,0x6E24,0x6F51,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DB[256] = {
+static const wchar_t c2u_DB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3209,7 +3209,7 @@ static wchar_t c2u_DB[256] = {
        0x50FB,0x5288,0x58C1,0x64D8,0x6A97,0x74A7,0x7656,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DC[256] = {
+static const wchar_t c2u_DC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3245,7 +3245,7 @@ static wchar_t c2u_DC[256] = {
        0x5256,0x526F,0x5426,0x5490,0x57E0,0x592B,0x5A66,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DD[256] = {
+static const wchar_t c2u_DD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3281,7 +3281,7 @@ static wchar_t c2u_DD[256] = {
        0x7891,0x79D5,0x79D8,0x7C83,0x7DCB,0x7FE1,0x80A5,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DE[256] = {
+static const wchar_t c2u_DE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3317,7 +3317,7 @@ static wchar_t c2u_DE[256] = {
        0x98FC,0x99DF,0x9E9D,0x524A,0xF969,0x6714,0xF96A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DF[256] = {
+static const wchar_t c2u_DF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3353,7 +3353,7 @@ static wchar_t c2u_DF[256] = {
        0x68F2,0x7280,0x745E,0x7B6E,0x7D6E,0x7DD6,0x7F72,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E0[256] = {
+static const wchar_t c2u_E0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3389,7 +3389,7 @@ static wchar_t c2u_E0[256] = {
        0x661F,0x665F,0x7329,0x73F9,0x76DB,0x7701,0x7B6C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E1[256] = {
+static const wchar_t c2u_E1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3425,7 +3425,7 @@ static wchar_t c2u_E1[256] = {
        0x58FD,0x5AC2,0x5B88,0x5CAB,0x5CC0,0x5E25,0x6101,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E2[256] = {
+static const wchar_t c2u_E2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3461,7 +3461,7 @@ static wchar_t c2u_E2[256] = {
        0x99B4,0x620C,0x8853,0x8FF0,0x9265,0x5D07,0x5D27,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E3[256] = {
+static const wchar_t c2u_E3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3497,7 +3497,7 @@ static wchar_t c2u_E3[256] = {
        0x5BA4,0x5BE6,0x6089,0x5BE9,0x5C0B,0x5FC3,0x6C81,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E4[256] = {
+static const wchar_t c2u_E4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3533,7 +3533,7 @@ static wchar_t c2u_E4[256] = {
        0x5384,0x627C,0x6396,0x6DB2,0x7E0A,0x814B,0x984D,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E5[256] = {
+static const wchar_t c2u_E5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3569,7 +3569,7 @@ static wchar_t c2u_E5[256] = {
        0x4E88,0x4F59,0xF97F,0xF980,0xF981,0x5982,0xF982,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E6[256] = {
+static const wchar_t c2u_E6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3605,7 +3605,7 @@ static wchar_t c2u_E6[256] = {
        0x67D3,0xF9A5,0x708E,0x7130,0x7430,0x8276,0x82D2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E7[256] = {
+static const wchar_t c2u_E7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3641,7 +3641,7 @@ static wchar_t c2u_E7[256] = {
        0x61CA,0x6556,0x65FF,0x6664,0x68A7,0x6C5A,0x6FB3,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E8[256] = {
+static const wchar_t c2u_E8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3677,7 +3677,7 @@ static wchar_t c2u_E8[256] = {
        0x66DC,0xF9BF,0x6A48,0xF9C0,0x71FF,0x7464,0xF9C1,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E9[256] = {
+static const wchar_t c2u_E9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3713,7 +3713,7 @@ static wchar_t c2u_E9[256] = {
        0x6A52,0x6B9E,0x6F90,0x7189,0x8018,0x82B8,0x8553,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EA[256] = {
+static const wchar_t c2u_EA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3749,7 +3749,7 @@ static wchar_t c2u_EA[256] = {
        0x6961,0x6962,0x6CB9,0x6D27,0xF9CA,0x6E38,0xF9CB,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EB[256] = {
+static const wchar_t c2u_EB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3785,7 +3785,7 @@ static wchar_t c2u_EB[256] = {
        0x77E3,0x7FA9,0x8264,0x858F,0x87FB,0x8863,0x8ABC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EC[256] = {
+static const wchar_t c2u_EC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3821,7 +3821,7 @@ static wchar_t c2u_EC[256] = {
        0xF9F5,0x7A14,0xF9F6,0x834F,0x8CC3,0x5165,0x5344,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_ED[256] = {
+static const wchar_t c2u_ED[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3857,7 +3857,7 @@ static wchar_t c2u_ED[256] = {
        0x8523,0x8594,0x85CF,0x88DD,0x8D13,0x91AC,0x9577,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EE[256] = {
+static const wchar_t c2u_EE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3893,7 +3893,7 @@ static wchar_t c2u_EE[256] = {
        0x5EDB,0x609B,0x6230,0x6813,0x6BBF,0x6C08,0x6FB1,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EF[256] = {
+static const wchar_t c2u_EF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3929,7 +3929,7 @@ static wchar_t c2u_EF[256] = {
        0x914A,0x91D8,0x9266,0x92CC,0x9320,0x9706,0x9756,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F0[256] = {
+static const wchar_t c2u_F0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3965,7 +3965,7 @@ static wchar_t c2u_F0[256] = {
        0x6DD9,0x742E,0x7A2E,0x7D42,0x7D9C,0x7E31,0x816B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F1[256] = {
+static const wchar_t c2u_F1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4001,7 +4001,7 @@ static wchar_t c2u_F1[256] = {
        0x75C7,0x7E52,0x84B8,0x8B49,0x8D08,0x4E4B,0x53EA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F2[256] = {
+static const wchar_t c2u_F2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4037,7 +4037,7 @@ static wchar_t c2u_F2[256] = {
        0x659F,0x6715,0xF9FD,0x57F7,0x6F57,0x7DDD,0x8F2F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F3[256] = {
+static const wchar_t c2u_F3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4073,7 +4073,7 @@ static wchar_t c2u_F3[256] = {
        0x83DC,0x8521,0x91C7,0x91F5,0x518A,0x67F5,0x7B56,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F4[256] = {
+static const wchar_t c2u_F4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4109,7 +4109,7 @@ static wchar_t c2u_F4[256] = {
        0x521D,0x527F,0x54E8,0x6194,0x6284,0x62DB,0x68A2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F5[256] = {
+static const wchar_t c2u_F5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4145,7 +4145,7 @@ static wchar_t c2u_F5[256] = {
        0x6C96,0x87F2,0x885D,0x8877,0x60B4,0x81B5,0x8403,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F6[256] = {
+static const wchar_t c2u_F6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4181,7 +4181,7 @@ static wchar_t c2u_F6[256] = {
        0x666B,0x67DD,0x6FC1,0x6FEF,0x7422,0x7438,0x8A17,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F7[256] = {
+static const wchar_t c2u_F7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4217,7 +4217,7 @@ static wchar_t c2u_F7[256] = {
        0x5742,0x677F,0x7248,0x74E3,0x8CA9,0x8FA6,0x9211,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F8[256] = {
+static const wchar_t c2u_F8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4253,7 +4253,7 @@ static wchar_t c2u_F8[256] = {
        0x74E2,0x7968,0x8868,0x8C79,0x98C7,0x98C4,0x9A43,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F9[256] = {
+static const wchar_t c2u_F9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4289,7 +4289,7 @@ static wchar_t c2u_F9[256] = {
        0x676D,0x6841,0x6C86,0x6E2F,0x7F38,0x809B,0x822A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_FA[256] = {
+static const wchar_t c2u_FA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4325,7 +4325,7 @@ static wchar_t c2u_FA[256] = {
        0x83A2,0x92CF,0x9830,0x4EA8,0x5144,0x5211,0x578B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_FB[256] = {
+static const wchar_t c2u_FB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4361,7 +4361,7 @@ static wchar_t c2u_FB[256] = {
        0x9D3B,0x5316,0x548C,0x5B05,0x6A3A,0x706B,0x7575,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_FC[256] = {
+static const wchar_t c2u_FC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4397,7 +4397,7 @@ static wchar_t c2u_FC[256] = {
        0x5B5D,0x6548,0x6585,0x66C9,0x689F,0x6D8D,0x6DC6,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_FD[256] = {
+static const wchar_t c2u_FD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -4433,7 +4433,7 @@ static wchar_t c2u_FD[256] = {
        0x71B9,0x71BA,0x72A7,0x79A7,0x7A00,0x7FB2,0x8A70,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t *page_charset2uni[256] = {
+static const wchar_t *page_charset2uni[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -4468,7 +4468,7 @@ static wchar_t *page_charset2uni[256] = {
        c2u_F8, c2u_F9, c2u_FA, c2u_FB, c2u_FC, c2u_FD, NULL,   NULL,   
 };
 
-static unsigned char u2c_01[512] = {
+static const unsigned char u2c_01[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4497,7 +4497,7 @@ static unsigned char u2c_01[512] = {
        0x00, 0x00, 0x00, 0x00, 0xA8, 0xAE, 0xA9, 0xAE, /* 0x64-0x67 */
 };
 
-static unsigned char u2c_02[512] = {
+static const unsigned char u2c_02[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4557,7 +4557,7 @@ static unsigned char u2c_02[512] = {
        0x00, 0x00, 0xA2, 0xA9, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */
 };
 
-static unsigned char u2c_03[512] = {
+static const unsigned char u2c_03[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4612,7 +4612,7 @@ static unsigned char u2c_03[512] = {
        0xA5, 0xF7, 0xA5, 0xF8, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */
 };
 
-static unsigned char u2c_04[512] = {
+static const unsigned char u2c_04[512] = {
        0x00, 0x00, 0xAC, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4636,7 +4636,7 @@ static unsigned char u2c_04[512] = {
        0x00, 0x00, 0xAC, 0xD7, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x53 */
 };
 
-static unsigned char u2c_11[512] = {
+static const unsigned char u2c_11[512] = {
        0xA4, 0xA1, 0xA4, 0xA2, 0xA4, 0xA4, 0xA4, 0xA7, /* 0x00-0x03 */
        0xA4, 0xA8, 0xA4, 0xA9, 0xA4, 0xB1, 0xA4, 0xB2, /* 0x04-0x07 */
        0xA4, 0xB3, 0xA4, 0xB5, 0xA4, 0xB6, 0xA4, 0xB7, /* 0x08-0x0B */
@@ -4703,7 +4703,7 @@ static unsigned char u2c_11[512] = {
        0x00, 0x00, 0xA4, 0xF6, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_20[512] = {
+static const unsigned char u2c_20[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4750,7 +4750,7 @@ static unsigned char u2c_20[512] = {
        0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, /* 0xA8-0xAB */
 };
 
-static unsigned char u2c_21[512] = {
+static const unsigned char u2c_21[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xC9, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xA2, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4808,7 +4808,7 @@ static unsigned char u2c_21[512] = {
        0xA2, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */
 };
 
-static unsigned char u2c_22[512] = {
+static const unsigned char u2c_22[512] = {
        0xA2, 0xA3, 0x00, 0x00, 0xA1, 0xD3, 0xA2, 0xA4, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xD4, /* 0x04-0x07 */
        0xA1, 0xF4, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xF5, /* 0x08-0x0B */
@@ -4854,7 +4854,7 @@ static unsigned char u2c_22[512] = {
        0x00, 0x00, 0xA1, 0xD1, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */
 };
 
-static unsigned char u2c_23[512] = {
+static const unsigned char u2c_23[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4862,7 +4862,7 @@ static unsigned char u2c_23[512] = {
        0x00, 0x00, 0x00, 0x00, 0xA1, 0xD2, 0x00, 0x00, /* 0x10-0x13 */
 };
 
-static unsigned char u2c_24[512] = {
+static const unsigned char u2c_24[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4925,7 +4925,7 @@ static unsigned char u2c_24[512] = {
        0xA8, 0xE5, 0xA8, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */
 };
 
-static unsigned char u2c_25[512] = {
+static const unsigned char u2c_25[512] = {
        0xA6, 0xA1, 0xA6, 0xAC, 0xA6, 0xA2, 0xA6, 0xAD, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4982,7 +4982,7 @@ static unsigned char u2c_25[512] = {
        0xA2, 0xC4, 0xA2, 0xC5, 0x00, 0x00, 0x00, 0x00, /* 0xD0-0xD3 */
 };
 
-static unsigned char u2c_26[512] = {
+static const unsigned char u2c_26[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xA1, 0xDA, 0xA1, 0xD9, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5013,7 +5013,7 @@ static unsigned char u2c_26[512] = {
        0xA2, 0xDD, 0xA2, 0xDA, 0x00, 0x00, 0x00, 0x00, /* 0x6C-0x6F */
 };
 
-static unsigned char u2c_30[512] = {
+static const unsigned char u2c_30[512] = {
        0xA1, 0xA1, 0xA1, 0xA2, 0xA1, 0xA3, 0xA1, 0xA8, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xA1, 0xB4, 0xA1, 0xB5, 0xA1, 0xB6, 0xA1, 0xB7, /* 0x08-0x0B */
@@ -5079,7 +5079,7 @@ static unsigned char u2c_30[512] = {
        0xAB, 0xF4, 0xAB, 0xF5, 0xAB, 0xF6, 0x00, 0x00, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_31[512] = {
+static const unsigned char u2c_31[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5123,7 +5123,7 @@ static unsigned char u2c_31[512] = {
        0xEF, 0xCB, 0xF4, 0xB8, 0xF2, 0xA2, 0xEC, 0xD1, /* 0x9C-0x9F */
 };
 
-static unsigned char u2c_32[512] = {
+static const unsigned char u2c_32[512] = {
        0xA9, 0xB1, 0xA9, 0xB2, 0xA9, 0xB3, 0xA9, 0xB4, /* 0x00-0x03 */
        0xA9, 0xB5, 0xA9, 0xB6, 0xA9, 0xB7, 0xA9, 0xB8, /* 0x04-0x07 */
        0xA9, 0xB9, 0xA9, 0xBA, 0xA9, 0xBB, 0xA9, 0xBC, /* 0x08-0x0B */
@@ -5172,7 +5172,7 @@ static unsigned char u2c_32[512] = {
        0xE5, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */
 };
 
-static unsigned char u2c_33[512] = {
+static const unsigned char u2c_33[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5232,7 +5232,7 @@ static unsigned char u2c_33[512] = {
        0xA7, 0xEE, 0xA7, 0xE9, 0x00, 0x00, 0x00, 0x00, /* 0xDC-0xDF */
 };
 
-static unsigned char u2c_4E[512] = {
+static const unsigned char u2c_4E[512] = {
        0xEC, 0xE9, 0xEF, 0xCB, 0x00, 0x00, 0xF6, 0xD2, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0xB2, /* 0x04-0x07 */
        0xED, 0xDB, 0xDF, 0xB2, 0xDF, 0xBE, 0xF9, 0xBB, /* 0x08-0x0B */
@@ -5299,7 +5299,7 @@ static unsigned char u2c_4E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xF2, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_4F[512] = {
+static const unsigned char u2c_4F[512] = {
        0x00, 0x00, 0xD0, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xF9, 0xF2, 0xEC, 0xA5, 0xD0, 0xDF, /* 0x08-0x0B */
@@ -5366,7 +5366,7 @@ static unsigned char u2c_4F[512] = {
        0xDC, 0xE4, 0x00, 0x00, 0xE5, 0xEF, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_50[512] = {
+static const unsigned char u2c_50[512] = {
        0x00, 0x00, 0x00, 0x00, 0xDC, 0xB1, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xD5, 0xD6, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xF3, 0xDA, 0x00, 0x00, 0xCB, 0xC1, /* 0x08-0x0B */
@@ -5434,7 +5434,7 @@ static unsigned char u2c_50[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xC7, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_51[512] = {
+static const unsigned char u2c_51[512] = {
        0xEB, 0xF0, 0xF1, 0xD6, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xE5, 0xE2, 0x00, 0x00, 0xCC, 0xCC, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xCB, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5502,7 +5502,7 @@ static unsigned char u2c_51[512] = {
        0x00, 0x00, 0xF9, 0xDE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_52[512] = {
+static const unsigned char u2c_52[512] = {
        0xD3, 0xEF, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xD3, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xDD, 0xC2, 0xEF, 0xB7, /* 0x04-0x07 */
        0xE7, 0xD4, 0x00, 0x00, 0xCA, 0xCA, 0x00, 0x00, /* 0x08-0x0B */
@@ -5570,7 +5570,7 @@ static unsigned char u2c_52[512] = {
        0x00, 0x00, 0x00, 0x00, 0xCE, 0xFE, 0xDA, 0xA8, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_53[512] = {
+static const unsigned char u2c_53[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xF8, 0xD0, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xFD, 0xD6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5637,7 +5637,7 @@ static unsigned char u2c_53[512] = {
        0xDE, 0xC9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_54[512] = {
+static const unsigned char u2c_54[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFD, 0xDE, /* 0x00-0x03 */
        0xCA, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xF9, 0xEA, 0xD1, 0xCE, 0xEE, 0xD4, 0x00, 0x00, /* 0x08-0x0B */
@@ -5704,7 +5704,7 @@ static unsigned char u2c_54[512] = {
        0x00, 0x00, 0x00, 0x00, 0xF8, 0xD4, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_55[512] = {
+static const unsigned char u2c_55[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xF8, 0xA6, 0x00, 0x00, 0xDE, 0xCA, 0xF2, 0xC6, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5772,7 +5772,7 @@ static unsigned char u2c_55[512] = {
        0x00, 0x00, 0xE1, 0xF5, 0xF1, 0xB3, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_56[512] = {
+static const unsigned char u2c_56[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xF7, 0xA3, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xCA, 0xA9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5839,7 +5839,7 @@ static unsigned char u2c_56[512] = {
        0x00, 0x00, 0xD6, 0xB7, 0xCD, 0xB3, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_57[512] = {
+static const unsigned char u2c_57[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xD5, /* 0x00-0x03 */
        0xE5, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xCF, 0xEA, 0x00, 0x00, 0x00, 0x00, 0xCF, 0xD0, /* 0x08-0x0B */
@@ -5907,7 +5907,7 @@ static unsigned char u2c_57[512] = {
        0xD0, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_58[512] = {
+static const unsigned char u2c_58[512] = {
        0xCF, 0xDC, 0x00, 0x00, 0xD3, 0xD1, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xCC, 0xB1, 0xF7, 0xD8, 0x00, 0x00, /* 0x04-0x07 */
        0xCB, 0xA8, 0xEB, 0xBC, 0xE4, 0xBE, 0x00, 0x00, /* 0x08-0x0B */
@@ -5975,7 +5975,7 @@ static unsigned char u2c_58[512] = {
        0x00, 0x00, 0xE1, 0xF8, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_59[512] = {
+static const unsigned char u2c_59[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6043,7 +6043,7 @@ static unsigned char u2c_59[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xED, 0xAC, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5A[512] = {
+static const unsigned char u2c_5A[512] = {
        0x00, 0x00, 0xEA, 0xCE, 0x00, 0x00, 0xE8, 0xDF, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6106,7 +6106,7 @@ static unsigned char u2c_5A[512] = {
        0x00, 0x00, 0xD2, 0xEC, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */
 };
 
-static unsigned char u2c_5B[512] = {
+static const unsigned char u2c_5B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xFD, 0xF0, 0x00, 0x00, 0xE0, 0xBD, /* 0x08-0x0B */
@@ -6173,7 +6173,7 @@ static unsigned char u2c_5B[512] = {
        0xF5, 0xBB, 0x00, 0x00, 0xDE, 0xD1, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_5C[512] = {
+static const unsigned char u2c_5C[512] = {
        0x00, 0x00, 0xDC, 0xE6, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xDE, 0xD2, 0x00, 0x00, 0x00, 0x00, 0xED, 0xE2, /* 0x04-0x07 */
        0xEE, 0xF6, 0xEA, 0xCF, 0xF0, 0xEE, 0xE3, 0xFC, /* 0x08-0x0B */
@@ -6241,7 +6241,7 @@ static unsigned char u2c_5C[512] = {
        0x00, 0x00, 0xFA, 0xF2, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5D[512] = {
+static const unsigned char u2c_5D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xFD, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6309,7 +6309,7 @@ static unsigned char u2c_5D[512] = {
        0x00, 0x00, 0xE1, 0xDE, 0xCB, 0xEE, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5E[512] = {
+static const unsigned char u2c_5E[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE3, 0xBC, 0xF8, 0xD6, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xDB, 0xEE, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6376,7 +6376,7 @@ static unsigned char u2c_5E[512] = {
        0x00, 0x00, 0x00, 0x00, 0xCB, 0xEF, 0xFC, 0xDF, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_5F[512] = {
+static const unsigned char u2c_5F[512] = {
        0x00, 0x00, 0xDC, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xD6, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xF8, 0xC9, 0x00, 0x00, /* 0x08-0x0B */
@@ -6444,7 +6444,7 @@ static unsigned char u2c_5F[512] = {
        0x00, 0x00, 0xFB, 0xEC, 0x00, 0x00, 0xDD, 0xC8, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_60[512] = {
+static const unsigned char u2c_60[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6511,7 +6511,7 @@ static unsigned char u2c_60[512] = {
        0x00, 0x00, 0xE5, 0xA9, 0xE0, 0xF6, 0xF6, 0xB3, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_61[512] = {
+static const unsigned char u2c_61[512] = {
        0x00, 0x00, 0xE1, 0xFE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xCB, 0xF0, 0x00, 0x00, /* 0x04-0x07 */
        0xEA, 0xEF, 0xEA, 0xF0, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6579,7 +6579,7 @@ static unsigned char u2c_61[512] = {
        0xCF, 0xAB, 0x00, 0x00, 0x00, 0x00, 0xEB, 0xF3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_62[512] = {
+static const unsigned char u2c_62[512] = {
        0xD5, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD3, 0xD4, /* 0x04-0x07 */
        0xCD, 0xFC, 0x00, 0x00, 0xD9, 0xE6, 0x00, 0x00, /* 0x08-0x0B */
@@ -6647,7 +6647,7 @@ static unsigned char u2c_62[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE3, 0xA6, 0xD1, 0xDA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_63[512] = {
+static const unsigned char u2c_63[512] = {
        0x00, 0x00, 0xF2, 0xA5, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF2, 0xA6, /* 0x04-0x07 */
        0x00, 0x00, 0xE4, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6713,7 +6713,7 @@ static unsigned char u2c_63[512] = {
        0xEA, 0xB5, 0x00, 0x00, 0xE5, 0xAA, 0xDF, 0xBA, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_64[512] = {
+static const unsigned char u2c_64[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6781,7 +6781,7 @@ static unsigned char u2c_64[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE8, 0xF6, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_65[512] = {
+static const unsigned char u2c_65[512] = {
        0xDA, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xF7, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6849,7 +6849,7 @@ static unsigned char u2c_65[512] = {
        0xDA, 0xC4, 0xD4, 0xC5, 0x00, 0x00, 0xE7, 0xFA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_66[512] = {
+static const unsigned char u2c_66[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xCD, 0xE0, 0xE3, 0xB0, /* 0x04-0x07 */
        0x00, 0x00, 0xDB, 0xB2, 0xFB, 0xC4, 0x00, 0x00, /* 0x08-0x0B */
@@ -6917,7 +6917,7 @@ static unsigned char u2c_66[512] = {
        0xD8, 0xBA, 0x00, 0x00, 0xF1, 0xF4, 0xF4, 0xF0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_67[512] = {
+static const unsigned char u2c_67[512] = {
        0xF5, 0xCC, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xE5, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xEA, 0xC5, 0xEA, 0xF3, 0x00, 0x00, 0xDD, 0xDB, /* 0x08-0x0B */
@@ -6985,7 +6985,7 @@ static unsigned char u2c_67[512] = {
        0x00, 0x00, 0x00, 0x00, 0xEF, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_68[512] = {
+static const unsigned char u2c_68[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7052,7 +7052,7 @@ static unsigned char u2c_68[512] = {
        0x00, 0x00, 0xD4, 0xA1, 0xCE, 0xB2, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_69[512] = {
+static const unsigned char u2c_69[512] = {
        0xE8, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xEB, 0xF5, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7120,7 +7120,7 @@ static unsigned char u2c_69[512] = {
        0x00, 0x00, 0xF0, 0xCB, 0x00, 0x00, 0xD0, 0xC7, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6A[512] = {
+static const unsigned char u2c_6A[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE4, 0xC5, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xDB, 0xE0, 0x00, 0x00, /* 0x08-0x0B */
@@ -7187,7 +7187,7 @@ static unsigned char u2c_6A[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xA1, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_6B[512] = {
+static const unsigned char u2c_6B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xD5, 0xB1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xCF, 0xED, 0x00, 0x00, /* 0x08-0x0B */
@@ -7251,7 +7251,7 @@ static unsigned char u2c_6B[512] = {
        0xCF, 0xB3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xEC-0xEF */
 };
 
-static unsigned char u2c_6C[512] = {
+static const unsigned char u2c_6C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xEE, 0xFD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7316,7 +7316,7 @@ static unsigned char u2c_6C[512] = {
        0xF7, 0xC1, 0x00, 0x00, 0x00, 0x00, 0xE7, 0xB6, /* 0xF0-0xF3 */
 };
 
-static unsigned char u2c_6D[512] = {
+static const unsigned char u2c_6D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE5, 0xC7, /* 0x08-0x0B */
@@ -7383,7 +7383,7 @@ static unsigned char u2c_6D[512] = {
        0xF4, 0xE8, 0xE5, 0xF4, 0xF4, 0xBC, 0xF4, 0xD5, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_6E[512] = {
+static const unsigned char u2c_6E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7451,7 +7451,7 @@ static unsigned char u2c_6E[512] = {
        0x00, 0x00, 0x00, 0x00, 0xCD, 0xE3, 0xD8, 0xBB, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6F[512] = {
+static const unsigned char u2c_6F[512] = {
        0x00, 0x00, 0xE5, 0xDB, 0xF8, 0xF7, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xF6, 0xD4, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7519,7 +7519,7 @@ static unsigned char u2c_6F[512] = {
        0x00, 0x00, 0x00, 0x00, 0xD5, 0xEB, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_70[512] = {
+static const unsigned char u2c_70[512] = {
        0x00, 0x00, 0xE5, 0xC8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xFB, 0xA4, 0xD4, 0xB9, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xDE, 0xE1, 0x00, 0x00, 0xE4, 0xA3, /* 0x08-0x0B */
@@ -7587,7 +7587,7 @@ static unsigned char u2c_70[512] = {
        0x00, 0x00, 0xDC, 0xEB, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_71[512] = {
+static const unsigned char u2c_71[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xFD, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xE5, 0xEA, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7655,7 +7655,7 @@ static unsigned char u2c_71[512] = {
        0xE3, 0xE8, 0x00, 0x00, 0xD4, 0xA7, 0xE8, 0xFC, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_72[512] = {
+static const unsigned char u2c_72[512] = {
        0xFA, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xF8, 0xEF, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7723,7 +7723,7 @@ static unsigned char u2c_72[512] = {
        0xD5, 0xC9, 0xF8, 0xAC, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_73[512] = {
+static const unsigned char u2c_73[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xE7, 0xD9, 0x00, 0x00, /* 0x08-0x0B */
@@ -7791,7 +7791,7 @@ static unsigned char u2c_73[512] = {
        0x00, 0x00, 0xEF, 0xEA, 0xFA, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_74[512] = {
+static const unsigned char u2c_74[512] = {
        0x00, 0x00, 0xE0, 0xC4, 0x00, 0x00, 0xCF, 0xB9, /* 0x00-0x03 */
        0x00, 0x00, 0xD5, 0xCA, 0xD7, 0xE2, 0xE2, 0xAF, /* 0x04-0x07 */
        0x00, 0x00, 0xD7, 0xB8, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7857,7 +7857,7 @@ static unsigned char u2c_74[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xED, 0xB6, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_75[512] = {
+static const unsigned char u2c_75[512] = {
        0x00, 0x00, 0xDC, 0xBA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xCC, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7925,7 +7925,7 @@ static unsigned char u2c_75[512] = {
        0xCD, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_76[512] = {
+static const unsigned char u2c_76[512] = {
        0xE5, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7993,7 +7993,7 @@ static unsigned char u2c_76[512] = {
        0xDA, 0xF0, 0x00, 0x00, 0xE2, 0xEA, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_77[512] = {
+static const unsigned char u2c_77[512] = {
        0x00, 0x00, 0xE0, 0xFD, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xD8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xF7, 0xAF, 0xDA, 0xB6, 0x00, 0x00, 0xCA, 0xD7, /* 0x08-0x0B */
@@ -8058,7 +8058,7 @@ static unsigned char u2c_77[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xB4, /* 0xF0-0xF3 */
 };
 
-static unsigned char u2c_78[512] = {
+static const unsigned char u2c_78[512] = {
        0x00, 0x00, 0x00, 0x00, 0xDE, 0xE3, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8125,7 +8125,7 @@ static unsigned char u2c_78[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDA, 0xF2, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_79[512] = {
+static const unsigned char u2c_79[512] = {
        0x00, 0x00, 0xF5, 0xA7, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8192,7 +8192,7 @@ static unsigned char u2c_79[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xB9, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_7A[512] = {
+static const unsigned char u2c_7A[512] = {
        0xFD, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xE1, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xCA, 0xD9, 0x00, 0x00, 0x00, 0x00, 0xEF, 0xEF, /* 0x08-0x0B */
@@ -8260,7 +8260,7 @@ static unsigned char u2c_7A[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCA, 0xDA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7B[512] = {
+static const unsigned char u2c_7B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8323,7 +8323,7 @@ static unsigned char u2c_7B[512] = {
        0x00, 0x00, 0xDE, 0xE8, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */
 };
 
-static unsigned char u2c_7C[512] = {
+static const unsigned char u2c_7C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xEA, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8391,7 +8391,7 @@ static unsigned char u2c_7C[512] = {
        0x00, 0x00, 0x00, 0x00, 0xD0, 0xAC, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7D[512] = {
+static const unsigned char u2c_7D[512] = {
        0xD1, 0xBA, 0x00, 0x00, 0xF1, 0xC4, 0x00, 0x00, /* 0x00-0x03 */
        0xE5, 0xB3, 0xFB, 0xF5, 0xE9, 0xE1, 0xFD, 0xE0, /* 0x04-0x07 */
        0xFC, 0xBC, 0x00, 0x00, 0xDA, 0xA2, 0xDA, 0xA3, /* 0x08-0x0B */
@@ -8458,7 +8458,7 @@ static unsigned char u2c_7D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xC6, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_7E[512] = {
+static const unsigned char u2c_7E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xF2, 0xDB, 0xE4, 0xFC, 0x00, 0x00, /* 0x08-0x0B */
@@ -8502,7 +8502,7 @@ static unsigned char u2c_7E[512] = {
        0xD5, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */
 };
 
-static unsigned char u2c_7F[512] = {
+static const unsigned char u2c_7F[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8570,7 +8570,7 @@ static unsigned char u2c_7F[512] = {
        0xEC, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_80[512] = {
+static const unsigned char u2c_80[512] = {
        0xE9, 0xA5, 0xD6, 0xD5, 0x00, 0x00, 0xCD, 0xC5, /* 0x00-0x03 */
        0x00, 0x00, 0xED, 0xBA, 0xD1, 0xBD, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xCF, 0xBE, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8638,7 +8638,7 @@ static unsigned char u2c_80[512] = {
        0x00, 0x00, 0xD2, 0xF6, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_81[512] = {
+static const unsigned char u2c_81[512] = {
        0x00, 0x00, 0x00, 0x00, 0xF2, 0xB7, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xFA, 0xF6, 0xF6, 0xAA, 0xFA, 0xF7, /* 0x04-0x07 */
        0xD8, 0xE6, 0x00, 0x00, 0xF4, 0xB1, 0x00, 0x00, /* 0x08-0x0B */
@@ -8706,7 +8706,7 @@ static unsigned char u2c_81[512] = {
        0xCF, 0xBF, 0x00, 0x00, 0xEB, 0xAC, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_82[512] = {
+static const unsigned char u2c_82[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xCF, 0xC0, 0x00, 0x00, 0xE6, 0xA8, /* 0x04-0x07 */
        0xFD, 0xE9, 0x00, 0x00, 0xCF, 0xC1, 0x00, 0x00, /* 0x08-0x0B */
@@ -8774,7 +8774,7 @@ static unsigned char u2c_82[512] = {
        0x00, 0x00, 0xCD, 0xC9, 0xF9, 0xB7, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_83[512] = {
+static const unsigned char u2c_83[512] = {
        0x00, 0x00, 0xF1, 0xE8, 0xD9, 0xF2, 0xDB, 0xF5, /* 0x00-0x03 */
        0xCA, 0xB5, 0xD9, 0xC6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xD8, 0xC9, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8842,7 +8842,7 @@ static unsigned char u2c_83[512] = {
        0x00, 0x00, 0xE2, 0xDD, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_84[512] = {
+static const unsigned char u2c_84[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFE, /* 0x00-0x03 */
        0xD4, 0xAC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xD5, 0xD1, 0x00, 0x00, /* 0x08-0x0B */
@@ -8910,7 +8910,7 @@ static unsigned char u2c_84[512] = {
        0xD6, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_85[512] = {
+static const unsigned char u2c_85[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8978,7 +8978,7 @@ static unsigned char u2c_85[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xAB, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_86[512] = {
+static const unsigned char u2c_86[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE7, 0xDE, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0xE1, 0xCC, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xE8, 0xB3, 0x00, 0x00, /* 0x08-0x0B */
@@ -9046,7 +9046,7 @@ static unsigned char u2c_86[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE4, 0xB6, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_87[512] = {
+static const unsigned char u2c_87[512] = {
        0xF5, 0xB9, 0x00, 0x00, 0xDC, 0xF0, 0xE3, 0xF1, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xE8, 0xA5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9114,7 +9114,7 @@ static unsigned char u2c_87[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE0, 0xEA, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_88[512] = {
+static const unsigned char u2c_88[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xE3, 0xB2, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9182,7 +9182,7 @@ static unsigned char u2c_88[512] = {
        0x00, 0x00, 0xF0, 0xB2, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_89[512] = {
+static const unsigned char u2c_89[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0xDC, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9249,7 +9249,7 @@ static unsigned char u2c_89[512] = {
        0xF5, 0xBA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_8A[512] = {
+static const unsigned char u2c_8A[512] = {
        0xE5, 0xEB, 0x00, 0x00, 0xEF, 0xF4, 0xDD, 0xB5, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xCD, 0xAA, 0x00, 0x00, 0xE3, 0xF2, 0x00, 0x00, /* 0x08-0x0B */
@@ -9317,7 +9317,7 @@ static unsigned char u2c_8A[512] = {
        0x00, 0x00, 0x00, 0x00, 0xD1, 0xE7, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8B[512] = {
+static const unsigned char u2c_8B[512] = {
        0xD9, 0xC7, 0xE4, 0xD7, 0xEA, 0xDD, 0x00, 0x00, /* 0x00-0x03 */
        0xD4, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9360,7 +9360,7 @@ static unsigned char u2c_8B[512] = {
        0x00, 0x00, 0x00, 0x00, 0xF3, 0xC6, 0x00, 0x00, /* 0x98-0x9B */
 };
 
-static unsigned char u2c_8C[512] = {
+static const unsigned char u2c_8C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9428,7 +9428,7 @@ static unsigned char u2c_8C[512] = {
        0xCF, 0xC5, 0xDF, 0xDF, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8D[512] = {
+static const unsigned char u2c_8D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xF2, 0xBE, 0xF6, 0xA1, 0x00, 0x00, 0xEB, 0xCB, /* 0x04-0x07 */
        0xF1, 0xFC, 0x00, 0x00, 0xF3, 0xC7, 0x00, 0x00, /* 0x08-0x0B */
@@ -9493,7 +9493,7 @@ static unsigned char u2c_8D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xAF, /* 0xF0-0xF3 */
 };
 
-static unsigned char u2c_8E[512] = {
+static const unsigned char u2c_8E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xE9, 0xC9, 0x00, 0x00, /* 0x08-0x0B */
@@ -9561,7 +9561,7 @@ static unsigned char u2c_8E[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE3, 0xDC, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8F[512] = {
+static const unsigned char u2c_8F[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xF2, /* 0x00-0x03 */
        0x00, 0x00, 0xD6, 0xD9, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xEE, 0xB0, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9629,7 +9629,7 @@ static unsigned char u2c_8F[512] = {
        0x00, 0x00, 0xF5, 0xDA, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_90[512] = {
+static const unsigned char u2c_90[512] = {
        0xF7, 0xDC, 0xE1, 0xEA, 0xCE, 0xC1, 0xD4, 0xB1, /* 0x00-0x03 */
        0x00, 0x00, 0xFD, 0xB1, 0xE6, 0xBD, 0x00, 0x00, /* 0x04-0x07 */
        0xFB, 0xAD, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xE7, /* 0x08-0x0B */
@@ -9697,7 +9697,7 @@ static unsigned char u2c_90[512] = {
        0x00, 0x00, 0xD4, 0xB4, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_91[512] = {
+static const unsigned char u2c_91[512] = {
        0x00, 0x00, 0x00, 0x00, 0xE4, 0xC7, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9763,7 +9763,7 @@ static unsigned char u2c_91[512] = {
        0x00, 0x00, 0xF3, 0xFB, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_92[512] = {
+static const unsigned char u2c_92[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9831,7 +9831,7 @@ static unsigned char u2c_92[512] = {
        0xCB, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_93[512] = {
+static const unsigned char u2c_93[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xD6, 0xE2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9897,7 +9897,7 @@ static unsigned char u2c_93[512] = {
        0x00, 0x00, 0x00, 0x00, 0xF3, 0xA1, 0x00, 0x00, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_94[512] = {
+static const unsigned char u2c_94[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xFC, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9932,7 +9932,7 @@ static unsigned char u2c_94[512] = {
        0x00, 0x00, 0xF3, 0xC8, 0x00, 0x00, 0xF3, 0xBA, /* 0x7C-0x7F */
 };
 
-static unsigned char u2c_95[512] = {
+static const unsigned char u2c_95[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9993,7 +9993,7 @@ static unsigned char u2c_95[512] = {
        0x00, 0x00, 0xF4, 0xC5, 0xDC, 0xA3, 0x00, 0x00, /* 0xE0-0xE3 */
 };
 
-static unsigned char u2c_96[512] = {
+static const unsigned char u2c_96[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10060,7 +10060,7 @@ static unsigned char u2c_96[512] = {
        0x00, 0x00, 0xDA, 0xDF, 0x00, 0x00, 0xEF, 0xB3, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_97[512] = {
+static const unsigned char u2c_97[512] = {
        0xE2, 0xCD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xEF, 0xFD, 0xF2, 0xE8, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10128,7 +10128,7 @@ static unsigned char u2c_97[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFA, 0xC2, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_98[512] = {
+static const unsigned char u2c_98[512] = {
        0xFB, 0xE1, 0xFA, 0xED, 0xF0, 0xA2, 0xCC, 0xF1, /* 0x00-0x03 */
        0x00, 0x00, 0xFA, 0xA3, 0xE2, 0xF7, 0x00, 0x00, /* 0x04-0x07 */
        0xE2, 0xCE, 0x00, 0x00, 0xE9, 0xF5, 0x00, 0x00, /* 0x08-0x0B */
@@ -10196,7 +10196,7 @@ static unsigned char u2c_98[512] = {
        0xDE, 0xF8, 0xF8, 0xE9, 0xE3, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_99[512] = {
+static const unsigned char u2c_99[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xF5, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xFA, 0xC3, 0xE5, 0xD7, 0x00, 0x00, /* 0x08-0x0B */
@@ -10264,7 +10264,7 @@ static unsigned char u2c_99[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xE7, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9A[512] = {
+static const unsigned char u2c_9A[512] = {
        0x00, 0x00, 0xDE, 0xBE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xDC, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10328,7 +10328,7 @@ static unsigned char u2c_9A[512] = {
        0x00, 0x00, 0x00, 0x00, 0xDB, 0xA5, 0x00, 0x00, /* 0xEC-0xEF */
 };
 
-static unsigned char u2c_9B[512] = {
+static const unsigned char u2c_9B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10391,7 +10391,7 @@ static unsigned char u2c_9B[512] = {
        0xCC, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xE8-0xEB */
 };
 
-static unsigned char u2c_9C[512] = {
+static const unsigned char u2c_9C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10457,7 +10457,7 @@ static unsigned char u2c_9C[512] = {
        0xD9, 0xB0, 0x00, 0x00, 0xE6, 0xE9, 0x00, 0x00, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_9D[512] = {
+static const unsigned char u2c_9D[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xE4, 0xBC, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10524,7 +10524,7 @@ static unsigned char u2c_9D[512] = {
        0xFD, 0xD3, 0xEB, 0xED, 0xD6, 0xDC, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_9E[512] = {
+static const unsigned char u2c_9E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10590,7 +10590,7 @@ static unsigned char u2c_9E[512] = {
        0xDA, 0xBD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xF4-0xF7 */
 };
 
-static unsigned char u2c_9F[512] = {
+static const unsigned char u2c_9F[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0xA8, /* 0x04-0x07 */
        0xDC, 0xAF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -10634,7 +10634,7 @@ static unsigned char u2c_9F[512] = {
        0xCF, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */
 };
 
-static unsigned char u2c_AC[512] = {
+static const unsigned char u2c_AC[512] = {
        0xB0, 0xA1, 0xB0, 0xA2, 0x81, 0x41, 0x81, 0x42, /* 0x00-0x03 */
        0xB0, 0xA3, 0x81, 0x43, 0x81, 0x44, 0xB0, 0xA4, /* 0x04-0x07 */
        0xB0, 0xA5, 0xB0, 0xA6, 0xB0, 0xA7, 0x81, 0x45, /* 0x08-0x0B */
@@ -10702,7 +10702,7 @@ static unsigned char u2c_AC[512] = {
        0xB0, 0xFA, 0xB0, 0xFB, 0x81, 0xF0, 0x81, 0xF1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_AD[512] = {
+static const unsigned char u2c_AD[512] = {
        0xB0, 0xFC, 0x81, 0xF2, 0x81, 0xF3, 0x81, 0xF4, /* 0x00-0x03 */
        0xB0, 0xFD, 0x81, 0xF5, 0xB0, 0xFE, 0x81, 0xF6, /* 0x04-0x07 */
        0x81, 0xF7, 0x81, 0xF8, 0x81, 0xF9, 0x81, 0xFA, /* 0x08-0x0B */
@@ -10770,7 +10770,7 @@ static unsigned char u2c_AD[512] = {
        0xB1, 0xD9, 0x83, 0x43, 0x83, 0x44, 0xB1, 0xDA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_AE[512] = {
+static const unsigned char u2c_AE[512] = {
        0xB1, 0xDB, 0xB1, 0xDC, 0x83, 0x45, 0x83, 0x46, /* 0x00-0x03 */
        0x83, 0x47, 0x83, 0x48, 0x83, 0x49, 0x83, 0x4A, /* 0x04-0x07 */
        0xB1, 0xDD, 0xB1, 0xDE, 0x83, 0x4B, 0xB1, 0xDF, /* 0x08-0x0B */
@@ -10838,7 +10838,7 @@ static unsigned char u2c_AE[512] = {
        0xB2, 0xBA, 0x84, 0x52, 0x84, 0x53, 0x84, 0x54, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_AF[512] = {
+static const unsigned char u2c_AF[512] = {
        0x84, 0x55, 0x84, 0x56, 0x84, 0x57, 0x84, 0x58, /* 0x00-0x03 */
        0x84, 0x59, 0x84, 0x5A, 0x84, 0x61, 0xB2, 0xBB, /* 0x04-0x07 */
        0xB2, 0xBC, 0x84, 0x62, 0x84, 0x63, 0x84, 0x64, /* 0x08-0x0B */
@@ -10906,7 +10906,7 @@ static unsigned char u2c_AF[512] = {
        0x85, 0x75, 0x85, 0x76, 0x85, 0x77, 0x85, 0x78, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B0[512] = {
+static const unsigned char u2c_B0[512] = {
        0xB2, 0xEB, 0xB2, 0xEC, 0x85, 0x79, 0x85, 0x7A, /* 0x00-0x03 */
        0xB2, 0xED, 0x85, 0x81, 0x85, 0x82, 0x85, 0x83, /* 0x04-0x07 */
        0x85, 0x84, 0x85, 0x85, 0x85, 0x86, 0x85, 0x87, /* 0x08-0x0B */
@@ -10974,7 +10974,7 @@ static unsigned char u2c_B0[512] = {
        0x86, 0x8C, 0x86, 0x8D, 0x86, 0x8E, 0x86, 0x8F, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B1[512] = {
+static const unsigned char u2c_B1[512] = {
        0x86, 0x90, 0x86, 0x91, 0x86, 0x92, 0x86, 0x93, /* 0x00-0x03 */
        0x86, 0x94, 0x86, 0x95, 0x86, 0x96, 0x86, 0x97, /* 0x04-0x07 */
        0xB3, 0xCA, 0xB3, 0xCB, 0x86, 0x98, 0xB3, 0xCC, /* 0x08-0x0B */
@@ -11042,7 +11042,7 @@ static unsigned char u2c_B1[512] = {
        0x87, 0x9E, 0xB4, 0xA8, 0x87, 0x9F, 0x87, 0xA0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B2[512] = {
+static const unsigned char u2c_B2[512] = {
        0x87, 0xA1, 0x87, 0xA2, 0x87, 0xA3, 0x87, 0xA4, /* 0x00-0x03 */
        0xB4, 0xA9, 0xB4, 0xAA, 0x87, 0xA5, 0x87, 0xA6, /* 0x04-0x07 */
        0xB4, 0xAB, 0x87, 0xA7, 0x87, 0xA8, 0xB4, 0xAC, /* 0x08-0x0B */
@@ -11110,7 +11110,7 @@ static unsigned char u2c_B2[512] = {
        0x88, 0xAA, 0x88, 0xAB, 0x88, 0xAC, 0xB4, 0xEA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B3[512] = {
+static const unsigned char u2c_B3[512] = {
        0xB4, 0xEB, 0xB4, 0xEC, 0x88, 0xAD, 0x88, 0xAE, /* 0x00-0x03 */
        0xB4, 0xED, 0x88, 0xAF, 0x88, 0xB0, 0x88, 0xB1, /* 0x04-0x07 */
        0xB4, 0xEE, 0x88, 0xB2, 0x88, 0xB3, 0x88, 0xB4, /* 0x08-0x0B */
@@ -11178,7 +11178,7 @@ static unsigned char u2c_B3[512] = {
        0xB5, 0xC5, 0x89, 0xBF, 0x89, 0xC0, 0x89, 0xC1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B4[512] = {
+static const unsigned char u2c_B4[512] = {
        0x89, 0xC2, 0x89, 0xC3, 0x89, 0xC4, 0x89, 0xC5, /* 0x00-0x03 */
        0x89, 0xC6, 0x89, 0xC7, 0x89, 0xC8, 0x89, 0xC9, /* 0x04-0x07 */
        0x89, 0xCA, 0x89, 0xCB, 0x89, 0xCC, 0x89, 0xCD, /* 0x08-0x0B */
@@ -11246,7 +11246,7 @@ static unsigned char u2c_B4[512] = {
        0x8A, 0xE2, 0x8A, 0xE3, 0x8A, 0xE4, 0x8A, 0xE5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B5[512] = {
+static const unsigned char u2c_B5[512] = {
        0x8A, 0xE6, 0x8A, 0xE7, 0x8A, 0xE8, 0x8A, 0xE9, /* 0x00-0x03 */
        0x8A, 0xEA, 0x8A, 0xEB, 0x8A, 0xEC, 0x8A, 0xED, /* 0x04-0x07 */
        0x8A, 0xEE, 0x8A, 0xEF, 0x8A, 0xF0, 0x8A, 0xF1, /* 0x08-0x0B */
@@ -11314,7 +11314,7 @@ static unsigned char u2c_B5[512] = {
        0x8B, 0xFB, 0x8B, 0xFC, 0x8B, 0xFD, 0x8B, 0xFE, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B6[512] = {
+static const unsigned char u2c_B6[512] = {
        0x8C, 0x41, 0x8C, 0x42, 0x8C, 0x43, 0x8C, 0x44, /* 0x00-0x03 */
        0x8C, 0x45, 0x8C, 0x46, 0x8C, 0x47, 0x8C, 0x48, /* 0x04-0x07 */
        0x8C, 0x49, 0x8C, 0x4A, 0x8C, 0x4B, 0x8C, 0x4C, /* 0x08-0x0B */
@@ -11382,7 +11382,7 @@ static unsigned char u2c_B6[512] = {
        0x8D, 0x82, 0x8D, 0x83, 0x8D, 0x84, 0x8D, 0x85, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B7[512] = {
+static const unsigned char u2c_B7[512] = {
        0xB6, 0xDC, 0xB6, 0xDD, 0x8D, 0x86, 0x8D, 0x87, /* 0x00-0x03 */
        0x8D, 0x88, 0xB6, 0xDE, 0x8D, 0x89, 0x8D, 0x8A, /* 0x04-0x07 */
        0x8D, 0x8B, 0x8D, 0x8C, 0x8D, 0x8D, 0x8D, 0x8E, /* 0x08-0x0B */
@@ -11450,7 +11450,7 @@ static unsigned char u2c_B7[512] = {
        0xB7, 0xB3, 0xB7, 0xB4, 0x8E, 0x9B, 0xB7, 0xB5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B8[512] = {
+static const unsigned char u2c_B8[512] = {
        0xB7, 0xB6, 0xB7, 0xB7, 0x8E, 0x9C, 0x8E, 0x9D, /* 0x00-0x03 */
        0x8E, 0x9E, 0x8E, 0x9F, 0x8E, 0xA0, 0xB7, 0xB8, /* 0x04-0x07 */
        0xB7, 0xB9, 0xB7, 0xBA, 0x8E, 0xA1, 0x8E, 0xA2, /* 0x08-0x0B */
@@ -11518,7 +11518,7 @@ static unsigned char u2c_B8[512] = {
        0x8F, 0xAE, 0xB7, 0xEE, 0x8F, 0xAF, 0x8F, 0xB0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_B9[512] = {
+static const unsigned char u2c_B9[512] = {
        0x8F, 0xB1, 0x8F, 0xB2, 0x8F, 0xB3, 0x8F, 0xB4, /* 0x00-0x03 */
        0xB7, 0xEF, 0x8F, 0xB5, 0x8F, 0xB6, 0x8F, 0xB7, /* 0x04-0x07 */
        0x8F, 0xB8, 0x8F, 0xB9, 0x8F, 0xBA, 0x8F, 0xBB, /* 0x08-0x0B */
@@ -11586,7 +11586,7 @@ static unsigned char u2c_B9[512] = {
        0x90, 0xBD, 0x90, 0xBE, 0x90, 0xBF, 0x90, 0xC0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_BA[512] = {
+static const unsigned char u2c_BA[512] = {
        0xB8, 0xCF, 0xB8, 0xD0, 0x90, 0xC1, 0x90, 0xC2, /* 0x00-0x03 */
        0x90, 0xC3, 0x90, 0xC4, 0x90, 0xC5, 0x90, 0xC6, /* 0x04-0x07 */
        0xB8, 0xD1, 0x90, 0xC7, 0x90, 0xC8, 0x90, 0xC9, /* 0x08-0x0B */
@@ -11654,7 +11654,7 @@ static unsigned char u2c_BA[512] = {
        0xB8, 0xFE, 0x91, 0xDC, 0x91, 0xDD, 0x91, 0xDE, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_BB[512] = {
+static const unsigned char u2c_BB[512] = {
        0xB9, 0xA1, 0x91, 0xDF, 0x91, 0xE0, 0x91, 0xE1, /* 0x00-0x03 */
        0xB9, 0xA2, 0x91, 0xE2, 0x91, 0xE3, 0x91, 0xE4, /* 0x04-0x07 */
        0x91, 0xE5, 0x91, 0xE6, 0x91, 0xE7, 0x91, 0xE8, /* 0x08-0x0B */
@@ -11722,7 +11722,7 @@ static unsigned char u2c_BB[512] = {
        0xB9, 0xCE, 0x92, 0xFC, 0x92, 0xFD, 0xB9, 0xCF, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_BC[512] = {
+static const unsigned char u2c_BC[512] = {
        0xB9, 0xD0, 0x92, 0xFE, 0xB9, 0xD1, 0x93, 0x41, /* 0x00-0x03 */
        0x93, 0x42, 0x93, 0x43, 0x93, 0x44, 0x93, 0x45, /* 0x04-0x07 */
        0xB9, 0xD2, 0xB9, 0xD3, 0x93, 0x46, 0xB9, 0xD4, /* 0x08-0x0B */
@@ -11790,7 +11790,7 @@ static unsigned char u2c_BC[512] = {
        0xBA, 0xBC, 0x93, 0xFE, 0x94, 0x41, 0x94, 0x42, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_BD[512] = {
+static const unsigned char u2c_BD[512] = {
        0x94, 0x43, 0x94, 0x44, 0x94, 0x45, 0x94, 0x46, /* 0x00-0x03 */
        0xBA, 0xBD, 0xBA, 0xBE, 0x94, 0x47, 0xBA, 0xBF, /* 0x04-0x07 */
        0x94, 0x48, 0xBA, 0xC0, 0x94, 0x49, 0x94, 0x4A, /* 0x08-0x0B */
@@ -11858,7 +11858,7 @@ static unsigned char u2c_BD[512] = {
        0x95, 0x69, 0x95, 0x6A, 0x95, 0x6B, 0x95, 0x6C, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_BE[512] = {
+static const unsigned char u2c_BE[512] = {
        0xBA, 0xE7, 0x95, 0x6D, 0x95, 0x6E, 0xBA, 0xE8, /* 0x00-0x03 */
        0x95, 0x6F, 0xBA, 0xE9, 0x95, 0x70, 0x95, 0x71, /* 0x04-0x07 */
        0x95, 0x72, 0x95, 0x73, 0x95, 0x74, 0x95, 0x75, /* 0x08-0x0B */
@@ -11926,7 +11926,7 @@ static unsigned char u2c_BE[512] = {
        0x96, 0x87, 0x96, 0x88, 0x96, 0x89, 0x96, 0x8A, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_BF[512] = {
+static const unsigned char u2c_BF[512] = {
        0x96, 0x8B, 0xBB, 0xBF, 0x96, 0x8C, 0x96, 0x8D, /* 0x00-0x03 */
        0x96, 0x8E, 0x96, 0x8F, 0x96, 0x90, 0x96, 0x91, /* 0x04-0x07 */
        0xBB, 0xC0, 0xBB, 0xC1, 0x96, 0x92, 0x96, 0x93, /* 0x08-0x0B */
@@ -11994,7 +11994,7 @@ static unsigned char u2c_BF[512] = {
        0x97, 0xBC, 0x97, 0xBD, 0x97, 0xBE, 0x97, 0xBF, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C0[512] = {
+static const unsigned char u2c_C0[512] = {
        0x97, 0xC0, 0x97, 0xC1, 0x97, 0xC2, 0x97, 0xC3, /* 0x00-0x03 */
        0x97, 0xC4, 0x97, 0xC5, 0x97, 0xC6, 0x97, 0xC7, /* 0x04-0x07 */
        0x97, 0xC8, 0x97, 0xC9, 0x97, 0xCA, 0x97, 0xCB, /* 0x08-0x0B */
@@ -12062,7 +12062,7 @@ static unsigned char u2c_C0[512] = {
        0x98, 0xDC, 0x98, 0xDD, 0x98, 0xDE, 0x98, 0xDF, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C1[512] = {
+static const unsigned char u2c_C1[512] = {
        0xBC, 0xA8, 0x98, 0xE0, 0x98, 0xE1, 0x98, 0xE2, /* 0x00-0x03 */
        0xBC, 0xA9, 0x98, 0xE3, 0x98, 0xE4, 0x98, 0xE5, /* 0x04-0x07 */
        0xBC, 0xAA, 0x98, 0xE6, 0x98, 0xE7, 0x98, 0xE8, /* 0x08-0x0B */
@@ -12130,7 +12130,7 @@ static unsigned char u2c_C1[512] = {
        0xBC, 0xEE, 0xBC, 0xEF, 0x99, 0xE4, 0x99, 0xE5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C2[512] = {
+static const unsigned char u2c_C2[512] = {
        0xBC, 0xF0, 0x99, 0xE6, 0x99, 0xE7, 0x99, 0xE8, /* 0x00-0x03 */
        0xBC, 0xF1, 0x99, 0xE9, 0x99, 0xEA, 0x99, 0xEB, /* 0x04-0x07 */
        0x99, 0xEC, 0x99, 0xED, 0x99, 0xEE, 0x99, 0xEF, /* 0x08-0x0B */
@@ -12198,7 +12198,7 @@ static unsigned char u2c_C2[512] = {
        0xBD, 0xD1, 0x9A, 0xF1, 0x9A, 0xF2, 0x9A, 0xF3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C3[512] = {
+static const unsigned char u2c_C3[512] = {
        0xBD, 0xD2, 0x9A, 0xF4, 0x9A, 0xF5, 0x9A, 0xF6, /* 0x00-0x03 */
        0x9A, 0xF7, 0x9A, 0xF8, 0x9A, 0xF9, 0x9A, 0xFA, /* 0x04-0x07 */
        0xBD, 0xD3, 0xBD, 0xD4, 0x9A, 0xFB, 0x9A, 0xFC, /* 0x08-0x0B */
@@ -12266,7 +12266,7 @@ static unsigned char u2c_C3[512] = {
        0x9C, 0x58, 0x9C, 0x59, 0x9C, 0x5A, 0x9C, 0x61, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C4[512] = {
+static const unsigned char u2c_C4[512] = {
        0x9C, 0x62, 0x9C, 0x63, 0x9C, 0x64, 0x9C, 0x65, /* 0x00-0x03 */
        0x9C, 0x66, 0x9C, 0x67, 0x9C, 0x68, 0x9C, 0x69, /* 0x04-0x07 */
        0xBD, 0xFA, 0x9C, 0x6A, 0x9C, 0x6B, 0x9C, 0x6C, /* 0x08-0x0B */
@@ -12334,7 +12334,7 @@ static unsigned char u2c_C4[512] = {
        0x9D, 0x97, 0x9D, 0x98, 0x9D, 0x99, 0xBE, 0xB7, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C5[512] = {
+static const unsigned char u2c_C5[512] = {
        0xBE, 0xB8, 0xBE, 0xB9, 0x9D, 0x9A, 0x9D, 0x9B, /* 0x00-0x03 */
        0x9D, 0x9C, 0x9D, 0x9D, 0x9D, 0x9E, 0x9D, 0x9F, /* 0x04-0x07 */
        0x9D, 0xA0, 0x9D, 0xA1, 0x9D, 0xA2, 0x9D, 0xA3, /* 0x08-0x0B */
@@ -12402,7 +12402,7 @@ static unsigned char u2c_C5[512] = {
        0xBF, 0xB0, 0xBF, 0xB1, 0xBF, 0xB2, 0xBF, 0xB3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C6[512] = {
+static const unsigned char u2c_C6[512] = {
        0xBF, 0xB4, 0xBF, 0xB5, 0x9E, 0x8E, 0x9E, 0x8F, /* 0x00-0x03 */
        0x9E, 0x90, 0xBF, 0xB6, 0xBF, 0xB7, 0xBF, 0xB8, /* 0x04-0x07 */
        0xBF, 0xB9, 0x9E, 0x91, 0x9E, 0x92, 0x9E, 0x93, /* 0x08-0x0B */
@@ -12470,7 +12470,7 @@ static unsigned char u2c_C6[512] = {
        0x9F, 0x88, 0xC0, 0xA6, 0x9F, 0x89, 0x9F, 0x8A, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C7[512] = {
+static const unsigned char u2c_C7[512] = {
        0x9F, 0x8B, 0x9F, 0x8C, 0x9F, 0x8D, 0x9F, 0x8E, /* 0x00-0x03 */
        0xC0, 0xA7, 0xC0, 0xA8, 0x9F, 0x8F, 0x9F, 0x90, /* 0x04-0x07 */
        0xC0, 0xA9, 0x9F, 0x91, 0x9F, 0x92, 0x9F, 0x93, /* 0x08-0x0B */
@@ -12538,7 +12538,7 @@ static unsigned char u2c_C7[512] = {
        0xA0, 0x82, 0xA0, 0x83, 0xA0, 0x84, 0xA0, 0x85, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C8[512] = {
+static const unsigned char u2c_C8[512] = {
        0xC0, 0xFA, 0xC0, 0xFB, 0xA0, 0x86, 0xA0, 0x87, /* 0x00-0x03 */
        0xC0, 0xFC, 0xA0, 0x88, 0xA0, 0x89, 0xA0, 0x8A, /* 0x04-0x07 */
        0xC0, 0xFD, 0xA0, 0x8B, 0xC0, 0xFE, 0xA0, 0x8C, /* 0x08-0x0B */
@@ -12606,7 +12606,7 @@ static unsigned char u2c_C8[512] = {
        0xC1, 0xD6, 0xC1, 0xD7, 0xA1, 0x96, 0xA1, 0x97, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_C9[512] = {
+static const unsigned char u2c_C9[512] = {
        0xC1, 0xD8, 0xA1, 0x98, 0xA1, 0x99, 0xA1, 0x9A, /* 0x00-0x03 */
        0xC1, 0xD9, 0xC1, 0xDA, 0xC1, 0xDB, 0xA1, 0x9B, /* 0x04-0x07 */
        0xA1, 0x9C, 0xA1, 0x9D, 0xA1, 0x9E, 0xA1, 0x9F, /* 0x08-0x0B */
@@ -12674,7 +12674,7 @@ static unsigned char u2c_C9[512] = {
        0xC2, 0xB2, 0xA4, 0x54, 0xA4, 0x55, 0xA4, 0x56, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_CA[512] = {
+static const unsigned char u2c_CA[512] = {
        0xC2, 0xB3, 0xA4, 0x57, 0xA4, 0x58, 0xA4, 0x59, /* 0x00-0x03 */
        0xA4, 0x5A, 0xA4, 0x61, 0xA4, 0x62, 0xA4, 0x63, /* 0x04-0x07 */
        0xC2, 0xB4, 0xC2, 0xB5, 0xA4, 0x64, 0xC2, 0xB6, /* 0x08-0x0B */
@@ -12742,7 +12742,7 @@ static unsigned char u2c_CA[512] = {
        0xA6, 0x93, 0xA6, 0x94, 0xA6, 0x95, 0xA6, 0x96, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_CB[512] = {
+static const unsigned char u2c_CB[512] = {
        0xA6, 0x97, 0xA6, 0x98, 0xA6, 0x99, 0xA6, 0x9A, /* 0x00-0x03 */
        0xA6, 0x9B, 0xA6, 0x9C, 0xA6, 0x9D, 0xA6, 0x9E, /* 0x04-0x07 */
        0xC2, 0xD7, 0xA6, 0x9F, 0xA6, 0xA0, 0xA7, 0x41, /* 0x08-0x0B */
@@ -12810,7 +12810,7 @@ static unsigned char u2c_CB[512] = {
        0xA9, 0x7A, 0xA9, 0x81, 0xA9, 0x82, 0xA9, 0x83, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_CC[512] = {
+static const unsigned char u2c_CC[512] = {
        0xA9, 0x84, 0xA9, 0x85, 0xA9, 0x86, 0xA9, 0x87, /* 0x00-0x03 */
        0xA9, 0x88, 0xA9, 0x89, 0xA9, 0x8A, 0xA9, 0x8B, /* 0x04-0x07 */
        0xA9, 0x8C, 0xA9, 0x8D, 0xA9, 0x8E, 0xA9, 0x8F, /* 0x08-0x0B */
@@ -12878,7 +12878,7 @@ static unsigned char u2c_CC[512] = {
        0xAB, 0x9F, 0xAB, 0xA0, 0xAC, 0x41, 0xAC, 0x42, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_CD[512] = {
+static const unsigned char u2c_CD[512] = {
        0xAC, 0x43, 0xC3, 0xC9, 0xAC, 0x44, 0xAC, 0x45, /* 0x00-0x03 */
        0xAC, 0x46, 0xAC, 0x47, 0xAC, 0x48, 0xAC, 0x49, /* 0x04-0x07 */
        0xC3, 0xCA, 0xC3, 0xCB, 0xAC, 0x4A, 0xAC, 0x4B, /* 0x08-0x0B */
@@ -12946,7 +12946,7 @@ static unsigned char u2c_CD[512] = {
        0xAE, 0x75, 0xC3, 0xF1, 0xAE, 0x76, 0xAE, 0x77, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_CE[512] = {
+static const unsigned char u2c_CE[512] = {
        0xAE, 0x78, 0xAE, 0x79, 0xAE, 0x7A, 0xAE, 0x81, /* 0x00-0x03 */
        0xC3, 0xF2, 0xAE, 0x82, 0xAE, 0x83, 0xAE, 0x84, /* 0x04-0x07 */
        0xC3, 0xF3, 0xAE, 0x85, 0xAE, 0x86, 0xAE, 0x87, /* 0x08-0x0B */
@@ -13014,7 +13014,7 @@ static unsigned char u2c_CE[512] = {
        0xB0, 0x9D, 0xB0, 0x9E, 0xB0, 0x9F, 0xB0, 0xA0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_CF[512] = {
+static const unsigned char u2c_CF[512] = {
        0xC4, 0xC9, 0xC4, 0xCA, 0xB1, 0x41, 0xB1, 0x42, /* 0x00-0x03 */
        0xC4, 0xCB, 0xB1, 0x43, 0xB1, 0x44, 0xB1, 0x45, /* 0x04-0x07 */
        0xC4, 0xCC, 0xB1, 0x46, 0xB1, 0x47, 0xB1, 0x48, /* 0x08-0x0B */
@@ -13082,7 +13082,7 @@ static unsigned char u2c_CF[512] = {
        0xC4, 0xF5, 0xB3, 0x6F, 0xB3, 0x70, 0xB3, 0x71, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_D0[512] = {
+static const unsigned char u2c_D0[512] = {
        0xC4, 0xF6, 0xB3, 0x72, 0xB3, 0x73, 0xB3, 0x74, /* 0x00-0x03 */
        0xC4, 0xF7, 0xB3, 0x75, 0xB3, 0x76, 0xB3, 0x77, /* 0x04-0x07 */
        0xB3, 0x78, 0xB3, 0x79, 0xB3, 0x7A, 0xB3, 0x81, /* 0x08-0x0B */
@@ -13150,7 +13150,7 @@ static unsigned char u2c_D0[512] = {
        0xB5, 0x98, 0xB5, 0x99, 0xB5, 0x9A, 0xB5, 0x9B, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_D1[512] = {
+static const unsigned char u2c_D1[512] = {
        0xB5, 0x9C, 0xB5, 0x9D, 0xB5, 0x9E, 0xB5, 0x9F, /* 0x00-0x03 */
        0xB5, 0xA0, 0xB6, 0x41, 0xB6, 0x42, 0xB6, 0x43, /* 0x04-0x07 */
        0xB6, 0x44, 0xB6, 0x45, 0xB6, 0x46, 0xB6, 0x47, /* 0x08-0x0B */
@@ -13218,7 +13218,7 @@ static unsigned char u2c_D1[512] = {
        0xB8, 0x70, 0xB8, 0x71, 0xB8, 0x72, 0xB8, 0x73, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_D2[512] = {
+static const unsigned char u2c_D2[512] = {
        0xB8, 0x74, 0xB8, 0x75, 0xB8, 0x76, 0xB8, 0x77, /* 0x00-0x03 */
        0xB8, 0x78, 0xB8, 0x79, 0xB8, 0x7A, 0xC5, 0xF2, /* 0x04-0x07 */
        0xB8, 0x81, 0xC5, 0xF3, 0xB8, 0x82, 0xB8, 0x83, /* 0x08-0x0B */
@@ -13286,7 +13286,7 @@ static unsigned char u2c_D2[512] = {
        0xBB, 0x42, 0xBB, 0x43, 0xBB, 0x44, 0xBB, 0x45, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_D3[512] = {
+static const unsigned char u2c_D3[512] = {
        0xC6, 0xC0, 0xC6, 0xC1, 0xBB, 0x46, 0xC6, 0xC2, /* 0x00-0x03 */
        0xBB, 0x47, 0xC6, 0xC3, 0xBB, 0x48, 0xBB, 0x49, /* 0x04-0x07 */
        0xBB, 0x4A, 0xBB, 0x4B, 0xBB, 0x4C, 0xBB, 0x4D, /* 0x08-0x0B */
@@ -13354,7 +13354,7 @@ static unsigned char u2c_D3[512] = {
        0xC6, 0xFB, 0xC6, 0xFC, 0xBD, 0x65, 0xC6, 0xFD, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_D4[512] = {
+static const unsigned char u2c_D4[512] = {
        0xBD, 0x66, 0xC6, 0xFE, 0xBD, 0x67, 0xBD, 0x68, /* 0x00-0x03 */
        0xBD, 0x69, 0xBD, 0x6A, 0xBD, 0x6B, 0xBD, 0x6C, /* 0x04-0x07 */
        0xC7, 0xA1, 0xBD, 0x6D, 0xBD, 0x6E, 0xBD, 0x6F, /* 0x08-0x0B */
@@ -13422,7 +13422,7 @@ static unsigned char u2c_D4[512] = {
        0xBF, 0xA0, 0xC7, 0xC0, 0xC0, 0x41, 0xC0, 0x42, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_D5[512] = {
+static const unsigned char u2c_D5[512] = {
        0xC0, 0x43, 0xC0, 0x44, 0xC0, 0x45, 0xC0, 0x46, /* 0x00-0x03 */
        0xC7, 0xC1, 0xC0, 0x47, 0xC0, 0x48, 0xC0, 0x49, /* 0x04-0x07 */
        0xC7, 0xC2, 0xC0, 0x4A, 0xC0, 0x4B, 0xC0, 0x4C, /* 0x08-0x0B */
@@ -13490,7 +13490,7 @@ static unsigned char u2c_D5[512] = {
        0xC2, 0x6A, 0xC2, 0x6B, 0xC2, 0x6C, 0xC2, 0x6D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_D6[512] = {
+static const unsigned char u2c_D6[512] = {
        0xC7, 0xF4, 0xC7, 0xF5, 0xC2, 0x6E, 0xC2, 0x6F, /* 0x00-0x03 */
        0xC7, 0xF6, 0xC2, 0x70, 0xC2, 0x71, 0xC2, 0x72, /* 0x04-0x07 */
        0xC7, 0xF7, 0xC2, 0x73, 0xC2, 0x74, 0xC2, 0x75, /* 0x08-0x0B */
@@ -13558,7 +13558,7 @@ static unsigned char u2c_D6[512] = {
        0xC8, 0xD1, 0xC8, 0xD2, 0xC4, 0x8D, 0xC4, 0x8E, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_D7[512] = {
+static const unsigned char u2c_D7[512] = {
        0xC8, 0xD3, 0xC4, 0x8F, 0xC4, 0x90, 0xC4, 0x91, /* 0x00-0x03 */
        0xC8, 0xD4, 0xC4, 0x92, 0xC4, 0x93, 0xC4, 0x94, /* 0x04-0x07 */
        0xC4, 0x95, 0xC4, 0x96, 0xC4, 0x97, 0xC4, 0x98, /* 0x08-0x0B */
@@ -13603,11 +13603,11 @@ static unsigned char u2c_D7[512] = {
        0xC6, 0x4F, 0xC6, 0x50, 0xC6, 0x51, 0xC6, 0x52, /* 0xA0-0xA3 */
 };
 
-static unsigned char u2c_DC[512] = {
+static const unsigned char u2c_DC[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
 };
 
-static unsigned char u2c_F9[512] = {
+static const unsigned char u2c_F9[512] = {
        0xCB, 0xD0, 0xCB, 0xD6, 0xCB, 0xE7, 0xCD, 0xCF, /* 0x00-0x03 */
        0xCD, 0xE8, 0xCE, 0xAD, 0xCF, 0xFB, 0xD0, 0xA2, /* 0x04-0x07 */
        0xD0, 0xB8, 0xD0, 0xD0, 0xD0, 0xDD, 0xD1, 0xD4, /* 0x08-0x0B */
@@ -13675,7 +13675,7 @@ static unsigned char u2c_F9[512] = {
        0xF2, 0xBD, 0xF2, 0xFA, 0xF3, 0xB1, 0xF4, 0xA7, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_FA[512] = {
+static const unsigned char u2c_FA[512] = {
        0xF4, 0xEE, 0xF6, 0xF4, 0xF6, 0xF6, 0xF7, 0xB8, /* 0x00-0x03 */
        0xF7, 0xC8, 0xF7, 0xD3, 0xF8, 0xDB, 0xF8, 0xF0, /* 0x04-0x07 */
        0xFA, 0xA1, 0xFA, 0xA2, 0xFA, 0xE6, 0xFC, 0xA9, /* 0x08-0x0B */
@@ -13690,7 +13690,7 @@ static unsigned char u2c_FA[512] = {
        0xCE, 0xBD, 0xF9, 0xCD, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */
 };
 
-static unsigned char u2c_FF[512] = {
+static const unsigned char u2c_FF[512] = {
        0x00, 0x00, 0xA3, 0xA1, 0xA3, 0xA2, 0xA3, 0xA3, /* 0x00-0x03 */
        0xA3, 0xA4, 0xA3, 0xA5, 0xA3, 0xA6, 0xA3, 0xA7, /* 0x04-0x07 */
        0xA3, 0xA8, 0xA3, 0xA9, 0xA3, 0xAA, 0xA3, 0xAB, /* 0x08-0x0B */
@@ -13752,7 +13752,7 @@ static unsigned char u2c_FF[512] = {
        0x00, 0x00, 0xA1, 0xCD, 0xA3, 0xDC, 0x00, 0x00, /* 0xE4-0xE7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        NULL,   u2c_01, u2c_02, u2c_03, u2c_04, NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   u2c_11, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -13786,7 +13786,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   u2c_F9, u2c_FA, NULL,   NULL,   NULL,   NULL,   u2c_FF, };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -13822,7 +13822,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -13861,7 +13861,7 @@ static unsigned char charset2upper[256] = {
 static int uni2char(const wchar_t uni,
                        unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni&0xFF;
        unsigned char ch = (uni>>8)&0xFF;
        int n;
@@ -13893,7 +13893,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
                        wchar_t *uni)
 {
        unsigned char ch, cl;
-       wchar_t *charset2uni;
+       const wchar_t *charset2uni;
        int n;
 
        if (boundlen <= 0)
index 5665945fb88cc6d648efb58a70b7f42cd312eb4e..ef2536829aa589a393d1b5d9528d1e28ab2ac47e 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t c2u_A1[256] = {
+static const wchar_t c2u_A1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -49,7 +49,7 @@ static wchar_t c2u_A1[256] = {
        0x2196,0x2197,0x2199,0x2198,0x2225,0x2223,0xFF0F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A2[256] = {
+static const wchar_t c2u_A2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -85,7 +85,7 @@ static wchar_t c2u_A2[256] = {
        0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A3[256] = {
+static const wchar_t c2u_A3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -118,7 +118,7 @@ static wchar_t c2u_A3[256] = {
        0x0000,0x20AC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0xE0-0xE7 */
 };
 
-static wchar_t c2u_A4[256] = {
+static const wchar_t c2u_A4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -154,7 +154,7 @@ static wchar_t c2u_A4[256] = {
        0x723B,0x7247,0x7259,0x725B,0x72AC,0x738B,0x4E19,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A5[256] = {
+static const wchar_t c2u_A5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -190,7 +190,7 @@ static wchar_t c2u_A5[256] = {
        0x4F01,0x4F0B,0x5149,0x5147,0x5146,0x5148,0x5168,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A6[256] = {
+static const wchar_t c2u_A6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -226,7 +226,7 @@ static wchar_t c2u_A6[256] = {
        0x4F3A,0x4F38,0x4F43,0x4F54,0x4F3C,0x4F46,0x4F63,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A7[256] = {
+static const wchar_t c2u_A7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -262,7 +262,7 @@ static wchar_t c2u_A7[256] = {
        0x6751,0x675C,0x6756,0x675E,0x6749,0x6746,0x6760,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A8[256] = {
+static const wchar_t c2u_A8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -298,7 +298,7 @@ static wchar_t c2u_A8[256] = {
        0x5378,0x5379,0x53D6,0x53D4,0x53D7,0x5473,0x5475,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_A9[256] = {
+static const wchar_t c2u_A9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -334,7 +334,7 @@ static wchar_t c2u_A9[256] = {
        0x6606,0x6602,0x660E,0x6600,0x660F,0x6615,0x660A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_AA[256] = {
+static const wchar_t c2u_AA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -370,7 +370,7 @@ static wchar_t c2u_AA[256] = {
        0x9577,0x9580,0x961C,0x9640,0x963F,0x963B,0x9644,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_AB[256] = {
+static const wchar_t c2u_AB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -406,7 +406,7 @@ static wchar_t c2u_AB[256] = {
        0x62ED,0x6301,0x62EE,0x62FD,0x6307,0x62F1,0x62F7,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_AC[256] = {
+static const wchar_t c2u_AC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -442,7 +442,7 @@ static wchar_t c2u_AC[256] = {
        0x7D07,0x7D04,0x7D06,0x7F38,0x7F8E,0x7FBF,0x8004,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_AD[256] = {
+static const wchar_t c2u_AD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -478,7 +478,7 @@ static wchar_t c2u_AD[256] = {
        0x5514,0x54E9,0x54ED,0x54E1,0x5509,0x54EE,0x54EA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_AE[256] = {
+static const wchar_t c2u_AE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -514,7 +514,7 @@ static wchar_t c2u_AE[256] = {
        0x6D88,0x6D87,0x6D66,0x6D78,0x6D77,0x6D59,0x6D93,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_AF[256] = {
+static const wchar_t c2u_AF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -550,7 +550,7 @@ static wchar_t c2u_AF[256] = {
        0x8339,0x8336,0x8317,0x8340,0x8331,0x8328,0x8343,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B0[256] = {
+static const wchar_t c2u_B0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -586,7 +586,7 @@ static wchar_t c2u_B0[256] = {
        0x5962,0x5A36,0x5A41,0x5A49,0x5A66,0x5A6A,0x5A40,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B1[256] = {
+static const wchar_t c2u_B1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -622,7 +622,7 @@ static wchar_t c2u_B1[256] = {
        0x689D,0x68A8,0x689F,0x68A1,0x6882,0x6B32,0x6BBA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B2[256] = {
+static const wchar_t c2u_B2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -658,7 +658,7 @@ static wchar_t c2u_B2[256] = {
        0x838A,0x8393,0x8389,0x83A0,0x8377,0x837B,0x837C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B3[256] = {
+static const wchar_t c2u_B3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -694,7 +694,7 @@ static wchar_t c2u_B3[256] = {
        0x5831,0x5821,0x581D,0x5820,0x58F9,0x58FA,0x5960,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B4[256] = {
+static const wchar_t c2u_B4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -730,7 +730,7 @@ static wchar_t c2u_B4[256] = {
        0x6E4D,0x6E3A,0x6E2C,0x6E43,0x6E1D,0x6E3E,0x6ECB,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B5[256] = {
+static const wchar_t c2u_B5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -766,7 +766,7 @@ static wchar_t c2u_B5[256] = {
        0x8996,0x8A3B,0x8A60,0x8A55,0x8A5E,0x8A3C,0x8A41,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B6[256] = {
+static const wchar_t c2u_B6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -802,7 +802,7 @@ static wchar_t c2u_B6[256] = {
        0x5967,0x5AC1,0x5AC9,0x5ACC,0x5ABE,0x5ABD,0x5ABC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B7[256] = {
+static const wchar_t c2u_B7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -838,7 +838,7 @@ static wchar_t c2u_B7[256] = {
        0x76DE,0x76DF,0x775B,0x776B,0x7766,0x775E,0x7763,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B8[256] = {
+static const wchar_t c2u_B8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -874,7 +874,7 @@ static wchar_t c2u_B8[256] = {
        0x8DE4,0x8DE6,0x8EB2,0x8F03,0x8F09,0x8EFE,0x8F0A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_B9[256] = {
+static const wchar_t c2u_B9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -910,7 +910,7 @@ static wchar_t c2u_B9[256] = {
        0x5ED3,0x5ED6,0x5F0A,0x5F46,0x5F70,0x5FB9,0x6147,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BA[256] = {
+static const wchar_t c2u_BA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -946,7 +946,7 @@ static wchar_t c2u_BA[256] = {
        0x7DBF,0x7DB5,0x7DB8,0x7DAD,0x7DD2,0x7DC7,0x7DAC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BB[256] = {
+static const wchar_t c2u_BB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -982,7 +982,7 @@ static wchar_t c2u_BB[256] = {
        0x50F5,0x50F9,0x5102,0x5108,0x5109,0x5105,0x51DC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BC[256] = {
+static const wchar_t c2u_BC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1018,7 +1018,7 @@ static wchar_t c2u_BC[256] = {
        0x7256,0x729B,0x734E,0x7357,0x7469,0x748B,0x7483,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BD[256] = {
+static const wchar_t c2u_BD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1054,7 +1054,7 @@ static wchar_t c2u_BD[256] = {
        0x8F1B,0x8F1F,0x8F29,0x8F26,0x8F2A,0x8F1C,0x8F1E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BE[256] = {
+static const wchar_t c2u_BE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1090,7 +1090,7 @@ static wchar_t c2u_BE[256] = {
        0x6A48,0x6B59,0x6B77,0x6C05,0x6FC2,0x6FB1,0x6FA1,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_BF[256] = {
+static const wchar_t c2u_BF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1126,7 +1126,7 @@ static wchar_t c2u_BF[256] = {
        0x9333,0x932F,0x9322,0x92FC,0x932B,0x9304,0x931A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C0[256] = {
+static const wchar_t c2u_C0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1162,7 +1162,7 @@ static wchar_t c2u_C0[256] = {
        0x7642,0x764C,0x76EA,0x77B3,0x77AA,0x77B0,0x77AC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C1[256] = {
+static const wchar_t c2u_C1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1198,7 +1198,7 @@ static wchar_t c2u_C1[256] = {
        0x971E,0x97A0,0x97D3,0x9846,0x98B6,0x9935,0x9A01,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C2[256] = {
+static const wchar_t c2u_C2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1234,7 +1234,7 @@ static wchar_t c2u_C2[256] = {
        0x96DC,0x96D9,0x96DB,0x96DE,0x9724,0x97A3,0x97A6,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C3[256] = {
+static const wchar_t c2u_C3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1270,7 +1270,7 @@ static wchar_t c2u_C3[256] = {
        0x96E3,0x972A,0x9727,0x9761,0x97DC,0x97FB,0x985E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C4[256] = {
+static const wchar_t c2u_C4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1306,7 +1306,7 @@ static wchar_t c2u_C4[256] = {
        0x8822,0x8821,0x881F,0x896A,0x896C,0x89BD,0x8B74,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C5[256] = {
+static const wchar_t c2u_C5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1342,7 +1342,7 @@ static wchar_t c2u_C5[256] = {
        0x7F50,0x7F88,0x8836,0x8839,0x8862,0x8B93,0x8B92,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_C6[256] = {
+static const wchar_t c2u_C6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1361,7 +1361,7 @@ static wchar_t c2u_C6[256] = {
        0x9E1A,0x7228,0x9A6A,0x9B31,0x9E1B,0x9E1E,0x7C72,0x0000,/* 0x78-0x7F */
 };
 
-static wchar_t c2u_C9[256] = {
+static const wchar_t c2u_C9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1397,7 +1397,7 @@ static wchar_t c2u_C9[256] = {
        0x6C46,0x6C52,0x6C5C,0x6C4F,0x6C4A,0x6C54,0x6C4B,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CA[256] = {
+static const wchar_t c2u_CA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1433,7 +1433,7 @@ static wchar_t c2u_CA[256] = {
        0x65F0,0x65F4,0x65F3,0x65F2,0x65F5,0x6745,0x6747,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CB[256] = {
+static const wchar_t c2u_CB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1469,7 +1469,7 @@ static wchar_t c2u_CB[256] = {
        0x5776,0x5780,0x5775,0x577B,0x5773,0x5774,0x5762,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CC[256] = {
+static const wchar_t c2u_CC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1505,7 +1505,7 @@ static wchar_t c2u_CC[256] = {
        0x6CD0,0x6CC2,0x6CBA,0x6CC3,0x6CC6,0x6CED,0x6CF2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CD[256] = {
+static const wchar_t c2u_CD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1541,7 +1541,7 @@ static wchar_t c2u_CD[256] = {
        0x5399,0x5398,0x54BA,0x54A1,0x54AD,0x54A5,0x54CF,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CE[256] = {
+static const wchar_t c2u_CE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1577,7 +1577,7 @@ static wchar_t c2u_CE[256] = {
        0x662E,0x670F,0x6710,0x67C1,0x67F2,0x67C8,0x67BA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_CF[256] = {
+static const wchar_t c2u_CF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1613,7 +1613,7 @@ static wchar_t c2u_CF[256] = {
        0x7944,0x79D5,0x79CD,0x79CF,0x79D6,0x79CE,0x7A80,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D0[256] = {
+static const wchar_t c2u_D0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1649,7 +1649,7 @@ static wchar_t c2u_D0[256] = {
        0x54FF,0x5504,0x5508,0x54EB,0x5511,0x5505,0x54F1,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D1[256] = {
+static const wchar_t c2u_D1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1685,7 +1685,7 @@ static wchar_t c2u_D1[256] = {
        0x6B31,0x6B34,0x6B6D,0x8082,0x6B88,0x6BE6,0x6BE4,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D2[256] = {
+static const wchar_t c2u_D2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1721,7 +1721,7 @@ static wchar_t c2u_D2[256] = {
        0x7A85,0x7A8B,0x7A8C,0x7A8A,0x7A87,0x7AD8,0x7B10,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D3[256] = {
+static const wchar_t c2u_D3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1757,7 +1757,7 @@ static wchar_t c2u_D3[256] = {
        0x90E5,0x90D8,0x90DB,0x90D7,0x90DC,0x90E4,0x9150,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D4[256] = {
+static const wchar_t c2u_D4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1793,7 +1793,7 @@ static wchar_t c2u_D4[256] = {
        0x5D20,0x5D0C,0x5D28,0x5D0D,0x5D26,0x5D25,0x5D0F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D5[256] = {
+static const wchar_t c2u_D5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1829,7 +1829,7 @@ static wchar_t c2u_D5[256] = {
        0x6DED,0x6DF0,0x6DBA,0x6DD5,0x6DC2,0x6DCF,0x6DC9,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D6[256] = {
+static const wchar_t c2u_D6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1865,7 +1865,7 @@ static wchar_t c2u_D6[256] = {
        0x7FCD,0x7FD0,0x7FD1,0x7FC7,0x7FCF,0x7FC9,0x801F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D7[256] = {
+static const wchar_t c2u_D7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1901,7 +1901,7 @@ static wchar_t c2u_D7[256] = {
        0x91F4,0x91F1,0x91F3,0x91F8,0x91E4,0x91F9,0x91EA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D8[256] = {
+static const wchar_t c2u_D8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1937,7 +1937,7 @@ static wchar_t c2u_D8[256] = {
        0x60C9,0x60B9,0x60CC,0x60E2,0x60CE,0x60C4,0x6114,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_D9[256] = {
+static const wchar_t c2u_D9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -1973,7 +1973,7 @@ static wchar_t c2u_D9[256] = {
        0x6E4B,0x6E40,0x6E51,0x6E3B,0x6E03,0x6E2E,0x6E5E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DA[256] = {
+static const wchar_t c2u_DA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2009,7 +2009,7 @@ static wchar_t c2u_DA[256] = {
        0x7D69,0x7D51,0x7D5F,0x7D4E,0x7F3E,0x7F3F,0x7F65,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DB[256] = {
+static const wchar_t c2u_DB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2045,7 +2045,7 @@ static wchar_t c2u_DB[256] = {
        0x8DD9,0x8DC8,0x8DD7,0x8DC5,0x8EEF,0x8EF7,0x8EFA,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DC[256] = {
+static const wchar_t c2u_DC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2081,7 +2081,7 @@ static wchar_t c2u_DC[256] = {
        0x5AB1,0x5AB5,0x5AB0,0x5ABF,0x5AC8,0x5ABB,0x5AC6,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DD[256] = {
+static const wchar_t c2u_DD[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2117,7 +2117,7 @@ static wchar_t c2u_DD[256] = {
        0x6B42,0x6B48,0x6B41,0x6B9B,0xFA0D,0x6BFB,0x6BFC,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DE[256] = {
+static const wchar_t c2u_DE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2153,7 +2153,7 @@ static wchar_t c2u_DE[256] = {
        0x7A18,0x7A19,0x7A12,0x7A17,0x7A15,0x7A22,0x7A13,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_DF[256] = {
+static const wchar_t c2u_DF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2189,7 +2189,7 @@ static wchar_t c2u_DF[256] = {
        0x88CC,0x88D0,0x8985,0x899B,0x89DF,0x89E5,0x89E4,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E0[256] = {
+static const wchar_t c2u_E0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2225,7 +2225,7 @@ static wchar_t c2u_E0[256] = {
        0x50E4,0x50D3,0x50EC,0x50F0,0x50EF,0x50E3,0x50E0,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E1[256] = {
+static const wchar_t c2u_E1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2261,7 +2261,7 @@ static wchar_t c2u_E1[256] = {
        0x669F,0x6705,0x6704,0x6722,0x69B1,0x69B6,0x69C9,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E2[256] = {
+static const wchar_t c2u_E2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2297,7 +2297,7 @@ static wchar_t c2u_E2[256] = {
        0x7998,0x798A,0x798B,0x7996,0x7995,0x7994,0x7993,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E3[256] = {
+static const wchar_t c2u_E3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2333,7 +2333,7 @@ static wchar_t c2u_E3[256] = {
        0x88F2,0x88FA,0x88FE,0x88EE,0x88FC,0x88F6,0x88FB,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E4[256] = {
+static const wchar_t c2u_E4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2369,7 +2369,7 @@ static wchar_t c2u_E4[256] = {
        0x564C,0x5635,0x5641,0x564A,0x5649,0x5646,0x5658,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E5[256] = {
+static const wchar_t c2u_E5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2405,7 +2405,7 @@ static wchar_t c2u_E5[256] = {
        0x6C02,0x6F41,0x6F26,0x6F7E,0x6F87,0x6FC6,0x6F92,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E6[256] = {
+static const wchar_t c2u_E6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2441,7 +2441,7 @@ static wchar_t c2u_E6[256] = {
        0x7FEC,0x7FE6,0x7FE8,0x8064,0x8067,0x81A3,0x819F,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E7[256] = {
+static const wchar_t c2u_E7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2477,7 +2477,7 @@ static wchar_t c2u_E7[256] = {
        0x8E15,0x8E1B,0x8E16,0x8E11,0x8E19,0x8E26,0x8E27,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E8[256] = {
+static const wchar_t c2u_E8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2513,7 +2513,7 @@ static wchar_t c2u_E8[256] = {
        0x5111,0x51DE,0x5334,0x53E1,0x5670,0x5660,0x566E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_E9[256] = {
+static const wchar_t c2u_E9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2549,7 +2549,7 @@ static wchar_t c2u_E9[256] = {
        0x6FAE,0x6FBA,0x6FAC,0x6FAA,0x6FCF,0x6FBF,0x6FB8,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EA[256] = {
+static const wchar_t c2u_EA[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2585,7 +2585,7 @@ static wchar_t c2u_EA[256] = {
        0x8556,0x8545,0x856B,0x854D,0x8553,0x8561,0x8558,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EB[256] = {
+static const wchar_t c2u_EB[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2621,7 +2621,7 @@ static wchar_t c2u_EB[256] = {
        0x92FF,0x9329,0x9339,0x9335,0x932A,0x9314,0x930C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EC[256] = {
+static const wchar_t c2u_EC[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2657,7 +2657,7 @@ static wchar_t c2u_EC[256] = {
        0x6A9F,0x6A9B,0x6AA1,0x6A9E,0x6A87,0x6A93,0x6A8E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_ED[256] = {
+static const wchar_t c2u_ED[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2693,7 +2693,7 @@ static wchar_t c2u_ED[256] = {
        0x85A0,0x858B,0x85A3,0x857B,0x85A4,0x859A,0x859E,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EE[256] = {
+static const wchar_t c2u_EE[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2729,7 +2729,7 @@ static wchar_t c2u_EE[256] = {
        0x971F,0x9718,0x971D,0x9719,0x979A,0x97A1,0x979C,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_EF[256] = {
+static const wchar_t c2u_EF[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2765,7 +2765,7 @@ static wchar_t c2u_EF[256] = {
        0x700A,0x7201,0x71FF,0x71F9,0x7203,0x71FD,0x7376,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F0[256] = {
+static const wchar_t c2u_F0[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2801,7 +2801,7 @@ static wchar_t c2u_F0[256] = {
        0x8E62,0x8E60,0x8E57,0x8E56,0x8E5E,0x8E65,0x8E67,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F1[256] = {
+static const wchar_t c2u_F1[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2837,7 +2837,7 @@ static wchar_t c2u_F1[256] = {
        0x58DB,0x5912,0x5B3D,0x5B3E,0x5B3F,0x5DC3,0x5E70,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F2[256] = {
+static const wchar_t c2u_F2[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2873,7 +2873,7 @@ static wchar_t c2u_F2[256] = {
        0x8B4A,0x8B40,0x8B53,0x8B56,0x8B54,0x8B4B,0x8B55,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F3[256] = {
+static const wchar_t c2u_F3[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2909,7 +2909,7 @@ static wchar_t c2u_F3[256] = {
        0x9F41,0x9F4D,0x9F56,0x9F57,0x9F58,0x5337,0x56B2,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F4[256] = {
+static const wchar_t c2u_F4[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2945,7 +2945,7 @@ static wchar_t c2u_F4[256] = {
        0x9416,0x9412,0x93FA,0x9409,0x93F8,0x940A,0x93FF,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F5[256] = {
+static const wchar_t c2u_F5[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -2981,7 +2981,7 @@ static wchar_t c2u_F5[256] = {
        0x8627,0x862E,0x8621,0x8620,0x8629,0x861E,0x8625,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F6[256] = {
+static const wchar_t c2u_F6[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3017,7 +3017,7 @@ static wchar_t c2u_F6[256] = {
        0x7A70,0x7A71,0x7C57,0x7C5C,0x7C59,0x7C5B,0x7C5A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F7[256] = {
+static const wchar_t c2u_F7[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3053,7 +3053,7 @@ static wchar_t c2u_F7[256] = {
        0x8832,0x882E,0x8833,0x8976,0x8974,0x8973,0x89FE,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F8[256] = {
+static const wchar_t c2u_F8[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3089,7 +3089,7 @@ static wchar_t c2u_F8[256] = {
        0x77D8,0x77D9,0x7939,0x7C69,0x7C6B,0x7CF6,0x7E9A,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t c2u_F9[256] = {
+static const wchar_t c2u_F9[256] = {
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x00-0x07 */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x08-0x0F */
        0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,/* 0x10-0x17 */
@@ -3125,7 +3125,7 @@ static wchar_t c2u_F9[256] = {
        0x2551,0x2550,0x256D,0x256E,0x2570,0x256F,0x2593,0x0000,/* 0xF8-0xFF */
 };
 
-static wchar_t *page_charset2uni[256] = {
+static const wchar_t *page_charset2uni[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -3160,7 +3160,7 @@ static wchar_t *page_charset2uni[256] = {
        c2u_F8, c2u_F9, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char u2c_02[512] = {
+static const unsigned char u2c_02[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3219,7 +3219,7 @@ static unsigned char u2c_02[512] = {
        0x00, 0x00, 0xA3, 0xBB, 0x00, 0x00, 0x00, 0x00, /* 0xD8-0xDB */
 };
 
-static unsigned char u2c_03[512] = {
+static const unsigned char u2c_03[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xA1, 0xC2, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3274,7 +3274,7 @@ static unsigned char u2c_03[512] = {
        0xA3, 0x72, 0xA3, 0x73, 0x00, 0x00, 0x00, 0x00, /* 0xC8-0xCB */
 };
 
-static unsigned char u2c_20[512] = {
+static const unsigned char u2c_20[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3293,7 +3293,7 @@ static unsigned char u2c_20[512] = {
        0x00, 0x00, 0x00, 0x00, 0xA1, 0xC3, 0x00, 0x00, /* 0x3C-0x3F */
 };
 
-static unsigned char u2c_21[512] = {
+static const unsigned char u2c_21[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA2, 0x4A, /* 0x00-0x03 */
        0x00, 0x00, 0xA1, 0xC1, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xA2, 0x4B, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3336,7 +3336,7 @@ static unsigned char u2c_21[512] = {
        0xA1, 0xFB, 0xA1, 0xFA, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9B */
 };
 
-static unsigned char u2c_22[512] = {
+static const unsigned char u2c_22[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3388,12 +3388,12 @@ static unsigned char u2c_22[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0xE9, /* 0xBC-0xBF */
 };
 
-static unsigned char u2c_23[512] = {
+static const unsigned char u2c_23[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0x5B, /* 0x04-0x07 */
 };
 
-static unsigned char u2c_25[512] = {
+static const unsigned char u2c_25[512] = {
        0xA2, 0x77, 0x00, 0x00, 0xA2, 0x78, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3455,7 +3455,7 @@ static unsigned char u2c_25[512] = {
        0xA2, 0xAB, 0xA2, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
 };
 
-static unsigned char u2c_26[512] = {
+static const unsigned char u2c_26[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xA1, 0xB9, 0xA1, 0xB8, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xA1, 0xF3, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3475,7 +3475,7 @@ static unsigned char u2c_26[512] = {
        0xA1, 0xF0, 0xA1, 0xF2, 0xA1, 0xF1, 0x00, 0x00, /* 0x40-0x43 */
 };
 
-static unsigned char u2c_30[512] = {
+static const unsigned char u2c_30[512] = {
        0xA1, 0x40, 0xA1, 0x42, 0xA1, 0x43, 0xA1, 0xB2, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xA1, 0x71, 0xA1, 0x72, 0xA1, 0x6D, 0xA1, 0x6E, /* 0x08-0x0B */
@@ -3491,7 +3491,7 @@ static unsigned char u2c_30[512] = {
        0xA1, 0xCA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x33 */
 };
 
-static unsigned char u2c_31[512] = {
+static const unsigned char u2c_31[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xA3, 0x74, 0xA3, 0x75, 0xA3, 0x76, /* 0x04-0x07 */
        0xA3, 0x77, 0xA3, 0x78, 0xA3, 0x79, 0xA3, 0x7A, /* 0x08-0x0B */
@@ -3535,7 +3535,7 @@ static unsigned char u2c_31[512] = {
        0xA4, 0x42, 0xA4, 0xD1, 0xA6, 0x61, 0xA4, 0x48, /* 0x9C-0x9F */
 };
 
-static unsigned char u2c_32[512] = {
+static const unsigned char u2c_32[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3584,7 +3584,7 @@ static unsigned char u2c_32[512] = {
        0xA9, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xB0-0xB3 */
 };
 
-static unsigned char u2c_33[512] = {
+static const unsigned char u2c_33[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -3642,7 +3642,7 @@ static unsigned char u2c_33[512] = {
        0x00, 0x00, 0xA2, 0x4F, 0x00, 0x00, 0x00, 0x00, /* 0xD4-0xD7 */
 };
 
-static unsigned char u2c_4E[512] = {
+static const unsigned char u2c_4E[512] = {
        0xA4, 0x40, 0xA4, 0x42, 0x00, 0x00, 0xA4, 0x43, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9, 0x45, /* 0x04-0x07 */
        0xA4, 0x56, 0xA4, 0x54, 0xA4, 0x57, 0xA4, 0x55, /* 0x08-0x0B */
@@ -3710,7 +3710,7 @@ static unsigned char u2c_4E[512] = {
        0x00, 0x00, 0xA5, 0xF7, 0x00, 0x00, 0xA5, 0xE9, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_4F[512] = {
+static const unsigned char u2c_4F[512] = {
        0xC9, 0xB1, 0xA5, 0xF8, 0xC9, 0xB5, 0x00, 0x00, /* 0x00-0x03 */
        0xC9, 0xB9, 0xC9, 0xB6, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xC9, 0xB3, 0xA5, 0xEA, 0xA5, 0xEC, 0xA5, 0xF9, /* 0x08-0x0B */
@@ -3778,7 +3778,7 @@ static unsigned char u2c_4F[512] = {
        0x00, 0x00, 0x00, 0x00, 0xAD, 0xDA, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_50[512] = {
+static const unsigned char u2c_50[512] = {
        0xAD, 0xCE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xD0, 0xC9, 0xAD, 0xC7, 0xD0, 0xCA, /* 0x04-0x07 */
        0x00, 0x00, 0xAD, 0xDC, 0x00, 0x00, 0xAD, 0xD3, /* 0x08-0x0B */
@@ -3846,7 +3846,7 @@ static unsigned char u2c_50[512] = {
        0x00, 0x00, 0xE4, 0xF0, 0xE4, 0xED, 0xE4, 0xE6, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_51[512] = {
+static const unsigned char u2c_51[512] = {
        0xBB, 0xF6, 0x00, 0x00, 0xBB, 0xFA, 0xE4, 0xE7, /* 0x00-0x03 */
        0xBB, 0xF5, 0xBB, 0xFD, 0xE4, 0xEA, 0xE4, 0xEB, /* 0x04-0x07 */
        0xBB, 0xFB, 0xBB, 0xFC, 0xE4, 0xF1, 0xE4, 0xEE, /* 0x08-0x0B */
@@ -3914,7 +3914,7 @@ static unsigned char u2c_51[512] = {
        0x00, 0x00, 0xA8, 0xE7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_52[512] = {
+static const unsigned char u2c_52[512] = {
        0xA4, 0x4D, 0xA4, 0x4E, 0x00, 0x00, 0xA4, 0x62, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xA4, 0xC0, 0xA4, 0xC1, /* 0x04-0x07 */
        0xA4, 0xC2, 0xC9, 0xBE, 0xA5, 0x5A, 0x00, 0x00, /* 0x08-0x0B */
@@ -3982,7 +3982,7 @@ static unsigned char u2c_52[512] = {
        0xC9, 0x56, 0x00, 0x00, 0xA4, 0xC4, 0xA4, 0xC5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_53[512] = {
+static const unsigned char u2c_53[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xA5, 0x5D, 0xA5, 0x5E, 0x00, 0x00, /* 0x04-0x07 */
        0xA6, 0x49, 0xCA, 0x71, 0xCB, 0xD6, 0xCB, 0xD7, /* 0x08-0x0B */
@@ -4050,7 +4050,7 @@ static unsigned char u2c_53[512] = {
        0xA5, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_54[512] = {
+static const unsigned char u2c_54[512] = {
        0x00, 0x00, 0xA6, 0x53, 0x00, 0x00, 0xA6, 0x59, /* 0x00-0x03 */
        0xA6, 0x55, 0x00, 0x00, 0xA6, 0x5B, 0xC9, 0xC5, /* 0x04-0x07 */
        0xA6, 0x58, 0xA6, 0x4E, 0xA6, 0x51, 0xA6, 0x54, /* 0x08-0x0B */
@@ -4118,7 +4118,7 @@ static unsigned char u2c_54[512] = {
        0xAD, 0xF3, 0xAE, 0x43, 0x00, 0x00, 0xD0, 0xF8, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_55[512] = {
+static const unsigned char u2c_55[512] = {
        0x00, 0x00, 0xAD, 0xF1, 0x00, 0x00, 0xD1, 0x46, /* 0x00-0x03 */
        0xD0, 0xF9, 0xD0, 0xFD, 0xAD, 0xF6, 0xAE, 0x42, /* 0x04-0x07 */
        0xD0, 0xFA, 0xAD, 0xFC, 0xD1, 0x40, 0xD1, 0x47, /* 0x08-0x0B */
@@ -4186,7 +4186,7 @@ static unsigned char u2c_55[512] = {
        0xE1, 0x4B, 0xB9, 0xC2, 0xB9, 0xBE, 0xE1, 0x54, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_56[512] = {
+static const unsigned char u2c_56[512] = {
        0xB9, 0xBF, 0xE1, 0x4E, 0xE1, 0x50, 0x00, 0x00, /* 0x00-0x03 */
        0xE1, 0x53, 0x00, 0x00, 0xB9, 0xC4, 0x00, 0x00, /* 0x04-0x07 */
        0xB9, 0xCB, 0xB9, 0xC5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4254,7 +4254,7 @@ static unsigned char u2c_56[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0xAA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_57[512] = {
+static const unsigned char u2c_57[512] = {
        0x00, 0x00, 0xD1, 0x48, 0xD1, 0x49, 0xAE, 0x45, /* 0x00-0x03 */
        0xAE, 0x46, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xAC, /* 0x04-0x07 */
        0xB0, 0xE9, 0xB0, 0xEB, 0xD4, 0xAB, 0xB0, 0xEA, /* 0x08-0x0B */
@@ -4322,7 +4322,7 @@ static unsigned char u2c_57[512] = {
        0xD4, 0xC3, 0xD4, 0xB5, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_58[512] = {
+static const unsigned char u2c_58[512] = {
        0xD4, 0xB3, 0xD4, 0xC6, 0xB0, 0xF3, 0x00, 0x00, /* 0x00-0x03 */
        0xD4, 0xCC, 0xB0, 0xED, 0xB0, 0xEF, 0xD4, 0xBB, /* 0x04-0x07 */
        0xD4, 0xB6, 0xAE, 0x4B, 0xB0, 0xEE, 0xD4, 0xB8, /* 0x08-0x0B */
@@ -4390,7 +4390,7 @@ static unsigned char u2c_58[512] = {
        0xDC, 0xF2, 0xB9, 0xD8, 0xE1, 0x69, 0xE5, 0x53, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_59[512] = {
+static const unsigned char u2c_59[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC9, 0x5A, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xCA, 0xB0, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -4458,7 +4458,7 @@ static unsigned char u2c_59[512] = {
        0xCE, 0x6A, 0xCE, 0x69, 0xCE, 0x74, 0xAB, 0xBA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5A[512] = {
+static const unsigned char u2c_5A[512] = {
        0xCE, 0x65, 0xAB, 0xC2, 0x00, 0x00, 0xAB, 0xBD, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xAE, 0x5C, 0xD1, 0x62, 0x00, 0x00, /* 0x08-0x0B */
@@ -4526,7 +4526,7 @@ static unsigned char u2c_5A[512] = {
        0x00, 0x00, 0xE5, 0x56, 0x00, 0x00, 0xE5, 0x54, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5B[512] = {
+static const unsigned char u2c_5B[512] = {
        0x00, 0x00, 0xE5, 0x5D, 0xE5, 0x5B, 0xE5, 0x59, /* 0x00-0x03 */
        0x00, 0x00, 0xE5, 0x5F, 0x00, 0x00, 0xE5, 0x5E, /* 0x04-0x07 */
        0xBC, 0x63, 0xBC, 0x5E, 0x00, 0x00, 0xBC, 0x60, /* 0x08-0x0B */
@@ -4594,7 +4594,7 @@ static unsigned char u2c_5B[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5C[512] = {
+static const unsigned char u2c_5C[512] = {
        0x00, 0x00, 0xAB, 0xCA, 0x00, 0x00, 0xD1, 0x69, /* 0x00-0x03 */
        0xAE, 0x67, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x4E, /* 0x04-0x07 */
        0xB1, 0x4D, 0xB1, 0x4C, 0xB4, 0x4C, 0xB4, 0x4D, /* 0x08-0x0B */
@@ -4662,7 +4662,7 @@ static unsigned char u2c_5C[512] = {
        0x00, 0x00, 0xAE, 0x6C, 0x00, 0x00, 0xD1, 0x6D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5D[512] = {
+static const unsigned char u2c_5D[512] = {
        0xD1, 0x71, 0xAE, 0x72, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xB1, 0x53, 0xB1, 0x52, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0xF5, /* 0x08-0x0B */
@@ -4730,7 +4730,7 @@ static unsigned char u2c_5D[512] = {
        0x00, 0x00, 0xB4, 0x53, 0xA4, 0x79, 0xC9, 0x5D, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5E[512] = {
+static const unsigned char u2c_5E[512] = {
        0x00, 0x00, 0x00, 0x00, 0xA5, 0xAB, 0xA5, 0xAC, /* 0x00-0x03 */
        0xC9, 0x78, 0x00, 0x00, 0xA6, 0x7C, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xCA, 0xCB, 0x00, 0x00, /* 0x08-0x0B */
@@ -4798,7 +4798,7 @@ static unsigned char u2c_5E[512] = {
        0x00, 0x00, 0x00, 0x00, 0xA4, 0x7B, 0xA4, 0xDC, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_5F[512] = {
+static const unsigned char u2c_5F[512] = {
        0x00, 0x00, 0xA5, 0xAF, 0xC9, 0xDD, 0x00, 0x00, /* 0x00-0x03 */
        0xA7, 0xCB, 0xCA, 0xD2, 0x00, 0x00, 0xCE, 0xBB, /* 0x04-0x07 */
        0xAB, 0xD9, 0x00, 0x00, 0xB9, 0xFA, 0xA4, 0x7C, /* 0x08-0x0B */
@@ -4866,7 +4866,7 @@ static unsigned char u2c_5F[512] = {
        0x00, 0x00, 0xA9, 0xBF, 0x00, 0x00, 0xA9, 0xC1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_60[512] = {
+static const unsigned char u2c_60[512] = {
        0xCA, 0xE4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xCC, 0xAF, 0xCC, 0xA2, 0xCC, 0x7E, /* 0x08-0x0B */
@@ -4934,7 +4934,7 @@ static unsigned char u2c_60[512] = {
        0xD9, 0x47, 0x00, 0x00, 0xD9, 0x48, 0xD9, 0x4E, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_61[512] = {
+static const unsigned char u2c_61[512] = {
        0xB4, 0x73, 0xB7, 0x54, 0x00, 0x00, 0xD9, 0x4A, /* 0x00-0x03 */
        0xD9, 0x4F, 0xD9, 0x43, 0xB7, 0x5E, 0x00, 0x00, /* 0x04-0x07 */
        0xB7, 0x55, 0xB4, 0x72, 0xD9, 0x41, 0xD9, 0x50, /* 0x08-0x0B */
@@ -5002,7 +5002,7 @@ static unsigned char u2c_61[512] = {
        0xC4, 0xDF, 0xF5, 0xCC, 0xC4, 0xE0, 0xC5, 0x74, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_62[512] = {
+static const unsigned char u2c_62[512] = {
        0xC5, 0xCA, 0xF7, 0xD9, 0x00, 0x00, 0xF7, 0xDA, /* 0x00-0x03 */
        0xF7, 0xDB, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xBA, /* 0x04-0x07 */
        0xA4, 0xE0, 0xC9, 0x7C, 0xA5, 0xB3, 0x00, 0x00, /* 0x08-0x0B */
@@ -5070,7 +5070,7 @@ static unsigned char u2c_62[512] = {
        0xAB, 0xF7, 0xAB, 0xFB, 0xAC, 0x42, 0xAE, 0xB3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_63[512] = {
+static const unsigned char u2c_63[512] = {
        0xCE, 0xE0, 0xAB, 0xF9, 0xAC, 0x45, 0xCE, 0xD9, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0xFC, /* 0x04-0x07 */
        0xAE, 0xB2, 0xAB, 0xF6, 0x00, 0x00, 0xCE, 0xD6, /* 0x08-0x0B */
@@ -5138,7 +5138,7 @@ static unsigned char u2c_63[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_64[512] = {
+static const unsigned char u2c_64[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xB7, 0x70, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xDD, 0x7C, 0xDD, 0xB1, 0xDD, 0xB6, /* 0x08-0x0B */
@@ -5206,7 +5206,7 @@ static unsigned char u2c_64[512] = {
        0xEF, 0xD7, 0xEF, 0xD3, 0xC2, 0x5A, 0xEF, 0xD1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_65[512] = {
+static const unsigned char u2c_65[512] = {
        0xC3, 0x6B, 0xEF, 0xD5, 0x00, 0x00, 0xEF, 0xD6, /* 0x00-0x03 */
        0xEF, 0xD2, 0x00, 0x00, 0xC2, 0x5B, 0xF2, 0x42, /* 0x04-0x07 */
        0x00, 0x00, 0xF2, 0x45, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5274,7 +5274,7 @@ static unsigned char u2c_65[512] = {
        0xCC, 0xC5, 0xCC, 0xCE, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_66[512] = {
+static const unsigned char u2c_66[512] = {
        0xA9, 0xFB, 0x00, 0x00, 0xA9, 0xF9, 0xCC, 0xCA, /* 0x00-0x03 */
        0xCC, 0xC6, 0xCC, 0xCD, 0xA9, 0xF8, 0xAA, 0x40, /* 0x04-0x07 */
        0xCC, 0xC8, 0xCC, 0xC4, 0xA9, 0xFE, 0xCC, 0xCB, /* 0x08-0x0B */
@@ -5342,7 +5342,7 @@ static unsigned char u2c_66[512] = {
        0xB0, 0xD2, 0x00, 0x00, 0xB4, 0xBF, 0xB4, 0xC0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_67[512] = {
+static const unsigned char u2c_67[512] = {
        0xB3, 0xCC, 0xD9, 0xA9, 0x00, 0x00, 0xB7, 0x7C, /* 0x00-0x03 */
        0xE1, 0xFA, 0xE1, 0xF9, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xA4, 0xEB, 0xA6, 0xB3, 0xCC, 0xD2, 0xAA, 0x42, /* 0x08-0x0B */
@@ -5410,7 +5410,7 @@ static unsigned char u2c_67[512] = {
        0xCF, 0x57, 0x00, 0x00, 0x00, 0x00, 0xAC, 0x55, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_68[512] = {
+static const unsigned char u2c_68[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5478,7 +5478,7 @@ static unsigned char u2c_68[512] = {
        0xD9, 0xC8, 0xD9, 0xC7, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_69[512] = {
+static const unsigned char u2c_69[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xD9, 0xAC, 0xB4, 0xC8, 0xD9, 0xD4, 0xD9, 0xBC, /* 0x04-0x07 */
        0xD9, 0xBE, 0x00, 0x00, 0xD9, 0xCB, 0xD9, 0xCA, /* 0x08-0x0B */
@@ -5546,7 +5546,7 @@ static unsigned char u2c_69[512] = {
        0xE5, 0xE4, 0xBC, 0xD1, 0xE5, 0xD8, 0xE5, 0xD3, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6A[512] = {
+static const unsigned char u2c_6A[512] = {
        0xE5, 0xCA, 0xBC, 0xCE, 0xBC, 0xD6, 0x00, 0x00, /* 0x00-0x03 */
        0xE5, 0xE7, 0xBC, 0xD7, 0xE5, 0xCB, 0xE5, 0xED, /* 0x04-0x07 */
        0xE5, 0xE0, 0xE5, 0xE6, 0xBC, 0xD4, 0x00, 0x00, /* 0x08-0x0B */
@@ -5614,7 +5614,7 @@ static unsigned char u2c_6A[512] = {
        0xF5, 0xCF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6B[512] = {
+static const unsigned char u2c_6B[512] = {
        0xF5, 0xD2, 0x00, 0x00, 0xF5, 0xCE, 0xF5, 0xD0, /* 0x00-0x03 */
        0xC4, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xF6, 0xE5, 0xF6, 0xE6, 0xC5, 0x76, 0xF6, 0xE4, /* 0x08-0x0B */
@@ -5682,7 +5682,7 @@ static unsigned char u2c_6B[512] = {
        0xDD, 0xFE, 0xB7, 0xB7, 0xE2, 0x6B, 0xE5, 0xF7, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6C[512] = {
+static const unsigned char u2c_6C[512] = {
        0xE5, 0xF6, 0xE5, 0xF5, 0xE5, 0xF8, 0xE9, 0xE7, /* 0x00-0x03 */
        0xE9, 0xE6, 0xBE, 0xFB, 0xE9, 0xE8, 0x00, 0x00, /* 0x04-0x07 */
        0xC0, 0xD6, 0xED, 0x4D, 0x00, 0x00, 0xEF, 0xEA, /* 0x08-0x0B */
@@ -5749,7 +5749,7 @@ static unsigned char u2c_6C[512] = {
        0x00, 0x00, 0xCD, 0x4C, 0x00, 0x00, 0x00, 0x00, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_6D[512] = {
+static const unsigned char u2c_6D[512] = {
        0xCF, 0x7C, 0xCF, 0xA1, 0x00, 0x00, 0xCF, 0xA4, /* 0x00-0x03 */
        0xCF, 0x77, 0x00, 0x00, 0x00, 0x00, 0xCF, 0xA7, /* 0x04-0x07 */
        0xCF, 0xAA, 0xCF, 0xAC, 0xCF, 0x74, 0xAC, 0x76, /* 0x08-0x0B */
@@ -5817,7 +5817,7 @@ static unsigned char u2c_6D[512] = {
        0xD9, 0xE7, 0xD6, 0x43, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6E[512] = {
+static const unsigned char u2c_6E[512] = {
        0xD5, 0xEB, 0x00, 0x00, 0x00, 0x00, 0xD9, 0xFC, /* 0x00-0x03 */
        0x00, 0x00, 0xB2, 0x4D, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -5885,7 +5885,7 @@ static unsigned char u2c_6E[512] = {
        0xE2, 0xB3, 0xE2, 0xAF, 0xBA, 0x75, 0xBA, 0xA1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_6F[512] = {
+static const unsigned char u2c_6F[512] = {
        0xE6, 0x53, 0xBA, 0xAE, 0xBA, 0x7D, 0xE2, 0x6F, /* 0x00-0x03 */
        0x00, 0x00, 0xE2, 0xAE, 0xBA, 0xA3, 0xE2, 0xAB, /* 0x04-0x07 */
        0xE2, 0xB8, 0xE2, 0x75, 0xE2, 0x7E, 0x00, 0x00, /* 0x08-0x0B */
@@ -5953,7 +5953,7 @@ static unsigned char u2c_6F[512] = {
        0xEF, 0xF6, 0x00, 0x00, 0xC2, 0x6F, 0xEF, 0xF2, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_70[512] = {
+static const unsigned char u2c_70[512] = {
        0xEF, 0xF3, 0xEF, 0xEE, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xE9, 0xF6, 0xEF, 0xEF, 0xC2, 0x70, 0xEF, 0xEB, /* 0x04-0x07 */
        0x00, 0x00, 0xC2, 0x6D, 0xEF, 0xF8, 0xC2, 0x6E, /* 0x08-0x0B */
@@ -6021,7 +6021,7 @@ static unsigned char u2c_70[512] = {
        0xD6, 0x52, 0xB2, 0x6C, 0x00, 0x00, 0xD6, 0x53, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_71[512] = {
+static const unsigned char u2c_71[512] = {
        0xD6, 0x56, 0x00, 0x00, 0xD6, 0x5A, 0x00, 0x00, /* 0x00-0x03 */
        0xD6, 0x4F, 0x00, 0x00, 0xD6, 0x54, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xB2, 0x6A, 0xB2, 0x6B, 0xD6, 0x59, /* 0x08-0x0B */
@@ -6089,7 +6089,7 @@ static unsigned char u2c_71[512] = {
        0xC2, 0x75, 0xEF, 0xFD, 0xC2, 0x76, 0xEF, 0xFA, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_72[512] = {
+static const unsigned char u2c_72[512] = {
        0x00, 0x00, 0xEF, 0xF9, 0xF2, 0x6C, 0xEF, 0xFC, /* 0x00-0x03 */
        0x00, 0x00, 0xF2, 0x6D, 0xC3, 0x7A, 0xF2, 0x6B, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xF2, 0x6A, 0x00, 0x00, /* 0x08-0x0B */
@@ -6157,7 +6157,7 @@ static unsigned char u2c_72[512] = {
        0xAF, 0x54, 0xAF, 0x56, 0xD2, 0xA6, 0xD6, 0x67, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_73[512] = {
+static const unsigned char u2c_73[512] = {
        0xD2, 0xA3, 0xD2, 0xAA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0x62, /* 0x04-0x07 */
        0xD6, 0x66, 0x00, 0x00, 0xD6, 0x65, 0xDA, 0x6E, /* 0x08-0x0B */
@@ -6225,7 +6225,7 @@ static unsigned char u2c_73[512] = {
        0xD6, 0x74, 0xD6, 0x70, 0xB2, 0x7B, 0xD6, 0x75, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_74[512] = {
+static const unsigned char u2c_74[512] = {
        0xD6, 0x72, 0xD6, 0x6F, 0x00, 0x00, 0xB2, 0x79, /* 0x00-0x03 */
        0xD6, 0x6E, 0xB2, 0x77, 0xB2, 0x7A, 0xD6, 0x71, /* 0x04-0x07 */
        0xD6, 0x79, 0xAF, 0x5B, 0xB2, 0x78, 0xD6, 0x77, /* 0x08-0x0B */
@@ -6293,7 +6293,7 @@ static unsigned char u2c_74[512] = {
        0x00, 0x00, 0xDE, 0xC2, 0xDE, 0xC1, 0xDE, 0xC0, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_75[512] = {
+static const unsigned char u2c_75[512] = {
        0xE2, 0xD5, 0x00, 0x00, 0xE2, 0xD6, 0xE2, 0xD7, /* 0x00-0x03 */
        0xBA, 0xC2, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xAD, /* 0x04-0x07 */
        0xE6, 0xAC, 0x00, 0x00, 0x00, 0x00, 0xEA, 0x69, /* 0x08-0x0B */
@@ -6361,7 +6361,7 @@ static unsigned char u2c_75[512] = {
        0xDE, 0xCC, 0xDE, 0xD4, 0xDE, 0xCB, 0xB7, 0xF5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_76[512] = {
+static const unsigned char u2c_76[512] = {
        0xB7, 0xEF, 0xB7, 0xF1, 0x00, 0x00, 0xDE, 0xC9, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xE2, 0xDB, 0xBA, 0xC7, 0xE2, 0xDF, 0xBA, 0xC6, /* 0x08-0x0B */
@@ -6429,7 +6429,7 @@ static unsigned char u2c_76[512] = {
        0xAC, 0xDF, 0x00, 0x00, 0xAC, 0xDE, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_77[512] = {
+static const unsigned char u2c_77[512] = {
        0x00, 0x00, 0xAC, 0xD9, 0x00, 0x00, 0xCF, 0xE1, /* 0x00-0x03 */
        0xCF, 0xE2, 0xCF, 0xE3, 0x00, 0x00, 0xAC, 0xE0, /* 0x04-0x07 */
        0xCF, 0xE0, 0xAC, 0xDC, 0xCF, 0xE4, 0xAC, 0xDD, /* 0x08-0x0B */
@@ -6497,7 +6497,7 @@ static unsigned char u2c_77[512] = {
        0xCD, 0x7B, 0xAA, 0xBF, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_78[512] = {
+static const unsigned char u2c_78[512] = {
        0x00, 0x00, 0x00, 0x00, 0xAC, 0xE2, 0xCF, 0xF2, /* 0x00-0x03 */
        0x00, 0x00, 0xCF, 0xED, 0xCF, 0xEA, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xCF, 0xF1, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6565,7 +6565,7 @@ static unsigned char u2c_78[512] = {
        0xED, 0xA9, 0xED, 0xA6, 0xED, 0xAD, 0xF0, 0x56, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_79[512] = {
+static const unsigned char u2c_79[512] = {
        0x00, 0x00, 0xC1, 0x47, 0xED, 0xA7, 0x00, 0x00, /* 0x00-0x03 */
        0xED, 0xAE, 0xED, 0xAB, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0xF0, 0x5A, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -6633,7 +6633,7 @@ static unsigned char u2c_79[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7A[512] = {
+static const unsigned char u2c_7A[512] = {
        0xB5, 0x7D, 0x00, 0x00, 0xDA, 0xD6, 0xDA, 0xD8, /* 0x00-0x03 */
        0xDA, 0xDA, 0xB5, 0x7C, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xB5, 0x7A, 0x00, 0x00, 0xDA, 0xD7, 0xB5, 0x7B, /* 0x08-0x0B */
@@ -6701,7 +6701,7 @@ static unsigned char u2c_7A[512] = {
        0x00, 0x00, 0xAC, 0xF2, 0x00, 0x00, 0xAC, 0xF1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7B[512] = {
+static const unsigned char u2c_7B[512] = {
        0xD0, 0x42, 0xD0, 0x43, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xD3, 0x40, 0xD3, 0x42, 0xAF, 0xB9, 0x00, 0x00, /* 0x04-0x07 */
        0xD3, 0x44, 0xD3, 0x47, 0xD3, 0x45, 0x00, 0x00, /* 0x08-0x0B */
@@ -6769,7 +6769,7 @@ static unsigned char u2c_7B[512] = {
        0x00, 0x00, 0xED, 0xC9, 0xC1, 0x4E, 0xED, 0xBE, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7C[512] = {
+static const unsigned char u2c_7C[512] = {
        0xED, 0xBD, 0xED, 0xC7, 0xED, 0xC4, 0xED, 0xC6, /* 0x00-0x03 */
        0x00, 0x00, 0xED, 0xBA, 0xED, 0xCA, 0xC1, 0x4C, /* 0x04-0x07 */
        0x00, 0x00, 0xED, 0xC5, 0xED, 0xCE, 0xED, 0xC2, /* 0x08-0x0B */
@@ -6837,7 +6837,7 @@ static unsigned char u2c_7C[512] = {
        0x00, 0x00, 0xCD, 0xA9, 0xAA, 0xC8, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_7D[512] = {
+static const unsigned char u2c_7D[512] = {
        0xAC, 0xF6, 0xD0, 0x4C, 0xAC, 0xF4, 0xD0, 0x4A, /* 0x00-0x03 */
        0xAC, 0xF9, 0xAC, 0xF5, 0xAC, 0xFA, 0xAC, 0xF8, /* 0x04-0x07 */
        0xD0, 0x4B, 0xAC, 0xF7, 0xAF, 0xBF, 0xAF, 0xBE, /* 0x08-0x0B */
@@ -6904,7 +6904,7 @@ static unsigned char u2c_7D[512] = {
        0x00, 0x00, 0xBD, 0x7B, 0xE6, 0xEA, 0xBD, 0x6F, /* 0xF8-0xFB */
 };
 
-static unsigned char u2c_7E[512] = {
+static const unsigned char u2c_7E[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0xE9, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0xBF, 0xA2, 0xBF, 0xA7, 0xBF, 0x7E, 0xEA, 0xD8, /* 0x08-0x0B */
@@ -6948,7 +6948,7 @@ static unsigned char u2c_7E[512] = {
        0xC6, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9C-0x9F */
 };
 
-static unsigned char u2c_7F[512] = {
+static const unsigned char u2c_7F[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7016,7 +7016,7 @@ static unsigned char u2c_7F[512] = {
        0xC1, 0x6C, 0xF2, 0xBE, 0xF2, 0xBF, 0xF4, 0xB1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_80[512] = {
+static const unsigned char u2c_80[512] = {
        0xC4, 0xA3, 0xA6, 0xD1, 0x00, 0x00, 0xA6, 0xD2, /* 0x00-0x03 */
        0xAC, 0xFE, 0xAA, 0xCC, 0xAF, 0xCF, 0xD0, 0x51, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xC0, /* 0x08-0x0B */
@@ -7084,7 +7084,7 @@ static unsigned char u2c_80[512] = {
        0xAF, 0xE2, 0xAF, 0xE0, 0xDB, 0x48, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_81[512] = {
+static const unsigned char u2c_81[512] = {
        0xD3, 0x6F, 0xD3, 0x6D, 0xAF, 0xD7, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xAF, 0xD9, 0xAF, 0xDC, 0x00, 0x00, /* 0x04-0x07 */
        0xAF, 0xDF, 0x00, 0x00, 0xAF, 0xE1, 0x00, 0x00, /* 0x08-0x0B */
@@ -7152,7 +7152,7 @@ static unsigned char u2c_81[512] = {
        0xA6, 0xDD, 0x00, 0x00, 0xAA, 0xD8, 0xD0, 0x68, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_82[512] = {
+static const unsigned char u2c_82[512] = {
        0xAF, 0xE6, 0xD3, 0x70, 0xB2, 0xEA, 0x00, 0x00, /* 0x00-0x03 */
        0xDB, 0x57, 0xB8, 0xA4, 0x00, 0x00, 0xBB, 0x50, /* 0x04-0x07 */
        0xBF, 0xB3, 0xC1, 0x7C, 0xC2, 0xC2, 0xF4, 0xB5, /* 0x08-0x0B */
@@ -7220,7 +7220,7 @@ static unsigned char u2c_82[512] = {
        0x00, 0x00, 0x00, 0x00, 0xD0, 0x6C, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_83[512] = {
+static const unsigned char u2c_83[512] = {
        0xD0, 0x70, 0xAD, 0x5F, 0xAD, 0x5A, 0xAD, 0x53, /* 0x00-0x03 */
        0xAD, 0x58, 0xAD, 0x54, 0xAD, 0x67, 0xD0, 0x6E, /* 0x04-0x07 */
        0xD3, 0xA5, 0xAD, 0x5B, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7288,7 +7288,7 @@ static unsigned char u2c_83[512] = {
        0xDB, 0x65, 0xB5, 0xE0, 0xDB, 0xB0, 0xDB, 0x71, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_84[512] = {
+static const unsigned char u2c_84[512] = {
        0x00, 0x00, 0xDB, 0x6D, 0x00, 0x00, 0xB5, 0xD1, /* 0x00-0x03 */
        0xB5, 0xE5, 0x00, 0x00, 0xDB, 0x7C, 0xB5, 0xE7, /* 0x04-0x07 */
        0x00, 0x00, 0xDB, 0x78, 0xB5, 0xDC, 0xB5, 0xD6, /* 0x08-0x0B */
@@ -7356,7 +7356,7 @@ static unsigned char u2c_84[512] = {
        0xE7, 0x64, 0xE7, 0x6E, 0xE7, 0x69, 0xBD, 0xB6, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_85[512] = {
+static const unsigned char u2c_85[512] = {
        0xE7, 0x4F, 0x00, 0x00, 0xE7, 0x6D, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xBD, 0xB7, 0xDF, 0xBD, /* 0x04-0x07 */
        0xE7, 0x5B, 0xE7, 0x52, 0xE7, 0x55, 0xE7, 0x7B, /* 0x08-0x0B */
@@ -7424,7 +7424,7 @@ static unsigned char u2c_85[512] = {
        0x00, 0x00, 0xF4, 0xC3, 0xF4, 0xBB, 0xF4, 0xB9, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_86[512] = {
+static const unsigned char u2c_86[512] = {
        0xF4, 0xBD, 0xF4, 0xBA, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0xF4, 0xBF, 0xF4, 0xC1, 0xC4, 0xAA, 0xC4, 0xAC, /* 0x04-0x07 */
        0x00, 0x00, 0xF4, 0xC0, 0xC4, 0xAD, 0xC4, 0xAB, /* 0x08-0x0B */
@@ -7492,7 +7492,7 @@ static unsigned char u2c_86[512] = {
        0x00, 0x00, 0x00, 0x00, 0xB8, 0xBF, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_87[512] = {
+static const unsigned char u2c_87[512] = {
        0xB8, 0xBE, 0xDF, 0xED, 0xB8, 0xC1, 0xB8, 0xC2, /* 0x00-0x03 */
        0xDF, 0xE3, 0xDF, 0xF0, 0xB8, 0xC3, 0xB8, 0xBD, /* 0x04-0x07 */
        0xB8, 0xBC, 0xDF, 0xEC, 0xB8, 0xC4, 0xDF, 0xE2, /* 0x08-0x0B */
@@ -7560,7 +7560,7 @@ static unsigned char u2c_87[512] = {
        0xF2, 0xE4, 0x00, 0x00, 0xC3, 0xCA, 0xF2, 0xE6, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_88[512] = {
+static const unsigned char u2c_88[512] = {
        0xF2, 0xDB, 0xF0, 0xCE, 0xF2, 0xE8, 0xF2, 0xDD, /* 0x00-0x03 */
        0x00, 0x00, 0xC3, 0xC7, 0xF2, 0xE3, 0x00, 0x00, /* 0x04-0x07 */
        0xF2, 0xE5, 0xF2, 0xE0, 0xF2, 0xE7, 0xF2, 0xE2, /* 0x08-0x0B */
@@ -7628,7 +7628,7 @@ static unsigned char u2c_88[512] = {
        0xE3, 0xFC, 0xBB, 0x73, 0xE3, 0xFA, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_89[512] = {
+static const unsigned char u2c_89[512] = {
        0x00, 0x00, 0xDB, 0xCE, 0xBB, 0x6F, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xE7, 0xC2, 0xE7, 0xC9, 0xBD, 0xC6, /* 0x04-0x07 */
        0x00, 0x00, 0xE7, 0xCD, 0xBD, 0xCA, 0xE7, 0xC5, /* 0x08-0x0B */
@@ -7696,7 +7696,7 @@ static unsigned char u2c_89[512] = {
        0xC5, 0xA9, 0x00, 0x00, 0xF7, 0xFE, 0xF9, 0x4C, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8A[512] = {
+static const unsigned char u2c_8A[512] = {
        0xA8, 0xA5, 0x00, 0x00, 0xAD, 0x71, 0xAD, 0x72, /* 0x00-0x03 */
        0xD0, 0xB0, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xB1, /* 0x04-0x07 */
        0xAD, 0x70, 0x00, 0x00, 0xB0, 0x54, 0x00, 0x00, /* 0x08-0x0B */
@@ -7764,7 +7764,7 @@ static unsigned char u2c_8A[512] = {
        0xBF, 0xDC, 0x00, 0x00, 0xBF, 0xD5, 0xEB, 0xAE, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8B[512] = {
+static const unsigned char u2c_8B[512] = {
        0xBF, 0xD1, 0xBF, 0xD6, 0xBF, 0xD7, 0x00, 0x00, /* 0x00-0x03 */
        0xC1, 0xC3, 0xEE, 0xA4, 0xEE, 0xAD, 0xEE, 0xAA, /* 0x04-0x07 */
        0xEE, 0xAC, 0x00, 0x00, 0xC1, 0xC0, 0xEE, 0xA5, /* 0x08-0x0B */
@@ -7808,7 +7808,7 @@ static unsigned char u2c_8B[512] = {
        0xC6, 0x6D, 0x00, 0x00, 0xF9, 0xA9, 0xF9, 0xC8, /* 0x9C-0x9F */
 };
 
-static unsigned char u2c_8C[512] = {
+static const unsigned char u2c_8C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -7876,7 +7876,7 @@ static unsigned char u2c_8C[512] = {
        0xC1, 0xCA, 0xC1, 0xC9, 0xF0, 0xF3, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8D[512] = {
+static const unsigned char u2c_8D[512] = {
        0xF0, 0xF6, 0x00, 0x00, 0xF0, 0xF5, 0x00, 0x00, /* 0x00-0x03 */
        0xF0, 0xF4, 0xC2, 0xD8, 0xF3, 0x48, 0xF3, 0x49, /* 0x04-0x07 */
        0xC3, 0xD8, 0xF3, 0x4A, 0xC3, 0xD9, 0x00, 0x00, /* 0x08-0x0B */
@@ -7944,7 +7944,7 @@ static unsigned char u2c_8D[512] = {
        0xBB, 0xB1, 0xE4, 0x5B, 0xE4, 0x61, 0xE4, 0x59, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8E[512] = {
+static const unsigned char u2c_8E[512] = {
        0xE4, 0x62, 0x00, 0x00, 0xE4, 0x58, 0xE4, 0x5D, /* 0x00-0x03 */
        0xE4, 0x63, 0xE4, 0x60, 0xE4, 0x5F, 0xE4, 0x5E, /* 0x04-0x07 */
        0x00, 0x00, 0xE4, 0x57, 0xE4, 0x5C, 0x00, 0x00, /* 0x08-0x0B */
@@ -8012,7 +8012,7 @@ static unsigned char u2c_8E[512] = {
        0xB6, 0x63, 0x00, 0x00, 0xB8, 0xFD, 0xE0, 0x75, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_8F[512] = {
+static const unsigned char u2c_8F[512] = {
        0xE0, 0x77, 0xE0, 0x76, 0xE0, 0x7B, 0xB8, 0xFB, /* 0x00-0x03 */
        0x00, 0x00, 0xE0, 0x78, 0xE0, 0x74, 0xE0, 0x79, /* 0x04-0x07 */
        0xE0, 0x7A, 0xB8, 0xFC, 0xB8, 0xFE, 0xE0, 0x7C, /* 0x08-0x0B */
@@ -8080,7 +8080,7 @@ static unsigned char u2c_8F[512] = {
        0xD3, 0xF0, 0xB0, 0x6C, 0xD3, 0xEA, 0xD3, 0xED, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_90[512] = {
+static const unsigned char u2c_90[512] = {
        0xB0, 0x68, 0xB0, 0x65, 0xD3, 0xEC, 0xB0, 0x6B, /* 0x00-0x03 */
        0xD3, 0xEF, 0xB0, 0x6D, 0xB0, 0x66, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD7, 0xE3, /* 0x08-0x0B */
@@ -8148,7 +8148,7 @@ static unsigned char u2c_90[512] = {
        0xDC, 0x54, 0xB3, 0xA3, 0xB6, 0x6E, 0xDC, 0x53, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_91[512] = {
+static const unsigned char u2c_91[512] = {
        0xDC, 0x59, 0xDC, 0x58, 0xB6, 0x6B, 0xDC, 0x5C, /* 0x00-0x03 */
        0xDC, 0x52, 0xDC, 0x5B, 0xDC, 0x50, 0xDC, 0x5A, /* 0x04-0x07 */
        0xDC, 0x55, 0xB6, 0x6D, 0x00, 0x00, 0xE0, 0xAA, /* 0x08-0x0B */
@@ -8216,7 +8216,7 @@ static unsigned char u2c_91[512] = {
        0x00, 0x00, 0xDC, 0x6D, 0x00, 0x00, 0xDC, 0x6C, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_92[512] = {
+static const unsigned char u2c_92[512] = {
        0xDC, 0x6A, 0xDC, 0x62, 0xDC, 0x71, 0xDC, 0x65, /* 0x00-0x03 */
        0xDC, 0x6F, 0xDC, 0x76, 0xDC, 0x6E, 0xB6, 0x79, /* 0x04-0x07 */
        0x00, 0x00, 0xB6, 0x75, 0xDC, 0x63, 0x00, 0x00, /* 0x08-0x0B */
@@ -8284,7 +8284,7 @@ static unsigned char u2c_92[512] = {
        0xBF, 0xFB, 0x00, 0x00, 0xEC, 0x41, 0xEB, 0xF8, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_93[512] = {
+static const unsigned char u2c_93[512] = {
        0xEC, 0x43, 0xEB, 0xE9, 0xEB, 0xF6, 0x00, 0x00, /* 0x00-0x03 */
        0xBF, 0xFD, 0x00, 0x00, 0xEB, 0xE1, 0x00, 0x00, /* 0x04-0x07 */
        0xEB, 0xDF, 0xEC, 0x42, 0x00, 0x00, 0xEC, 0x40, /* 0x08-0x0B */
@@ -8352,7 +8352,7 @@ static unsigned char u2c_93[512] = {
        0xF5, 0x40, 0xC4, 0xC3, 0xF4, 0xED, 0xF4, 0xFE, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_94[512] = {
+static const unsigned char u2c_94[512] = {
        0xF4, 0xF4, 0x00, 0x00, 0x00, 0x00, 0xC4, 0xC2, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xF5, 0x44, 0xF4, 0xF6, /* 0x04-0x07 */
        0x00, 0x00, 0xF4, 0xFB, 0xF4, 0xFD, 0xF4, 0xE7, /* 0x08-0x0B */
@@ -8389,7 +8389,7 @@ static unsigned char u2c_94[512] = {
        0xF9, 0xC0, 0xF9, 0xC1, 0xF9, 0xBF, 0xF9, 0xC9, /* 0x80-0x83 */
 };
 
-static unsigned char u2c_95[512] = {
+static const unsigned char u2c_95[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8451,7 +8451,7 @@ static unsigned char u2c_95[512] = {
        0xF6, 0x6C, 0xF6, 0x6B, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
 };
 
-static unsigned char u2c_96[512] = {
+static const unsigned char u2c_96[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8519,7 +8519,7 @@ static unsigned char u2c_96[512] = {
        0x00, 0x00, 0xE0, 0xD7, 0x00, 0x00, 0xE4, 0xBD, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_97[512] = {
+static const unsigned char u2c_97[512] = {
        0xBB, 0xDD, 0x00, 0x00, 0xE8, 0xAF, 0x00, 0x00, /* 0x00-0x03 */
        0xBE, 0x5D, 0xE8, 0xAD, 0xBE, 0x5E, 0xBE, 0x5F, /* 0x04-0x07 */
        0xE8, 0xAE, 0xBE, 0x60, 0x00, 0x00, 0xEC, 0x51, /* 0x08-0x0B */
@@ -8587,7 +8587,7 @@ static unsigned char u2c_97[512] = {
        0x00, 0x00, 0xF5, 0x4C, 0xF5, 0x4D, 0xC5, 0x54, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_98[512] = {
+static const unsigned char u2c_98[512] = {
        0xF8, 0x51, 0xAD, 0xB6, 0xB3, 0xBB, 0xB3, 0xBC, /* 0x00-0x03 */
        0xD8, 0x4E, 0xB6, 0xB5, 0xB6, 0xB6, 0xDC, 0xAC, /* 0x04-0x07 */
        0xB6, 0xB7, 0x00, 0x00, 0xB9, 0x7A, 0x00, 0x00, /* 0x08-0x0B */
@@ -8655,7 +8655,7 @@ static unsigned char u2c_98[512] = {
        0xB9, 0x7D, 0xB9, 0xA1, 0xB9, 0xA2, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_99[512] = {
+static const unsigned char u2c_99[512] = {
        0xE4, 0xCF, 0x00, 0x00, 0xE4, 0xCE, 0xBB, 0xE5, /* 0x00-0x03 */
        0x00, 0x00, 0xBB, 0xE6, 0x00, 0x00, 0xE4, 0xD0, /* 0x04-0x07 */
        0xE8, 0xBF, 0xBB, 0xE8, 0xBE, 0x69, 0x00, 0x00, /* 0x08-0x0B */
@@ -8723,7 +8723,7 @@ static unsigned char u2c_99[512] = {
        0xEF, 0x62, 0xEF, 0x60, 0xEF, 0x61, 0xC2, 0x40, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9A[512] = {
+static const unsigned char u2c_9A[512] = {
        0x00, 0x00, 0xC1, 0xFE, 0xEF, 0x58, 0xEF, 0x63, /* 0x00-0x03 */
        0xF1, 0xB3, 0xF1, 0xB6, 0xF1, 0xB8, 0xF1, 0xB7, /* 0x04-0x07 */
        0x00, 0x00, 0xF1, 0xB1, 0xF1, 0xB5, 0xF1, 0xB0, /* 0x08-0x0B */
@@ -8791,7 +8791,7 @@ static unsigned char u2c_9A[512] = {
        0xEF, 0x68, 0xEF, 0x66, 0xEF, 0x65, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9B[512] = {
+static const unsigned char u2c_9B[512] = {
        0x00, 0x00, 0xEF, 0x67, 0x00, 0x00, 0xC3, 0x4F, /* 0x00-0x03 */
        0xF1, 0xBC, 0xF1, 0xBD, 0xC3, 0x50, 0x00, 0x00, /* 0x04-0x07 */
        0xF1, 0xBB, 0x00, 0x00, 0xF3, 0xC3, 0xF3, 0xC2, /* 0x08-0x0B */
@@ -8859,7 +8859,7 @@ static unsigned char u2c_9B[512] = {
        0x00, 0x00, 0xC3, 0x56, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9C[512] = {
+static const unsigned char u2c_9C[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0xF5, 0x6D, 0xF5, 0x73, 0xF5, 0x71, /* 0x04-0x07 */
        0xF5, 0x6B, 0xF5, 0x76, 0x00, 0x00, 0xF5, 0x6A, /* 0x08-0x0B */
@@ -8927,7 +8927,7 @@ static unsigned char u2c_9C[512] = {
        0xE8, 0xE4, 0xE8, 0xE6, 0x00, 0x00, 0xE8, 0xE7, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9D[512] = {
+static const unsigned char u2c_9D[512] = {
        0xE8, 0xEA, 0x00, 0x00, 0x00, 0x00, 0xBE, 0xA1, /* 0x00-0x03 */
        0xE8, 0xEF, 0xE8, 0xEE, 0xBE, 0x7D, 0xE8, 0xE9, /* 0x04-0x07 */
        0xE8, 0xED, 0xBE, 0x7E, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -8995,7 +8995,7 @@ static unsigned char u2c_9D[512] = {
        0x00, 0x00, 0xF8, 0xE6, 0xF8, 0xDD, 0xF8, 0xE5, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9E[512] = {
+static const unsigned char u2c_9E[512] = {
        0xF8, 0xE2, 0xF8, 0xE3, 0xF8, 0xDC, 0xF8, 0xDF, /* 0x00-0x03 */
        0xF8, 0xE7, 0xF8, 0xE1, 0xF8, 0xE0, 0xF8, 0xDE, /* 0x04-0x07 */
        0x00, 0x00, 0xF8, 0xE4, 0x00, 0x00, 0xF9, 0x5D, /* 0x08-0x0B */
@@ -9063,7 +9063,7 @@ static unsigned char u2c_9E[512] = {
        0xF3, 0xF5, 0xE0, 0xEF, 0x00, 0x00, 0xEF, 0xB1, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_9F[512] = {
+static const unsigned char u2c_9F[512] = {
        0xF1, 0xE2, 0xF1, 0xE1, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0xF8, 0x78, 0xC6, 0x52, /* 0x04-0x07 */
        0x00, 0x00, 0xF9, 0x65, 0xF9, 0x7E, 0x00, 0x00, /* 0x08-0x0B */
@@ -9109,11 +9109,11 @@ static unsigned char u2c_9F[512] = {
        0xF9, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xA4-0xA7 */
 };
 
-static unsigned char u2c_DC[512] = {
+static const unsigned char u2c_DC[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
 };
 
-static unsigned char u2c_F9[512] = {
+static const unsigned char u2c_F9[512] = {
        0xB0, 0x5A, 0xA7, 0xF3, 0xA8, 0xAE, 0xB8, 0xEB, /* 0x00-0x03 */
        0xB7, 0xC6, 0xA6, 0xEA, 0xA5, 0x79, 0xC0, 0x74, /* 0x04-0x07 */
        0xC0, 0x74, 0xAB, 0xB4, 0xAA, 0xF7, 0xB3, 0xE2, /* 0x08-0x0B */
@@ -9181,7 +9181,7 @@ static unsigned char u2c_F9[512] = {
        0xC3, 0xD1, 0xA4, 0xB0, 0xAF, 0xF9, 0xA8, 0xEB, /* 0xFC-0xFF */
 };
 
-static unsigned char u2c_FA[512] = {
+static const unsigned char u2c_FA[512] = {
        0xA4, 0xC1, 0xAB, 0xD7, 0xA9, 0xDD, 0xBF, 0x7D, /* 0x00-0x03 */
        0xA6, 0x76, 0xAC, 0x7D, 0xBC, 0xC9, 0xBF, 0xE7, /* 0x04-0x07 */
        0xA6, 0xE6, 0xAD, 0xB0, 0xA8, 0xA3, 0xB9, 0xF8, /* 0x08-0x0B */
@@ -9196,7 +9196,7 @@ static unsigned char u2c_FA[512] = {
        0xC0, 0x5D, 0xC5, 0x62, 0x00, 0x00, 0x00, 0x00, /* 0x2C-0x2F */
 };
 
-static unsigned char u2c_FE[512] = {
+static const unsigned char u2c_FE[512] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0B */
@@ -9226,7 +9226,7 @@ static unsigned char u2c_FE[512] = {
        0xA2, 0x42, 0xA2, 0x4C, 0xA2, 0x4D, 0xA2, 0x4E, /* 0x68-0x6B */
 };
 
-static unsigned char u2c_FF[512] = {
+static const unsigned char u2c_FF[512] = {
        0x00, 0x00, 0xA1, 0x49, 0xA1, 0xA8, 0xA1, 0xAD, /* 0x00-0x03 */
        0xA2, 0x43, 0xA2, 0x48, 0xA1, 0xAE, 0xA1, 0xA6, /* 0x04-0x07 */
        0xA1, 0x5D, 0xA1, 0x5E, 0xA1, 0xAF, 0xA1, 0xCF, /* 0x08-0x0B */
@@ -9288,7 +9288,7 @@ static unsigned char u2c_FF[512] = {
        0x00, 0x00, 0xA2, 0x44, 0x00, 0x00, 0x00, 0x00, /* 0xE4-0xE7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        NULL,   NULL,   u2c_02, u2c_03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -9322,7 +9322,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   u2c_F9, u2c_FA, NULL,   NULL,   NULL,   u2c_FE, u2c_FF, };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -9358,7 +9358,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -9397,7 +9397,7 @@ static unsigned char charset2upper[256] = {
 static int uni2char(const wchar_t uni,
                        unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni&0xFF;
        unsigned char ch = (uni>>8)&0xFF;
        int n;
@@ -9429,7 +9429,7 @@ static int char2uni(const unsigned char *rawstring, int boundlen,
                        wchar_t *uni)
 {
        unsigned char ch, cl;
-       wchar_t *charset2uni;
+       const wchar_t *charset2uni;
        int n;
 
        if (boundlen <= 0)
index 73293511578b09355d25d1acad13b968b41e138e..7424929a278b0088ba92772ffb1b3a7644864906 100644 (file)
@@ -57,7 +57,7 @@ static struct nls_table *p_nls;
 } while(0)
 
 /* SJIS IBM extended characters to EUC map */
-static unsigned char sjisibm2euc_map[][2] = {
+static const unsigned char sjisibm2euc_map[][2] = {
        {0xF3, 0xF3}, {0xF3, 0xF4}, {0xF3, 0xF5}, {0xF3, 0xF6}, {0xF3, 0xF7},
        {0xF3, 0xF8}, {0xF3, 0xF9}, {0xF3, 0xFA}, {0xF3, 0xFB}, {0xF3, 0xFC},
        {0xF3, 0xFD}, {0xF3, 0xFE}, {0xF4, 0xA1}, {0xF4, 0xA2}, {0xF4, 0xA3},
@@ -243,7 +243,7 @@ static struct {
 };
 
 /* EUC to SJIS IBM extended characters map (G3 Upper block) */
-static unsigned char euc2sjisibm_g3upper_map[][2] = {
+static const unsigned char euc2sjisibm_g3upper_map[][2] = {
        {0xFA, 0x40}, {0xFA, 0x41}, {0xFA, 0x42}, {0xFA, 0x43}, {0xFA, 0x44},
        {0xFA, 0x45}, {0xFA, 0x46}, {0xFA, 0x47}, {0xFA, 0x48}, {0xFA, 0x49},
        {0xFA, 0x4A}, {0xFA, 0x4B}, {0xFA, 0x4C}, {0xFA, 0x4D}, {0xFA, 0x4E},
index 2483c3c6c1c16b64669e3c83ed7e8b0b520325d6..7b951bb5849cb52e48a30dc8c3f3187949c581bb 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x00fd, 0x00fe, 0x00ff,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,11 +132,11 @@ static unsigned char page00[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -172,7 +172,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -210,7 +210,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 7b8721d7436855950a0ef042d4e37344d84cefb6..c4d52ea9f0921a6530bc96de8e02529643856f9e 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -94,7 +94,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x017c, 0x017e, 0x2019,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -130,7 +130,7 @@ static unsigned char page00[256] = {
        0xb8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0xc2, 0xe2, 0x00, 0x00, 0xc0, 0xe0, 0xc3, 0xe3, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0xc7, 0xe7, 0x00, 0x00, 0xcb, 0xeb, /* 0x10-0x17 */
@@ -149,14 +149,14 @@ static unsigned char page01[256] = {
        0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe, 0x00, /* 0x78-0x7f */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
        0x00, 0xff, 0x00, 0x00, 0xb4, 0xa1, 0xa5, 0x00, /* 0x18-0x1f */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
          NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
          NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -164,7 +164,7 @@ static unsigned char *page_uni2charset[256] = {
        page20,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -200,7 +200,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -238,7 +238,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 2e895e638dba5091d2cd935b76998b71df6ea4fc..dc02600c7fe16828d3bb4688652bd46be363e485 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003, 
        0x0004, 0x0005, 0x0006, 0x0007, 
@@ -101,7 +101,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x00fd, 0x0177, 0x00ff, 
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -137,7 +137,7 @@ static unsigned char page00[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -173,7 +173,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page1e[256] = {
+static const unsigned char page1e[256] = {
        0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -209,7 +209,7 @@ static unsigned char page1e[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
 
@@ -220,7 +220,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -256,7 +256,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -294,7 +294,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 5c91592779fe79849141aaf24121e81f8804af23..3c7dfc832ef1309fb095d445a33ad529ebdd3a11 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -94,7 +94,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x00fd, 0x00fe, 0x00ff,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -130,7 +130,7 @@ static unsigned char page00[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -149,7 +149,7 @@ static unsigned char page01[256] = {
        0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -175,7 +175,7 @@ static unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
 
@@ -186,7 +186,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -222,7 +222,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -260,7 +260,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 892d38fe95303ad8dcc92dd63aea42803d49e9a6..a2d2197e4c7740e5ea808e196945b8806e74fbc8 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x00fd, 0x0163, 0x02d9,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xb1, 0xc6, 0xe6, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */
        0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -151,7 +151,7 @@ static unsigned char page01[256] = {
        0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe, 0x00, /* 0x78-0x7f */
 };
 
-static unsigned char page02[256] = {
+static const unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -183,11 +183,11 @@ static unsigned char page02[256] = {
        0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -223,7 +223,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -261,7 +261,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 49317bcdb4be7330684f1bf36088c124d7dd0cc7..a61e0daa3a860a6472e52b29f1b640b599f9b0a4 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x016d, 0x015d, 0x02d9,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0xc6, 0xe6, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -151,7 +151,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, /* 0x78-0x7f */
 };
 
-static unsigned char page02[256] = {
+static const unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -183,11 +183,11 @@ static unsigned char page02[256] = {
        0xa2, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -223,7 +223,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -261,7 +261,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 9f3b9368c2cfc7519d27bfec1704414b5fedd9ac..e8ff555483b673526845585366b71ba573b27d04 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x0169, 0x016b, 0x02d9,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */
        0xd0, 0xf0, 0xaa, 0xba, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */
@@ -151,7 +151,7 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe, 0x00, /* 0x78-0x7f */
 };
 
-static unsigned char page02[256] = {
+static const unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -183,11 +183,11 @@ static unsigned char page02[256] = {
        0x00, 0xff, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, page02, NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -223,7 +223,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -261,7 +261,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 001a2bb132cece6f61f729bb55fde89e649a7974..4721e89301249c2e7e765ac19efdabee4cb9baec 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x045c, 0x00a7, 0x045e, 0x045f,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -122,7 +122,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
 };
 
-static unsigned char page04[256] = {
+static const unsigned char page04[256] = {
        0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */
        0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */
        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */
@@ -137,13 +137,13 @@ static unsigned char page04[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */
 };
 
-static unsigned char page21[256] = {
+static const unsigned char page21[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, /* 0x10-0x17 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   page04, NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -151,7 +151,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   page21, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -187,7 +187,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 8cec03d66088cf63781c3180ae1c55419a015857..01a517d6d306a18fe7d48b811529a00a59c5eb39 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x0000, 0x0000, 0x0000, 0x0000,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -122,7 +122,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
 };
 
-static unsigned char page06[256] = {
+static const unsigned char page06[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -139,11 +139,11 @@ static unsigned char page06[256] = {
        0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   NULL,   NULL,   page06, NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -179,7 +179,7 @@ static unsigned char charset2lower[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -216,7 +216,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 1be707d5ac3149b208d013eadca113632ace9968..2d27b93ef19e152bd4415e6e9f62e8bcc2472394 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x03cc, 0x03cd, 0x03ce, 0x0000,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -124,7 +124,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */
 };
 
-static unsigned char page02[256] = {
+static const unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -152,7 +152,7 @@ static unsigned char page02[256] = {
        0x00, 0x00, 0x00, 0x00, 0xa2, 0xa1, 0x00, 0x00, /* 0xb8-0xbf */
 };
 
-static unsigned char page03[256] = {
+static const unsigned char page03[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -182,13 +182,13 @@ static unsigned char page03[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */
 };
 
-static unsigned char page20[256] = {
+static const unsigned char page20[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, /* 0x10-0x17 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   page02, page03, NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -196,7 +196,7 @@ static unsigned char *page_uni2charset[256] = {
        page20, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -232,7 +232,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -270,7 +270,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 8c0146f73834b694ef2836bd0640d8f9ce6081a6..694bf070c72102535c122499bfd0e88bb6adacf7 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x00fc, 0x0131, 0x015f, 0x00ff,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -132,7 +132,7 @@ static unsigned char page00[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char page01[256] = {
+static const unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -147,11 +147,11 @@ static unsigned char page01[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, page01, NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -187,7 +187,7 @@ static unsigned char charset2lower[256] = {
        0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -225,7 +225,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index fefbe0807265bbf838321894f38be9bf4791ccb0..43875310540dd83d3cf354013fdc0b91bbf35140 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -96,7 +96,7 @@ static wchar_t charset2uni[256] = {
        0x042d, 0x0429, 0x0427, 0x042a,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -131,7 +131,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */
 };
 
-static unsigned char page04[256] = {
+static const unsigned char page04[256] = {
        0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */
@@ -145,7 +145,7 @@ static unsigned char page04[256] = {
        0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -161,7 +161,7 @@ static unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page23[256] = {
+static const unsigned char page23[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -169,7 +169,7 @@ static unsigned char page23[256] = {
        0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -194,7 +194,7 @@ static unsigned char page25[256] = {
        0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   page04, NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -202,7 +202,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -238,7 +238,7 @@ static unsigned char charset2lower[256] = {
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -276,7 +276,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index 015070211f229d721b73db16ad8edc32895c83c6..8c9f0292b5ae88318249c53708b31ae600dafa81 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/nls.h>
 #include <linux/errno.h>
 
-static wchar_t charset2uni[256] = {
+static const wchar_t charset2uni[256] = {
        /* 0x00*/
        0x0000, 0x0001, 0x0002, 0x0003,
        0x0004, 0x0005, 0x0006, 0x0007,
@@ -94,7 +94,7 @@ static wchar_t charset2uni[256] = {
        0x042d, 0x0429, 0x0427, 0x042a,
 };
 
-static unsigned char page00[256] = {
+static const unsigned char page00[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -129,7 +129,7 @@ static unsigned char page00[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */
 };
 
-static unsigned char page04[256] = {
+static const unsigned char page04[256] = {
        0x00, 0xb3, 0x00, 0x00, 0xb4, 0x00, 0xb6, 0xb7, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */
@@ -152,7 +152,7 @@ static unsigned char page04[256] = {
        0xbd, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
 };
 
-static unsigned char page22[256] = {
+static const unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -168,7 +168,7 @@ static unsigned char page22[256] = {
        0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */
 };
 
-static unsigned char page23[256] = {
+static const unsigned char page23[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -176,7 +176,7 @@ static unsigned char page23[256] = {
        0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
 };
 
-static unsigned char page25[256] = {
+static const unsigned char page25[256] = {
        0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
        0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */
        0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */
@@ -201,7 +201,7 @@ static unsigned char page25[256] = {
        0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 };
 
-static unsigned char *page_uni2charset[256] = {
+static const unsigned char *const page_uni2charset[256] = {
        page00, NULL,   NULL,   NULL,   page04, NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
@@ -209,7 +209,7 @@ static unsigned char *page_uni2charset[256] = {
        NULL,   NULL,   page22, page23, NULL,   page25, NULL,   NULL,   
 };
 
-static unsigned char charset2lower[256] = {
+static const unsigned char charset2lower[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -245,7 +245,7 @@ static unsigned char charset2lower[256] = {
        0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xf8-0xff */
 };
 
-static unsigned char charset2upper[256] = {
+static const unsigned char charset2upper[256] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */
        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */
        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */
@@ -283,7 +283,7 @@ static unsigned char charset2upper[256] = {
 
 static int uni2char(wchar_t uni, unsigned char *out, int boundlen)
 {
-       unsigned char *uni2charset;
+       const unsigned char *uni2charset;
        unsigned char cl = uni & 0x00ff;
        unsigned char ch = (uni & 0xff00) >> 8;
 
index c814204d4ea0d8ab6533ebd2c59d0b626669bc61..6cd08dfdc2ed17afcacb1985e2c444910f18e4dd 100644 (file)
@@ -61,7 +61,7 @@ static int ntfs_file_open(struct inode *vi, struct file *filp)
 {
        if (sizeof(unsigned long) < 8) {
                if (i_size_read(vi) > MAX_LFS_FILESIZE)
-                       return -EFBIG;
+                       return -EOVERFLOW;
        }
        return generic_file_open(vi, filp);
 }
index 90c4e3a29706c1210ccce4d9d94dc37e3df0659d..3e76f3b216bc2add33b2d3298f7bbe40233e3232 100644 (file)
@@ -2381,14 +2381,14 @@ static void ntfs_put_super(struct super_block *sb)
         */
        ntfs_commit_inode(vol->mft_ino);
        write_inode_now(vol->mft_ino, 1);
-       if (!list_empty(&sb->s_dirty)) {
+       if (sb_has_dirty_inodes(sb)) {
                const char *s1, *s2;
 
                mutex_lock(&vol->mft_ino->i_mutex);
                truncate_inode_pages(vol->mft_ino->i_mapping, 0);
                mutex_unlock(&vol->mft_ino->i_mutex);
                write_inode_now(vol->mft_ino, 1);
-               if (!list_empty(&sb->s_dirty)) {
+               if (sb_has_dirty_inodes(sb)) {
                        static const char *_s1 = "inodes";
                        static const char *_s2 = "";
                        s1 = _s1;
@@ -3080,8 +3080,7 @@ struct kmem_cache *ntfs_inode_cache;
 struct kmem_cache *ntfs_big_inode_cache;
 
 /* Init once constructor for the inode slab cache. */
-static void ntfs_big_inode_init_once(void *foo, struct kmem_cache *cachep,
-               unsigned long flags)
+static void ntfs_big_inode_init_once(struct kmem_cache *cachep, void *foo)
 {
        ntfs_inode *ni = (ntfs_inode *)foo;
 
index 7453b70c1a1901ee6ee551be4a258a20a63d9526..6a2f143e269c338b09989595264722dcf742e4e4 100644 (file)
@@ -586,7 +586,7 @@ bail:
 }
 
 static int ocfs2_dir_foreach_blk_id(struct inode *inode,
-                                   unsigned long *f_version,
+                                   u64 *f_version,
                                    loff_t *f_pos, void *priv,
                                    filldir_t filldir, int *filldir_err)
 {
@@ -648,7 +648,7 @@ revalidate:
                         * not the directory has been modified
                         * during the copy operation.
                         */
-                       unsigned long version = *f_version;
+                       u64 version = *f_version;
                        unsigned char d_type = DT_UNKNOWN;
 
                        if (de->file_type < OCFS2_FT_MAX)
@@ -677,7 +677,7 @@ out:
 }
 
 static int ocfs2_dir_foreach_blk_el(struct inode *inode,
-                                   unsigned long *f_version,
+                                   u64 *f_version,
                                    loff_t *f_pos, void *priv,
                                    filldir_t filldir, int *filldir_err)
 {
@@ -798,7 +798,7 @@ out:
        return stored;
 }
 
-static int ocfs2_dir_foreach_blk(struct inode *inode, unsigned long *f_version,
+static int ocfs2_dir_foreach_blk(struct inode *inode, u64 *f_version,
                                 loff_t *f_pos, void *priv, filldir_t filldir,
                                 int *filldir_err)
 {
@@ -818,7 +818,7 @@ int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv,
                      filldir_t filldir)
 {
        int ret = 0, filldir_err = 0;
-       unsigned long version = inode->i_version;
+       u64 version = inode->i_version;
 
        while (*f_pos < i_size_read(inode)) {
                ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv,
index 7418dc83de1c050039aa2b53719fc96ac3129437..6639baab079856af2d6ff3d336450feb7303db8b 100644 (file)
@@ -255,9 +255,8 @@ static ssize_t dlmfs_file_write(struct file *filp,
        return writelen;
 }
 
-static void dlmfs_init_once(void *foo,
-                           struct kmem_cache *cachep,
-                           unsigned long flags)
+static void dlmfs_init_once(struct kmem_cache *cachep,
+                           void *foo)
 {
        struct dlmfs_inode_private *ip =
                (struct dlmfs_inode_private *) foo;
@@ -588,13 +587,17 @@ static int __init init_dlmfs_fs(void)
 
        dlmfs_print_version();
 
+       status = bdi_init(&dlmfs_backing_dev_info);
+       if (status)
+               return status;
+
        dlmfs_inode_cache = kmem_cache_create("dlmfs_inode_cache",
                                sizeof(struct dlmfs_inode_private),
                                0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
                                        SLAB_MEM_SPREAD),
                                dlmfs_init_once);
        if (!dlmfs_inode_cache)
-               return -ENOMEM;
+               goto bail;
        cleanup_inode = 1;
 
        user_dlm_worker = create_singlethread_workqueue("user_dlm");
@@ -611,6 +614,7 @@ bail:
                        kmem_cache_destroy(dlmfs_inode_cache);
                if (cleanup_worker)
                        destroy_workqueue(user_dlm_worker);
+               bdi_destroy(&dlmfs_backing_dev_info);
        } else
                printk("OCFS2 User DLM kernel interface loaded\n");
        return status;
@@ -624,6 +628,8 @@ static void __exit exit_dlmfs_fs(void)
        destroy_workqueue(user_dlm_worker);
 
        kmem_cache_destroy(dlmfs_inode_cache);
+
+       bdi_destroy(&dlmfs_backing_dev_info);
 }
 
 MODULE_AUTHOR("Oracle");
index 0e2a1b45bf922f909936d1af3212e4e6d469edfd..be562ac3e89c25e690e2701cb500cf5c5c12ae77 100644 (file)
@@ -1000,9 +1000,7 @@ bail:
        return status;
 }
 
-static void ocfs2_inode_init_once(void *data,
-                                 struct kmem_cache *cachep,
-                                 unsigned long flags)
+static void ocfs2_inode_init_once(struct kmem_cache *cachep, void *data)
 {
        struct ocfs2_inode_info *oi = data;
 
index 044bfa891c94c5e0d8330eea20893bf0ffffbd55..75385144df7da2fe10e8158a27322ec473a96d37 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -658,7 +658,8 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
                newattrs.ia_gid = group;
        }
        if (!S_ISDIR(inode->i_mode))
-               newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
+               newattrs.ia_valid |=
+                       ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
        mutex_lock(&inode->i_mutex);
        error = notify_change(dentry, &newattrs);
        mutex_unlock(&inode->i_mutex);
@@ -1177,7 +1178,7 @@ asmlinkage long sys_vhangup(void)
 int generic_file_open(struct inode * inode, struct file * filp)
 {
        if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
-               return -EFBIG;
+               return -EOVERFLOW;
        return 0;
 }
 
index dd86be2aa6c922b0bc4ec0407fa4effd8c50be2c..d88173840082aad76ab84a2c086c3d06bb73bef9 100644 (file)
@@ -415,7 +415,7 @@ static struct file_system_type openprom_fs_type = {
        .kill_sb        = kill_anon_super,
 };
 
-static void op_inode_init_once(void *data, struct kmem_cache * cachep, unsigned long flags)
+static void op_inode_init_once(struct kmem_cache * cachep, void *data)
 {
        struct op_inode_info *oi = (struct op_inode_info *) data;
 
index 78fdfea1a7f87a9afe95a24e0566279c1fbd69ab..4fe74d156416f0936b686d57dc6ee7bd2518dba5 100644 (file)
@@ -199,27 +199,6 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
         (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
         security_ptrace(current,task) == 0))
 
-static int proc_pid_environ(struct task_struct *task, char * buffer)
-{
-       int res = 0;
-       struct mm_struct *mm = get_task_mm(task);
-       if (mm) {
-               unsigned int len;
-
-               res = -ESRCH;
-               if (!ptrace_may_attach(task))
-                       goto out;
-
-               len  = mm->env_end - mm->env_start;
-               if (len > PAGE_SIZE)
-                       len = PAGE_SIZE;
-               res = access_process_vm(task, mm->env_start, buffer, len, 0);
-out:
-               mmput(mm);
-       }
-       return res;
-}
-
 static int proc_pid_cmdline(struct task_struct *task, char * buffer)
 {
        int res = 0;
@@ -658,6 +637,76 @@ static const struct file_operations proc_mem_operations = {
        .open           = mem_open,
 };
 
+static ssize_t environ_read(struct file *file, char __user *buf,
+                       size_t count, loff_t *ppos)
+{
+       struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
+       char *page;
+       unsigned long src = *ppos;
+       int ret = -ESRCH;
+       struct mm_struct *mm;
+
+       if (!task)
+               goto out_no_task;
+
+       if (!ptrace_may_attach(task))
+               goto out;
+
+       ret = -ENOMEM;
+       page = (char *)__get_free_page(GFP_TEMPORARY);
+       if (!page)
+               goto out;
+
+       ret = 0;
+
+       mm = get_task_mm(task);
+       if (!mm)
+               goto out_free;
+
+       while (count > 0) {
+               int this_len, retval, max_len;
+
+               this_len = mm->env_end - (mm->env_start + src);
+
+               if (this_len <= 0)
+                       break;
+
+               max_len = (count > PAGE_SIZE) ? PAGE_SIZE : count;
+               this_len = (this_len > max_len) ? max_len : this_len;
+
+               retval = access_process_vm(task, (mm->env_start + src),
+                       page, this_len, 0);
+
+               if (retval <= 0) {
+                       ret = retval;
+                       break;
+               }
+
+               if (copy_to_user(buf, page, retval)) {
+                       ret = -EFAULT;
+                       break;
+               }
+
+               ret += retval;
+               src += retval;
+               buf += retval;
+               count -= retval;
+       }
+       *ppos = src;
+
+       mmput(mm);
+out_free:
+       free_page((unsigned long) page);
+out:
+       put_task_struct(task);
+out_no_task:
+       return ret;
+}
+
+static const struct file_operations proc_environ_operations = {
+       .read           = environ_read,
+};
+
 static ssize_t oom_adjust_read(struct file *file, char __user *buf,
                                size_t count, loff_t *ppos)
 {
@@ -2049,7 +2098,7 @@ static const struct pid_entry tgid_base_stuff[] = {
        DIR("task",       S_IRUGO|S_IXUGO, task),
        DIR("fd",         S_IRUSR|S_IXUSR, fd),
        DIR("fdinfo",     S_IRUSR|S_IXUSR, fdinfo),
-       INF("environ",    S_IRUSR, pid_environ),
+       REG("environ",    S_IRUSR, environ),
        INF("auxv",       S_IRUSR, pid_auxv),
        INF("status",     S_IRUGO, pid_status),
 #ifdef CONFIG_SCHED_DEBUG
@@ -2336,7 +2385,7 @@ out_no_task:
 static const struct pid_entry tid_base_stuff[] = {
        DIR("fd",        S_IRUSR|S_IXUSR, fd),
        DIR("fdinfo",    S_IRUSR|S_IXUSR, fdinfo),
-       INF("environ",   S_IRUSR, pid_environ),
+       REG("environ",   S_IRUSR, environ),
        INF("auxv",      S_IRUSR, pid_auxv),
        INF("status",    S_IRUGO, pid_status),
 #ifdef CONFIG_SCHED_DEBUG
@@ -2586,7 +2635,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
        /* f_version caches the tgid value that the last readdir call couldn't
         * return. lseek aka telldir automagically resets f_version to 0.
         */
-       tid = filp->f_version;
+       tid = (int)filp->f_version;
        filp->f_version = 0;
        for (task = first_tid(leader, tid, pos - 2);
             task;
@@ -2595,7 +2644,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
                if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) {
                        /* returning this tgid failed, save it as the first
                         * pid for the next readir call */
-                       filp->f_version = tid;
+                       filp->f_version = (u64)tid;
                        put_task_struct(task);
                        break;
                }
index 0e4d37c93eea70208a82a5861735817209082fd7..99ca00485fc307ff52014dc303b60fd918f87de4 100644 (file)
@@ -107,7 +107,7 @@ static void proc_destroy_inode(struct inode *inode)
        kmem_cache_free(proc_inode_cachep, PROC_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct proc_inode *ei = (struct proc_inode *) foo;
 
@@ -119,10 +119,8 @@ int __init proc_init_inodecache(void)
        proc_inode_cachep = kmem_cache_create("proc_inode_cache",
                                             sizeof(struct proc_inode),
                                             0, (SLAB_RECLAIM_ACCOUNT|
-                                               SLAB_MEM_SPREAD),
+                                               SLAB_MEM_SPREAD|SLAB_PANIC),
                                             init_once);
-       if (proc_inode_cachep == NULL)
-               return -ENOMEM;
        return 0;
 }
 
index 25d2d9c6e329c6b0eb04524cd80d2538cb3f4118..8ae221dfd0101ea3048de30bbf3444a89f147ea0 100644 (file)
@@ -8,27 +8,10 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/time.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/mman.h>
-#include <linux/proc_fs.h>
-#include <linux/mm.h>
-#include <linux/mmzone.h>
-#include <linux/pagemap.h>
-#include <linux/swap.h>
-#include <linux/slab.h>
-#include <linux/smp.h>
-#include <linux/seq_file.h>
-#include <linux/hugetlb.h>
+#include <linux/spinlock.h>
 #include <linux/vmalloc.h>
-#include <asm/uaccess.h>
+#include <linux/highmem.h>
 #include <asm/pgtable.h>
-#include <asm/tlb.h>
-#include <asm/div64.h>
 #include "internal.h"
 
 void get_vmalloc_info(struct vmalloc_info *vmi)
index 5de7f874d95c0fce684261bb52d7e44d1d957271..d6dc72c78bc1bd9a1d36fb29e6728450fcbb34e5 100644 (file)
@@ -526,11 +526,8 @@ static int show_stat(struct seq_file *p, void *v)
        }
        seq_printf(p, "intr %llu", (unsigned long long)sum);
 
-#ifndef CONFIG_SMP
-       /* Touches too many cache lines on SMP setups */
        for (i = 0; i < NR_IRQS; i++)
                seq_printf(p, " %u", per_irq_sum[i]);
-#endif
 
        seq_printf(p,
                "\nctxt %llu\n"
index df8bd87e49b724f3014f65245aa48922792c58c8..638bdb963213bd70e2b0dab87f71cec1ce3d7f9f 100644 (file)
@@ -536,8 +536,7 @@ static void qnx4_destroy_inode(struct inode *inode)
        kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode));
 }
 
-static void init_once(void *foo, struct kmem_cache * cachep,
-                     unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo;
 
index 5a0236e02ee1f28a828e975ebbef3df998b6ec30..c71e65dcad2575f60f5776f88061681d1f24f33f 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the linux ramfs routines.
 #
 
-obj-$(CONFIG_RAMFS) += ramfs.o
+obj-y += ramfs.o
 
 file-mmu-y := file-nommu.o
 file-mmu-$(CONFIG_MMU) := file-mmu.o
index ef2b46d099ffb195e45c4c462a68a55090147580..8428d5b2711de8e901b75dd3c209039c3e2d429a 100644 (file)
@@ -223,7 +223,17 @@ module_exit(exit_ramfs_fs)
 
 int __init init_rootfs(void)
 {
-       return register_filesystem(&rootfs_fs_type);
+       int err;
+
+       err = bdi_init(&ramfs_backing_dev_info);
+       if (err)
+               return err;
+
+       err = register_filesystem(&rootfs_fs_type);
+       if (err)
+               bdi_destroy(&ramfs_backing_dev_info);
+
+       return err;
 }
 
 MODULE_LICENSE("GPL");
index b286ccb085879172a6bac6f5055c14b4c3cd363a..2a5dd34649b34eb2c81275c57ef7afdf9a6ec781 100644 (file)
@@ -1201,63 +1201,6 @@ int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t * hint, b_blocknr_t * new
        return ret;
 }
 
-/* These 2 functions are here to provide blocks reservation to the rest of kernel */
-/* Reserve @blocks amount of blocks in fs pointed by @sb. Caller must make sure
-   there are actually this much blocks on the FS available */
-void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb,     /* super block of
-                                                                          filesystem where
-                                                                          blocks should be
-                                                                          reserved */
-                                          int blocks   /* How much to reserve */
-    )
-{
-
-       /* Fast case, if reservation is zero - exit immediately. */
-       if (!blocks)
-               return;
-
-       spin_lock(&REISERFS_SB(sb)->bitmap_lock);
-       REISERFS_SB(sb)->reserved_blocks += blocks;
-       spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
-}
-
-/* Unreserve @blocks amount of blocks in fs pointed by @sb */
-void reiserfs_release_claimed_blocks(struct super_block *sb,   /* super block of
-                                                                  filesystem where
-                                                                  blocks should be
-                                                                  reserved */
-                                    int blocks /* How much to unreserve */
-    )
-{
-
-       /* Fast case, if unreservation is zero - exit immediately. */
-       if (!blocks)
-               return;
-
-       spin_lock(&REISERFS_SB(sb)->bitmap_lock);
-       REISERFS_SB(sb)->reserved_blocks -= blocks;
-       spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
-       RFALSE(REISERFS_SB(sb)->reserved_blocks < 0,
-              "amount of blocks reserved became zero?");
-}
-
-/* This function estimates how much pages we will be able to write to FS
-   used for reiserfs_file_write() purposes for now. */
-int reiserfs_can_fit_pages(struct super_block *sb      /* superblock of filesystem
-                                                          to estimate space */ )
-{
-       int space;
-
-       spin_lock(&REISERFS_SB(sb)->bitmap_lock);
-       space =
-           (SB_FREE_BLOCKS(sb) -
-            REISERFS_SB(sb)->reserved_blocks) >> (PAGE_CACHE_SHIFT -
-                                                  sb->s_blocksize_bits);
-       spin_unlock(&REISERFS_SB(sb)->bitmap_lock);
-
-       return space > 0 ? space : 0;
-}
-
 void reiserfs_cache_bitmap_metadata(struct super_block *sb,
                                     struct buffer_head *bh,
                                     struct reiserfs_bitmap_info *info)
index ffbfc2caaf2050990de21e5a4348a789fbd65c99..e6b03d2020c1c51aedbe6e443ccc7e236c50d242 100644 (file)
@@ -121,6 +121,16 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
                                        continue;
                                d_reclen = entry_length(bh, ih, entry_num);
                                d_name = B_I_DEH_ENTRY_FILE_NAME(bh, ih, deh);
+
+                               if (d_reclen <= 0 ||
+                                   d_name + d_reclen > bh->b_data + bh->b_size) {
+                                       /* There is corrupted data in entry,
+                                        * We'd better stop here */
+                                       pathrelse(&path_to_entry);
+                                       ret = -EIO;
+                                       goto out;
+                               }
+
                                if (!d_name[d_reclen - 1])
                                        d_reclen = strlen(d_name);
 
index 95051d44a918e141ac45bccd79ff315997dfefc1..9ea12004fa57e6ecbe44abb357ee2599cbed9daf 100644 (file)
@@ -208,8 +208,8 @@ static int file_capable(struct inode *inode, long block)
        return 0;
 }
 
-/*static*/ int restart_transaction(struct reiserfs_transaction_handle *th,
-                                  struct inode *inode, struct treepath *path)
+static int restart_transaction(struct reiserfs_transaction_handle *th,
+                              struct inode *inode, struct treepath *path)
 {
        struct super_block *s = th->t_super;
        int len = th->t_blocks_allocated;
index f25086aeef5f450afa6c4aa604787cd168ae299f..4cad9e75ef560f6238087bf2cc49ccd5cc571412 100644 (file)
@@ -615,6 +615,31 @@ static int journal_list_still_alive(struct super_block *s,
        return 0;
 }
 
+/*
+ * If page->mapping was null, we failed to truncate this page for
+ * some reason.  Most likely because it was truncated after being
+ * logged via data=journal.
+ *
+ * This does a check to see if the buffer belongs to one of these
+ * lost pages before doing the final put_bh.  If page->mapping was
+ * null, it tries to free buffers on the page, which should make the
+ * final page_cache_release drop the page from the lru.
+ */
+static void release_buffer_page(struct buffer_head *bh)
+{
+       struct page *page = bh->b_page;
+       if (!page->mapping && !TestSetPageLocked(page)) {
+               page_cache_get(page);
+               put_bh(bh);
+               if (!page->mapping)
+                       try_to_free_buffers(page);
+               unlock_page(page);
+               page_cache_release(page);
+       } else {
+               put_bh(bh);
+       }
+}
+
 static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
 {
        char b[BDEVNAME_SIZE];
@@ -628,8 +653,9 @@ static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
                set_buffer_uptodate(bh);
        else
                clear_buffer_uptodate(bh);
+
        unlock_buffer(bh);
-       put_bh(bh);
+       release_buffer_page(bh);
 }
 
 static void reiserfs_end_ordered_io(struct buffer_head *bh, int uptodate)
@@ -966,7 +992,8 @@ static int flush_older_commits(struct super_block *s,
        }
        return 0;
 }
-int reiserfs_async_progress_wait(struct super_block *s)
+
+static int reiserfs_async_progress_wait(struct super_block *s)
 {
        DEFINE_WAIT(wait);
        struct reiserfs_journal *j = SB_JOURNAL(s);
@@ -1546,9 +1573,10 @@ static int flush_journal_list(struct super_block *s,
                                BUG_ON(!test_clear_buffer_journal_dirty
                                       (cn->bh));
 
-                               /* undo the inc from journal_mark_dirty */
+                               /* drop one ref for us */
                                put_bh(cn->bh);
-                               brelse(cn->bh);
+                               /* drop one ref for journal_mark_dirty */
+                               release_buffer_page(cn->bh);
                        }
                        cn = cn->next;
                }
@@ -2621,6 +2649,61 @@ static int journal_init_dev(struct super_block *super,
        return result;
 }
 
+/**
+ * When creating/tuning a file system user can assign some
+ * journal params within boundaries which depend on the ratio
+ * blocksize/standard_blocksize.
+ *
+ * For blocks >= standard_blocksize transaction size should
+ * be not less then JOURNAL_TRANS_MIN_DEFAULT, and not more
+ * then JOURNAL_TRANS_MAX_DEFAULT.
+ *
+ * For blocks < standard_blocksize these boundaries should be
+ * decreased proportionally.
+ */
+#define REISERFS_STANDARD_BLKSIZE (4096)
+
+static int check_advise_trans_params(struct super_block *p_s_sb,
+                                    struct reiserfs_journal *journal)
+{
+        if (journal->j_trans_max) {
+               /* Non-default journal params.
+                  Do sanity check for them. */
+               int ratio = 1;
+               if (p_s_sb->s_blocksize < REISERFS_STANDARD_BLKSIZE)
+                       ratio = REISERFS_STANDARD_BLKSIZE / p_s_sb->s_blocksize;
+
+               if (journal->j_trans_max > JOURNAL_TRANS_MAX_DEFAULT / ratio ||
+                   journal->j_trans_max < JOURNAL_TRANS_MIN_DEFAULT / ratio ||
+                   SB_ONDISK_JOURNAL_SIZE(p_s_sb) / journal->j_trans_max <
+                   JOURNAL_MIN_RATIO) {
+                       reiserfs_warning(p_s_sb,
+                                "sh-462: bad transaction max size (%u). FSCK?",
+                                journal->j_trans_max);
+                       return 1;
+               }
+               if (journal->j_max_batch != (journal->j_trans_max) *
+                       JOURNAL_MAX_BATCH_DEFAULT/JOURNAL_TRANS_MAX_DEFAULT) {
+                       reiserfs_warning(p_s_sb,
+                               "sh-463: bad transaction max batch (%u). FSCK?",
+                               journal->j_max_batch);
+                       return 1;
+               }
+       } else {
+               /* Default journal params.
+                   The file system was created by old version
+                  of mkreiserfs, so some fields contain zeros,
+                  and we need to advise proper values for them */
+               if (p_s_sb->s_blocksize != REISERFS_STANDARD_BLKSIZE)
+                       reiserfs_panic(p_s_sb, "sh-464: bad blocksize (%u)",
+                                      p_s_sb->s_blocksize);
+               journal->j_trans_max = JOURNAL_TRANS_MAX_DEFAULT;
+               journal->j_max_batch = JOURNAL_MAX_BATCH_DEFAULT;
+               journal->j_max_commit_age = JOURNAL_MAX_COMMIT_AGE;
+       }
+       return 0;
+}
+
 /*
 ** must be called once on fs mount.  calls journal_read for you
 */
@@ -2716,49 +2799,8 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
            le32_to_cpu(jh->jh_journal.jp_journal_max_commit_age);
        journal->j_max_trans_age = JOURNAL_MAX_TRANS_AGE;
 
-       if (journal->j_trans_max) {
-               /* make sure these parameters are available, assign it if they are not */
-               __u32 initial = journal->j_trans_max;
-               __u32 ratio = 1;
-
-               if (p_s_sb->s_blocksize < 4096)
-                       ratio = 4096 / p_s_sb->s_blocksize;
-
-               if (SB_ONDISK_JOURNAL_SIZE(p_s_sb) / journal->j_trans_max <
-                   JOURNAL_MIN_RATIO)
-                       journal->j_trans_max =
-                           SB_ONDISK_JOURNAL_SIZE(p_s_sb) / JOURNAL_MIN_RATIO;
-               if (journal->j_trans_max > JOURNAL_TRANS_MAX_DEFAULT / ratio)
-                       journal->j_trans_max =
-                           JOURNAL_TRANS_MAX_DEFAULT / ratio;
-               if (journal->j_trans_max < JOURNAL_TRANS_MIN_DEFAULT / ratio)
-                       journal->j_trans_max =
-                           JOURNAL_TRANS_MIN_DEFAULT / ratio;
-
-               if (journal->j_trans_max != initial)
-                       reiserfs_warning(p_s_sb,
-                                        "sh-461: journal_init: wrong transaction max size (%u). Changed to %u",
-                                        initial, journal->j_trans_max);
-
-               journal->j_max_batch = journal->j_trans_max *
-                   JOURNAL_MAX_BATCH_DEFAULT / JOURNAL_TRANS_MAX_DEFAULT;
-       }
-
-       if (!journal->j_trans_max) {
-               /*we have the file system was created by old version of mkreiserfs 
-                  so this field contains zero value */
-               journal->j_trans_max = JOURNAL_TRANS_MAX_DEFAULT;
-               journal->j_max_batch = JOURNAL_MAX_BATCH_DEFAULT;
-               journal->j_max_commit_age = JOURNAL_MAX_COMMIT_AGE;
-
-               /* for blocksize >= 4096 - max transaction size is 1024. For block size < 4096
-                  trans max size is decreased proportionally */
-               if (p_s_sb->s_blocksize < 4096) {
-                       journal->j_trans_max /= (4096 / p_s_sb->s_blocksize);
-                       journal->j_max_batch = (journal->j_trans_max) * 9 / 10;
-               }
-       }
-
+       if (check_advise_trans_params(p_s_sb, journal) != 0)
+               goto free_and_return;
        journal->j_default_max_commit_age = journal->j_max_commit_age;
 
        if (commit_max_age != 0) {
@@ -3708,13 +3750,8 @@ int journal_mark_freed(struct reiserfs_transaction_handle *th,
                }
        }
 
-       if (bh) {
-               put_bh(bh);     /* get_hash grabs the buffer */
-               if (atomic_read(&(bh->b_count)) < 0) {
-                       reiserfs_warning(p_s_sb,
-                                        "journal-2165: bh->b_count < 0");
-               }
-       }
+       if (bh)
+               release_buffer_page(bh); /* get_hash grabs the buffer */
        return 0;
 }
 
index a005451930b7e1b01d8dfb4a8db8f756a4c37bf2..b82897ae090bdba89331029216c3ce33893415fd 100644 (file)
@@ -145,7 +145,7 @@ static int finish_unfinished(struct super_block *s)
 {
        INITIALIZE_PATH(path);
        struct cpu_key max_cpu_key, obj_key;
-       struct reiserfs_key save_link_key;
+       struct reiserfs_key save_link_key, last_inode_key;
        int retval = 0;
        struct item_head *ih;
        struct buffer_head *bh;
@@ -166,6 +166,8 @@ static int finish_unfinished(struct super_block *s)
        set_cpu_key_k_offset(&max_cpu_key, ~0U);
        max_cpu_key.key_length = 3;
 
+       memset(&last_inode_key, 0, sizeof(last_inode_key));
+
 #ifdef CONFIG_QUOTA
        /* Needed for iput() to work correctly and not trash data */
        if (s->s_flags & MS_ACTIVE) {
@@ -278,8 +280,18 @@ static int finish_unfinished(struct super_block *s)
                        REISERFS_I(inode)->i_flags |= i_link_saved_unlink_mask;
                        /* not completed unlink (rmdir) found */
                        reiserfs_info(s, "Removing %k..", INODE_PKEY(inode));
-                       /* removal gets completed in iput */
-                       retval = 0;
+                       if (memcmp(&last_inode_key, INODE_PKEY(inode),
+                                       sizeof(last_inode_key))){
+                               last_inode_key = *INODE_PKEY(inode);
+                               /* removal gets completed in iput */
+                               retval = 0;
+                       } else {
+                               reiserfs_warning(s, "Dead loop in "
+                                               "finish_unfinished detected, "
+                                               "just remove save link\n");
+                               retval = remove_save_link_only(s,
+                                                       &save_link_key, 0);
+                       }
                }
 
                iput(inode);
@@ -508,7 +520,7 @@ static void reiserfs_destroy_inode(struct inode *inode)
        kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode));
 }
 
-static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo;
 
index dae7945f90e4e9aee698a4d06008eb41d7dd2e2a..a49cf5b9a195d32c51c7f077ea7b60cc7dc22cf8 100644 (file)
@@ -92,7 +92,7 @@ static inline unsigned long romfs_maxsize(struct super_block *sb)
 
 static inline struct romfs_inode_info *ROMFS_I(struct inode *inode)
 {
-       return list_entry(inode, struct romfs_inode_info, vfs_inode);
+       return container_of(inode, struct romfs_inode_info, vfs_inode);
 }
 
 static __u32
@@ -555,7 +555,7 @@ static struct kmem_cache * romfs_inode_cachep;
 static struct inode *romfs_alloc_inode(struct super_block *sb)
 {
        struct romfs_inode_info *ei;
-       ei = (struct romfs_inode_info *)kmem_cache_alloc(romfs_inode_cachep, GFP_KERNEL);
+       ei = kmem_cache_alloc(romfs_inode_cachep, GFP_KERNEL);
        if (!ei)
                return NULL;
        return &ei->vfs_inode;
@@ -566,7 +566,7 @@ static void romfs_destroy_inode(struct inode *inode)
        kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode));
 }
 
-static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct romfs_inode_info *ei = foo;
 
index 46dca31c607ad79fd2e857cb1e3b72a902ee6c0f..7dede89658f535964e8808682d6d7fe784281d4e 100644 (file)
@@ -586,7 +586,7 @@ static int do_poll(unsigned int nfds,  struct poll_list *list,
        /* Optimise the no-wait case */
        if (!(*timeout))
                pt = NULL;
+
        for (;;) {
                struct poll_list *walk;
                long __timeout;
@@ -616,10 +616,12 @@ static int do_poll(unsigned int nfds,  struct poll_list *list,
                 * a poll_table to them on the next loop iteration.
                 */
                pt = NULL;
-               if (count || !*timeout || signal_pending(current))
-                       break;
-               count = wait->error;
-               if (count)
+               if (!count) {
+                       count = wait->error;
+                       if (signal_pending(current))
+                               count = -EINTR;
+               }
+               if (count || !*timeout)
                        break;
 
                if (*timeout < 0) {
@@ -651,93 +653,89 @@ static int do_poll(unsigned int nfds,  struct poll_list *list,
 int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)
 {
        struct poll_wqueues table;
-       int fdcount, err;
-       unsigned int i;
-       struct poll_list *head;
-       struct poll_list *walk;
+       int err = -EFAULT, fdcount, len, size;
        /* Allocate small arguments on the stack to save memory and be
           faster - use long to make sure the buffer is aligned properly
           on 64 bit archs to avoid unaligned access */
        long stack_pps[POLL_STACK_ALLOC/sizeof(long)];
-       struct poll_list *stack_pp = NULL;
+       struct poll_list *const head = (struct poll_list *)stack_pps;
+       struct poll_list *walk = head;
+       unsigned long todo = nfds;
 
-       /* Do a sanity check on nfds ... */
        if (nfds > current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
                return -EINVAL;
 
-       poll_initwait(&table);
+       len = min_t(unsigned int, nfds, N_STACK_PPS);
+       for (;;) {
+               walk->next = NULL;
+               walk->len = len;
+               if (!len)
+                       break;
 
-       head = NULL;
-       walk = NULL;
-       i = nfds;
-       err = -ENOMEM;
-       while(i!=0) {
-               struct poll_list *pp;
-               int num, size;
-               if (stack_pp == NULL)
-                       num = N_STACK_PPS;
-               else
-                       num = POLLFD_PER_PAGE;
-               if (num > i)
-                       num = i;
-               size = sizeof(struct poll_list) + sizeof(struct pollfd)*num;
-               if (!stack_pp)
-                       stack_pp = pp = (struct poll_list *)stack_pps;
-               else {
-                       pp = kmalloc(size, GFP_KERNEL);
-                       if (!pp)
-                               goto out_fds;
-               }
-               pp->next=NULL;
-               pp->len = num;
-               if (head == NULL)
-                       head = pp;
-               else
-                       walk->next = pp;
+               if (copy_from_user(walk->entries, ufds + nfds-todo,
+                                       sizeof(struct pollfd) * walk->len))
+                       goto out_fds;
+
+               todo -= walk->len;
+               if (!todo)
+                       break;
 
-               walk = pp;
-               if (copy_from_user(pp->entries, ufds + nfds-i, 
-                               sizeof(struct pollfd)*num)) {
-                       err = -EFAULT;
+               len = min(todo, POLLFD_PER_PAGE);
+               size = sizeof(struct poll_list) + sizeof(struct pollfd) * len;
+               walk = walk->next = kmalloc(size, GFP_KERNEL);
+               if (!walk) {
+                       err = -ENOMEM;
                        goto out_fds;
                }
-               i -= pp->len;
        }
 
+       poll_initwait(&table);
        fdcount = do_poll(nfds, head, &table, timeout);
+       poll_freewait(&table);
 
-       /* OK, now copy the revents fields back to user space. */
-       walk = head;
-       err = -EFAULT;
-       while(walk != NULL) {
+       for (walk = head; walk; walk = walk->next) {
                struct pollfd *fds = walk->entries;
                int j;
 
-               for (j=0; j < walk->len; j++, ufds++) {
-                       if(__put_user(fds[j].revents, &ufds->revents))
+               for (j = 0; j < walk->len; j++, ufds++)
+                       if (__put_user(fds[j].revents, &ufds->revents))
                                goto out_fds;
-               }
-               walk = walk->next;
        }
+
        err = fdcount;
-       if (!fdcount && signal_pending(current))
-               err = -EINTR;
 out_fds:
-       walk = head;
-       while(walk!=NULL) {
-               struct poll_list *pp = walk->next;
-               if (walk != stack_pp)
-                       kfree(walk);
-               walk = pp;
+       walk = head->next;
+       while (walk) {
+               struct poll_list *pos = walk;
+               walk = walk->next;
+               kfree(pos);
        }
-       poll_freewait(&table);
+
        return err;
 }
 
+static long do_restart_poll(struct restart_block *restart_block)
+{
+       struct pollfd __user *ufds = (struct pollfd __user*)restart_block->arg0;
+       int nfds = restart_block->arg1;
+       s64 timeout = ((s64)restart_block->arg3<<32) | (s64)restart_block->arg2;
+       int ret;
+
+       ret = do_sys_poll(ufds, nfds, &timeout);
+       if (ret == -EINTR) {
+               restart_block->fn = do_restart_poll;
+               restart_block->arg2 = timeout & 0xFFFFFFFF;
+               restart_block->arg3 = (u64)timeout >> 32;
+               ret = -ERESTART_RESTARTBLOCK;
+       }
+       return ret;
+}
+
 asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
                        long timeout_msecs)
 {
        s64 timeout_jiffies;
+       int ret;
 
        if (timeout_msecs > 0) {
 #if HZ > 1000
@@ -752,7 +750,18 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
                timeout_jiffies = timeout_msecs;
        }
 
-       return do_sys_poll(ufds, nfds, &timeout_jiffies);
+       ret = do_sys_poll(ufds, nfds, &timeout_jiffies);
+       if (ret == -EINTR) {
+               struct restart_block *restart_block;
+               restart_block = &current_thread_info()->restart_block;
+               restart_block->fn = do_restart_poll;
+               restart_block->arg0 = (unsigned long)ufds;
+               restart_block->arg1 = nfds;
+               restart_block->arg2 = timeout_jiffies & 0xFFFFFFFF;
+               restart_block->arg3 = (u64)timeout_jiffies >> 32;
+               ret = -ERESTART_RESTARTBLOCK;
+       }
+       return ret;
 }
 
 #ifdef TIF_RESTORE_SIGMASK
index aefb0be07942d735de747ad8697834368f8a907a..fb7f7e8034df512db10978276d7c2cf8f9cc0a75 100644 (file)
@@ -74,45 +74,45 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo,
         * If you change siginfo_t structure, please be sure
         * this code is fixed accordingly.
         */
-       err |= __put_user(kinfo->si_signo, &uinfo->signo);
-       err |= __put_user(kinfo->si_errno, &uinfo->err);
-       err |= __put_user((short)kinfo->si_code, &uinfo->code);
+       err |= __put_user(kinfo->si_signo, &uinfo->ssi_signo);
+       err |= __put_user(kinfo->si_errno, &uinfo->ssi_errno);
+       err |= __put_user((short) kinfo->si_code, &uinfo->ssi_code);
        switch (kinfo->si_code & __SI_MASK) {
        case __SI_KILL:
-               err |= __put_user(kinfo->si_pid, &uinfo->pid);
-               err |= __put_user(kinfo->si_uid, &uinfo->uid);
+               err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
+               err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
                break;
        case __SI_TIMER:
-                err |= __put_user(kinfo->si_tid, &uinfo->tid);
-                err |= __put_user(kinfo->si_overrun, &uinfo->overrun);
-                err |= __put_user((long)kinfo->si_ptr, &uinfo->svptr);
+                err |= __put_user(kinfo->si_tid, &uinfo->ssi_tid);
+                err |= __put_user(kinfo->si_overrun, &uinfo->ssi_overrun);
+                err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
                break;
        case __SI_POLL:
-               err |= __put_user(kinfo->si_band, &uinfo->band);
-               err |= __put_user(kinfo->si_fd, &uinfo->fd);
+               err |= __put_user(kinfo->si_band, &uinfo->ssi_band);
+               err |= __put_user(kinfo->si_fd, &uinfo->ssi_fd);
                break;
        case __SI_FAULT:
-               err |= __put_user((long)kinfo->si_addr, &uinfo->addr);
+               err |= __put_user((long) kinfo->si_addr, &uinfo->ssi_addr);
 #ifdef __ARCH_SI_TRAPNO
-               err |= __put_user(kinfo->si_trapno, &uinfo->trapno);
+               err |= __put_user(kinfo->si_trapno, &uinfo->ssi_trapno);
 #endif
                break;
        case __SI_CHLD:
-               err |= __put_user(kinfo->si_pid, &uinfo->pid);
-               err |= __put_user(kinfo->si_uid, &uinfo->uid);
-               err |= __put_user(kinfo->si_status, &uinfo->status);
-               err |= __put_user(kinfo->si_utime, &uinfo->utime);
-               err |= __put_user(kinfo->si_stime, &uinfo->stime);
+               err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
+               err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
+               err |= __put_user(kinfo->si_status, &uinfo->ssi_status);
+               err |= __put_user(kinfo->si_utime, &uinfo->ssi_utime);
+               err |= __put_user(kinfo->si_stime, &uinfo->ssi_stime);
                break;
        case __SI_RT: /* This is not generated by the kernel as of now. */
        case __SI_MESGQ: /* But this is */
-               err |= __put_user(kinfo->si_pid, &uinfo->pid);
-               err |= __put_user(kinfo->si_uid, &uinfo->uid);
-               err |= __put_user((long)kinfo->si_ptr, &uinfo->svptr);
+               err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
+               err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
+               err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
                break;
        default: /* this is just in case for now ... */
-               err |= __put_user(kinfo->si_pid, &uinfo->pid);
-               err |= __put_user(kinfo->si_uid, &uinfo->uid);
+               err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
+               err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
                break;
        }
 
index 73d1450a95d4233357650af9b99359cf56dab217..ab517755ece0aed5a07d46fcd16ad447e68f8d85 100644 (file)
@@ -67,7 +67,7 @@ static void smb_destroy_inode(struct inode *inode)
        kmem_cache_free(smb_inode_cachep, SMB_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct smb_inode_info *ei = (struct smb_inode_info *) foo;
 
index 59a941d404d9c60b46a83ced4472ee915a7fe93c..6bdcb6107bc3c55b58199537e2eb5537133cd460 100644 (file)
@@ -824,13 +824,18 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
 {
        struct address_space *mapping = out->f_mapping;
        struct inode *inode = mapping->host;
+       int killsuid, killpriv;
        ssize_t ret;
-       int err;
+       int err = 0;
 
-       err = should_remove_suid(out->f_path.dentry);
-       if (unlikely(err)) {
+       killpriv = security_inode_need_killpriv(out->f_path.dentry);
+       killsuid = should_remove_suid(out->f_path.dentry);
+       if (unlikely(killsuid || killpriv)) {
                mutex_lock(&inode->i_mutex);
-               err = __remove_suid(out->f_path.dentry, err);
+               if (killpriv)
+                       err = security_inode_killpriv(out->f_path.dentry);
+               if (!err && killsuid)
+                       err = __remove_suid(out->f_path.dentry, killsuid);
                mutex_unlock(&inode->i_mutex);
                if (err)
                        return err;
index fc8ebedc6bed1aa901e24ebf8e34fd397cc6361e..1bfcca2104be91ac9a8233cd94bf0e0e3ef6a182 100644 (file)
@@ -67,6 +67,7 @@ static struct super_block *alloc_super(struct file_system_type *type)
                }
                INIT_LIST_HEAD(&s->s_dirty);
                INIT_LIST_HEAD(&s->s_io);
+               INIT_LIST_HEAD(&s->s_more_io);
                INIT_LIST_HEAD(&s->s_files);
                INIT_LIST_HEAD(&s->s_instances);
                INIT_HLIST_HEAD(&s->s_anon);
index 9161db4d6b5c55b40b71e3202cad31d93a0cdad1..7a8ce9e98b32d9aeb2128f177173c64c5181a941 100644 (file)
@@ -24,9 +24,9 @@
 
 DEFINE_MUTEX(sysfs_mutex);
 DEFINE_MUTEX(sysfs_rename_mutex);
-spinlock_t sysfs_assoc_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(sysfs_assoc_lock);
 
-static spinlock_t sysfs_ino_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(sysfs_ino_lock);
 static DEFINE_IDA(sysfs_ino_ida);
 
 /**
@@ -112,8 +112,7 @@ struct dentry *sysfs_get_dentry(struct sysfs_dirent *sd)
                /* look it up */
                parent = dentry;
                mutex_lock(&parent->d_inode->i_mutex);
-               dentry = lookup_one_len_kern(cur->s_name, parent,
-                                            strlen(cur->s_name));
+               dentry = lookup_one_noperm(cur->s_name, parent);
                mutex_unlock(&parent->d_inode->i_mutex);
                dput(parent);
 
index c4ef945d39c812508e9fa1a9430bfa3cebd29d5f..d9262f74f94e50c3c2efacd256f9a9536dc3d850 100644 (file)
@@ -37,6 +37,11 @@ static const struct inode_operations sysfs_inode_operations ={
        .setattr        = sysfs_setattr,
 };
 
+int __init sysfs_inode_init(void)
+{
+       return bdi_init(&sysfs_backing_dev_info);
+}
+
 int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
 {
        struct inode * inode = dentry->d_inode;
index c76c540be3c830c57707d23a95cac5f8b83323a5..74168266cd59a1abca9e8039131c0ce46b240980 100644 (file)
@@ -92,6 +92,10 @@ int __init sysfs_init(void)
        if (!sysfs_dir_cachep)
                goto out;
 
+       err = sysfs_inode_init();
+       if (err)
+               goto out_err;
+
        err = register_filesystem(&sysfs_fs_type);
        if (!err) {
                sysfs_mount = kern_mount(&sysfs_fs_type);
index f0326f281d1cdbbe228fce7146cd4d9bef3e9fe1..f8417988f6b0d99262a3b1515104a549ee392a0c 100644 (file)
@@ -146,6 +146,7 @@ static inline void sysfs_put(struct sysfs_dirent *sd)
 struct inode *sysfs_get_inode(struct sysfs_dirent *sd);
 int sysfs_setattr(struct dentry *dentry, struct iattr *iattr);
 int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name);
+int sysfs_inode_init(void);
 
 /*
  * file.c
index 7c4e5d302abb937d3cdbe4903ff52bf941a5a6d3..81ec6c548c07c0e34db7821cf72e8f0676f3d177 100644 (file)
@@ -318,7 +318,7 @@ static void sysv_destroy_inode(struct inode *inode)
        kmem_cache_free(sysv_inode_cachep, SYSV_I(inode));
 }
 
-static void init_once(void *p, struct kmem_cache *cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *p)
 {
        struct sysv_inode_info *si = (struct sysv_inode_info *)p;
 
index 87e87dcd3f9c94db447581b9f718ac92ea13c146..ab26176f6b91129e924351c067aad96b909223ec 100644 (file)
@@ -689,7 +689,7 @@ static int udf_table_new_block(struct super_block *sb,
        uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
        uint32_t newblock = 0, adsize;
        uint32_t elen, goal_elen = 0;
-       kernel_lb_addr eloc, goal_eloc;
+       kernel_lb_addr eloc, uninitialized_var(goal_eloc);
        struct extent_position epos, goal_epos;
        int8_t etype;
 
index c68a6e730b97918f041819f055492193b10869ab..4360c7a05743727a3f7b94753057a5a831eb2b0b 100644 (file)
@@ -134,7 +134,7 @@ static void udf_destroy_inode(struct inode *inode)
        kmem_cache_free(udf_inode_cachep, UDF_I(inode));
 }
 
-static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct udf_inode_info *ei = (struct udf_inode_info *)foo;
 
@@ -913,8 +913,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
                                        UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table =
                                                udf_iget(sb, loc);
                                        if (!UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table) {
-                                               udf_debug("cannot load unallocSpaceTable (part %d)\n",
-                                                       i);
+                                               udf_debug("cannot load unallocSpaceTable (part %d)\n", i);
                                                return 1;
                                        }
                                        UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE;
@@ -944,8 +943,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
                                        UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table =
                                                udf_iget(sb, loc);
                                        if (!UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table) {
-                                               udf_debug("cannot load freedSpaceTable (part %d)\n",
-                                                       i);
+                                               udf_debug("cannot load freedSpaceTable (part %d)\n", i);
                                                return 1;
                                        }
                                        UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_TABLE;
@@ -1293,19 +1291,16 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
 
                        if (!UDF_SB_LASTBLOCK(sb)) {
                                udf_debug("Unable to determine Lastblock (For "
-                                               "Virtual Partition)\n");
+                                         "Virtual Partition)\n");
                                return 1;
                        }
 
                        for (j = 0; j < UDF_SB_NUMPARTS(sb); j++) {
-                               if (j != i && UDF_SB_PARTVSN(sb, i) ==
-                                       UDF_SB_PARTVSN(sb, j) &&
-                                       UDF_SB_PARTNUM(sb, i) ==
-                                               UDF_SB_PARTNUM(sb, j)) {
+                               if (j != i &&
+                                   UDF_SB_PARTVSN(sb, i) == UDF_SB_PARTVSN(sb, j) &&
+                                   UDF_SB_PARTNUM(sb, i) == UDF_SB_PARTNUM(sb, j)) {
                                        ino.partitionReferenceNum = j;
-                                       ino.logicalBlockNum =
-                                           UDF_SB_LASTBLOCK(sb) -
-                                           UDF_SB_PARTROOT(sb, j);
+                                       ino.logicalBlockNum = UDF_SB_LASTBLOCK(sb) - UDF_SB_PARTROOT(sb, j);
                                        break;
                                }
                        }
@@ -1318,9 +1313,9 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
 
                        if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) {
                                UDF_SB_TYPEVIRT(sb, i).s_start_offset =
-                                   udf_ext0_offset(UDF_SB_VAT(sb));
+                                       udf_ext0_offset(UDF_SB_VAT(sb));
                                UDF_SB_TYPEVIRT(sb, i).s_num_entries =
-                                   (UDF_SB_VAT(sb)->i_size - 36) >> 2;
+                                       (UDF_SB_VAT(sb)->i_size - 36) >> 2;
                        } else if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP20) {
                                struct buffer_head *bh = NULL;
                                uint32_t pos;
@@ -1330,19 +1325,15 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
                                if (!bh)
                                        return 1;
                                UDF_SB_TYPEVIRT(sb, i).s_start_offset =
-                                   le16_to_cpu(((struct
-                                       virtualAllocationTable20 *)bh->b_data +
-                                         udf_ext0_offset(UDF_SB_VAT(sb)))->
-                                               lengthHeader) +
-                                         udf_ext0_offset(UDF_SB_VAT(sb));
-                               UDF_SB_TYPEVIRT(sb, i).s_num_entries =
-                                   (UDF_SB_VAT(sb)->i_size -
-                                    UDF_SB_TYPEVIRT(sb, i).s_start_offset) >> 2;
+                                       le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data +
+                                                    udf_ext0_offset(UDF_SB_VAT(sb)))->lengthHeader) +
+                                       udf_ext0_offset(UDF_SB_VAT(sb));
+                               UDF_SB_TYPEVIRT(sb, i).s_num_entries = (UDF_SB_VAT(sb)->i_size -
+                                                                       UDF_SB_TYPEVIRT(sb, i).s_start_offset) >> 2;
                                brelse(bh);
                        }
                        UDF_SB_PARTROOT(sb, i) = udf_get_pblock(sb, 0, i, 0);
-                       UDF_SB_PARTLEN(sb, i) = UDF_SB_PARTLEN(sb,
-                                               ino.partitionReferenceNum);
+                       UDF_SB_PARTLEN(sb, i) = UDF_SB_PARTLEN(sb, ino.partitionReferenceNum);
                }
        }
        return 0;
@@ -1357,21 +1348,17 @@ static void udf_open_lvid(struct super_block *sb)
                UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
                UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
                if (udf_time_to_stamp(&cpu_time, CURRENT_TIME))
-                       UDF_SB_LVID(sb)->recordingDateAndTime =
-                           cpu_to_lets(cpu_time);
+                       UDF_SB_LVID(sb)->recordingDateAndTime = cpu_to_lets(cpu_time);
                UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_OPEN;
 
-               UDF_SB_LVID(sb)->descTag.descCRC =
-                   cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag),
-                                       le16_to_cpu(UDF_SB_LVID(sb)->descTag.
-                                                   descCRCLength), 0));
+               UDF_SB_LVID(sb)->descTag.descCRC = cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag),
+                                                                      le16_to_cpu(UDF_SB_LVID(sb)->descTag.descCRCLength), 0));
 
                UDF_SB_LVID(sb)->descTag.tagChecksum = 0;
                for (i = 0; i < 16; i++)
                        if (i != 4)
                                UDF_SB_LVID(sb)->descTag.tagChecksum +=
-                                   ((uint8_t *) &
-                                    (UDF_SB_LVID(sb)->descTag))[i];
+                                       ((uint8_t *) &(UDF_SB_LVID(sb)->descTag))[i];
 
                mark_buffer_dirty(UDF_SB_LVIDBH(sb));
        }
index 3fd80eb66af337f47942fd8483d9ad1f11ba5669..adcb87c2da7edbd79be82f07d4641f41d9a7646b 100644 (file)
@@ -108,10 +108,10 @@ time_t *udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src)
        *dest = year_seconds[src.year - EPOCH_YEAR];
        *dest -= offset * 60;
 
-       yday = ((__mon_yday[__isleap (src.year)]
-                [src.month - 1]) + (src.day - 1));
-       *dest += ( ( (yday * 24) + src.hour ) * 60 + src.minute ) * 60 + src.second;
-       *dest_usec = src.centiseconds * 10000 + src.hundredsOfMicroseconds * 100 + src.microseconds;
+       yday = ((__mon_yday[__isleap(src.year)][src.month - 1]) + src.day - 1);
+       *dest += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second;
+       *dest_usec = src.centiseconds * 10000 +
+                       src.hundredsOfMicroseconds * 100 + src.microseconds;
        return dest;
 }
 
index 841ac25fd95042f86d134330a13dafd8521521dd..f63a09ce8683b8fbb43eb088e4b7466ce40caec0 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/bitops.h>
 #include <asm/byteorder.h>
 
+#include "ufs.h"
 #include "swab.h"
 #include "util.h"
 
index 09c39e5e638631a784faed8106835dbe7e49ff47..2a815665644f30b0d3efb4d632004cada1ddc57f 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <asm/byteorder.h>
 
+#include "ufs.h"
 #include "swab.h"
 #include "util.h"
 
index 2410ec6002db55807945b126fa880a096036dc36..30f8c2bb0c3e7a4c4aa29e86ae2ffdfc3cd9e00c 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/ufs_fs.h>
 #include <linux/swap.h>
 
+#include "ufs.h"
 #include "swab.h"
 #include "util.h"
 
index 6705d74c6d2d9b836dcdd3d3be1d40b65b3bf8e1..a46c97bf023fb25462606b228ed5372a67d79fd4 100644 (file)
@@ -27,6 +27,9 @@
 #include <linux/ufs_fs.h>
 #include <linux/buffer_head.h> /* for sync_mapping_buffers() */
 
+#include "ufs.h"
+
+
 static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync)
 {
        struct inode *inode = dentry->d_inode;
index c28a8b6f2feb65695dca3be4cd7d954871425d8f..7e260bc0d94f66719f40a71bebdfea19fb09c859 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/bitops.h>
 #include <asm/byteorder.h>
 
+#include "ufs.h"
 #include "swab.h"
 #include "util.h"
 
index d84d4b0f4779416573cf82a06730a2593628fa62..4320782761ae875c54fc9f6a04592a3990ecfdc3 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
 
+#include "ufs.h"
 #include "swab.h"
 #include "util.h"
 
index a059ccd064eaa317f257ac1ac73ec3a28ba9867e..d8bfbee2fe2ba9e9ced1bcc66dbfdebb4b9ced7c 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/fs.h>
 #include <linux/ufs_fs.h>
 #include <linux/smp_lock.h>
-#include "swab.h"      /* will go away - see comment in mknod() */
+#include "ufs.h"
 #include "util.h"
 
 static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode)
@@ -110,7 +110,6 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t
        err = PTR_ERR(inode);
        if (!IS_ERR(inode)) {
                init_special_inode(inode, mode, rdev);
-               /* NOTE: that'll go when we get wide dev_t */
                ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev);
                mark_inode_dirty(inode);
                lock_kernel();
index 38eb0b7a1f3d3111c0e4a1b604d7ac40e110cc46..584cf12cc40fb9874c2815e1585e79944cb84c83 100644 (file)
 #include <linux/buffer_head.h>
 #include <linux/vfs.h>
 #include <linux/log2.h>
+#include <linux/mount.h>
+#include <linux/seq_file.h>
 
+#include "ufs.h"
 #include "swab.h"
 #include "util.h"
 
@@ -286,16 +289,28 @@ void ufs_warning (struct super_block * sb, const char * function,
 }
 
 enum {
-       Opt_type_old, Opt_type_sunx86, Opt_type_sun, Opt_type_44bsd,
-       Opt_type_ufs2, Opt_type_hp, Opt_type_nextstepcd, Opt_type_nextstep,
-       Opt_type_openstep, Opt_onerror_panic, Opt_onerror_lock,
-       Opt_onerror_umount, Opt_onerror_repair, Opt_err
+       Opt_type_old = UFS_MOUNT_UFSTYPE_OLD,
+       Opt_type_sunx86 = UFS_MOUNT_UFSTYPE_SUNx86,
+       Opt_type_sun = UFS_MOUNT_UFSTYPE_SUN,
+       Opt_type_sunos = UFS_MOUNT_UFSTYPE_SUNOS,
+       Opt_type_44bsd = UFS_MOUNT_UFSTYPE_44BSD,
+       Opt_type_ufs2 = UFS_MOUNT_UFSTYPE_UFS2,
+       Opt_type_hp = UFS_MOUNT_UFSTYPE_HP,
+       Opt_type_nextstepcd = UFS_MOUNT_UFSTYPE_NEXTSTEP_CD,
+       Opt_type_nextstep = UFS_MOUNT_UFSTYPE_NEXTSTEP,
+       Opt_type_openstep = UFS_MOUNT_UFSTYPE_OPENSTEP,
+       Opt_onerror_panic = UFS_MOUNT_ONERROR_PANIC,
+       Opt_onerror_lock = UFS_MOUNT_ONERROR_LOCK,
+       Opt_onerror_umount = UFS_MOUNT_ONERROR_UMOUNT,
+       Opt_onerror_repair = UFS_MOUNT_ONERROR_REPAIR,
+       Opt_err
 };
 
 static match_table_t tokens = {
        {Opt_type_old, "ufstype=old"},
        {Opt_type_sunx86, "ufstype=sunx86"},
        {Opt_type_sun, "ufstype=sun"},
+       {Opt_type_sunos, "ufstype=sunos"},
        {Opt_type_44bsd, "ufstype=44bsd"},
        {Opt_type_ufs2, "ufstype=ufs2"},
        {Opt_type_ufs2, "ufstype=5xbsd"},
@@ -303,6 +318,7 @@ static match_table_t tokens = {
        {Opt_type_nextstepcd, "ufstype=nextstep-cd"},
        {Opt_type_nextstep, "ufstype=nextstep"},
        {Opt_type_openstep, "ufstype=openstep"},
+/*end of possible ufs types */
        {Opt_onerror_panic, "onerror=panic"},
        {Opt_onerror_lock, "onerror=lock"},
        {Opt_onerror_umount, "onerror=umount"},
@@ -339,6 +355,10 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
                        ufs_clear_opt (*mount_options, UFSTYPE);
                        ufs_set_opt (*mount_options, UFSTYPE_SUN);
                        break;
+               case Opt_type_sunos:
+                       ufs_clear_opt(*mount_options, UFSTYPE);
+                       ufs_set_opt(*mount_options, UFSTYPE_SUNOS);
+                       break;
                case Opt_type_44bsd:
                        ufs_clear_opt (*mount_options, UFSTYPE);
                        ufs_set_opt (*mount_options, UFSTYPE_44BSD);
@@ -654,8 +674,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD);
        }
 
-       sbi->s_uspi = uspi =
-               kmalloc (sizeof(struct ufs_sb_private_info), GFP_KERNEL);
+       uspi = kzalloc(sizeof(struct ufs_sb_private_info), GFP_KERNEL);
+       sbi->s_uspi = uspi;
        if (!uspi)
                goto failed;
        uspi->s_dirblksize = UFS_SECTOR_SIZE;
@@ -692,10 +712,22 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                uspi->s_fshift = 10;
                uspi->s_sbsize = super_block_size = 2048;
                uspi->s_sbbase = 0;
-               uspi->s_maxsymlinklen = 56;
+               uspi->s_maxsymlinklen = 0; /* Not supported on disk */
                flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN;
                break;
 
+       case UFS_MOUNT_UFSTYPE_SUNOS:
+               UFSD(("ufstype=sunos\n"))
+               uspi->s_fsize = block_size = 1024;
+               uspi->s_fmask = ~(1024 - 1);
+               uspi->s_fshift = 10;
+               uspi->s_sbsize = 2048;
+               super_block_size = 2048;
+               uspi->s_sbbase = 0;
+               uspi->s_maxsymlinklen = 0; /* Not supported on disk */
+               flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_SUNOS | UFS_CG_SUN;
+               break;
+
        case UFS_MOUNT_UFSTYPE_SUNx86:
                UFSD("ufstype=sunx86\n");
                uspi->s_fsize = block_size = 1024;
@@ -703,7 +735,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
                uspi->s_fshift = 10;
                uspi->s_sbsize = super_block_size = 2048;
                uspi->s_sbbase = 0;
-               uspi->s_maxsymlinklen = 56;
+               uspi->s_maxsymlinklen = 0; /* Not supported on disk */
                flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN;
                break;
 
@@ -805,11 +837,18 @@ again:
        if (!ubh) 
             goto failed;
 
-       
        usb1 = ubh_get_usb_first(uspi);
        usb2 = ubh_get_usb_second(uspi);
        usb3 = ubh_get_usb_third(uspi);
 
+       /* Sort out mod used on SunOS 4.1.3 for fs_state */
+       uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat);
+       if (((flags & UFS_ST_MASK) == UFS_ST_SUNOS) &&
+           (uspi->s_postblformat != UFS_42POSTBLFMT)) {
+               flags &= ~UFS_ST_MASK;
+               flags |=  UFS_ST_SUN;
+       }
+
        /*
         * Check ufs magic number
         */
@@ -894,18 +933,20 @@ magic_found:
                goto again;
        }
 
-       sbi->s_flags = flags;/*after that line some functions use s_flags*/
+       /* Set sbi->s_flags here, used by ufs_get_fs_state() below */
+       sbi->s_flags = flags;
        ufs_print_super_stuff(sb, usb1, usb2, usb3);
 
        /*
         * Check, if file system was correctly unmounted.
         * If not, make it read only.
         */
-       if (((flags & UFS_ST_MASK) == UFS_ST_44BSD) ||
-         ((flags & UFS_ST_MASK) == UFS_ST_OLD) ||
-         (((flags & UFS_ST_MASK) == UFS_ST_SUN || 
-         (flags & UFS_ST_MASK) == UFS_ST_SUNx86) && 
-         (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) {
+       if ((((flags & UFS_ST_MASK) == UFS_ST_44BSD)    ||
+            ((flags & UFS_ST_MASK) == UFS_ST_OLD)      ||
+            ((flags & UFS_ST_MASK) == UFS_ST_SUN)      ||
+            ((flags & UFS_ST_MASK) == UFS_ST_SUNOS)    ||
+            ((flags & UFS_ST_MASK) == UFS_ST_SUNx86))  &&
+           (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)))) {
                switch(usb1->fs_clean) {
                case UFS_FSCLEAN:
                        UFSD("fs is clean\n");
@@ -995,7 +1036,6 @@ magic_found:
        uspi->s_contigsumsize = fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_contigsumsize);
        uspi->s_qbmask = ufs_get_fs_qbmask(sb, usb3);
        uspi->s_qfmask = ufs_get_fs_qfmask(sb, usb3);
-       uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat);
        uspi->s_nrpos = fs32_to_cpu(sb, usb3->fs_nrpos);
        uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff);
        uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff);
@@ -1077,6 +1117,7 @@ static void ufs_write_super(struct super_block *sb)
        if (!(sb->s_flags & MS_RDONLY)) {
                usb1->fs_time = cpu_to_fs32(sb, get_seconds());
                if ((flags & UFS_ST_MASK) == UFS_ST_SUN 
+                 || (flags & UFS_ST_MASK) == UFS_ST_SUNOS
                  || (flags & UFS_ST_MASK) == UFS_ST_SUNx86)
                        ufs_set_fs_state(sb, usb1, usb3,
                                        UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
@@ -1146,6 +1187,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
                ufs_put_super_internal(sb);
                usb1->fs_time = cpu_to_fs32(sb, get_seconds());
                if ((flags & UFS_ST_MASK) == UFS_ST_SUN
+                 || (flags & UFS_ST_MASK) == UFS_ST_SUNOS
                  || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) 
                        ufs_set_fs_state(sb, usb1, usb3,
                                UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time));
@@ -1162,6 +1204,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
                return -EINVAL;
 #else
                if (ufstype != UFS_MOUNT_UFSTYPE_SUN && 
+                   ufstype != UFS_MOUNT_UFSTYPE_SUNOS &&
                    ufstype != UFS_MOUNT_UFSTYPE_44BSD &&
                    ufstype != UFS_MOUNT_UFSTYPE_SUNx86 &&
                    ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
@@ -1179,6 +1222,26 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
        return 0;
 }
 
+static int ufs_show_options(struct seq_file *seq, struct vfsmount *vfs)
+{
+       struct ufs_sb_info *sbi = UFS_SB(vfs->mnt_sb);
+       unsigned mval = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE;
+       struct match_token *tp = tokens;
+
+       while (tp->token != Opt_onerror_panic && tp->token != mval)
+               ++tp;
+       BUG_ON(tp->token == Opt_onerror_panic);
+       seq_printf(seq, ",%s", tp->pattern);
+
+       mval = sbi->s_mount_opt & UFS_MOUNT_ONERROR;
+       while (tp->token != Opt_err && tp->token != mval)
+               ++tp;
+       BUG_ON(tp->token == Opt_err);
+       seq_printf(seq, ",%s", tp->pattern);
+
+       return 0;
+}
+
 static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
        struct super_block *sb = dentry->d_sb;
@@ -1232,7 +1295,7 @@ static void ufs_destroy_inode(struct inode *inode)
        kmem_cache_free(ufs_inode_cachep, UFS_I(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache * cachep, void *foo)
 {
        struct ufs_inode_info *ei = (struct ufs_inode_info *) foo;
 
@@ -1271,6 +1334,7 @@ static const struct super_operations ufs_super_ops = {
        .write_super    = ufs_write_super,
        .statfs         = ufs_statfs,
        .remount_fs     = ufs_remount,
+       .show_options   = ufs_show_options,
 #ifdef CONFIG_QUOTA
        .quota_read     = ufs_quota_read,
        .quota_write    = ufs_quota_write,
index d8549f807e8003ef06abc6c79a34799829b7d204..43ac10e75a4aae8234a20cf301b55aaa7ad661e2 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/fs.h>
 #include <linux/namei.h>
 #include <linux/ufs_fs.h>
+#include "ufs.h"
+
 
 static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
index 79c54c85fb58e8cd937da6fa1e8b46505e26908b..311ded34c2b2b1027dc17e3f8b7d4f9682ba7412 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/blkdev.h>
 #include <linux/sched.h>
 
+#include "ufs.h"
 #include "swab.h"
 #include "util.h"
 
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h
new file mode 100644 (file)
index 0000000..7faa4cd
--- /dev/null
@@ -0,0 +1,157 @@
+#ifndef _UFS_UFS_H
+#define _UFS_UFS_H 1
+
+#define UFS_MAX_GROUP_LOADED 8
+#define UFS_CGNO_EMPTY ((unsigned)-1)
+
+struct ufs_sb_private_info;
+struct ufs_cg_private_info;
+struct ufs_csum;
+
+struct ufs_sb_info {
+       struct ufs_sb_private_info * s_uspi;
+       struct ufs_csum * s_csp;
+       unsigned s_bytesex;
+       unsigned s_flags;
+       struct buffer_head ** s_ucg;
+       struct ufs_cg_private_info * s_ucpi[UFS_MAX_GROUP_LOADED];
+       unsigned s_cgno[UFS_MAX_GROUP_LOADED];
+       unsigned short s_cg_loaded;
+       unsigned s_mount_opt;
+};
+
+struct ufs_inode_info {
+       union {
+               __fs32  i_data[15];
+               __u8    i_symlink[4*15];
+               __fs64  u2_i_data[15];
+       } i_u1;
+       __u32   i_flags;
+       __u32   i_shadow;
+       __u32   i_unused1;
+       __u32   i_unused2;
+       __u32   i_oeftflag;
+       __u16   i_osync;
+       __u64   i_lastfrag;
+       __u32   i_dir_start_lookup;
+       struct inode vfs_inode;
+};
+
+/* mount options */
+#define UFS_MOUNT_ONERROR              0x0000000F
+#define UFS_MOUNT_ONERROR_PANIC                0x00000001
+#define UFS_MOUNT_ONERROR_LOCK         0x00000002
+#define UFS_MOUNT_ONERROR_UMOUNT       0x00000004
+#define UFS_MOUNT_ONERROR_REPAIR       0x00000008
+
+#define UFS_MOUNT_UFSTYPE              0x0000FFF0
+#define UFS_MOUNT_UFSTYPE_OLD          0x00000010
+#define UFS_MOUNT_UFSTYPE_44BSD                0x00000020
+#define UFS_MOUNT_UFSTYPE_SUN          0x00000040
+#define UFS_MOUNT_UFSTYPE_NEXTSTEP     0x00000080
+#define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD  0x00000100
+#define UFS_MOUNT_UFSTYPE_OPENSTEP     0x00000200
+#define UFS_MOUNT_UFSTYPE_SUNx86       0x00000400
+#define UFS_MOUNT_UFSTYPE_HP           0x00000800
+#define UFS_MOUNT_UFSTYPE_UFS2         0x00001000
+#define UFS_MOUNT_UFSTYPE_SUNOS                0x00002000
+
+#define ufs_clear_opt(o,opt)   o &= ~UFS_MOUNT_##opt
+#define ufs_set_opt(o,opt)     o |= UFS_MOUNT_##opt
+#define ufs_test_opt(o,opt)    ((o) & UFS_MOUNT_##opt)
+
+/*
+ * Debug code
+ */
+#ifdef CONFIG_UFS_DEBUG
+#      define UFSD(f, a...)    {                                       \
+               printk ("UFSD (%s, %d): %s:",                           \
+                       __FILE__, __LINE__, __FUNCTION__);              \
+               printk (f, ## a);                                       \
+       }
+#else
+#      define UFSD(f, a...)    /**/
+#endif
+
+/* balloc.c */
+extern void ufs_free_fragments (struct inode *, u64, unsigned);
+extern void ufs_free_blocks (struct inode *, u64, unsigned);
+extern u64 ufs_new_fragments(struct inode *, void *, u64, u64,
+                            unsigned, int *, struct page *);
+
+/* cylinder.c */
+extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
+extern void ufs_put_cylinder (struct super_block *, unsigned);
+
+/* dir.c */
+extern const struct inode_operations ufs_dir_inode_operations;
+extern int ufs_add_link (struct dentry *, struct inode *);
+extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
+extern int ufs_make_empty(struct inode *, struct inode *);
+extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
+extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
+extern int ufs_empty_dir (struct inode *);
+extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
+extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
+                        struct page *page, struct inode *inode);
+
+/* file.c */
+extern const struct inode_operations ufs_file_inode_operations;
+extern const struct file_operations ufs_file_operations;
+
+extern const struct address_space_operations ufs_aops;
+
+/* ialloc.c */
+extern void ufs_free_inode (struct inode *inode);
+extern struct inode * ufs_new_inode (struct inode *, int);
+
+/* inode.c */
+extern void ufs_read_inode (struct inode *);
+extern void ufs_put_inode (struct inode *);
+extern int ufs_write_inode (struct inode *, int);
+extern int ufs_sync_inode (struct inode *);
+extern void ufs_delete_inode (struct inode *);
+extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
+extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
+
+/* namei.c */
+extern const struct file_operations ufs_dir_operations;
+
+/* super.c */
+extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+
+/* symlink.c */
+extern const struct inode_operations ufs_fast_symlink_inode_operations;
+
+/* truncate.c */
+extern int ufs_truncate (struct inode *, loff_t);
+
+static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
+{
+       return sb->s_fs_info;
+}
+
+static inline struct ufs_inode_info *UFS_I(struct inode *inode)
+{
+       return container_of(inode, struct ufs_inode_info, vfs_inode);
+}
+
+/*
+ * Give cylinder group number for a file system block.
+ * Give cylinder group block number for a file system block.
+ */
+/* #define     ufs_dtog(d)     ((d) / uspi->s_fpg) */
+static inline u64 ufs_dtog(struct ufs_sb_private_info * uspi, u64 b)
+{
+       do_div(b, uspi->s_fpg);
+       return b;
+}
+/* #define     ufs_dtogd(d)    ((d) % uspi->s_fpg) */
+static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b)
+{
+       return do_div(b, uspi->s_fpg);
+}
+
+#endif /* _UFS_UFS_H */
index 84357f1ff0ec8915b4839d45f01fc33566c99a70..410084dae3891be9c0c4d3de4c42dc6ccf50218e 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/ufs_fs.h>
 #include <linux/buffer_head.h>
 
+#include "ufs.h"
 #include "swab.h"
 #include "util.h"
 
index 79a340a1909e19f44d5f925a5fb589894b0f241d..b26fc4dec1e7a8331151d767b3ad6ea9c4e426cc 100644 (file)
@@ -38,6 +38,10 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
                 struct ufs_super_block_third *usb3)
 {
        switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
+       case UFS_ST_SUNOS:
+               if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT)
+                       return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state);
+               /* Fall Through to UFS_ST_SUN */
        case UFS_ST_SUN:
                return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state);
        case UFS_ST_SUNx86:
@@ -53,6 +57,12 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
                 struct ufs_super_block_third *usb3, s32 value)
 {
        switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
+       case UFS_ST_SUNOS:
+               if (fs32_to_cpu(sb, usb3->fs_postblformat == UFS_42POSTBLFMT)) {
+                       usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
+                       break;
+               }
+               /* Fall Through to UFS_ST_SUN */
        case UFS_ST_SUN:
                usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value);
                break;
@@ -81,6 +91,7 @@ ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3)
        __fs64 tmp;
 
        switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
+       case UFS_ST_SUNOS:
        case UFS_ST_SUN:
                ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0];
                ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1];
@@ -104,6 +115,7 @@ ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3)
        __fs64 tmp;
 
        switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
+       case UFS_ST_SUNOS:
        case UFS_ST_SUN:
                ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0];
                ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1];
@@ -179,10 +191,12 @@ static inline u32
 ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode)
 {
        switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
-       case UFS_UID_EFT:
-               return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
        case UFS_UID_44BSD:
                return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid);
+       case UFS_UID_EFT:
+               if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
+                       return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid);
+               /* Fall through */
        default:
                return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid);
        }
@@ -192,24 +206,31 @@ static inline void
 ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value)
 {
        switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
-       case UFS_UID_EFT:
-               inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
-               break;
        case UFS_UID_44BSD:
                inode->ui_u3.ui_44.ui_uid = cpu_to_fs32(sb, value);
+               inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
+               break;
+       case UFS_UID_EFT:
+               inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value);
+               if (value > 0xFFFF)
+                       value = 0xFFFF;
+               /* Fall through */
+       default:
+               inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value);
                break;
        }
-       inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value); 
 }
 
 static inline u32
 ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
 {
        switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
-       case UFS_UID_EFT:
-               return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
        case UFS_UID_44BSD:
                return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid);
+       case UFS_UID_EFT:
+               if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
+                       return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
+               /* Fall through */
        default:
                return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid);
        }
@@ -219,14 +240,19 @@ static inline void
 ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value)
 {
        switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) {
-       case UFS_UID_EFT:
-               inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
-               break;
        case UFS_UID_44BSD:
                inode->ui_u3.ui_44.ui_gid = cpu_to_fs32(sb, value);
+               inode->ui_u1.oldids.ui_sgid =  cpu_to_fs16(sb, value);
+               break;
+       case UFS_UID_EFT:
+               inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value);
+               if (value > 0xFFFF)
+                       value = 0xFFFF;
+               /* Fall through */
+       default:
+               inode->ui_u1.oldids.ui_sgid =  cpu_to_fs16(sb, value);
                break;
        }
-       inode->ui_u1.oldids.ui_sgid =  cpu_to_fs16(sb, value);
 }
 
 extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *);
index 682eb63b20ad3c4c7452870c3d9e6e832aea21e0..b9912ecbee241231ca0b776d9131af1e2643d80a 100644 (file)
@@ -38,6 +38,14 @@ asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times)
 
 #endif
 
+static bool nsec_valid(long nsec)
+{
+       if (nsec == UTIME_OMIT || nsec == UTIME_NOW)
+               return true;
+
+       return nsec >= 0 && nsec <= 999999999;
+}
+
 /* If times==NULL, set access and modification to current time,
  * must be owner or have write permission.
  * Else, update from *times, must be owner or super user.
@@ -52,6 +60,11 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
        struct file *f = NULL;
 
        error = -EINVAL;
+       if (times && (!nsec_valid(times[0].tv_nsec) ||
+                     !nsec_valid(times[1].tv_nsec))) {
+               goto out;
+       }
+
        if (flags & ~AT_SYMLINK_NOFOLLOW)
                goto out;
 
index e6ea293f303c99cfa625ae08747f3c7e486c2ea4..5e9564902976e0f1d76fbfbb0cb4565afcf36def 100644 (file)
@@ -79,7 +79,7 @@ kmem_zone_init(int size, char *zone_name)
 
 static inline kmem_zone_t *
 kmem_zone_init_flags(int size, char *zone_name, unsigned long flags,
-                    void (*construct)(void *, kmem_zone_t *, unsigned long))
+                    void (*construct)(kmem_zone_t *, void *))
 {
        return kmem_cache_create(zone_name, size, 0, flags, construct);
 }
index 354d68a32d4a4e4aa9e701c327bdd95d9139be1c..52bd08c0a2780c0b12a582fe6a4031d716cf9926 100644 (file)
@@ -402,10 +402,9 @@ xfs_start_page_writeback(
                clear_page_dirty_for_io(page);
        set_page_writeback(page);
        unlock_page(page);
-       if (!buffers) {
+       /* If no buffers on the page are to be written, finish it here */
+       if (!buffers)
                end_page_writeback(page);
-               wbc->pages_skipped++;   /* We didn't write this page */
-       }
 }
 
 static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh)
index 0b5fa124bef2a8d53b88af18169020df11f0a68c..e0e06dd4bef2325f84bef2011bf8e506bb460376 100644 (file)
@@ -133,7 +133,7 @@ xfs_ichgtime(
         */
        SYNCHRONIZE();
        ip->i_update_core = 1;
-       if (!(inode->i_state & I_LOCK))
+       if (!(inode->i_state & I_SYNC))
                mark_inode_dirty_sync(inode);
 }
 
@@ -185,7 +185,7 @@ xfs_ichgtime_fast(
         */
        SYNCHRONIZE();
        ip->i_update_core = 1;
-       if (!(inode->i_state & I_LOCK))
+       if (!(inode->i_state & I_SYNC))
                mark_inode_dirty_sync(inode);
 }
 
index 491d1f4f202d8d5919ade355c0a212825e8c8a54..9c7d8202088fb5cdda4da6ef2c9f2ad0b2ed649e 100644 (file)
@@ -356,9 +356,8 @@ xfs_fs_destroy_inode(
 
 STATIC void
 xfs_fs_inode_init_once(
-       void                    *vnode,
        kmem_zone_t             *zonep,
-       unsigned long           flags)
+       void                    *vnode)
 {
        inode_init_once(vn_to_inode((bhv_vnode_t *)vnode));
 }
index 2d03f995865ffe8ff03d03477d7a950dbdbbb5d7..b52288774345deaf39d422aaa380c85590b36772 100644 (file)
@@ -1,6 +1,5 @@
 header-y += asm-generic/
 header-y += linux/
-header-y += scsi/
 header-y += sound/
 header-y += mtd/
 header-y += rdma/
index 6c2d78fba264ac21ce616fcf9622bf1ea9b89fc7..4b518e3b952c2e607993d4e5ebf0b64c01b83d14 100644 (file)
@@ -155,6 +155,7 @@ extern int alpha_l1d_cacheshape;
 extern int alpha_l2_cacheshape;
 extern int alpha_l3_cacheshape;
 
+/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
 #define ARCH_DLINFO                                            \
   do {                                                         \
     NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape);      \
index 6a9f02af95294b4995e61dfc514b88433fd4f6ff..0be50413b2b5007ff2343d0be0b94d1d6dc378c3 100644 (file)
@@ -91,8 +91,6 @@ static int FDC2 = -1;
 #define N_FDC 2
 #define N_DRIVE 8
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
 /*
  * Most Alphas have no problems with floppy DMA crossing 64k borders,
  * except for certain ones, like XL and RUFFIAN.
index ab5b60dcef19f5b3ea7bf17ed2cdfaea1ddf42f4..38f18cf18c9d0e99ae5f353893379923193c6b1b 100644 (file)
@@ -551,12 +551,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
 #endif
 #define RTC_ALWAYS_BCD 0
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 /*
  * Some mucking forons use if[n]def writeq to check if platform has it.
  * It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them
index 1a6295f2c2d43ddf0cdee488a6585a6ea225f1f0..f1e9278a9fe22aeb149665bdcbe39d4aaefbed16 100644 (file)
@@ -30,7 +30,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name)            __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name)     __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init(struct semaphore *sem, int val)
 {
index 620c4d86cbf48d50ae8b254fc147f80fa199b1e7..fd9dc889f36c87b55da179ba39f3528e6cf8e1cb 100644 (file)
@@ -48,6 +48,7 @@
 
 #ifndef __ASSEMBLY__
 #include <linux/kernel.h>
+#define AT_VECTOR_SIZE_ARCH 4 /* entries in ARCH_DLINFO */
 
 /*
  * This is the logout header that should be common to all platforms
index d595c15166a42754944109c8ea47b8b454039142..41a5e9d6bb694999ad426a2a6526a0556e00f1d7 100644 (file)
@@ -128,8 +128,6 @@ static inline void fd_scandrives (void)
 #define N_FDC 1
 #define N_DRIVE 4
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
 #define CROSS_64KB(a,s) (0)
 
 /*
diff --git a/include/asm-arm/ipc.h b/include/asm-arm/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index d5dc624f452a203142908c5cf96adf642dcdbd2b..1c8b441f89e300c6c46dda9bcf6c707a38ceca66 100644 (file)
@@ -28,7 +28,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INIT(name,count)
 
 #define DECLARE_MUTEX(name)            __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name)     __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init(struct semaphore *sem, int val)
 {
index 22992ee0627ac3fb5c87bfa4c297184b8bfd1628..3141451a9bd62c2b553a21ebf8aff59e958c66d5 100644 (file)
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
diff --git a/include/asm-arm26/irq_regs.h b/include/asm-arm26/irq_regs.h
new file mode 100644 (file)
index 0000000..3dd9c0b
--- /dev/null
@@ -0,0 +1 @@
+#include <asm-generic/irq_regs.h>
index 64bb92bb677338ec3c2ee872e0431719fb16bc91..8be7ea9c9047119b3541cd8d7ec860c1dd763d73 100644 (file)
@@ -298,13 +298,6 @@ extern void __iounmap(void __iomem *addr);
 #define ioport_map(port, nr)   ioremap(port, nr)
 #define ioport_unmap(port)     iounmap(port)
 
-#define dma_cache_wback_inv(_start, _size)     \
-       flush_dcache_region(_start, _size)
-#define dma_cache_inv(_start, _size)           \
-       invalidate_dcache_region(_start, _size)
-#define dma_cache_wback(_start, _size)         \
-       clean_dcache_region(_start, _size)
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
index ef99ddccc10caceb947e1eb9c8485ee5ed9ed565..feaf1d453386ba814b9b0a7a3f9856304afb8ea9 100644 (file)
@@ -36,7 +36,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 2bff153a32ed6d557edc376ed0bdb65e62e2e939..8999a381940361b760e001182b8adbc2abb6d6ed 100644 (file)
@@ -25,9 +25,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
index 525179bf43d70368fe1406ee926f70c18ffe5523..d1d2e6be3b59328f42f02d46e91402cffd0b5ab8 100644 (file)
@@ -183,10 +183,6 @@ extern void blkfin_inv_cache_all(void);
 #define        ioport_map(port, nr)            ((void __iomem*)(port))
 #define        ioport_unmap(addr)
 
-#define dma_cache_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
-
 /* Pages to physical address... */
 #define page_to_phys(page)      ((page - mem_map) << PAGE_SHIFT)
 #define page_to_bus(page)       ((page - mem_map) << PAGE_SHIFT)
diff --git a/include/asm-blackfin/ipc.h b/include/asm-blackfin/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 94c04d7ab23e5efbf7080f97c0081a4c970f8a23..533f90fb2e4e6a99eb75d9077a1d860a3f3c4688 100644 (file)
@@ -35,7 +35,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init(struct semaphore *sem, int val)
 {
index 36f8dc8c52bad814927029fde7a00da260b102a4..9785a6d531c6c8b488d0ca55d11da642fc3ba863 100644 (file)
@@ -27,9 +27,9 @@ typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
 /* HK0617   -- Changes to unsigned long temporarily */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif                         /* __ASSEMBLY__ */
diff --git a/include/asm-cris/ipc.h b/include/asm-cris/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
diff --git a/include/asm-cris/irq_regs.h b/include/asm-cris/irq_regs.h
new file mode 100644 (file)
index 0000000..3dd9c0b
--- /dev/null
@@ -0,0 +1 @@
+#include <asm-generic/irq_regs.h>
index 53f548b791c18ebb8456c1b593a0f38b95e557cb..31a4ac448195e640931b58eb4cc8089079b9605f 100644 (file)
@@ -35,7 +35,6 @@ struct semaphore {
         struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init(struct semaphore *sem, int val)
 {
index 84557c9bac93e4ef7993eae2c0576644a601719b..5a21c42bc6c593ca28c7a2afdecd73e56047d2bf 100644 (file)
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
diff --git a/include/asm-frv/ipc.h b/include/asm-frv/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 09586528e00794f391d7cd680d0950db4a9307ae..d7aaa1911a1afed07771d7eed8437cb196bcf061 100644 (file)
@@ -49,7 +49,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 1b6d1923b25b5e41b3f7092a36bf213ebd531675..767e5ed71c4ba37c718b8b5beecfe045c856ef8b 100644 (file)
@@ -30,9 +30,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
index 5bfeef7616494f22a117d1905933274c6850d51b..c18110ee30f1212ddd621d073919145ae022eb35 100644 (file)
@@ -2,7 +2,6 @@ header-y += errno-base.h
 header-y += errno.h
 header-y += fcntl.h
 header-y += ioctl.h
-header-y += ipc.h
 header-y += mman.h
 header-y += poll.h
 header-y += signal.h
index a37e95fe58d64734f0323ace02bf062ad155f8cd..8fd81713cfc0cd68ca2f6fca85282f1892cdd632 100644 (file)
@@ -30,6 +30,5 @@ unifdef-y += unistd.h
 unifdef-y += user.h
 
 # These probably shouldn't be exported
-unifdef-y += shmparam.h
 unifdef-y += elf.h
 unifdef-y += page.h
diff --git a/include/asm-generic/ipc.h b/include/asm-generic/ipc.h
deleted file mode 100644 (file)
index a40407a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef _ASM_GENERIC_IPC_H
-#define _ASM_GENERIC_IPC_H
-/*
- * These are used to wrap system calls.
- *
- * See architecture code for ugly details..
- */
-struct ipc_kludge {
-       struct msgbuf __user *msgp;
-       long msgtyp;
-};
-
-#define SEMOP           1
-#define SEMGET          2
-#define SEMCTL          3
-#define SEMTIMEDOP      4
-#define MSGSND         11
-#define MSGRCV         12
-#define MSGGET         13
-#define MSGCTL         14
-#define SHMAT          21
-#define SHMDT          22
-#define SHMGET         23
-#define SHMCTL         24
-
-/* Used by the DIPC package, try and avoid reusing it */
-#define DIPC            25
-
-#define IPCCALL(version,op)    ((version)<<16 | (op))
-
-#endif /* _ASM_GENERIC_IPC_H */
index 91b7487cb7ae9582cc0d0c3e3d00ab9d7cfec071..7543a57b4ea13dce3ba67355eb161f8b14ce305f 100644 (file)
@@ -264,12 +264,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
 
 extern void iounmap(void *addr);
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 /* H8/300 internal I/O functions */
 static __inline__ unsigned char ctrl_inb(unsigned long addr)
 {
diff --git a/include/asm-h8300/ipc.h b/include/asm-h8300/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 81bae2a99192af8ed1747491f2af24929d8fd59a..f3ffff83ff09c0fab806b98e8159cb7f440f3605 100644 (file)
@@ -39,7 +39,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 2a8b1b2be782fa1df9923dd8b3a5bf96dcc3c407..56566e2a09fdf847da5195a6afb56157c4b8400b 100644 (file)
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 /*
index 25f9835d5459e2028c3b1ba1c811861bb2d19193..f10e29b60b0010b322b3aec2242b3dfb6a5de66e 100644 (file)
@@ -192,6 +192,7 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
 
 #define GATE_EHDR      ((const struct elfhdr *) GATE_ADDR)
 
+/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
 #define ARCH_DLINFO                                                            \
 do {                                                                           \
        extern char __kernel_syscall_via_epc[];                                 \
index eb17a86929679834eaf5372b01a57ab5fd84edb0..4ebed77aa4726c5263e0ff1a0ff5dfacc60daf11 100644 (file)
@@ -435,10 +435,6 @@ extern void memcpy_fromio(void *dst, const volatile void __iomem *src, long n);
 extern void memcpy_toio(volatile void __iomem *dst, const void *src, long n);
 extern void memset_io(volatile void __iomem *s, int c, long n);
 
-#define dma_cache_inv(_start,_size)             do { } while (0)
-#define dma_cache_wback(_start,_size)           do { } while (0)
-#define dma_cache_wback_inv(_start,_size)       do { } while (0)
-
 # endif /* __KERNEL__ */
 
 /*
index 7d5e2ccc37a079fb4fe2ffbd16d69c919c6610a5..6a8a27cfae3e04f0f35771aa9490ff3b46e8729d 100644 (file)
@@ -24,6 +24,7 @@
 
 extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
 extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
+extern pg_data_t *pgdat_list[MAX_NUMNODES];
 
 /* Stuff below this line could be architecture independent */
 
index f483eeb95dd1dabfd248803492bb0a6a7561b6ec..d8393d11288ded185df9fcc48853f9cc566f27fe 100644 (file)
@@ -28,7 +28,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name, count)
 
 #define DECLARE_MUTEX(name)            __DECLARE_SEMAPHORE_GENERIC(name, 1)
-#define DECLARE_MUTEX_LOCKED(name)     __DECLARE_SEMAPHORE_GENERIC(name, 0)
 
 static inline void
 sema_init (struct semaphore *sem, int val)
index 91bb8e00066c76b5a59c00fd3f8a4649ba6e7fb7..595112bca3ccc8f39448dedcf9e195c6ac1f94d4 100644 (file)
@@ -32,6 +32,8 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 
+#define AT_VECTOR_SIZE_ARCH 2 /* entries in ARCH_DLINFO */
+
 struct pci_vector_struct {
        __u16 segment;  /* PCI Segment number */
        __u16 bus;      /* PCI Bus number */
diff --git a/include/asm-m32r/ipc.h b/include/asm-m32r/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 41e45d7b87ef2262c396872c87b3a143fd9ff88a..b5bf95a6f2b475890eebdd8ff5f3eec29e872153 100644 (file)
@@ -35,7 +35,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 27d3eb539c50ddf16bbea835d11fcd7359bbf703..b64c16639a7b77c7098bea0a053c13c14340ae57 100644 (file)
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 #endif /* __ASSEMBLY__ */
 
index 45dc908932a3993a8295dd0a27575b07415b640a..697d50393dd07d8db81b73e22544aa3fc325d24d 100644 (file)
@@ -31,9 +31,6 @@ asmlinkage irqreturn_t floppy_hardint(int irq, void *dev_id);
 #define FLOPPY0_TYPE (MACH_IS_Q40 ? 6 : 4)
 #define FLOPPY1_TYPE 0
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
-
 /* basically PC init + set use_virtual_dma */
 #define  FDC1 m68k_floppy_init()
 
index 47bb9cf107b7aa4cf1b8935d3a451eb2f5d20313..baf4f9b8acfc327de5da8c759c310c7b43509e66 100644 (file)
@@ -384,12 +384,6 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
        return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
 }
 
-
-/* m68k caches aren't DMA coherent */
-extern void dma_cache_wback_inv(unsigned long start, unsigned long size);
-extern void dma_cache_wback(unsigned long start, unsigned long size);
-extern void dma_cache_inv(unsigned long start, unsigned long size);
-
 static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
 {
        __builtin_memset((void __force *) addr, val, count);
diff --git a/include/asm-m68k/ipc.h b/include/asm-m68k/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index fd4c7cc3d3bebc83605c56e92c0a73a2d250dde8..64d6b119bb0a096a4dcd669d15678a3e15197288 100644 (file)
@@ -40,7 +40,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init(struct semaphore *sem, int val)
 {
index b5a1febc97d41d2658d6d25552d788ed3f1ce6ca..c35c09d93b662d97c6f0b8be3fa1a42c2d6792f0 100644 (file)
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
index 8df4cee2a0cd272ee28339f75ae80772fde54f83..653d9b2d7ddfe5be3799ba95ca715d6898f3c56b 100644 (file)
@@ -165,12 +165,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
 
 extern void iounmap(void *addr);
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 /* Pages to physical address... */
 #define page_to_phys(page)      ((page - mem_map) << PAGE_SHIFT)
 #define page_to_bus(page)       ((page - mem_map) << PAGE_SHIFT)
diff --git a/include/asm-m68knommu/ipc.h b/include/asm-m68knommu/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 5cc1fdd86f504ebb71bf8b1596aecd144615c688..5779eb6c06893d71f51e2ffe1b83ff98f85327b3 100644 (file)
@@ -39,7 +39,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index a62d0990c8ae8cfb526c1fd97b72282e62236579..992d232adc8383bb95dc988fa53ec068b86bc292 100644 (file)
@@ -34,8 +34,6 @@ static inline void fd_cacheflush(char * addr, long size)
 #define N_FDC 1                        /* do you *really* want a second controller? */
 #define N_DRIVE 8
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
 /*
  * The DMA channel used by the floppy controller cannot access data at
  * addresses >= 16MB
index 2cd8323c8586f47d440aca4d72901478d9a21754..e62058b0d28c37c48d7a71c40c7271322fed5e63 100644 (file)
@@ -554,6 +554,8 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
  *    caches.  Dirty lines of the caches may be written back or simply
  *    be discarded.  This operation is necessary before dma operations
  *    to the memory.
+ *
+ * This API used to be exported; it now is for arch code internal use only.
  */
 #ifdef CONFIG_DMA_NONCOHERENT
 
diff --git a/include/asm-mips/ipc.h b/include/asm-mips/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 080daa77f867e5d52ff4189c8dbed243d97298e7..fdf8042b784b57915779566ad2de94dbb75f7b3e 100644 (file)
@@ -49,7 +49,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name, count)
 
 #define DECLARE_MUTEX(name)            __DECLARE_SEMAPHORE_GENERIC(name, 1)
-#define DECLARE_MUTEX_LOCKED(name)     __DECLARE_SEMAPHORE_GENERIC(name, 0)
 
 static inline void sema_init(struct semaphore *sem, int val)
 {
index 63a13c5bd8324ea0527779bcb575b2fb99026a6b..2dd147f519d15ea5f7b9f0b1b68964c2d3eadea7 100644 (file)
@@ -34,9 +34,9 @@ typedef unsigned long __u64;
 
 #else
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif
index da2f9c1571430e8a6a52e1c7b402eeea5205e31d..4ca69f558fae648f2be584e4f89490fd2c338417 100644 (file)
@@ -266,10 +266,6 @@ static int FDC2 = -1;
 #define N_FDC 1
 #define N_DRIVE 8
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
-#define AUTO_DMA
-
 #define EXTRA_FLOPPY_PARAMS
 
 #endif /* __ASM_PARISC_FLOPPY_H */
index 4cc9bcec0564389bd33b69a136f66a24f4bafd96..95f00e11c7b495d0b54202ff3eb5d2200d3934a6 100644 (file)
@@ -270,11 +270,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
 /* IO Port space is :      BBiiii   where BB is HBA number. */
 #define IO_SPACE_LIMIT 0x00ffffff
 
-
-#define dma_cache_inv(_start,_size)            do { flush_kernel_dcache_range(_start,_size); } while (0)
-#define dma_cache_wback(_start,_size)          do { flush_kernel_dcache_range(_start,_size); } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { flush_kernel_dcache_range(_start,_size); } while (0)
-
 /* PA machines have an MM I/O space from 0xf0000000-0xffffffff in 32
  * bit mode and from 0xfffffffff0000000-0xfffffffffffffff in 64 bit
  * mode (essentially just sign extending.  This macro takes in a 32
index d45827a21f943d07cb36153dd2906d937e016fb8..b771dcfcfdd15fed26e8cee1e43ce375e418ea29 100644 (file)
@@ -53,7 +53,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 extern inline void sema_init (struct semaphore *sem, int val)
 {
index d4aa33033d98d334d2b28d977e3f17355eccb3d1..56c84802da59b395132f5e691bea2c485b9fa16e 100644 (file)
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
index 4869513b872f44244f0ee3e4aaa820c4312847ce..5f640e5424751196ee64d91b1f0a11b74bcbe39b 100644 (file)
@@ -13,9 +13,7 @@ header-y += shmbuf.h
 header-y += socket.h
 header-y += termbits.h
 header-y += fcntl.h
-header-y += ipc.h
 header-y += poll.h
-header-y += shmparam.h
 header-y += sockios.h
 header-y += ucontext.h
 header-y += ioctl.h
index e42820d6d25bcf0a218948d58a26fc7f149566fd..6bd07ef78ac42b27aac921d650a2b04f6856c45b 100644 (file)
@@ -101,6 +101,7 @@ typedef elf_greg_t64 elf_gregset_t64[ELF_NGREG];
 
 typedef unsigned int elf_greg_t32;
 typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG];
+typedef elf_gregset_t32 compat_elf_gregset_t;
 
 /*
  * ELF_ARCH, CLASS, and DATA are used to set parameters in the core dumps.
@@ -175,26 +176,27 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];
 
 #define ELF_ET_DYN_BASE         (0x20000000)
 
-/* Common routine for both 32-bit and 64-bit processes */
+/*
+ * Our registers are always unsigned longs, whether we're a 32 bit
+ * process or 64 bit, on either a 64 bit or 32 bit kernel.
+ *
+ * This macro relies on elf_regs[i] having the right type to truncate to,
+ * either u32 or u64.  It defines the body of the elf_core_copy_regs
+ * function, either the native one with elf_gregset_t elf_regs or
+ * the 32-bit one with elf_gregset_t32 elf_regs.
+ */
+#define PPC_ELF_CORE_COPY_REGS(elf_regs, regs) \
+       int i, nregs = min(sizeof(*regs) / sizeof(unsigned long), \
+                          (size_t)ELF_NGREG);                    \
+       for (i = 0; i < nregs; i++) \
+               elf_regs[i] = ((unsigned long *) regs)[i]; \
+       memset(&elf_regs[i], 0, (ELF_NGREG - i) * sizeof(elf_regs[0]))
+
+/* Common routine for both 32-bit and 64-bit native processes */
 static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs,
-                                           struct pt_regs *regs)
+                                         struct pt_regs *regs)
 {
-       int i, nregs;
-
-       memset((void *)elf_regs, 0, sizeof(elf_gregset_t));
-
-       /* Our registers are always unsigned longs, whether we're a 32 bit
-        * process or 64 bit, on either a 64 bit or 32 bit kernel.
-        * Don't use ELF_GREG_TYPE here. */
-       nregs = sizeof(struct pt_regs) / sizeof(unsigned long);
-       if (nregs > ELF_NGREG)
-               nregs = ELF_NGREG;
-
-       for (i = 0; i < nregs; i++) {
-               /* This will correctly truncate 64 bit registers to 32 bits
-                * for a 32 bit process on a 64 bit kernel. */
-               elf_regs[i] = (elf_greg_t)((ELF_GREG_TYPE *)regs)[i];
-       }
+       PPC_ELF_CORE_COPY_REGS(elf_regs, regs);
 }
 #define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, regs);
 
@@ -212,6 +214,14 @@ static inline int dump_task_regs(struct task_struct *tsk,
 extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); 
 #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
 
+typedef elf_vrregset_t elf_fpxregset_t;
+
+#ifdef CONFIG_ALTIVEC
+extern int dump_task_altivec(struct task_struct *, elf_vrregset_t *vrregs);
+#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_altivec(tsk, regs)
+#define ELF_CORE_XFPREG_TYPE NT_PPC_VMX
+#endif
+
 #endif /* __KERNEL__ */
 
 /* ELF_HWCAP yields a mask that user programs can use to figure out what
@@ -281,6 +291,7 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
  *   AT_IGNOREPPC is used for that.
  * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
  *   even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
+ * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes
  */
 #define ARCH_DLINFO                                                    \
 do {                                                                   \
index 34146f0eea63c7af99dd9687478c1d1b329da5b0..24bd34c57e9d020bac9f24dc3be933db06e6e019 100644 (file)
@@ -202,8 +202,6 @@ static int FDC2 = -1;
 #define N_FDC 2                        /* Don't change this! */
 #define N_DRIVE 8
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
 /*
  * The PowerPC has no problems with floppy DMA crossing 64k borders.
  */
index 0d0589ef8ea68314ae6c8af77413a5022b50326a..bf14ab4ef4c9794b30432d5d415ec06660d8c121 100644 (file)
@@ -498,23 +498,6 @@ static inline void name at                                 \
 #define writeq writeq
 #endif
 
-#ifdef CONFIG_NOT_COHERENT_CACHE
-
-#define dma_cache_inv(_start,_size) \
-       invalidate_dcache_range(_start, (_start + _size))
-#define dma_cache_wback(_start,_size) \
-       clean_dcache_range(_start, (_start + _size))
-#define dma_cache_wback_inv(_start,_size) \
-       flush_dcache_range(_start, (_start + _size))
-
-#else /* CONFIG_NOT_COHERENT_CACHE */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
-#endif /* !CONFIG_NOT_COHERENT_CACHE */
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
diff --git a/include/asm-powerpc/ipc.h b/include/asm-powerpc/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 57369d2cadef816fdb551b83b6d59b647f1763da..48dd32e077499878e6f376011f9e69ff165fea1d 100644 (file)
@@ -35,7 +35,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name)            __DECLARE_SEMAPHORE_GENERIC(name, 1)
-#define DECLARE_MUTEX_LOCKED(name)     __DECLARE_SEMAPHORE_GENERIC(name, 0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index d10e99bf500119972d6ef6579ada5b1164136ce4..87be8c3bc9cb25efb11aebac0734caaa5fe5e85a 100644 (file)
@@ -40,6 +40,7 @@
 #define set_mb(var, value)     do { var = value; mb(); } while (0)
 
 #ifdef __KERNEL__
+#define AT_VECTOR_SIZE_ARCH 6 /* entries in ARCH_DLINFO */
 #ifdef CONFIG_SMP
 #define smp_mb()       mb()
 #define smp_rmb()      rmb()
index a584341c87e3f4c3d0c5d82bf831d39695be350f..903fd1932436a0f696f51f509777382b6a24707d 100644 (file)
@@ -40,9 +40,9 @@ typedef unsigned int __u32;
 typedef __signed__ long __s64;
 typedef unsigned long __u64;
 #else
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 #endif /* __powerpc64__ */
 
index ae316e6d2ca99650cd42eb57ae9903f3c3672c4c..7d9b3f430d929594343b7518f78131161aa47795 100644 (file)
@@ -166,8 +166,6 @@ static int FDC2 = -1;
 #define N_FDC 2                        /* Don't change this! */
 #define N_DRIVE 8
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
 /*
  * The PowerPC has no problems with floppy DMA crossing 64k borders.
  */
index 8f58231a8bc67bdf490182294036b2e2a05733b3..a0d409a5d80f835a8ad6fdaf1060ed7071fb2418 100644 (file)
@@ -478,23 +478,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
 #include <asm/mpc8260_pci9.h>
 #endif
 
-#ifdef CONFIG_NOT_COHERENT_CACHE
-
-#define dma_cache_inv(_start,_size) \
-       invalidate_dcache_range(_start, (_start + _size))
-#define dma_cache_wback(_start,_size) \
-       clean_dcache_range(_start, (_start + _size))
-#define dma_cache_wback_inv(_start,_size) \
-       flush_dcache_range(_start, (_start + _size))
-
-#else
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
-#endif
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
diff --git a/include/asm-ppc/irq_regs.h b/include/asm-ppc/irq_regs.h
new file mode 100644 (file)
index 0000000..3dd9c0b
--- /dev/null
@@ -0,0 +1 @@
+#include <asm-generic/irq_regs.h>
diff --git a/include/asm-s390/ipc.h b/include/asm-s390/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index dbce058aefa92a6ed2f6781d1a5b1c147e1eae27..0e7001ad8392e3ce894898095143700e0ffa33ce 100644 (file)
@@ -33,7 +33,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index fc5d7cf19324be9160352b7ce0675619278ec23e..2c5879ae90ca1864ea286b6e79c01d604314422f 100644 (file)
@@ -28,9 +28,9 @@ typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
 #ifndef __s390x__
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 #else /* __s390x__ */
 typedef __signed__ long __s64;
index 43ca244564b104a6d3438a7c3d86225fc5e12290..12cc4b392bf039efbace9fa6090521b1d08b3799 100644 (file)
@@ -133,6 +133,7 @@ extern void __kernel_vsyscall;
 #define VDSO_BASE              ((unsigned long)current->mm->context.vdso)
 #define VDSO_SYM(x)            (VDSO_BASE + (unsigned long)(x))
 
+/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
 #define ARCH_DLINFO                                            \
 do {                                                           \
        if (vdso_enabled)                                       \
index 3b59b3af777bb16214072e4cb732230c295dbbbd..59fbfdc90dfb0bbbdcab34fb367e62317e821a0c 100644 (file)
@@ -213,7 +213,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
        }
 #endif
 
-       dma_cache_wback_inv(addr, size);
+       __flush_purge_region(addr, size);
 
        /* actual, physical DMA */
        doing_pdma = 0;
@@ -263,10 +263,6 @@ static int FDC2 = -1;
 #define N_FDC 2
 #define N_DRIVE 8
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
-#define AUTO_DMA
-
 #define EXTRA_FLOPPY_PARAMS
 
 #endif /* __ASM_SH_FLOPPY_H */
index 1a336cdc75fed1a5a3e9bca2a90178eeb21bca2c..6ed34d8eac5f48026088535adcd931a053a2d609 100644 (file)
@@ -326,31 +326,6 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
 #define iounmap(addr)                                  \
        __iounmap((addr))
 
-/*
- * The caches on some architectures aren't dma-coherent and have need to
- * handle this in software.  There are three types of operations that
- * can be applied to dma buffers.
- *
- *  - dma_cache_wback_inv(start, size) makes caches and RAM coherent by
- *    writing the content of the caches back to memory, if necessary.
- *    The function also invalidates the affected part of the caches as
- *    necessary before DMA transfers from outside to memory.
- *  - dma_cache_inv(start, size) invalidates the affected parts of the
- *    caches.  Dirty lines of the caches may be written back or simply
- *    be discarded.  This operation is necessary before dma operations
- *    to the memory.
- *  - dma_cache_wback(start, size) writes back any dirty lines but does
- *    not invalidate the cache.  This can be used before DMA reads from
- *    memory,
- */
-
-#define dma_cache_wback_inv(_start,_size) \
-    __flush_purge_region(_start,_size)
-#define dma_cache_inv(_start,_size) \
-    __flush_invalidate_region(_start,_size)
-#define dma_cache_wback(_start,_size) \
-    __flush_wback_region(_start,_size)
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
diff --git a/include/asm-sh/ipc.h b/include/asm-sh/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 489f7847c5d96f8de23250192d6abe035182c27a..9e5a37c4dce2d297eaf9f2162910495c1fae4f8d 100644 (file)
@@ -37,7 +37,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 9d849e6df268b8138252e29f11126f31c21ee2b7..4faa2fb886163007f57af8ec54ad45769b2bf2d3 100644 (file)
@@ -15,6 +15,7 @@
 struct task_struct *__switch_to(struct task_struct *prev,
                                struct task_struct *next);
 
+#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */
 /*
  *     switch_to() should switch tasks to task nr n, first
  */
index fd00dbb82f84ff8122784d663578dd5ca935d8fa..7ba69d9707eff7eecc876b345469ee81a8461866 100644 (file)
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
index de4309960207779eb216d7d06ecc4cb9a6d32778..e661857f98dc8e83bf60bc181e35c4464b343a57 100644 (file)
@@ -42,7 +42,11 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
                                  enum dma_data_direction dir)
 {
-       dma_cache_wback_inv((unsigned long)vaddr, size);
+       unsigned long s = (unsigned long) vaddr & L1_CACHE_ALIGN_MASK;
+       unsigned long e = (vaddr + size) & L1_CACHE_ALIGN_MASK;
+
+       for (; s <= e; s += L1_CACHE_BYTES)
+               asm volatile ("ocbp     %0, 0" : : "r" (s));
 }
 
 static inline dma_addr_t dma_map_single(struct device *dev,
index 3de3ad99f45789d29f5b5c0eb496fed3bf9c762c..7bd7314d38c209e12fc36bf9bfb4abafc8b1086a 100644 (file)
@@ -181,54 +181,6 @@ extern void iounmap(void *addr);
 unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name);
 extern void onchip_unmap(unsigned long vaddr);
 
-/*
- * The caches on some architectures aren't dma-coherent and have need to
- * handle this in software.  There are three types of operations that
- * can be applied to dma buffers.
- *
- *  - dma_cache_wback_inv(start, size) makes caches and RAM coherent by
- *    writing the content of the caches back to memory, if necessary.
- *    The function also invalidates the affected part of the caches as
- *    necessary before DMA transfers from outside to memory.
- *  - dma_cache_inv(start, size) invalidates the affected parts of the
- *    caches.  Dirty lines of the caches may be written back or simply
- *    be discarded.  This operation is necessary before dma operations
- *    to the memory.
- *  - dma_cache_wback(start, size) writes back any dirty lines but does
- *    not invalidate the cache.  This can be used before DMA reads from
- *    memory,
- */
-
-static __inline__ void dma_cache_wback_inv (unsigned long start, unsigned long size)
-{
-       unsigned long s = start & L1_CACHE_ALIGN_MASK;
-       unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
-       for (; s <= e; s += L1_CACHE_BYTES)
-               asm volatile ("ocbp     %0, 0" : : "r" (s));
-}
-
-static __inline__ void dma_cache_inv (unsigned long start, unsigned long size)
-{
-       // Note that caller has to be careful with overzealous
-       // invalidation should there be partial cache lines at the extremities
-       // of the specified range
-       unsigned long s = start & L1_CACHE_ALIGN_MASK;
-       unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
-       for (; s <= e; s += L1_CACHE_BYTES)
-               asm volatile ("ocbi     %0, 0" : : "r" (s));
-}
-
-static __inline__ void dma_cache_wback (unsigned long start, unsigned long size)
-{
-       unsigned long s = start & L1_CACHE_ALIGN_MASK;
-       unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
-       for (; s <= e; s += L1_CACHE_BYTES)
-               asm volatile ("ocbwb    %0, 0" : : "r" (s));
-}
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
diff --git a/include/asm-sh64/ipc.h b/include/asm-sh64/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 4695264591495d4d7364a89e9cfdefd8c1b0c760..f027cc14b55bc96a59b6935d76cd5f9d8beee1b3 100644 (file)
@@ -44,7 +44,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 8d41db2153b599bcd618a47bff5726bd9d7828bd..2c7ad73b3883329ff04b023608f4b28604535358 100644 (file)
@@ -30,9 +30,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
index acd06d8ff70a040ba5063ca99b93689c231f24eb..5da1eef0f706b77c703b96cfa895caa1b437927d 100644 (file)
@@ -77,8 +77,6 @@ static struct sun_floppy_ops sun_fdops;
 #define fd_dma_mem_free(addr,size) (vfree((void *)(addr)))
 #endif
 
-#define FLOPPY_MOTOR_MASK         0x10
-
 /* XXX This isn't really correct. XXX */
 #define get_dma_residue(x)        (0)
 
index c23e74a0eaa8d4021c101a6bb4c3a5922ddfb4b2..243bf8e9a058d799284d82f44323e0202a02e3d3 100644 (file)
@@ -310,13 +310,6 @@ extern void sbus_iounmap(volatile void __iomem *vaddr, unsigned long size);
 #define RTC_PORT(x)   (rtc_port + (x))
 #define RTC_ALWAYS_BCD  0
 
-/* Nothing to do */
-/* P3: Only IDE DMA may need these. XXX Verify that it still does... */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 #endif
 
 #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED         1
diff --git a/include/asm-sparc/ipc.h b/include/asm-sparc/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index f74ba31e265bd261dde9482bfdbe9bd78d1fcf12..8018f9f4d497d85863b38610e4b651b2f6f7341f 100644 (file)
@@ -26,7 +26,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 854fd3a65acfbfa002aeeae6cc1fef4f7952c284..a90dc82129d1eaad506862a50fb8419652dc2716 100644 (file)
@@ -10,7 +10,6 @@ header-y += bbc.h
 header-y += bpp.h
 header-y += display7seg.h
 header-y += envctrl.h
-header-y += ipc.h
 header-y += openprom.h
 header-y += openpromio.h
 header-y += pconf.h
index 1783239c7b405a18003ea2b2372c73b18effbe1e..c47f58d6c15c7aa4b01c47a9ff0610971f864b86 100644 (file)
@@ -84,8 +84,6 @@ static struct sun_floppy_ops sun_fdops;
 #define fd_free_irq()             sun_fdops.fd_free_irq()
 #define fd_eject(drive)           sun_fdops.fd_eject(drive)
 
-static int FLOPPY_MOTOR_MASK = 0x10;
-
 /* Super paranoid... */
 #undef HAVE_DISABLE_HLT
 
@@ -622,7 +620,6 @@ isa_done:
        sun_fdops.fd_eject = sun_pci_fd_eject;
 
         fdc_status = (unsigned long) &sun_fdc->status_82077;
-       FLOPPY_MOTOR_MASK = 0xf0;
 
        allowed_drive_mask = 0;
        sun_floppy_types[0] = 0;
@@ -729,7 +726,6 @@ static unsigned long __init sun_floppy_init(void)
                sun_fdops.fd_eject = sun_pci_fd_eject;
 
                fdc_status = (unsigned long) &sun_fdc->status_82077;
-               FLOPPY_MOTOR_MASK = 0xf0;
 
                /*
                 * XXX: Find out on which machines this is really needed.
index 9565a892801e440c2051302973e6fc817c1a1659..cd7ef3097ac28b5734f39b4fc384789fdcd8d2c3 100644 (file)
@@ -474,12 +474,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
 #define sbus_iounmap(__addr, __size)   \
        release_region((unsigned long)(__addr), (__size))
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
diff --git a/include/asm-sparc64/ipc.h b/include/asm-sparc64/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index 093dcc6788dbe0309eb380db540da991827e65a4..7f7c0c4e024faa737e67e678c5fe6b1ac8a921a7 100644 (file)
@@ -26,7 +26,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name)            __DECLARE_SEMAPHORE_GENERIC(name, 1)
-#define DECLARE_MUTEX_LOCKED(name)     __DECLARE_SEMAPHORE_GENERIC(name, 0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 911d0427de6db8bec6788dd0eaa471d7d32240c4..8c66fded8a328113b3200da486826c1617610239 100644 (file)
@@ -1,7 +1,6 @@
 /* $Id: shmparam.h,v 1.5 2001/09/24 21:17:57 kanoj Exp $ */
 #ifndef _ASMSPARC64_SHMPARAM_H
 #define _ASMSPARC64_SHMPARAM_H
-#ifdef __KERNEL__
 
 #include <asm/spitfire.h>
 
@@ -9,5 +8,4 @@
 /* attach addr a multiple of this */
 #define        SHMLBA  ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE)
 
-#endif /* __KERNEL__ */
 #endif /* _ASMSPARC64_SHMPARAM_H */
diff --git a/include/asm-um/ipc.h b/include/asm-um/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
diff --git a/include/asm-v850/ipc.h b/include/asm-v850/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
diff --git a/include/asm-v850/irq_regs.h b/include/asm-v850/irq_regs.h
new file mode 100644 (file)
index 0000000..3dd9c0b
--- /dev/null
@@ -0,0 +1 @@
+#include <asm-generic/irq_regs.h>
index 735baaf3a16e8fe7478f8307a10be49f1c6a7a09..10ed0ccf37dfa5a503798d523fc36dd5d1b53810 100644 (file)
@@ -22,7 +22,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER (name,count)
 
 #define DECLARE_MUTEX(name)            __DECLARE_SEMAPHORE_GENERIC (name,1)
-#define DECLARE_MUTEX_LOCKED(name)     __DECLARE_SEMAPHORE_GENERIC (name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index dcef5719687501bc39ceabff1c95e0d978996243..284bda88211293b040fcee3f3b50143d3bd0b7cb 100644 (file)
@@ -27,9 +27,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* !__ASSEMBLY__ */
index b32df3a332da12853ff4ea102411bd81c13a59d5..b3f694eaaf37a6f7238b1a653c58399c3d877b4c 100644 (file)
@@ -129,6 +129,7 @@ extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct
 #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
 #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
 #define ELF_CORE_COPY_XFPREGS(tsk, elf_xfpregs) dump_task_extended_fpu(tsk, elf_xfpregs)
+#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
 
 #define VDSO_HIGH_BASE         (__fix_to_virt(FIX_VDSO))
 #define VDSO_CURRENT_BASE      ((unsigned long)current->mm->context.vdso)
@@ -152,6 +153,7 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
 
 extern unsigned int vdso_enabled;
 
+/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
 #define ARCH_DLINFO                                                    \
 do if (vdso_enabled) {                                                 \
                NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY);                    \
index 44ef2f55a8e9c0970e789d007be7108d2ce0fb5f..99583b39d2163e27e90c88cbec0450af786c46f2 100644 (file)
@@ -275,10 +275,6 @@ static int FDC2 = -1;
 #define N_FDC 2
 #define N_DRIVE 8
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
-#define AUTO_DMA
-
 #define EXTRA_FLOPPY_PARAMS
 
 #endif /* __ASM_I386_FLOPPY_H */
index 6ea13c3806f3c70ae922731ac14c47375099d15e..d993380dcb47f9102534e6e71e79aacf01c0b648 100644 (file)
@@ -274,10 +274,6 @@ static int FDC2 = -1;
 #define N_FDC 2
 #define N_DRIVE 8
 
-#define FLOPPY_MOTOR_MASK 0xf0
-
-#define AUTO_DMA
-
 #define EXTRA_FLOPPY_PARAMS
 
 #endif /* __ASM_X86_64_FLOPPY_H */
index e8e0bd64112052dd82fc9723e7695d17940dedc4..4ea7b1ad3c1d5c7fd6f3762ade3ef8a888f07065 100644 (file)
@@ -237,18 +237,9 @@ static inline void flush_write_buffers(void)
        __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory");
 }
 
-#define dma_cache_inv(_start,_size)            flush_write_buffers()
-#define dma_cache_wback(_start,_size)          flush_write_buffers()
-#define dma_cache_wback_inv(_start,_size)      flush_write_buffers()
-
 #else
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-#define flush_write_buffers()
+#define flush_write_buffers() do { } while (0)
 
 #endif
 
index 7475095c5061b1634066f439c3112a209b6c7c29..a037b079433200b0633d845e54cae305d6941d53 100644 (file)
@@ -249,12 +249,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
  */
 #define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 #define flush_write_buffers() 
 
 extern int iommu_bio_merge;
diff --git a/include/asm-x86/ipc.h b/include/asm-x86/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
index c7fefa6b12fd41bc5856908f9c869dfd3d8eecc1..acd4b339c49b411b273949c0c70b799696844bd8 100644 (file)
@@ -40,7 +40,7 @@ extern spinlock_t pgd_lock;
 extern struct page *pgd_list;
 void check_pgt_cache(void);
 
-void pmd_ctor(void *, struct kmem_cache *, unsigned long);
+void pmd_ctor(struct kmem_cache *, void *);
 void pgtable_cache_init(void);
 void paging_init(void);
 
index 4e34a468c3835cc323eea52518f5c916cea79691..835c1d751a9f8cdcb7270a8034c9cdbb97309e13 100644 (file)
@@ -59,7 +59,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index 1194888536b93736f3d2616c6cb4eddfd2803e56..79694306bf7da415ad04aa5ca356ec860303038c 100644 (file)
@@ -60,7 +60,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index e7e5d426fef58c2b6892fea59c341528d827afaf..d84e593b7dfc69645240040432eab4e3398d3af8 100644 (file)
@@ -7,6 +7,7 @@
 #include <asm/cmpxchg.h>
 
 #ifdef __KERNEL__
+#define AT_VECTOR_SIZE_ARCH 2 /* entries in ARCH_DLINFO */
 
 struct task_struct;    /* one of the stranger aspects of C forward declarations.. */
 extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
index ad0a55bd782f203acb29b5bbea353783b9ee0ac6..faca1922c4c37b8723a03978140dfb783fa48889 100644 (file)
@@ -19,9 +19,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 #endif /* __ASSEMBLY__ */
index f10c3487cd4c5cb26b18d2e92df574395c349594..3e04167cd9dce22d2989f18e569255ecb059b11d 100644 (file)
@@ -33,7 +33,6 @@ struct semaphore {
        struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
 
 #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
 
 static inline void sema_init (struct semaphore *sem, int val)
 {
index f1e84526f9992b3c98a96aad641cc01448c1b345..b27d841a8eb7f2b4e4e934ccd9a876a494ac2273 100644 (file)
@@ -38,9 +38,9 @@ typedef unsigned short __u16;
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
 #endif
 
 /*
index e2ee73aef0ee0d926a9a3dfdb0dea3396beb4f5c..4ea429b187507ae8c78d2fef367bfb553092862d 100644 (file)
@@ -19,4 +19,6 @@
  */
 extern struct key_type key_type_rxrpc;
 
+extern struct key *rxrpc_get_null_key(const char *);
+
 #endif /* _KEYS_USER_TYPE_H */
index 025af706d1141c2818ef9eec96b3c0ba43ca80a9..7ac8303c8471d5cff03a82def3456af934f4c291 100644 (file)
@@ -46,7 +46,6 @@ header-y += chio.h
 header-y += coda_psdev.h
 header-y += coff.h
 header-y += comstats.h
-header-y += consolemap.h
 header-y += const.h
 header-y += cycx_cfm.h
 header-y += dlm_device.h
@@ -283,6 +282,7 @@ unifdef-y += nfs_idmap.h
 unifdef-y += n_r3964.h
 unifdef-y += nubus.h
 unifdef-y += nvram.h
+unifdef-y += oom.h
 unifdef-y += parport.h
 unifdef-y += patchkey.h
 unifdef-y += pci.h
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
new file mode 100644 (file)
index 0000000..0602339
--- /dev/null
@@ -0,0 +1,312 @@
+#ifndef __INCLUDE_ATMEL_SSC_H
+#define __INCLUDE_ATMEL_SSC_H
+
+#include <linux/platform_device.h>
+#include <linux/list.h>
+
+struct ssc_device {
+       struct list_head        list;
+       void __iomem            *regs;
+       struct platform_device  *pdev;
+       struct clk              *clk;
+       int                     user;
+       int                     irq;
+};
+
+struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
+void ssc_free(struct ssc_device *ssc);
+
+/* SSC register offsets */
+
+/* SSC Control Register */
+#define SSC_CR                         0x00000000
+#define SSC_CR_RXDIS_SIZE                       1
+#define SSC_CR_RXDIS_OFFSET                     1
+#define SSC_CR_RXEN_SIZE                        1
+#define SSC_CR_RXEN_OFFSET                      0
+#define SSC_CR_SWRST_SIZE                       1
+#define SSC_CR_SWRST_OFFSET                    15
+#define SSC_CR_TXDIS_SIZE                       1
+#define SSC_CR_TXDIS_OFFSET                     9
+#define SSC_CR_TXEN_SIZE                        1
+#define SSC_CR_TXEN_OFFSET                      8
+
+/* SSC Clock Mode Register */
+#define SSC_CMR                                0x00000004
+#define SSC_CMR_DIV_SIZE                       12
+#define SSC_CMR_DIV_OFFSET                      0
+
+/* SSC Receive Clock Mode Register */
+#define SSC_RCMR                       0x00000010
+#define SSC_RCMR_CKG_SIZE                       2
+#define SSC_RCMR_CKG_OFFSET                     6
+#define SSC_RCMR_CKI_SIZE                       1
+#define SSC_RCMR_CKI_OFFSET                     5
+#define SSC_RCMR_CKO_SIZE                       3
+#define SSC_RCMR_CKO_OFFSET                     2
+#define SSC_RCMR_CKS_SIZE                       2
+#define SSC_RCMR_CKS_OFFSET                     0
+#define SSC_RCMR_PERIOD_SIZE                    8
+#define SSC_RCMR_PERIOD_OFFSET                 24
+#define SSC_RCMR_START_SIZE                     4
+#define SSC_RCMR_START_OFFSET                   8
+#define SSC_RCMR_STOP_SIZE                      1
+#define SSC_RCMR_STOP_OFFSET                   12
+#define SSC_RCMR_STTDLY_SIZE                    8
+#define SSC_RCMR_STTDLY_OFFSET                 16
+
+/* SSC Receive Frame Mode Register */
+#define SSC_RFMR                       0x00000014
+#define SSC_RFMR_DATLEN_SIZE                    5
+#define SSC_RFMR_DATLEN_OFFSET                  0
+#define SSC_RFMR_DATNB_SIZE                     4
+#define SSC_RFMR_DATNB_OFFSET                   8
+#define SSC_RFMR_FSEDGE_SIZE                    1
+#define SSC_RFMR_FSEDGE_OFFSET                 24
+#define SSC_RFMR_FSLEN_SIZE                     4
+#define SSC_RFMR_FSLEN_OFFSET                  16
+#define SSC_RFMR_FSOS_SIZE                      4
+#define SSC_RFMR_FSOS_OFFSET                   20
+#define SSC_RFMR_LOOP_SIZE                      1
+#define SSC_RFMR_LOOP_OFFSET                    5
+#define SSC_RFMR_MSBF_SIZE                      1
+#define SSC_RFMR_MSBF_OFFSET                    7
+
+/* SSC Transmit Clock Mode Register */
+#define SSC_TCMR                       0x00000018
+#define SSC_TCMR_CKG_SIZE                       2
+#define SSC_TCMR_CKG_OFFSET                     6
+#define SSC_TCMR_CKI_SIZE                       1
+#define SSC_TCMR_CKI_OFFSET                     5
+#define SSC_TCMR_CKO_SIZE                       3
+#define SSC_TCMR_CKO_OFFSET                     2
+#define SSC_TCMR_CKS_SIZE                       2
+#define SSC_TCMR_CKS_OFFSET                     0
+#define SSC_TCMR_PERIOD_SIZE                    8
+#define SSC_TCMR_PERIOD_OFFSET                 24
+#define SSC_TCMR_START_SIZE                     4
+#define SSC_TCMR_START_OFFSET                   8
+#define SSC_TCMR_STTDLY_SIZE                    8
+#define SSC_TCMR_STTDLY_OFFSET                 16
+
+/* SSC Transmit Frame Mode Register */
+#define SSC_TFMR                       0x0000001c
+#define SSC_TFMR_DATDEF_SIZE                    1
+#define SSC_TFMR_DATDEF_OFFSET                  5
+#define SSC_TFMR_DATLEN_SIZE                    5
+#define SSC_TFMR_DATLEN_OFFSET                  0
+#define SSC_TFMR_DATNB_SIZE                     4
+#define SSC_TFMR_DATNB_OFFSET                   8
+#define SSC_TFMR_FSDEN_SIZE                     1
+#define SSC_TFMR_FSDEN_OFFSET                  23
+#define SSC_TFMR_FSEDGE_SIZE                    1
+#define SSC_TFMR_FSEDGE_OFFSET                 24
+#define SSC_TFMR_FSLEN_SIZE                     4
+#define SSC_TFMR_FSLEN_OFFSET                  16
+#define SSC_TFMR_FSOS_SIZE                      3
+#define SSC_TFMR_FSOS_OFFSET                   20
+#define SSC_TFMR_MSBF_SIZE                      1
+#define SSC_TFMR_MSBF_OFFSET                    7
+
+/* SSC Receive Hold Register */
+#define SSC_RHR                                0x00000020
+#define SSC_RHR_RDAT_SIZE                      32
+#define SSC_RHR_RDAT_OFFSET                     0
+
+/* SSC Transmit Hold Register */
+#define SSC_THR                                0x00000024
+#define SSC_THR_TDAT_SIZE                      32
+#define SSC_THR_TDAT_OFFSET                     0
+
+/* SSC Receive Sync. Holding Register */
+#define SSC_RSHR                       0x00000030
+#define SSC_RSHR_RSDAT_SIZE                    16
+#define SSC_RSHR_RSDAT_OFFSET                   0
+
+/* SSC Transmit Sync. Holding Register */
+#define SSC_TSHR                       0x00000034
+#define SSC_TSHR_TSDAT_SIZE                    16
+#define SSC_TSHR_RSDAT_OFFSET                   0
+
+/* SSC Receive Compare 0 Register */
+#define SSC_RC0R                       0x00000038
+#define SSC_RC0R_CP0_SIZE                      16
+#define SSC_RC0R_CP0_OFFSET                     0
+
+/* SSC Receive Compare 1 Register */
+#define SSC_RC1R                       0x0000003c
+#define SSC_RC1R_CP1_SIZE                      16
+#define SSC_RC1R_CP1_OFFSET                     0
+
+/* SSC Status Register */
+#define SSC_SR                         0x00000040
+#define SSC_SR_CP0_SIZE                                 1
+#define SSC_SR_CP0_OFFSET                       8
+#define SSC_SR_CP1_SIZE                                 1
+#define SSC_SR_CP1_OFFSET                       9
+#define SSC_SR_ENDRX_SIZE                       1
+#define SSC_SR_ENDRX_OFFSET                     6
+#define SSC_SR_ENDTX_SIZE                       1
+#define SSC_SR_ENDTX_OFFSET                     2
+#define SSC_SR_OVRUN_SIZE                       1
+#define SSC_SR_OVRUN_OFFSET                     5
+#define SSC_SR_RXBUFF_SIZE                      1
+#define SSC_SR_RXBUFF_OFFSET                    7
+#define SSC_SR_RXEN_SIZE                        1
+#define SSC_SR_RXEN_OFFSET                     17
+#define SSC_SR_RXRDY_SIZE                       1
+#define SSC_SR_RXRDY_OFFSET                     4
+#define SSC_SR_RXSYN_SIZE                       1
+#define SSC_SR_RXSYN_OFFSET                    11
+#define SSC_SR_TXBUFE_SIZE                      1
+#define SSC_SR_TXBUFE_OFFSET                    3
+#define SSC_SR_TXEMPTY_SIZE                     1
+#define SSC_SR_TXEMPTY_OFFSET                   1
+#define SSC_SR_TXEN_SIZE                        1
+#define SSC_SR_TXEN_OFFSET                     16
+#define SSC_SR_TXRDY_SIZE                       1
+#define SSC_SR_TXRDY_OFFSET                     0
+#define SSC_SR_TXSYN_SIZE                       1
+#define SSC_SR_TXSYN_OFFSET                    10
+
+/* SSC Interrupt Enable Register */
+#define SSC_IER                                0x00000044
+#define SSC_IER_CP0_SIZE                        1
+#define SSC_IER_CP0_OFFSET                      8
+#define SSC_IER_CP1_SIZE                        1
+#define SSC_IER_CP1_OFFSET                      9
+#define SSC_IER_ENDRX_SIZE                      1
+#define SSC_IER_ENDRX_OFFSET                    6
+#define SSC_IER_ENDTX_SIZE                      1
+#define SSC_IER_ENDTX_OFFSET                    2
+#define SSC_IER_OVRUN_SIZE                      1
+#define SSC_IER_OVRUN_OFFSET                    5
+#define SSC_IER_RXBUFF_SIZE                     1
+#define SSC_IER_RXBUFF_OFFSET                   7
+#define SSC_IER_RXRDY_SIZE                      1
+#define SSC_IER_RXRDY_OFFSET                    4
+#define SSC_IER_RXSYN_SIZE                      1
+#define SSC_IER_RXSYN_OFFSET                   11
+#define SSC_IER_TXBUFE_SIZE                     1
+#define SSC_IER_TXBUFE_OFFSET                   3
+#define SSC_IER_TXEMPTY_SIZE                    1
+#define SSC_IER_TXEMPTY_OFFSET                  1
+#define SSC_IER_TXRDY_SIZE                      1
+#define SSC_IER_TXRDY_OFFSET                    0
+#define SSC_IER_TXSYN_SIZE                      1
+#define SSC_IER_TXSYN_OFFSET                   10
+
+/* SSC Interrupt Disable Register */
+#define SSC_IDR                                0x00000048
+#define SSC_IDR_CP0_SIZE                        1
+#define SSC_IDR_CP0_OFFSET                      8
+#define SSC_IDR_CP1_SIZE                        1
+#define SSC_IDR_CP1_OFFSET                      9
+#define SSC_IDR_ENDRX_SIZE                      1
+#define SSC_IDR_ENDRX_OFFSET                    6
+#define SSC_IDR_ENDTX_SIZE                      1
+#define SSC_IDR_ENDTX_OFFSET                    2
+#define SSC_IDR_OVRUN_SIZE                      1
+#define SSC_IDR_OVRUN_OFFSET                    5
+#define SSC_IDR_RXBUFF_SIZE                     1
+#define SSC_IDR_RXBUFF_OFFSET                   7
+#define SSC_IDR_RXRDY_SIZE                      1
+#define SSC_IDR_RXRDY_OFFSET                    4
+#define SSC_IDR_RXSYN_SIZE                      1
+#define SSC_IDR_RXSYN_OFFSET                   11
+#define SSC_IDR_TXBUFE_SIZE                     1
+#define SSC_IDR_TXBUFE_OFFSET                   3
+#define SSC_IDR_TXEMPTY_SIZE                    1
+#define SSC_IDR_TXEMPTY_OFFSET                  1
+#define SSC_IDR_TXRDY_SIZE                      1
+#define SSC_IDR_TXRDY_OFFSET                    0
+#define SSC_IDR_TXSYN_SIZE                      1
+#define SSC_IDR_TXSYN_OFFSET                   10
+
+/* SSC Interrupt Mask Register */
+#define SSC_IMR                                0x0000004c
+#define SSC_IMR_CP0_SIZE                        1
+#define SSC_IMR_CP0_OFFSET                      8
+#define SSC_IMR_CP1_SIZE                        1
+#define SSC_IMR_CP1_OFFSET                      9
+#define SSC_IMR_ENDRX_SIZE                      1
+#define SSC_IMR_ENDRX_OFFSET                    6
+#define SSC_IMR_ENDTX_SIZE                      1
+#define SSC_IMR_ENDTX_OFFSET                    2
+#define SSC_IMR_OVRUN_SIZE                      1
+#define SSC_IMR_OVRUN_OFFSET                    5
+#define SSC_IMR_RXBUFF_SIZE                     1
+#define SSC_IMR_RXBUFF_OFFSET                   7
+#define SSC_IMR_RXRDY_SIZE                      1
+#define SSC_IMR_RXRDY_OFFSET                    4
+#define SSC_IMR_RXSYN_SIZE                      1
+#define SSC_IMR_RXSYN_OFFSET                   11
+#define SSC_IMR_TXBUFE_SIZE                     1
+#define SSC_IMR_TXBUFE_OFFSET                   3
+#define SSC_IMR_TXEMPTY_SIZE                    1
+#define SSC_IMR_TXEMPTY_OFFSET                  1
+#define SSC_IMR_TXRDY_SIZE                      1
+#define SSC_IMR_TXRDY_OFFSET                    0
+#define SSC_IMR_TXSYN_SIZE                      1
+#define SSC_IMR_TXSYN_OFFSET                   10
+
+/* SSC PDC Receive Pointer Register */
+#define SSC_PDC_RPR                    0x00000100
+
+/* SSC PDC Receive Counter Register */
+#define SSC_PDC_RCR                    0x00000104
+
+/* SSC PDC Transmit Pointer Register */
+#define SSC_PDC_TPR                    0x00000108
+
+/* SSC PDC Receive Next Pointer Register */
+#define SSC_PDC_RNPR                   0x00000110
+
+/* SSC PDC Receive Next Counter Register */
+#define SSC_PDC_RNCR                   0x00000114
+
+/* SSC PDC Transmit Counter Register */
+#define SSC_PDC_TCR                    0x0000010c
+
+/* SSC PDC Transmit Next Pointer Register */
+#define SSC_PDC_TNPR                   0x00000118
+
+/* SSC PDC Transmit Next Counter Register */
+#define SSC_PDC_TNCR                   0x0000011c
+
+/* SSC PDC Transfer Control Register */
+#define SSC_PDC_PTCR                   0x00000120
+#define SSC_PDC_PTCR_RXTDIS_SIZE                1
+#define SSC_PDC_PTCR_RXTDIS_OFFSET              1
+#define SSC_PDC_PTCR_RXTEN_SIZE                         1
+#define SSC_PDC_PTCR_RXTEN_OFFSET               0
+#define SSC_PDC_PTCR_TXTDIS_SIZE                1
+#define SSC_PDC_PTCR_TXTDIS_OFFSET              9
+#define SSC_PDC_PTCR_TXTEN_SIZE                         1
+#define SSC_PDC_PTCR_TXTEN_OFFSET               8
+
+/* SSC PDC Transfer Status Register */
+#define SSC_PDC_PTSR                   0x00000124
+#define SSC_PDC_PTSR_RXTEN_SIZE                         1
+#define SSC_PDC_PTSR_RXTEN_OFFSET               0
+#define SSC_PDC_PTSR_TXTEN_SIZE                         1
+#define SSC_PDC_PTSR_TXTEN_OFFSET               8
+
+/* Bit manipulation macros */
+#define SSC_BIT(name)                                  \
+       (1 << SSC_##name##_OFFSET)
+#define SSC_BF(name, value)                            \
+       (((value) & ((1 << SSC_##name##_SIZE) - 1))     \
+        << SSC_##name##_OFFSET)
+#define SSC_BFEXT(name, value)                         \
+       (((value) >> SSC_##name##_OFFSET)               \
+        & ((1 << SSC_##name##_SIZE) - 1))
+#define SSC_BFINS(name, value, old)                    \
+       (((old) & ~(((1 << SSC_##name##_SIZE) - 1)      \
+       << SSC_##name##_OFFSET)) | SSC_BF(name, value))
+
+/* Register access macros */
+#define ssc_readl(base, reg)           __raw_readl(base + SSC_##reg)
+#define ssc_writel(base, reg, value)   __raw_writel((value), base + SSC_##reg)
+
+#endif /* __INCLUDE_ATMEL_SSC_H */
index d2bc0d66e65d49ed3df74f2666b3d079a023eeca..ad895455ab72cebf26a218910433a34edd53e30d 100644 (file)
@@ -26,6 +26,8 @@
 
 #define AT_SECURE 23   /* secure mode boolean */
 
-#define AT_VECTOR_SIZE  44 /* Size of auxiliary table.  */
+#ifdef __KERNEL__
+#define AT_VECTOR_SIZE_BASE (14 + 2) /* NEW_AUX_ENT entries in auxiliary table */
+#endif
 
 #endif /* _LINUX_AUXVEC_H */
index 7011d6255593dda940f859ab02e89e505d1a57ae..48a62baace582a5a841436ba2c8fa1bffdd52c4f 100644 (file)
@@ -8,6 +8,9 @@
 #ifndef _LINUX_BACKING_DEV_H
 #define _LINUX_BACKING_DEV_H
 
+#include <linux/percpu_counter.h>
+#include <linux/log2.h>
+#include <linux/proportions.h>
 #include <asm/atomic.h>
 
 struct page;
@@ -24,6 +27,14 @@ enum bdi_state {
 
 typedef int (congested_fn)(void *, int);
 
+enum bdi_stat_item {
+       BDI_RECLAIMABLE,
+       BDI_WRITEBACK,
+       NR_BDI_STAT_ITEMS
+};
+
+#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
+
 struct backing_dev_info {
        unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
        unsigned long state;    /* Always use atomic bitops on this */
@@ -32,8 +43,90 @@ struct backing_dev_info {
        void *congested_data;   /* Pointer to aux data for congested func */
        void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
        void *unplug_io_data;
+
+       struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS];
+
+       struct prop_local_percpu completions;
+       int dirty_exceeded;
 };
 
+int bdi_init(struct backing_dev_info *bdi);
+void bdi_destroy(struct backing_dev_info *bdi);
+
+static inline void __add_bdi_stat(struct backing_dev_info *bdi,
+               enum bdi_stat_item item, s64 amount)
+{
+       __percpu_counter_add(&bdi->bdi_stat[item], amount, BDI_STAT_BATCH);
+}
+
+static inline void __inc_bdi_stat(struct backing_dev_info *bdi,
+               enum bdi_stat_item item)
+{
+       __add_bdi_stat(bdi, item, 1);
+}
+
+static inline void inc_bdi_stat(struct backing_dev_info *bdi,
+               enum bdi_stat_item item)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       __inc_bdi_stat(bdi, item);
+       local_irq_restore(flags);
+}
+
+static inline void __dec_bdi_stat(struct backing_dev_info *bdi,
+               enum bdi_stat_item item)
+{
+       __add_bdi_stat(bdi, item, -1);
+}
+
+static inline void dec_bdi_stat(struct backing_dev_info *bdi,
+               enum bdi_stat_item item)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       __dec_bdi_stat(bdi, item);
+       local_irq_restore(flags);
+}
+
+static inline s64 bdi_stat(struct backing_dev_info *bdi,
+               enum bdi_stat_item item)
+{
+       return percpu_counter_read_positive(&bdi->bdi_stat[item]);
+}
+
+static inline s64 __bdi_stat_sum(struct backing_dev_info *bdi,
+               enum bdi_stat_item item)
+{
+       return percpu_counter_sum_positive(&bdi->bdi_stat[item]);
+}
+
+static inline s64 bdi_stat_sum(struct backing_dev_info *bdi,
+               enum bdi_stat_item item)
+{
+       s64 sum;
+       unsigned long flags;
+
+       local_irq_save(flags);
+       sum = __bdi_stat_sum(bdi, item);
+       local_irq_restore(flags);
+
+       return sum;
+}
+
+/*
+ * maximal error of a stat counter.
+ */
+static inline unsigned long bdi_stat_error(struct backing_dev_info *bdi)
+{
+#ifdef CONFIG_SMP
+       return nr_cpu_ids * BDI_STAT_BATCH;
+#else
+       return 1;
+#endif
+}
 
 /*
  * Flags in backing_dev_info::capability
@@ -93,7 +186,6 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
 void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
 void set_bdi_congested(struct backing_dev_info *bdi, int rw);
 long congestion_wait(int rw, long timeout);
-void congestion_end(int rw);
 
 #define bdi_cap_writeback_dirty(bdi) \
        (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
index 91c8c07fe8b73fbf365cd7e4c67dd33a8e349a54..b7fc55ec8d480d71dcda61a249962ce846f2f22d 100644 (file)
@@ -37,7 +37,8 @@ struct linux_binprm{
        int sh_bang;
        struct file * file;
        int e_uid, e_gid;
-       kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
+       kernel_cap_t cap_inheritable, cap_permitted;
+       bool cap_effective;
        void *security;
        int argc, envc;
        char * filename;        /* Name of binary as seen by procps */
@@ -63,17 +64,17 @@ struct linux_binprm{
  * linux accepts.
  */
 struct linux_binfmt {
-       struct linux_binfmt * next;
+       struct list_head lh;
        struct module *module;
        int (*load_binary)(struct linux_binprm *, struct  pt_regs * regs);
        int (*load_shlib)(struct file *);
-       int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
+       int (*core_dump)(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
        unsigned long min_coredump;     /* minimal dump size */
        int hasvdso;
 };
 
 extern int register_binfmt(struct linux_binfmt *);
-extern int unregister_binfmt(struct linux_binfmt *);
+extern void unregister_binfmt(struct linux_binfmt *);
 
 extern int prepare_binprm(struct linux_binprm *);
 extern int __must_check remove_arg_zero(struct linux_binprm *);
index 2dfa58555934c28dd8bd3c4e27b56ec79ada5b28..8961e7fb755c34bc4f1ea346fbb83854286bc932 100644 (file)
@@ -1,14 +1,14 @@
 /*
  * This is <linux/capability.h>
  *
- * Andrew G. Morgan <morgan@transmeta.com>
+ * Andrew G. Morgan <morgan@kernel.org>
  * Alexander Kjeldaas <astor@guardian.no>
  * with help from Aleph1, Roland Buresund and Andrew Main.
  *
  * See here for the libcap library ("POSIX draft" compliance):
  *
- * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.2/
- */ 
+ * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
+ */
 
 #ifndef _LINUX_CAPABILITY_H
 #define _LINUX_CAPABILITY_H
@@ -28,23 +28,41 @@ struct task_struct;
    following structure to such a composite is better handled in a user
    library since the draft standard requires the use of malloc/free
    etc.. */
+
 #define _LINUX_CAPABILITY_VERSION  0x19980330
 
 typedef struct __user_cap_header_struct {
        __u32 version;
        int pid;
 } __user *cap_user_header_t;
+
 typedef struct __user_cap_data_struct {
         __u32 effective;
         __u32 permitted;
         __u32 inheritable;
 } __user *cap_user_data_t;
-  
-#ifdef __KERNEL__
 
-#include <asm/current.h>
+#define XATTR_CAPS_SUFFIX "capability"
+#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
+
+#define XATTR_CAPS_SZ (3*sizeof(__le32))
+#define VFS_CAP_REVISION_MASK  0xFF000000
+#define VFS_CAP_REVISION_1     0x01000000
+
+#define VFS_CAP_REVISION       VFS_CAP_REVISION_1
+
+#define VFS_CAP_FLAGS_MASK     ~VFS_CAP_REVISION_MASK
+#define VFS_CAP_FLAGS_EFFECTIVE        0x000001
+
+struct vfs_cap_data {
+       __u32 magic_etc;  /* Little endian */
+       struct {
+               __u32 permitted;    /* Little endian */
+               __u32 inheritable;  /* Little endian */
+       } data[1];
+};
+
+#ifdef __KERNEL__
 
 /* #define STRICT_CAP_T_TYPECHECKS */
 
@@ -59,7 +77,7 @@ typedef struct kernel_cap_struct {
 typedef __u32 kernel_cap_t;
 
 #endif
-  
+
 #define _USER_CAP_HEADER_SIZE  (2*sizeof(__u32))
 #define _KERNEL_CAP_T_SIZE     (sizeof(kernel_cap_t))
 
@@ -67,7 +85,7 @@ typedef __u32 kernel_cap_t;
 
 
 /**
- ** POSIX-draft defined capabilities. 
+ ** POSIX-draft defined capabilities.
  **/
 
 /* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
@@ -87,7 +105,7 @@ typedef __u32 kernel_cap_t;
    defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
 
 #define CAP_DAC_READ_SEARCH  2
-    
+
 /* Overrides all restrictions about allowed operations on files, where
    file owner ID must be equal to the user ID, except where CAP_FSETID
    is applicable. It doesn't override MAC and DAC restrictions. */
@@ -257,7 +275,7 @@ typedef __u32 kernel_cap_t;
 /* Override reserved space on ext2 filesystem */
 /* Modify data journaling mode on ext3 filesystem (uses journaling
    resources) */
-/* NOTE: ext2 honors fsuid when checking for resource overrides, so 
+/* NOTE: ext2 honors fsuid when checking for resource overrides, so
    you can override using fsuid too */
 /* Override size restrictions on IPC message queues */
 /* Allow more than 64hz interrupts from the real-time clock */
@@ -289,8 +307,10 @@ typedef __u32 kernel_cap_t;
 
 #define CAP_AUDIT_CONTROL    30
 
+#define CAP_SETFCAP         31
+
 #ifdef __KERNEL__
-/* 
+/*
  * Bounding set
  */
 extern kernel_cap_t cap_bset;
@@ -298,7 +318,7 @@ extern kernel_cap_t cap_bset;
 /*
  * Internal kernel functions only
  */
+
 #ifdef STRICT_CAP_T_TYPECHECKS
 
 #define to_cap_t(x) { x }
index 03ec2311fb29c9ce4d252e2e9b41b8eea19e8e18..acd583384bd9dffb50a097eae3370caf5704d78c 100644 (file)
@@ -1,4 +1,6 @@
-/* Never include this file directly.  Include <linux/compiler.h> instead.  */
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
+#endif
 
 /*
  * Common definitions for all gcc versions go here.
index a9e2863c2dbf058a97b62ccf18af83bf8a1145c2..2d8c0f48f55e6236a4c25b8510feafb48670ff10 100644 (file)
@@ -1,4 +1,6 @@
-/* Never include this file directly.  Include <linux/compiler.h> instead.  */
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
+#endif
 
 /* These definitions are for GCC v3.x.  */
 #include <linux/compiler-gcc.h>
index 14f7494280f0bda301cc12ebe31b2992fd25e870..ee7ca5de970cb6cfadd4c04f5df4444ed07645a8 100644 (file)
@@ -1,4 +1,6 @@
-/* Never include this file directly.  Include <linux/compiler.h> instead.  */
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
+#endif
 
 /* These definitions are for GCC v4.x.  */
 #include <linux/compiler-gcc.h>
index b769961e6f2371090a1bfe94b751afc4ab0306b7..d8e636e5607d78c40f75043b7dca312fc3c0748a 100644 (file)
@@ -1,4 +1,6 @@
-/* Never include this file directly.  Include <linux/compiler.h> instead.  */
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-intel.h> directly, include <linux/compiler.h> instead."
+#endif
 
 #ifdef __ECC
 
index 06b2768c603f6a9ff0aeb70ef050245698b5ee78..e2bf7e5db39a513c650e1e422f024f31c0e6ed2d 100644 (file)
@@ -16,4 +16,5 @@ extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode);
 extern unsigned short *set_translate(int m, struct vc_data *vc);
 extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
 extern u32 conv_8bit_to_uni(unsigned char c);
+extern int conv_uni_to_8bit(u32 uni);
 void console_map_init(void);
index 9e633ea103cef6bcef9dab816ef95b6439c1ae1e..ea44d2e768a042902e566273173a83ee337b7f0b 100644 (file)
@@ -45,7 +45,8 @@ static int inline cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
                __cpuset_zone_allowed_hardwall(z, gfp_mask);
 }
 
-extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
+extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
+                                         const struct task_struct *tsk2);
 
 #define cpuset_memory_pressure_bump()                          \
        do {                                                    \
@@ -113,7 +114,8 @@ static inline int cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
        return 1;
 }
 
-static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
+static inline int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
+                                                const struct task_struct *tsk2)
 {
        return 1;
 }
index 1dba681e428d27e1750652e94b9a84c080cb1b59..3be4e5a27d82f4f3bbf24d1fa1eb78af78516dfc 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/types.h>
 
 #define CRAMFS_MAGIC           0x28cd3d45      /* some random number */
+#define CRAMFS_MAGIC_WEND      0x453dcd28      /* magic number with the wrong endianess */
 #define CRAMFS_SIGNATURE       "Compressed ROMFS"
 
 /*
index d2da84acf45d8266bc4fd1b7cea428b1c7296a73..576e83bd6d88e5b6dfcad00a4136106c3c87dbec 100644 (file)
@@ -2,7 +2,6 @@
 #define _LINUX_ELF_H
 
 #include <linux/types.h>
-#include <linux/auxvec.h>
 #include <linux/elf-em.h>
 #include <asm/elf.h>
 
@@ -355,6 +354,7 @@ typedef struct elf64_shdr {
 #define NT_TASKSTRUCT  4
 #define NT_AUXV                6
 #define NT_PRXFPREG     0x46e62b7f      /* copied from gdb5.1/include/elf/common.h */
+#define NT_PPC_VMX     0x100           /* PowerPC Altivec/VMX registers */
 
 
 /* Note header in a PT_NOTE section */
diff --git a/include/linux/elfcore-compat.h b/include/linux/elfcore-compat.h
new file mode 100644 (file)
index 0000000..532d13a
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef _LINUX_ELFCORE_COMPAT_H
+#define _LINUX_ELFCORE_COMPAT_H
+
+#include <linux/elf.h>
+#include <linux/elfcore.h>
+#include <linux/compat.h>
+
+/*
+ * Make sure these layouts match the linux/elfcore.h native definitions.
+ */
+
+struct compat_elf_siginfo
+{
+       compat_int_t                    si_signo;
+       compat_int_t                    si_code;
+       compat_int_t                    si_errno;
+};
+
+struct compat_elf_prstatus
+{
+       struct compat_elf_siginfo       pr_info;
+       short                           pr_cursig;
+       compat_ulong_t                  pr_sigpend;
+       compat_ulong_t                  pr_sighold;
+       compat_pid_t                    pr_pid;
+       compat_pid_t                    pr_ppid;
+       compat_pid_t                    pr_pgrp;
+       compat_pid_t                    pr_sid;
+       struct compat_timeval           pr_utime;
+       struct compat_timeval           pr_stime;
+       struct compat_timeval           pr_cutime;
+       struct compat_timeval           pr_cstime;
+       compat_elf_gregset_t            pr_reg;
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+       compat_ulong_t                  pr_exec_fdpic_loadmap;
+       compat_ulong_t                  pr_interp_fdpic_loadmap;
+#endif
+       compat_int_t                    pr_fpvalid;
+};
+
+struct compat_elf_prpsinfo
+{
+       char                            pr_state;
+       char                            pr_sname;
+       char                            pr_zomb;
+       char                            pr_nice;
+       compat_ulong_t                  pr_flag;
+       compat_uid_t                    pr_uid;
+       compat_gid_t                    pr_gid;
+       compat_pid_t                    pr_pid, pr_ppid, pr_pgrp, pr_sid;
+       char                            pr_fname[16];
+       char                            pr_psargs[ELF_PRARGSZ];
+};
+
+#endif /* _LINUX_ELFCORE_COMPAT_H */
index 153d755376a42344d046482e7c7606dcea4bb373..c77c3bbfe4bb480c273a72f89bad409fa23609d0 100644 (file)
 #undef EXT2FS_DEBUG
 
 /*
- * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
+ * Define EXT2_RESERVATION to reserve data blocks for expanding files
  */
-#define EXT2_PREALLOCATE
-#define EXT2_DEFAULT_PREALLOC_BLOCKS   8
-
+#define EXT2_DEFAULT_RESERVE_BLOCKS     8
+/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
+#define EXT2_MAX_RESERVE_BLOCKS         1027
+#define EXT2_RESERVE_WINDOW_NOT_ALLOCATED 0
 /*
  * The second extended file system version
  */
@@ -200,6 +201,8 @@ struct ext2_group_desc
 #define        EXT2_IOC_SETFLAGS               FS_IOC_SETFLAGS
 #define        EXT2_IOC_GETVERSION             FS_IOC_GETVERSION
 #define        EXT2_IOC_SETVERSION             FS_IOC_SETVERSION
+#define        EXT2_IOC_GETRSVSZ               _IOR('f', 5, long)
+#define        EXT2_IOC_SETRSVSZ               _IOW('f', 6, long)
 
 /*
  * ioctl commands in 32 bit emulation
@@ -317,8 +320,9 @@ struct ext2_inode {
 #define EXT2_MOUNT_XATTR_USER          0x004000  /* Extended user attributes */
 #define EXT2_MOUNT_POSIX_ACL           0x008000  /* POSIX Access Control Lists */
 #define EXT2_MOUNT_XIP                 0x010000  /* Execute in place */
-#define EXT2_MOUNT_USRQUOTA            0x020000 /* user quota */
-#define EXT2_MOUNT_GRPQUOTA            0x040000 /* group quota */
+#define EXT2_MOUNT_USRQUOTA            0x020000  /* user quota */
+#define EXT2_MOUNT_GRPQUOTA            0x040000  /* group quota */
+#define EXT2_MOUNT_RESERVATION         0x080000  /* Preallocation */
 
 
 #define clear_opt(o, opt)              o &= ~EXT2_MOUNT_##opt
@@ -558,4 +562,11 @@ enum {
 #define EXT2_DIR_REC_LEN(name_len)     (((name_len) + 8 + EXT2_DIR_ROUND) & \
                                         ~EXT2_DIR_ROUND)
 
+static inline ext2_fsblk_t
+ext2_group_first_block_no(struct super_block *sb, unsigned long group_no)
+{
+       return group_no * (ext2_fsblk_t)EXT2_BLOCKS_PER_GROUP(sb) +
+               le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
+}
+
 #endif /* _LINUX_EXT2_FS_H */
index d149f2959e671093bea029d5f43da4a7b53453a3..f273415ab6f1afab257883b2b00d4f9cd6d1512b 100644 (file)
 
 #include <linux/blockgroup_lock.h>
 #include <linux/percpu_counter.h>
+#include <linux/rbtree.h>
+
+/* XXX Here for now... not interested in restructing headers JUST now */
+
+/* data type for block offset of block group */
+typedef int ext2_grpblk_t;
+
+/* data type for filesystem-wide blocks number */
+typedef unsigned long ext2_fsblk_t;
+
+#define E2FSBLK "%lu"
+
+struct ext2_reserve_window {
+       ext2_fsblk_t            _rsv_start;     /* First byte reserved */
+       ext2_fsblk_t            _rsv_end;       /* Last byte reserved or 0 */
+};
+
+struct ext2_reserve_window_node {
+       struct rb_node          rsv_node;
+       __u32                   rsv_goal_size;
+       __u32                   rsv_alloc_hit;
+       struct ext2_reserve_window      rsv_window;
+};
+
+struct ext2_block_alloc_info {
+       /* information about reservation window */
+       struct ext2_reserve_window_node rsv_window_node;
+       /*
+        * was i_next_alloc_block in ext2_inode_info
+        * is the logical (file-relative) number of the
+        * most-recently-allocated block in this file.
+        * We use this for detecting linearly ascending allocation requests.
+        */
+       __u32                   last_alloc_logical_block;
+       /*
+        * Was i_next_alloc_goal in ext2_inode_info
+        * is the *physical* companion to i_next_alloc_block.
+        * it the the physical block number of the block which was most-recentl
+        * allocated to this file.  This give us the goal (target) for the next
+        * allocation when we detect linearly ascending requests.
+        */
+       ext2_fsblk_t            last_alloc_physical_block;
+};
+
+#define rsv_start rsv_window._rsv_start
+#define rsv_end rsv_window._rsv_end
 
 /*
  * second extended-fs super-block data in memory
@@ -39,6 +85,7 @@ struct ext2_sb_info {
        struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
        struct buffer_head ** s_group_desc;
        unsigned long  s_mount_opt;
+       unsigned long s_sb_block;
        uid_t s_resuid;
        gid_t s_resgid;
        unsigned short s_mount_state;
@@ -55,6 +102,10 @@ struct ext2_sb_info {
        struct percpu_counter s_freeinodes_counter;
        struct percpu_counter s_dirs_counter;
        struct blockgroup_lock s_blockgroup_lock;
+       /* root of the per fs reservation window tree */
+       spinlock_t s_rsv_window_lock;
+       struct rb_root s_rsv_window_root;
+       struct ext2_reserve_window_node s_rsv_window_head;
 };
 
 #endif /* _LINUX_EXT2_FS_SB */
index ece49a804fe18485bfdc5e1e4672c0a7f9bf0002..589b0b355d84d1967eac403c390f23e428eb33c2 100644 (file)
 /*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
 #define EXT3_MAX_RESERVE_BLOCKS         1027
 #define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
-/*
- * Always enable hashed directories
- */
-#define CONFIG_EXT3_INDEX
 
 /*
  * Debug code
@@ -665,17 +661,11 @@ struct ext3_dir_entry_2 {
  * (c) Daniel Phillips, 2001
  */
 
-#ifdef CONFIG_EXT3_INDEX
-  #define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
-                                             EXT3_FEATURE_COMPAT_DIR_INDEX) && \
+#define is_dx(dir) (EXT3_HAS_COMPAT_FEATURE(dir->i_sb, \
+                                     EXT3_FEATURE_COMPAT_DIR_INDEX) && \
                      (EXT3_I(dir)->i_flags & EXT3_INDEX_FL))
 #define EXT3_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT3_LINK_MAX)
 #define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
-#else
-  #define is_dx(dir) 0
-#define EXT3_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT3_LINK_MAX)
-#define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2)
-#endif
 
 /* Legal values for the dx_root hash_version field: */
 
index d3c08353edf62e195ae1bcbceadc1afaffc1c915..b65f0288b842202866b878e5bae6889d2b763576 100644 (file)
@@ -44,6 +44,7 @@ struct ext3_sb_info {
        struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */
        struct buffer_head ** s_group_desc;
        unsigned long  s_mount_opt;
+       ext3_fsblk_t s_sb_block;
        uid_t s_resuid;
        gid_t s_resgid;
        unsigned short s_mount_state;
index 1b2ffee12be910095b846d0ca18a856c5ef75e82..0a8e47d47c91ce11b2dbc6d4f99f3de004201111 100644 (file)
@@ -45,6 +45,7 @@ struct ext4_sb_info {
        struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
        struct buffer_head ** s_group_desc;
        unsigned long  s_mount_opt;
+       ext4_fsblk_t s_sb_block;
        uid_t s_resuid;
        gid_t s_resgid;
        unsigned short s_mount_state;
index 40b93265d4bae5240896a2c3eaac75fb2577ca76..86037400a6e380f8ec5b1bd31acc6ebfbb296bd1 100644 (file)
@@ -3,12 +3,17 @@
 
 #include <asm/fcntl.h>
 
-/* Cancel a blocking posix lock; internal use only until we expose an
- * asynchronous lock api to userspace: */
-#define F_CANCELLK     (F_LINUX_SPECIFIC_BASE+5)
+#define F_SETLEASE     (F_LINUX_SPECIFIC_BASE + 0)
+#define F_GETLEASE     (F_LINUX_SPECIFIC_BASE + 1)
 
-#define F_SETLEASE     (F_LINUX_SPECIFIC_BASE+0)
-#define F_GETLEASE     (F_LINUX_SPECIFIC_BASE+1)
+/*
+ * Cancel a blocking posix lock; internal use only until we expose an
+ * asynchronous lock api to userspace:
+ */
+#define F_CANCELLK     (F_LINUX_SPECIFIC_BASE + 5)
+
+/* Create a file descriptor with FD_CLOEXEC set. */
+#define F_DUPFD_CLOEXEC        (F_LINUX_SPECIFIC_BASE + 6)
 
 /*
  * Request nofications on a directory.
index 0114fbc78061249fc765e8197fb06f5a512a6ea9..56023c74e9fd65ec1b3c559da66a271435f15067 100644 (file)
@@ -62,6 +62,15 @@ extern struct kmem_cache *filp_cachep;
 extern void FASTCALL(__fput(struct file *));
 extern void FASTCALL(fput(struct file *));
 
+struct file_operations;
+struct vfsmount;
+struct dentry;
+extern int init_file(struct file *, struct vfsmount *mnt,
+               struct dentry *dentry, mode_t mode,
+               const struct file_operations *fop);
+extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry,
+               mode_t mode, const struct file_operations *fop);
+
 static inline void fput_light(struct file *file, int fput_needed)
 {
        if (unlikely(fput_needed))
index f70d52c46617b053b301e804a446ed83b3ee92b3..e3fc5dbb22460ad7d265f5fb47d8839ea4fe32f5 100644 (file)
@@ -283,7 +283,6 @@ extern int dir_notify_enable;
 #include <linux/init.h>
 #include <linux/pid.h>
 #include <linux/mutex.h>
-#include <linux/sysctl.h>
 #include <linux/capability.h>
 
 #include <asm/atomic.h>
@@ -301,9 +300,9 @@ struct kstatfs;
 struct vm_area_struct;
 struct vfsmount;
 
-extern void __init inode_init(unsigned long);
+extern void __init inode_init(void);
 extern void __init inode_init_early(void);
-extern void __init mnt_init(unsigned long);
+extern void __init mnt_init(void);
 extern void __init files_init(unsigned long);
 
 struct buffer_head;
@@ -330,6 +329,7 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
 #define ATTR_KILL_SUID 2048
 #define ATTR_KILL_SGID 4096
 #define ATTR_FILE      8192
+#define ATTR_KILL_PRIV 16384
 
 /*
  * This is the Inode Attributes structure, used for notify_change().  It
@@ -793,7 +793,7 @@ struct file {
        unsigned int            f_uid, f_gid;
        struct file_ra_state    f_ra;
 
-       unsigned long           f_version;
+       u64                     f_version;
 #ifdef CONFIG_SECURITY
        void                    *f_security;
 #endif
@@ -1003,6 +1003,7 @@ struct super_block {
        struct list_head        s_inodes;       /* all inodes */
        struct list_head        s_dirty;        /* dirty inodes */
        struct list_head        s_io;           /* parked for writeback */
+       struct list_head        s_more_io;      /* parked for more writeback */
        struct hlist_head       s_anon;         /* anonymous dentries for (nfs) exporting */
        struct list_head        s_files;
 
@@ -1261,16 +1262,68 @@ struct super_operations {
 #endif
 };
 
-/* Inode state bits.  Protected by inode_lock. */
-#define I_DIRTY_SYNC           1 /* Not dirty enough for O_DATASYNC */
-#define I_DIRTY_DATASYNC       2 /* Data-related inode changes pending */
-#define I_DIRTY_PAGES          4 /* Data-related inode changes pending */
-#define __I_LOCK               3
+/*
+ * Inode state bits.  Protected by inode_lock.
+ *
+ * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
+ * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
+ *
+ * Four bits define the lifetime of an inode.  Initially, inodes are I_NEW,
+ * until that flag is cleared.  I_WILL_FREE, I_FREEING and I_CLEAR are set at
+ * various stages of removing an inode.
+ *
+ * Two bits are used for locking and completion notification, I_LOCK and I_SYNC.
+ *
+ * I_DIRTY_SYNC                Inode itself is dirty.
+ * I_DIRTY_DATASYNC    Data-related inode changes pending
+ * I_DIRTY_PAGES       Inode has dirty pages.  Inode itself may be clean.
+ * I_NEW               get_new_inode() sets i_state to I_LOCK|I_NEW.  Both
+ *                     are cleared by unlock_new_inode(), called from iget().
+ * I_WILL_FREE         Must be set when calling write_inode_now() if i_count
+ *                     is zero.  I_FREEING must be set when I_WILL_FREE is
+ *                     cleared.
+ * I_FREEING           Set when inode is about to be freed but still has dirty
+ *                     pages or buffers attached or the inode itself is still
+ *                     dirty.
+ * I_CLEAR             Set by clear_inode().  In this state the inode is clean
+ *                     and can be destroyed.
+ *
+ *                     Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
+ *                     prohibited for many purposes.  iget() must wait for
+ *                     the inode to be completely released, then create it
+ *                     anew.  Other functions will just ignore such inodes,
+ *                     if appropriate.  I_LOCK is used for waiting.
+ *
+ * I_LOCK              Serves as both a mutex and completion notification.
+ *                     New inodes set I_LOCK.  If two processes both create
+ *                     the same inode, one of them will release its inode and
+ *                     wait for I_LOCK to be released before returning.
+ *                     Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can
+ *                     also cause waiting on I_LOCK, without I_LOCK actually
+ *                     being set.  find_inode() uses this to prevent returning
+ *                     nearly-dead inodes.
+ * I_SYNC              Similar to I_LOCK, but limited in scope to writeback
+ *                     of inode dirty data.  Having a seperate lock for this
+ *                     purpose reduces latency and prevents some filesystem-
+ *                     specific deadlocks.
+ *
+ * Q: Why does I_DIRTY_DATASYNC exist?  It appears as if it could be replaced
+ *    by (I_DIRTY_SYNC|I_DIRTY_PAGES).
+ * Q: What is the difference between I_WILL_FREE and I_FREEING?
+ * Q: igrab() only checks on (I_FREEING|I_WILL_FREE).  Should it also check on
+ *    I_CLEAR?  If not, why?
+ */
+#define I_DIRTY_SYNC           1
+#define I_DIRTY_DATASYNC       2
+#define I_DIRTY_PAGES          4
+#define I_NEW                  8
+#define I_WILL_FREE            16
+#define I_FREEING              32
+#define I_CLEAR                        64
+#define __I_LOCK               7
 #define I_LOCK                 (1 << __I_LOCK)
-#define I_FREEING              16
-#define I_CLEAR                        32
-#define I_NEW                  64
-#define I_WILL_FREE            128
+#define __I_SYNC               8
+#define I_SYNC                 (1 << __I_SYNC)
 
 #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
 
@@ -1729,6 +1782,7 @@ extern int bdev_read_only(struct block_device *);
 extern int set_blocksize(struct block_device *, int);
 extern int sb_set_blocksize(struct super_block *, int);
 extern int sb_min_blocksize(struct super_block *, int);
+extern int sb_has_dirty_inodes(struct super_block *);
 
 extern int generic_file_mmap(struct file *, struct vm_area_struct *);
 extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
@@ -1887,8 +1941,6 @@ extern int simple_empty(struct dentry *);
 extern int simple_readpage(struct file *file, struct page *page);
 extern int simple_prepare_write(struct file *file, struct page *page,
                        unsigned offset, unsigned to);
-extern int simple_commit_write(struct file *file, struct page *page,
-                               unsigned offset, unsigned to);
 extern int simple_write_begin(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned flags,
                        struct page **pagep, void **fsdata);
@@ -2032,7 +2084,8 @@ static inline void free_secdata(void *secdata)
 { }
 #endif /* CONFIG_SECURITY */
 
-int proc_nr_files(ctl_table *table, int write, struct file *filp,
+struct ctl_table;
+int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
                  void __user *buffer, size_t *lenp, loff_t *ppos);
 
 
index 4aba6b0ad41c114d442c2e871cfe03208e716822..ae77daed6c2feb8e1b2b41a0b1b66e03d6cd9327 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef _LINUX_IF_FDDI_H
 #define _LINUX_IF_FDDI_H
 
+#include <linux/types.h>
+
 /*
  *  Define max and min legal sizes.  The frame sizes do not include
  *  4 byte FCS/CRC (frame check sequence).
index 9b7a2ba8237eeca0766fa2cef0a06e565b727853..5141381a75279bbb0a6b15c729e93d015302088b 100644 (file)
@@ -161,7 +161,7 @@ struct obs_kernel_param {
  * obs_kernel_param "array" too far apart in .init.setup.
  */
 #define __setup_param(str, unique_id, fn, early)                       \
-       static char __setup_str_##unique_id[] __initdata = str; \
+       static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
        static struct obs_kernel_param __setup_##unique_id      \
                __attribute_used__                              \
                __attribute__((__section__(".init.setup")))     \
index 513bc3e489f018f33495867568d708a9335b0c06..d4b2f1c76e12c528b8701111445bd864ef5ea062 100644 (file)
@@ -76,7 +76,6 @@ extern struct nsproxy init_nsproxy;
 #define INIT_NSPROXY(nsproxy) {                                                \
        .pid_ns         = &init_pid_ns,                                 \
        .count          = ATOMIC_INIT(1),                               \
-       .nslock         = __SPIN_LOCK_UNLOCKED(nsproxy.nslock),         \
        .uts_ns         = &init_uts_ns,                                 \
        .mnt_ns         = NULL,                                         \
        INIT_NET_NS(net_ns)                                             \
@@ -171,6 +170,7 @@ extern struct group_info init_groups;
                [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID),           \
                [PIDTYPE_SID]  = INIT_PID_LINK(PIDTYPE_SID),            \
        },                                                              \
+       .dirties = INIT_PROP_LOCAL_SINGLE(dirties),                     \
        INIT_TRACE_IRQFLAGS                                             \
        INIT_LOCKDEP                                                    \
 }
index 8e5f289052a2caf81110c3a9185df57d3808becc..2306920fa38811bf1bdae40343217e8c497362d5 100644 (file)
 #define IRQF_NOBALANCING       0x00000800
 #define IRQF_IRQPOLL           0x00001000
 
-/*
- * Migration helpers. Scheduled for removal in 9/2007
- * Do not use for new code !
- */
-static inline
-unsigned long __deprecated deprecated_irq_flag(unsigned long flag)
-{
-       return flag;
-}
-
-#define SA_INTERRUPT           deprecated_irq_flag(IRQF_DISABLED)
-#define SA_SAMPLE_RANDOM       deprecated_irq_flag(IRQF_SAMPLE_RANDOM)
-#define SA_SHIRQ               deprecated_irq_flag(IRQF_SHARED)
-#define SA_PROBEIRQ            deprecated_irq_flag(IRQF_PROBE_SHARED)
-#define SA_PERCPU              deprecated_irq_flag(IRQF_PERCPU)
-
-#define SA_TRIGGER_LOW         deprecated_irq_flag(IRQF_TRIGGER_LOW)
-#define SA_TRIGGER_HIGH                deprecated_irq_flag(IRQF_TRIGGER_HIGH)
-#define SA_TRIGGER_FALLING     deprecated_irq_flag(IRQF_TRIGGER_FALLING)
-#define SA_TRIGGER_RISING      deprecated_irq_flag(IRQF_TRIGGER_RISING)
-#define SA_TRIGGER_MASK                deprecated_irq_flag(IRQF_TRIGGER_MASK)
-
 typedef irqreturn_t (*irq_handler_t)(int, void *);
 
 struct irqaction {
index 3fd3ddd5f0d9e4bb885367f8de6fde50dc00918d..ee111834091cf99752fc3679281ef9c86adbbf45 100644 (file)
@@ -49,6 +49,34 @@ struct ipc_perm
 #define IPC_64  0x0100  /* New version (support 32-bit UIDs, bigger
                           message sizes, etc. */
 
+/*
+ * These are used to wrap system calls.
+ *
+ * See architecture code for ugly details..
+ */
+struct ipc_kludge {
+       struct msgbuf __user *msgp;
+       long msgtyp;
+};
+
+#define SEMOP           1
+#define SEMGET          2
+#define SEMCTL          3
+#define SEMTIMEDOP      4
+#define MSGSND         11
+#define MSGRCV         12
+#define MSGGET         13
+#define MSGCTL         14
+#define SHMAT          21
+#define SHMDT          22
+#define SHMGET         23
+#define SHMCTL         24
+
+/* Used by the DIPC package, try and avoid reusing it */
+#define DIPC            25
+
+#define IPCCALL(version,op)    ((version)<<16 | (op))
+
 #ifdef __KERNEL__
 
 #include <linux/kref.h>
index 1c1a3ff0535b9299315787b7fff7b3ba0965f0b8..7274ec68c246628bf5939f30f76ef450a3bb6483 100644 (file)
@@ -2,7 +2,7 @@
 #define _DIACR_H
 #include <linux/kd.h>
 
-extern struct kbdiacr accent_table[];
+extern struct kbdiacruc accent_table[];
 extern unsigned int accent_table_size;
 
 #endif /* _DIACR_H */
index 28be4fbe9044a988a16497746da884be5a5a22c6..c91fc0c9c4951418bc70b7cb8f957da08a9699c3 100644 (file)
@@ -125,6 +125,16 @@ struct kbdiacrs {
 #define KDGKBDIACR      0x4B4A  /* read kernel accent table */
 #define KDSKBDIACR      0x4B4B  /* write kernel accent table */
 
+struct kbdiacruc {
+        __u32 diacr, base, result;
+};
+struct kbdiacrsuc {
+        unsigned int kb_cnt;    /* number of entries in following array */
+       struct kbdiacruc kbdiacruc[256];    /* MAX_DIACR from keyboard.h */
+};
+#define KDGKBDIACRUC    0x4BFA  /* read kernel accent table - UCS */
+#define KDSKBDIACRUC    0x4BFB  /* write kernel accent table - UCS */
+
 struct kbkeycode {
        unsigned int scancode, keycode;
 };
index 5fdbc814c2eb73ad5330be18348cee1a629210f9..94bc99656963ac5ad78cada2c608b2d93db4e8c0 100644 (file)
@@ -76,6 +76,13 @@ extern const char linux_proc_banner[];
 #define        KERN_INFO       "<6>"   /* informational                        */
 #define        KERN_DEBUG      "<7>"   /* debug-level messages                 */
 
+/*
+ * Annotation for a "continued" line of log printout (only done after a
+ * line that had no enclosing \n). Only to be used by core/arch code
+ * during early bootup (a continued line is not SMP-safe otherwise).
+ */
+#define        KERN_CONT       ""
+
 extern int console_printk[];
 
 #define console_loglevel (console_printk[0])
@@ -172,6 +179,9 @@ asmlinkage int vprintk(const char *fmt, va_list args)
        __attribute__ ((format (printf, 1, 0)));
 asmlinkage int printk(const char * fmt, ...)
        __attribute__ ((format (printf, 1, 2))) __cold;
+extern int log_buf_get_len(void);
+extern int log_buf_read(int idx);
+extern int log_buf_copy(char *dest, int idx, int len);
 #else
 static inline int vprintk(const char *s, va_list args)
        __attribute__ ((format (printf, 1, 0)));
@@ -179,6 +189,9 @@ static inline int vprintk(const char *s, va_list args) { return 0; }
 static inline int printk(const char *s, ...)
        __attribute__ ((format (printf, 1, 2)));
 static inline int __cold printk(const char *s, ...) { return 0; }
+static inline int log_buf_get_len(void) { return 0; }
+static inline int log_buf_read(int idx) { return 0; }
+static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
 #endif
 
 unsigned long int_sqrt(unsigned long);
@@ -245,10 +258,25 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
                        const void *buf, size_t len);
 #define hex_asc(x)     "0123456789abcdef"[x]
 
+#define pr_emerg(fmt, arg...) \
+       printk(KERN_EMERG fmt, ##arg)
+#define pr_alert(fmt, arg...) \
+       printk(KERN_ALERT fmt, ##arg)
+#define pr_crit(fmt, arg...) \
+       printk(KERN_CRIT fmt, ##arg)
+#define pr_err(fmt, arg...) \
+       printk(KERN_ERR fmt, ##arg)
+#define pr_warning(fmt, arg...) \
+       printk(KERN_WARNING fmt, ##arg)
+#define pr_notice(fmt, arg...) \
+       printk(KERN_NOTICE fmt, ##arg)
+#define pr_info(fmt, arg...) \
+       printk(KERN_INFO fmt, ##arg)
+
 #ifdef DEBUG
 /* If you are writing a driver, please use dev_dbg instead */
-#define pr_debug(fmt,arg...) \
-       printk(KERN_DEBUG fmt,##arg)
+#define pr_debug(fmt, arg...) \
+       printk(KERN_DEBUG fmt, ##arg)
 #else
 static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
 {
@@ -256,9 +284,6 @@ static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char *
 }
 #endif
 
-#define pr_info(fmt,arg...) \
-       printk(KERN_INFO fmt,##arg)
-
 /*
  *      Display an IP address in readable format.
  */
index 8c2c7fcd58ceab1937e8d20f4ac0da0c0940b404..ad4b82ce84af13ffac6e2f3b381242f4bdde43d8 100644 (file)
@@ -121,6 +121,30 @@ extern struct page *kimage_alloc_control_pages(struct kimage *image,
 extern void crash_kexec(struct pt_regs *);
 int kexec_should_crash(struct task_struct *);
 void crash_save_cpu(struct pt_regs *regs, int cpu);
+void crash_save_vmcoreinfo(void);
+void arch_crash_save_vmcoreinfo(void);
+void vmcoreinfo_append_str(const char *fmt, ...)
+       __attribute__ ((format (printf, 1, 2)));
+unsigned long paddr_vmcoreinfo_note(void);
+
+#define VMCOREINFO_SYMBOL(name) \
+       vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
+#define VMCOREINFO_SIZE(name) \
+       vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
+                             (unsigned long)sizeof(struct name))
+#define VMCOREINFO_TYPEDEF_SIZE(name) \
+       vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
+                             (unsigned long)sizeof(name))
+#define VMCOREINFO_OFFSET(name, field) \
+       vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
+                             (unsigned long)&(((struct name *)0)->field))
+#define VMCOREINFO_LENGTH(name, value) \
+       vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
+#define VMCOREINFO_NUMBER(name) \
+       vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
+#define VMCOREINFO_CONFIG(name) \
+       vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
+
 extern struct kimage *kexec_image;
 extern struct kimage *kexec_crash_image;
 
@@ -148,11 +172,20 @@ extern struct kimage *kexec_crash_image;
 
 #define KEXEC_FLAGS    (KEXEC_ON_CRASH)  /* List of defined/legal kexec flags */
 
+#define VMCOREINFO_BYTES           (4096)
+#define VMCOREINFO_NOTE_NAME       "VMCOREINFO"
+#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
+#define VMCOREINFO_NOTE_SIZE       (KEXEC_NOTE_HEAD_BYTES*2 + VMCOREINFO_BYTES \
+                                   + VMCOREINFO_NOTE_NAME_BYTES)
+
 /* Location of a reserved region to hold the crash kernel.
  */
 extern struct resource crashk_res;
 typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
 extern note_buf_t *crash_notes;
+extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
+extern size_t vmcoreinfo_size;
+extern size_t vmcoreinfo_max_size;
 
 
 #else /* !CONFIG_KEXEC */
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
new file mode 100644 (file)
index 0000000..65833d4
--- /dev/null
@@ -0,0 +1,112 @@
+/* Definitions for key type implementations
+ *
+ * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Licence
+ * as published by the Free Software Foundation; either version
+ * 2 of the Licence, or (at your option) any later version.
+ */
+
+#ifndef _LINUX_KEY_TYPE_H
+#define _LINUX_KEY_TYPE_H
+
+#include <linux/key.h>
+
+#ifdef CONFIG_KEYS
+
+/*
+ * key under-construction record
+ * - passed to the request_key actor if supplied
+ */
+struct key_construction {
+       struct key      *key;   /* key being constructed */
+       struct key      *authkey;/* authorisation for key being constructed */
+};
+
+typedef int (*request_key_actor_t)(struct key_construction *key,
+                                  const char *op, void *aux);
+
+/*
+ * kernel managed key type definition
+ */
+struct key_type {
+       /* name of the type */
+       const char *name;
+
+       /* default payload length for quota precalculation (optional)
+        * - this can be used instead of calling key_payload_reserve(), that
+        *   function only needs to be called if the real datalen is different
+        */
+       size_t def_datalen;
+
+       /* instantiate a key of this type
+        * - this method should call key_payload_reserve() to determine if the
+        *   user's quota will hold the payload
+        */
+       int (*instantiate)(struct key *key, const void *data, size_t datalen);
+
+       /* update a key of this type (optional)
+        * - this method should call key_payload_reserve() to recalculate the
+        *   quota consumption
+        * - the key must be locked against read when modifying
+        */
+       int (*update)(struct key *key, const void *data, size_t datalen);
+
+       /* match a key against a description */
+       int (*match)(const struct key *key, const void *desc);
+
+       /* clear some of the data from a key on revokation (optional)
+        * - the key's semaphore will be write-locked by the caller
+        */
+       void (*revoke)(struct key *key);
+
+       /* clear the data from a key (optional) */
+       void (*destroy)(struct key *key);
+
+       /* describe a key */
+       void (*describe)(const struct key *key, struct seq_file *p);
+
+       /* read a key's data (optional)
+        * - permission checks will be done by the caller
+        * - the key's semaphore will be readlocked by the caller
+        * - should return the amount of data that could be read, no matter how
+        *   much is copied into the buffer
+        * - shouldn't do the copy if the buffer is NULL
+        */
+       long (*read)(const struct key *key, char __user *buffer, size_t buflen);
+
+       /* handle request_key() for this type instead of invoking
+        * /sbin/request-key (optional)
+        * - key is the key to instantiate
+        * - authkey is the authority to assume when instantiating this key
+        * - op is the operation to be done, usually "create"
+        * - the call must not return until the instantiation process has run
+        *   its course
+        */
+       request_key_actor_t request_key;
+
+       /* internal fields */
+       struct list_head        link;           /* link in types list */
+};
+
+extern struct key_type key_type_keyring;
+
+extern int register_key_type(struct key_type *ktype);
+extern void unregister_key_type(struct key_type *ktype);
+
+extern int key_payload_reserve(struct key *key, size_t datalen);
+extern int key_instantiate_and_link(struct key *key,
+                                   const void *data,
+                                   size_t datalen,
+                                   struct key *keyring,
+                                   struct key *instkey);
+extern int key_negate_and_link(struct key *key,
+                              unsigned timeout,
+                              struct key *keyring,
+                              struct key *instkey);
+extern void complete_request_key(struct key_construction *cons, int error);
+
+#endif /* CONFIG_KEYS */
+#endif /* _LINUX_KEY_TYPE_H */
index a9220e75782ec821a8144a198e8630ef634dbca4..fcdbd5ed227b56ce486b09fb76f3ef1052f364b6 100644 (file)
@@ -1,6 +1,6 @@
-/* key.h: authentication token and access key management
+/* Authentication token and access key management
  *
- * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
+ * Copyright (C) 2004, 2007 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
  *
  * This program is free software; you can redistribute it and/or
@@ -175,78 +175,6 @@ struct key {
        } payload;
 };
 
-/*****************************************************************************/
-/*
- * kernel managed key type definition
- */
-typedef int (*request_key_actor_t)(struct key *key, struct key *authkey,
-                                  const char *op, void *aux);
-
-struct key_type {
-       /* name of the type */
-       const char *name;
-
-       /* default payload length for quota precalculation (optional)
-        * - this can be used instead of calling key_payload_reserve(), that
-        *   function only needs to be called if the real datalen is different
-        */
-       size_t def_datalen;
-
-       /* instantiate a key of this type
-        * - this method should call key_payload_reserve() to determine if the
-        *   user's quota will hold the payload
-        */
-       int (*instantiate)(struct key *key, const void *data, size_t datalen);
-
-       /* update a key of this type (optional)
-        * - this method should call key_payload_reserve() to recalculate the
-        *   quota consumption
-        * - the key must be locked against read when modifying
-        */
-       int (*update)(struct key *key, const void *data, size_t datalen);
-
-       /* match a key against a description */
-       int (*match)(const struct key *key, const void *desc);
-
-       /* clear some of the data from a key on revokation (optional)
-        * - the key's semaphore will be write-locked by the caller
-        */
-       void (*revoke)(struct key *key);
-
-       /* clear the data from a key (optional) */
-       void (*destroy)(struct key *key);
-
-       /* describe a key */
-       void (*describe)(const struct key *key, struct seq_file *p);
-
-       /* read a key's data (optional)
-        * - permission checks will be done by the caller
-        * - the key's semaphore will be readlocked by the caller
-        * - should return the amount of data that could be read, no matter how
-        *   much is copied into the buffer
-        * - shouldn't do the copy if the buffer is NULL
-        */
-       long (*read)(const struct key *key, char __user *buffer, size_t buflen);
-
-       /* handle request_key() for this type instead of invoking
-        * /sbin/request-key (optional)
-        * - key is the key to instantiate
-        * - authkey is the authority to assume when instantiating this key
-        * - op is the operation to be done, usually "create"
-        * - the call must not return until the instantiation process has run
-        *   its course
-        */
-       request_key_actor_t request_key;
-
-       /* internal fields */
-       struct list_head        link;           /* link in types list */
-};
-
-extern struct key_type key_type_keyring;
-
-extern int register_key_type(struct key_type *ktype);
-extern void unregister_key_type(struct key_type *ktype);
-
 extern struct key *key_alloc(struct key_type *type,
                             const char *desc,
                             uid_t uid, gid_t gid,
@@ -259,16 +187,6 @@ extern struct key *key_alloc(struct key_type *type,
 #define KEY_ALLOC_QUOTA_OVERRUN        0x0001  /* add to quota, permit even if overrun */
 #define KEY_ALLOC_NOT_IN_QUOTA 0x0002  /* not in quota */
 
-extern int key_payload_reserve(struct key *key, size_t datalen);
-extern int key_instantiate_and_link(struct key *key,
-                                   const void *data,
-                                   size_t datalen,
-                                   struct key *keyring,
-                                   struct key *instkey);
-extern int key_negate_and_link(struct key *key,
-                              unsigned timeout,
-                              struct key *keyring,
-                              struct key *instkey);
 extern void key_revoke(struct key *key);
 extern void key_put(struct key *key);
 
@@ -293,6 +211,17 @@ extern struct key *request_key_with_auxdata(struct key_type *type,
                                            const char *callout_info,
                                            void *aux);
 
+extern struct key *request_key_async(struct key_type *type,
+                                    const char *description,
+                                    const char *callout_info);
+
+extern struct key *request_key_async_with_auxdata(struct key_type *type,
+                                                 const char *description,
+                                                 const char *callout_info,
+                                                 void *aux);
+
+extern int wait_for_key_construction(struct key *key, bool intr);
+
 extern int key_validate(struct key *key);
 
 extern key_ref_t key_create_or_update(key_ref_t keyring,
@@ -328,8 +257,6 @@ extern int keyring_add_key(struct key *keyring,
 
 extern struct key *key_lookup(key_serial_t id);
 
-extern void keyring_replace_payload(struct key *key, void *replacement);
-
 #define key_serial(key) ((key) ? (key)->serial : 0)
 
 /*
index ad9dcb9e337523337d5d2bacaa7c2e9f679f786a..b0cf0135fe3edec0f7054e6602ca7f54572d592f 100644 (file)
@@ -477,6 +477,18 @@ static inline void list_splice_init_rcu(struct list_head *list,
        for (pos = (head)->next, n = pos->next; pos != (head); \
                pos = n, n = pos->next)
 
+/**
+ * list_for_each_prev_safe - iterate over a list backwards safe against removal
+                       of list entry
+ * @pos:       the &struct list_head to use as a loop cursor.
+ * @n:         another &struct list_head to use as temporary storage
+ * @head:      the head for your list.
+ */
+#define list_for_each_prev_safe(pos, n, head) \
+       for (pos = (head)->prev, n = pos->prev; \
+            prefetch(pos->prev), pos != (head); \
+            pos = n, n = pos->prev)
+
 /**
  * list_for_each_entry -       iterate over list of given type
  * @pos:       the type * to use as a loop cursor.
index 1b8a2c1cb0e30e36ac1369372453dba264d4c3f9..c8cf5e8ef1717d40cde2768fd0608f29924b1545 100644 (file)
@@ -63,6 +63,15 @@ unsigned long __roundup_pow_of_two(unsigned long n)
        return 1UL << fls_long(n - 1);
 }
 
+/*
+ * round down to nearest power of two
+ */
+static inline __attribute__((const))
+unsigned long __rounddown_pow_of_two(unsigned long n)
+{
+       return 1UL << (fls_long(n) - 1);
+}
+
 /**
  * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value
  * @n - parameter
@@ -165,4 +174,20 @@ unsigned long __roundup_pow_of_two(unsigned long n)
        __roundup_pow_of_two(n)                 \
  )
 
+/**
+ * rounddown_pow_of_two - round the given value down to nearest power of two
+ * @n - parameter
+ *
+ * round the given value down to the nearest power of two
+ * - the result is undefined when n == 0
+ * - this can be used to initialise global variables from constant data
+ */
+#define rounddown_pow_of_two(n)                        \
+(                                              \
+       __builtin_constant_p(n) ? (             \
+               (n == 1) ? 0 :                  \
+               (1UL << ilog2(n))) :            \
+       __rounddown_pow_of_two(n)               \
+ )
+
 #endif /* _LINUX_LOG2_H */
index 36cc20dfd1427398daaad3a7b2fc0faeaaa04e93..722d4755060f7deee6f403ee7a5aafed5a914c25 100644 (file)
@@ -38,4 +38,7 @@
 #define SMB_SUPER_MAGIC                0x517B
 #define USBDEVICE_SUPER_MAGIC  0x9fa2
 
+#define FUTEXFS_SUPER_MAGIC    0xBAD1DEA
+#define INOTIFYFS_SUPER_MAGIC  0x2BAD1DEA
+
 #endif /* __LINUX_MAGIC_H__ */
index 7e87e1b1662e55b5fbcfc81e022e56bb9807881a..520238cbae5d10424ead32f6c9b03472c790decf 100644 (file)
@@ -10,9 +10,7 @@
 #include <linux/mmzone.h>
 #include <linux/rbtree.h>
 #include <linux/prio_tree.h>
-#include <linux/mutex.h>
 #include <linux/debug_locks.h>
-#include <linux/backing-dev.h>
 #include <linux/mm_types.h>
 
 struct mempolicy;
index 877667918452f8c752714c6f6d5905b8352eae30..f4c03e0b355e04dbbbc05f9500350d632ef87bd6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _LINUX_MM_TYPES_H
 #define _LINUX_MM_TYPES_H
 
-#include <linux/auxvec.h>      /* For AT_VECTOR_SIZE */
+#include <linux/auxvec.h>
 #include <linux/types.h>
 #include <linux/threads.h>
 #include <linux/list.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
 
+#ifndef AT_VECTOR_SIZE_ARCH
+#define AT_VECTOR_SIZE_ARCH 0
+#endif
+#define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
+
 struct address_space;
 
 #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
index f4bfe824834f995dd533c538f377bfaf39331aea..4c4522a51a3bfa6667a60d0c593efcf970781e52 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/wait.h>
+#include <linux/bitops.h>
 #include <linux/cache.h>
 #include <linux/threads.h>
 #include <linux/numa.h>
@@ -262,10 +263,7 @@ struct zone {
        unsigned long           nr_scan_active;
        unsigned long           nr_scan_inactive;
        unsigned long           pages_scanned;     /* since last reclaim */
-       int                     all_unreclaimable; /* All pages pinned */
-
-       /* A count of how many reclaimers are scanning this zone */
-       atomic_t                reclaim_in_progress;
+       unsigned long           flags;             /* zone flags, see below */
 
        /* Zone statistics */
        atomic_long_t           vm_stat[NR_VM_ZONE_STAT_ITEMS];
@@ -343,6 +341,42 @@ struct zone {
        const char              *name;
 } ____cacheline_internodealigned_in_smp;
 
+typedef enum {
+       ZONE_ALL_UNRECLAIMABLE,         /* all pages pinned */
+       ZONE_RECLAIM_LOCKED,            /* prevents concurrent reclaim */
+       ZONE_OOM_LOCKED,                /* zone is in OOM killer zonelist */
+} zone_flags_t;
+
+static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
+{
+       set_bit(flag, &zone->flags);
+}
+
+static inline int zone_test_and_set_flag(struct zone *zone, zone_flags_t flag)
+{
+       return test_and_set_bit(flag, &zone->flags);
+}
+
+static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag)
+{
+       clear_bit(flag, &zone->flags);
+}
+
+static inline int zone_is_all_unreclaimable(const struct zone *zone)
+{
+       return test_bit(ZONE_ALL_UNRECLAIMABLE, &zone->flags);
+}
+
+static inline int zone_is_reclaim_locked(const struct zone *zone)
+{
+       return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
+}
+
+static inline int zone_is_oom_locked(const struct zone *zone)
+{
+       return test_bit(ZONE_OOM_LOCKED, &zone->flags);
+}
+
 /*
  * The "priority" of VM scanning is how much of the queues we will scan in one
  * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
index b6a646cea1cba4f1a3cbd9a3139077a3c162e21d..642f325e4917fe16cf95660be6ff8b733c7e599d 100644 (file)
@@ -312,9 +312,6 @@ struct module
        /* Arch-specific module values */
        struct mod_arch_specific arch;
 
-       /* Am I unsafe to unload? */
-       int unsafe;
-
        unsigned int taints;    /* same bits as kernel:tainted */
 
 #ifdef CONFIG_GENERIC_BUG
@@ -346,6 +343,9 @@ struct module
 
        /* Section attributes */
        struct module_sect_attrs *sect_attrs;
+
+       /* Notes attributes */
+       struct module_notes_attrs *notes_attrs;
 #endif
 
        /* Per-cpu data. */
@@ -441,16 +441,6 @@ static inline void __module_get(struct module *module)
        __mod ? __mod->name : "kernel";         \
 })
 
-#define __unsafe(mod)                                                       \
-do {                                                                        \
-       if (mod && !(mod)->unsafe) {                                         \
-               printk(KERN_WARNING                                          \
-                      "Module %s cannot be unloaded due to unsafe usage in" \
-                      " %s:%u\n", (mod)->name, __FILE__, __LINE__);         \
-               (mod)->unsafe = 1;                                           \
-       }                                                                    \
-} while(0)
-
 /* For kallsyms to ask for address resolution.  NULL means not found. */
 const char *module_address_lookup(unsigned long addr,
                                  unsigned long *symbolsize,
@@ -518,8 +508,6 @@ static inline void module_put(struct module *module)
 
 #define module_name(mod) "kernel"
 
-#define __unsafe(mod)
-
 /* For kallsyms to ask for address resolution.  NULL means not found. */
 static inline const char *module_address_lookup(unsigned long addr,
                                                unsigned long *symbolsize,
index c83588c8d08b25aacbc72edc2d3529912c674248..13410b20600f4a33284da6252cc7beeb99c9f105 100644 (file)
@@ -38,7 +38,11 @@ struct kernel_param {
        unsigned int perm;
        param_set_fn set;
        param_get_fn get;
-       void *arg;
+       union {
+               void *arg;
+               const struct kparam_string *str;
+               const struct kparam_array *arr;
+       };
 };
 
 /* Special one for strings we want to copy into */
@@ -66,11 +70,11 @@ struct kparam_array
        /* Default value instead of permissions? */                     \
        static int __param_perm_check_##name __attribute__((unused)) =  \
        BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
-       static char __param_str_##name[] = prefix #name;                \
+       static const char __param_str_##name[] = prefix #name;          \
        static struct kernel_param const __param_##name                 \
        __attribute_used__                                              \
     __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
-       = { __param_str_##name, perm, set, get, arg }
+       = { __param_str_##name, perm, set, get, { arg } }
 
 #define module_param_call(name, set, get, arg, perm)                         \
        __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm)
@@ -88,10 +92,10 @@ struct kparam_array
 
 /* Actually copy string: maxlen param is usually sizeof(string). */
 #define module_param_string(name, string, len, perm)                   \
-       static struct kparam_string __param_string_##name               \
+       static const struct kparam_string __param_string_##name         \
                = { len, string };                                      \
        module_param_call(name, param_set_copystring, param_get_string, \
-                  &__param_string_##name, perm);                       \
+                         .str = &__param_string_##name, perm);         \
        __MODULE_PARM_TYPE(name, "string")
 
 /* Called on module insert or kernel boot */
@@ -149,11 +153,11 @@ extern int param_get_invbool(char *buffer, struct kernel_param *kp);
 
 /* Comma-separated array: *nump is set to number they actually specified. */
 #define module_param_array_named(name, array, type, nump, perm)                \
-       static struct kparam_array __param_arr_##name                   \
+       static const struct kparam_array __param_arr_##name             \
        = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\
            sizeof(array[0]), array };                                  \
        module_param_call(name, param_array_set, param_array_get,       \
-                         &__param_arr_##name, perm);                   \
+                         .arr = &__param_arr_##name, perm);            \
        __MODULE_PARM_TYPE(name, "array of " #type)
 
 #define module_param_array(name, type, nump, perm)             \
index 6a735c72f23f1c2fd3b983af1c47d9b275879ff9..601479772b989a5581fd89fa9cc13cb838c13c11 100644 (file)
@@ -29,7 +29,8 @@
  * - task may not exit with mutex held
  * - memory areas where held locks reside must not be freed
  * - held mutexes must not be reinitialized
- * - mutexes may not be used in irq contexts
+ * - mutexes may not be used in hardware or software interrupt
+ *   contexts such as tasklets and timers
  *
  * These semantics are fully enforced when DEBUG_MUTEXES is
  * enabled. Furthermore, besides enforcing the above rules, the mutex
index 6c38efbd810f8e0354747e73b3285039ed4399ea..4cb4f8d2f78d283d6046e3dd23f3b427ee6525be 100644 (file)
@@ -81,8 +81,8 @@ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry
 extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
 extern void release_open_intent(struct nameidata *);
 
-extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
-extern struct dentry *lookup_one_len_kern(const char *, struct dentry *, int);
+extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
+extern struct dentry *lookup_one_noperm(const char *, struct dentry *);
 
 extern int follow_down(struct vfsmount **, struct dentry **);
 extern int follow_up(struct vfsmount **, struct dentry **);
index 0f3e69302540d71222d61fa22e2fbdbd2706aae9..cc2b47240a8f2b53cb68ea9af0593bcbdd1e8897 100644 (file)
@@ -26,6 +26,7 @@
 #define NBD_PRINT_DEBUG        _IO( 0xab, 6 )
 #define NBD_SET_SIZE_BLOCKS    _IO( 0xab, 7 )
 #define NBD_DISCONNECT  _IO( 0xab, 8 )
+#define NBD_SET_TIMEOUT _IO( 0xab, 9 )
 
 enum {
        NBD_CMD_READ = 0,
@@ -65,6 +66,7 @@ struct nbd_device {
        int blksize;
        u64 bytesize;
        pid_t pid; /* pid of nbd-client, if attached */
+       int xmit_timeout;
 };
 
 #endif
index 816c04ad73819aecc9bab033ccc8b86d2ba435c8..6a882208301a823b7c39ea7f6a0cd813632c953a 100644 (file)
@@ -7,13 +7,13 @@
 typedef __u16 wchar_t;
 
 struct nls_table {
-       char *charset;
-       char *alias;
+       const char *charset;
+       const char *alias;
        int (*uni2char) (wchar_t uni, unsigned char *out, int boundlen);
        int (*char2uni) (const unsigned char *rawstring, int boundlen,
                         wchar_t *uni);
-       unsigned char *charset2lower;
-       unsigned char *charset2upper;
+       const unsigned char *charset2lower;
+       const unsigned char *charset2upper;
        struct module *owner;
        struct nls_table *next;
 };
index bec4485e3d76d0a91cba665b4716e5a6480bb42e..033a648709b620be45ad76db17c1bfa8fe31fcf1 100644 (file)
@@ -23,7 +23,6 @@ struct pid_namespace;
  */
 struct nsproxy {
        atomic_t count;
-       spinlock_t nslock;
        struct uts_namespace *uts_ns;
        struct ipc_namespace *ipc_ns;
        struct mnt_namespace *mnt_ns;
index ad76463629a019f189926334f16e5e8736228b73..3852436b652a8a4568c16ea626829cbaa14c6aab 100644 (file)
@@ -7,4 +7,28 @@
 #define OOM_ADJUST_MIN (-16)
 #define OOM_ADJUST_MAX 15
 
-#endif
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+
+struct zonelist;
+struct notifier_block;
+
+/*
+ * Types of limitations to the nodes from which allocations may occur
+ */
+enum oom_constraint {
+       CONSTRAINT_NONE,
+       CONSTRAINT_CPUSET,
+       CONSTRAINT_MEMORY_POLICY,
+};
+
+extern int try_set_zone_oom(struct zonelist *zonelist);
+extern void clear_zonelist_oom(struct zonelist *zonelist);
+
+extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
+extern int register_oom_notifier(struct notifier_block *nb);
+extern int unregister_oom_notifier(struct notifier_block *nb);
+
+#endif /* __KERNEL__*/
+#endif /* _INCLUDE_LINUX_OOM_H */
index 3d9f70972cdfa7a0943653037f777b548dc85478..9007ccdfc1127cfe73db03e31dd82a843f8f4fa8 100644 (file)
@@ -30,10 +30,28 @@ struct percpu_counter {
 #define FBC_BATCH      (NR_CPUS*4)
 #endif
 
-void percpu_counter_init(struct percpu_counter *fbc, s64 amount);
+int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
+int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
 void percpu_counter_destroy(struct percpu_counter *fbc);
-void percpu_counter_mod(struct percpu_counter *fbc, s32 amount);
-s64 percpu_counter_sum(struct percpu_counter *fbc);
+void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
+void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
+s64 __percpu_counter_sum(struct percpu_counter *fbc);
+
+static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
+{
+       __percpu_counter_add(fbc, amount, FBC_BATCH);
+}
+
+static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
+{
+       s64 ret = __percpu_counter_sum(fbc);
+       return ret < 0 ? 0 : ret;
+}
+
+static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
+{
+       return __percpu_counter_sum(fbc);
+}
 
 static inline s64 percpu_counter_read(struct percpu_counter *fbc)
 {
@@ -61,17 +79,28 @@ struct percpu_counter {
        s64 count;
 };
 
-static inline void percpu_counter_init(struct percpu_counter *fbc, s64 amount)
+static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
 {
        fbc->count = amount;
+       return 0;
 }
 
+#define percpu_counter_init_irq percpu_counter_init
+
 static inline void percpu_counter_destroy(struct percpu_counter *fbc)
 {
 }
 
+static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
+{
+       fbc->count = amount;
+}
+
+#define __percpu_counter_add(fbc, amount, batch) \
+       percpu_counter_add(fbc, amount)
+
 static inline void
-percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
+percpu_counter_add(struct percpu_counter *fbc, s64 amount)
 {
        preempt_disable();
        fbc->count += amount;
@@ -88,21 +117,31 @@ static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
        return fbc->count;
 }
 
-static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
+static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
 {
        return percpu_counter_read_positive(fbc);
 }
 
+static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
+{
+       return percpu_counter_read(fbc);
+}
+
 #endif /* CONFIG_SMP */
 
 static inline void percpu_counter_inc(struct percpu_counter *fbc)
 {
-       percpu_counter_mod(fbc, 1);
+       percpu_counter_add(fbc, 1);
 }
 
 static inline void percpu_counter_dec(struct percpu_counter *fbc)
 {
-       percpu_counter_mod(fbc, -1);
+       percpu_counter_add(fbc, -1);
+}
+
+static inline void percpu_counter_sub(struct percpu_counter *fbc, s64 amount)
+{
+       percpu_counter_add(fbc, -amount);
 }
 
 #endif /* _LINUX_PERCPU_COUNTER_H */
index 16b46aace3490413107532583ebeeb3ca85d7084..664d68cb1fbde9ba4f78d2099924ed9f209aa1ff 100644 (file)
@@ -243,11 +243,11 @@ struct pnp_fixup {
 #define PNP_CONFIGURABLE       0x0008
 #define PNP_REMOVABLE          0x0010
 
-#define pnp_can_read(dev)      (((dev)->protocol) && ((dev)->protocol->get) && \
+#define pnp_can_read(dev)      (((dev)->protocol->get) && \
                                 ((dev)->capabilities & PNP_READ))
-#define pnp_can_write(dev)     (((dev)->protocol) && ((dev)->protocol->set) && \
+#define pnp_can_write(dev)     (((dev)->protocol->set) && \
                                 ((dev)->capabilities & PNP_WRITE))
-#define pnp_can_disable(dev)   (((dev)->protocol) && ((dev)->protocol->disable) && \
+#define pnp_can_disable(dev)   (((dev)->protocol->disable) && \
                                 ((dev)->capabilities & PNP_DISABLE))
 #define pnp_can_configure(dev) ((!(dev)->active) && \
                                 ((dev)->capabilities & PNP_CONFIGURABLE))
index eec48f5f9348efd17ba2fd47d6a4d38cc31be100..ff576d1db67de07a090f40bcd93d75c71d879500 100644 (file)
@@ -78,9 +78,6 @@ int profile_event_unregister(enum profile_type, struct notifier_block * n);
 int register_timer_hook(int (*hook)(struct pt_regs *));
 void unregister_timer_hook(int (*hook)(struct pt_regs *));
 
-/* Timer based profiling hook */
-extern int (*timer_hook)(struct pt_regs *);
-
 struct pt_regs;
 
 #else
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
new file mode 100644 (file)
index 0000000..2c3b3ca
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * FLoating proportions
+ *
+ *  Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
+ *
+ * This file contains the public data structure and API definitions.
+ */
+
+#ifndef _LINUX_PROPORTIONS_H
+#define _LINUX_PROPORTIONS_H
+
+#include <linux/percpu_counter.h>
+#include <linux/spinlock.h>
+#include <linux/mutex.h>
+
+struct prop_global {
+       /*
+        * The period over which we differentiate
+        *
+        *   period = 2^shift
+        */
+       int shift;
+       /*
+        * The total event counter aka 'time'.
+        *
+        * Treated as an unsigned long; the lower 'shift - 1' bits are the
+        * counter bits, the remaining upper bits the period counter.
+        */
+       struct percpu_counter events;
+};
+
+/*
+ * global proportion descriptor
+ *
+ * this is needed to consitently flip prop_global structures.
+ */
+struct prop_descriptor {
+       int index;
+       struct prop_global pg[2];
+       struct mutex mutex;             /* serialize the prop_global switch */
+};
+
+int prop_descriptor_init(struct prop_descriptor *pd, int shift);
+void prop_change_shift(struct prop_descriptor *pd, int new_shift);
+
+/*
+ * ----- PERCPU ------
+ */
+
+struct prop_local_percpu {
+       /*
+        * the local events counter
+        */
+       struct percpu_counter events;
+
+       /*
+        * snapshot of the last seen global state
+        */
+       int shift;
+       unsigned long period;
+       spinlock_t lock;                /* protect the snapshot state */
+};
+
+int prop_local_init_percpu(struct prop_local_percpu *pl);
+void prop_local_destroy_percpu(struct prop_local_percpu *pl);
+void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl);
+void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl,
+               long *numerator, long *denominator);
+
+static inline
+void prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       __prop_inc_percpu(pd, pl);
+       local_irq_restore(flags);
+}
+
+/*
+ * ----- SINGLE ------
+ */
+
+struct prop_local_single {
+       /*
+        * the local events counter
+        */
+       unsigned long events;
+
+       /*
+        * snapshot of the last seen global state
+        * and a lock protecting this state
+        */
+       int shift;
+       unsigned long period;
+       spinlock_t lock;                /* protect the snapshot state */
+};
+
+#define INIT_PROP_LOCAL_SINGLE(name)                   \
+{      .lock = __SPIN_LOCK_UNLOCKED(name.lock),        \
+}
+
+int prop_local_init_single(struct prop_local_single *pl);
+void prop_local_destroy_single(struct prop_local_single *pl);
+void __prop_inc_single(struct prop_descriptor *pd, struct prop_local_single *pl);
+void prop_fraction_single(struct prop_descriptor *pd, struct prop_local_single *pl,
+               long *numerator, long *denominator);
+
+static inline
+void prop_inc_single(struct prop_descriptor *pd, struct prop_local_single *pl)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       __prop_inc_single(pd, pl);
+       local_irq_restore(flags);
+}
+
+#endif /* _LINUX_PROPORTIONS_H */
index 62439828395e3f3faa424f3305844713f02aca60..6e0393a5b2eafd4c98ec08fae1a0d83372a03672 100644 (file)
@@ -128,6 +128,37 @@ struct if_dqinfo {
        __u32 dqi_valid;
 };
 
+/*
+ * Definitions for quota netlink interface
+ */
+#define QUOTA_NL_NOWARN 0
+#define QUOTA_NL_IHARDWARN 1           /* Inode hardlimit reached */
+#define QUOTA_NL_ISOFTLONGWARN 2       /* Inode grace time expired */
+#define QUOTA_NL_ISOFTWARN 3           /* Inode softlimit reached */
+#define QUOTA_NL_BHARDWARN 4           /* Block hardlimit reached */
+#define QUOTA_NL_BSOFTLONGWARN 5       /* Block grace time expired */
+#define QUOTA_NL_BSOFTWARN 6           /* Block softlimit reached */
+
+enum {
+       QUOTA_NL_C_UNSPEC,
+       QUOTA_NL_C_WARNING,
+       __QUOTA_NL_C_MAX,
+};
+#define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1)
+
+enum {
+       QUOTA_NL_A_UNSPEC,
+       QUOTA_NL_A_QTYPE,
+       QUOTA_NL_A_EXCESS_ID,
+       QUOTA_NL_A_WARNING,
+       QUOTA_NL_A_DEV_MAJOR,
+       QUOTA_NL_A_DEV_MINOR,
+       QUOTA_NL_A_CAUSED_ID,
+       __QUOTA_NL_A_MAX,
+};
+#define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1)
+
+
 #ifdef __KERNEL__
 #include <linux/spinlock.h>
 #include <linux/rwsem.h>
index 75e17a05540ef4a748f5f0586c027d4ab70e9dc5..306a1d1a5af070fc5823c4d0f6e6a3f3192650c7 100644 (file)
@@ -138,7 +138,6 @@ typedef __u16 bitmap_counter_t;
 
 /* use these for bitmap->flags and bitmap->sb->state bit-fields */
 enum bitmap_state {
-       BITMAP_ACTIVE = 0x001, /* the bitmap is in use */
        BITMAP_STALE  = 0x002,  /* the bitmap file is out of date or had -EIO */
        BITMAP_WRITE_ERROR = 0x004, /* A write error has occurred */
        BITMAP_HOSTENDIAN = 0x8000,
@@ -258,7 +257,6 @@ struct bitmap {
 int  bitmap_create(mddev_t *mddev);
 void bitmap_flush(mddev_t *mddev);
 void bitmap_destroy(mddev_t *mddev);
-int  bitmap_active(struct bitmap *bitmap);
 
 char *file_path(struct file *file, char *buf, int count);
 void bitmap_print_sb(struct bitmap *bitmap);
index 76c1a530edc5784c9b5812d3d869e2ce89a03db0..cc24a01df940a67a18bce50a666d5a9080c7b387 100644 (file)
@@ -231,6 +231,18 @@ extern struct lockdep_map rcu_lock_map;
                local_bh_enable(); \
        } while(0)
 
+/*
+ * Prevent the compiler from merging or refetching accesses.  The compiler
+ * is also forbidden from reordering successive instances of ACCESS_ONCE(),
+ * but only when the compiler is aware of some particular ordering.  One way
+ * to make the compiler aware of ordering is to put the two invocations of
+ * ACCESS_ONCE() in different C statements.
+ *
+ * This macro does absolutely -nothing- to prevent the CPU from reordering,
+ * merging, or refetching absolutely anything at any time.
+ */
+#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+
 /**
  * rcu_dereference - fetch an RCU-protected pointer in an
  * RCU read-side critical section.  This pointer may later
@@ -242,7 +254,7 @@ extern struct lockdep_map rcu_lock_map;
  */
 
 #define rcu_dereference(p)     ({ \
-                               typeof(p) _________p1 = p; \
+                               typeof(p) _________p1 = ACCESS_ONCE(p); \
                                smp_read_barrier_depends(); \
                                (_________p1); \
                                })
index 180a9d832dde000f966cee08666235b58690f168..8dcf237d3386e901fedfb98553e11e2ebf796d32 100644 (file)
@@ -1703,8 +1703,6 @@ static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_ha
        return th->t_blocks_allocated - th->t_blocks_logged;
 }
 
-int reiserfs_async_progress_wait(struct super_block *s);
-
 struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
                                                                    super_block
                                                                    *,
@@ -1859,8 +1857,6 @@ void padd_item(char *item, int total_length, int length);
 #define GET_BLOCK_NO_IMUX     8        /* i_mutex is not held, don't preallocate */
 #define GET_BLOCK_NO_DANGLE   16       /* don't leave any transactions running */
 
-int restart_transaction(struct reiserfs_transaction_handle *th,
-                       struct inode *inode, struct treepath *path);
 void reiserfs_read_locked_inode(struct inode *inode,
                                struct reiserfs_iget_args *args);
 int reiserfs_find_actor(struct inode *inode, void *p);
@@ -2137,9 +2133,6 @@ void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th,
                               struct inode *inode);
 void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th);
 #endif
-void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb, int blocks);
-void reiserfs_release_claimed_blocks(struct super_block *sb, int blocks);
-int reiserfs_can_fit_pages(struct super_block *sb);
 
 /* hashes.c */
 __u32 keyed_hash(const signed char *msg, int len);
index 592e3a55f818fe328222a6051d6a51c5c15ecfae..3de5aa210feb5fabf434a82d936d5b1f66c5e3b4 100644 (file)
@@ -74,6 +74,7 @@ struct sched_param {
 #include <linux/pid.h>
 #include <linux/percpu.h>
 #include <linux/topology.h>
+#include <linux/proportions.h>
 #include <linux/seccomp.h>
 #include <linux/rcupdate.h>
 #include <linux/futex.h>
@@ -260,6 +261,7 @@ extern void softlockup_tick(void);
 extern void spawn_softlockup_task(void);
 extern void touch_softlockup_watchdog(void);
 extern void touch_all_softlockup_watchdogs(void);
+extern int softlockup_thresh;
 #else
 static inline void softlockup_tick(void)
 {
@@ -357,8 +359,9 @@ extern int get_dumpable(struct mm_struct *mm);
 #define MMF_DUMP_ANON_SHARED   3
 #define MMF_DUMP_MAPPED_PRIVATE        4
 #define MMF_DUMP_MAPPED_SHARED 5
+#define MMF_DUMP_ELF_HEADERS   6
 #define MMF_DUMP_FILTER_SHIFT  MMF_DUMPABLE_BITS
-#define MMF_DUMP_FILTER_BITS   4
+#define MMF_DUMP_FILTER_BITS   5
 #define MMF_DUMP_FILTER_MASK \
        (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
 #define MMF_DUMP_FILTER_DEFAULT \
@@ -515,8 +518,10 @@ struct user_struct {
        atomic_t inotify_watches; /* How many inotify watches does this user have? */
        atomic_t inotify_devs;  /* How many inotify devs does this user have opened? */
 #endif
+#ifdef CONFIG_POSIX_MQUEUE
        /* protected by mq_lock */
        unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */
+#endif
        unsigned long locked_shm; /* How many pages of mlocked shm ? */
 
 #ifdef CONFIG_KEYS
@@ -913,6 +918,16 @@ struct task_struct {
 #endif
 
        unsigned short ioprio;
+       /*
+        * fpu_counter contains the number of consecutive context switches
+        * that the FPU is used. If this is over a threshold, the lazy fpu
+        * saving becomes unlazy to save the trap. This is an unsigned char
+        * so that after 256 times the counter wraps and the behavior turns
+        * lazy again; this to deal with bursty apps that only use FPU for
+        * a short time
+        */
+       unsigned char fpu_counter;
+       s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
 #ifdef CONFIG_BLK_DEV_IO_TRACE
        unsigned int btrace_seq;
 #endif
@@ -998,16 +1013,6 @@ struct task_struct {
        struct key *thread_keyring;     /* keyring private to this thread */
        unsigned char jit_keyring;      /* default keyring to attach requested keys to */
 #endif
-       /*
-        * fpu_counter contains the number of consecutive context switches
-        * that the FPU is used. If this is over a threshold, the lazy fpu
-        * saving becomes unlazy to save the trap. This is an unsigned char
-        * so that after 256 times the counter wraps and the behavior turns
-        * lazy again; this to deal with bursty apps that only use FPU for
-        * a short time
-        */
-       unsigned char fpu_counter;
-       int oomkilladj; /* OOM kill score adjustment (bit shift). */
        char comm[TASK_COMM_LEN]; /* executable name excluding path
                                     - access with [gs]et_task_comm (which lock
                                       it with task_lock())
@@ -1039,8 +1044,9 @@ struct task_struct {
        int (*notifier)(void *priv);
        void *notifier_data;
        sigset_t *notifier_mask;
-       
+#ifdef CONFIG_SECURITY
        void *security;
+#endif
        struct audit_context *audit_context;
        seccomp_t seccomp;
 
@@ -1129,13 +1135,14 @@ struct task_struct {
        int cpuset_mems_generation;
        int cpuset_mem_spread_rotor;
 #endif
+#ifdef CONFIG_FUTEX
        struct robust_list_head __user *robust_list;
 #ifdef CONFIG_COMPAT
        struct compat_robust_list_head __user *compat_robust_list;
 #endif
        struct list_head pi_state_list;
        struct futex_pi_state *pi_state_cache;
-
+#endif
        atomic_t fs_excl;       /* holding fs exclusive resources */
        struct rcu_head rcu;
 
@@ -1149,6 +1156,7 @@ struct task_struct {
 #ifdef CONFIG_FAULT_INJECTION
        int make_it_fail;
 #endif
+       struct prop_local_single dirties;
 };
 
 /*
index 928d4793c6f429736eebfc28196dc5c5ae9fc710..9b0b63c50f445717c8645962c7a06c77042115d6 100644 (file)
@@ -51,10 +51,16 @@ extern void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe);
 extern int cap_bprm_secureexec(struct linux_binprm *bprm);
 extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags);
 extern int cap_inode_removexattr(struct dentry *dentry, char *name);
+extern int cap_inode_need_killpriv(struct dentry *dentry);
+extern int cap_inode_killpriv(struct dentry *dentry);
 extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
 extern void cap_task_reparent_to_init (struct task_struct *p);
+extern int cap_task_kill(struct task_struct *p, struct siginfo *info, int sig, u32 secid);
+extern int cap_task_setscheduler (struct task_struct *p, int policy, struct sched_param *lp);
+extern int cap_task_setioprio (struct task_struct *p, int ioprio);
+extern int cap_task_setnice (struct task_struct *p, int nice);
 extern int cap_syslog (int type);
-extern int cap_vm_enough_memory (struct mm_struct *mm, long pages);
+extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
 
 struct msghdr;
 struct sk_buff;
@@ -413,6 +419,18 @@ struct request_sock;
  *     is specified by @buffer_size.  @buffer may be NULL to request
  *     the size of the buffer required.
  *     Returns number of bytes used/required on success.
+ * @inode_need_killpriv:
+ *     Called when an inode has been changed.
+ *     @dentry is the dentry being changed.
+ *     Return <0 on error to abort the inode change operation.
+ *     Return 0 if inode_killpriv does not need to be called.
+ *     Return >0 if inode_killpriv does need to be called.
+ * @inode_killpriv:
+ *     The setuid bit is being removed.  Remove similar security labels.
+ *     Called with the dentry->d_inode->i_mutex held.
+ *     @dentry is the dentry being changed.
+ *     Return 0 on success.  If error is returned, then the operation
+ *     causing setuid bit removal is failed.
  *
  * Security hooks for file operations
  *
@@ -1140,10 +1158,6 @@ struct request_sock;
  *     allow module stacking.
  *     @name contains the name of the security module being stacked.
  *     @ops contains a pointer to the struct security_operations of the module to stack.
- * @unregister_security:
- *     remove a stacked module.
- *     @name contains the name of the security module being unstacked.
- *     @ops contains a pointer to the struct security_operations of the module to unstack.
  * 
  * @secid_to_secctx:
  *     Convert secid to security context.
@@ -1239,7 +1253,8 @@ struct security_operations {
        int (*inode_getxattr) (struct dentry *dentry, char *name);
        int (*inode_listxattr) (struct dentry *dentry);
        int (*inode_removexattr) (struct dentry *dentry, char *name);
-       const char *(*inode_xattr_getsuffix) (void);
+       int (*inode_need_killpriv) (struct dentry *dentry);
+       int (*inode_killpriv) (struct dentry *dentry);
        int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
        int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
        int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
@@ -1330,8 +1345,6 @@ struct security_operations {
        /* allow module stacking */
        int (*register_security) (const char *name,
                                  struct security_operations *ops);
-       int (*unregister_security) (const char *name,
-                                   struct security_operations *ops);
 
        void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
 
@@ -1409,748 +1422,10 @@ struct security_operations {
 
 };
 
-/* global variables */
-extern struct security_operations *security_ops;
-
-/* inline stuff */
-static inline int security_ptrace (struct task_struct * parent, struct task_struct * child)
-{
-       return security_ops->ptrace (parent, child);
-}
-
-static inline int security_capget (struct task_struct *target,
-                                  kernel_cap_t *effective,
-                                  kernel_cap_t *inheritable,
-                                  kernel_cap_t *permitted)
-{
-       return security_ops->capget (target, effective, inheritable, permitted);
-}
-
-static inline int security_capset_check (struct task_struct *target,
-                                        kernel_cap_t *effective,
-                                        kernel_cap_t *inheritable,
-                                        kernel_cap_t *permitted)
-{
-       return security_ops->capset_check (target, effective, inheritable, permitted);
-}
-
-static inline void security_capset_set (struct task_struct *target,
-                                       kernel_cap_t *effective,
-                                       kernel_cap_t *inheritable,
-                                       kernel_cap_t *permitted)
-{
-       security_ops->capset_set (target, effective, inheritable, permitted);
-}
-
-static inline int security_capable(struct task_struct *tsk, int cap)
-{
-       return security_ops->capable(tsk, cap);
-}
-
-static inline int security_acct (struct file *file)
-{
-       return security_ops->acct (file);
-}
-
-static inline int security_sysctl(struct ctl_table *table, int op)
-{
-       return security_ops->sysctl(table, op);
-}
-
-static inline int security_quotactl (int cmds, int type, int id,
-                                    struct super_block *sb)
-{
-       return security_ops->quotactl (cmds, type, id, sb);
-}
-
-static inline int security_quota_on (struct dentry * dentry)
-{
-       return security_ops->quota_on (dentry);
-}
-
-static inline int security_syslog(int type)
-{
-       return security_ops->syslog(type);
-}
-
-static inline int security_settime(struct timespec *ts, struct timezone *tz)
-{
-       return security_ops->settime(ts, tz);
-}
-
-static inline int security_vm_enough_memory(long pages)
-{
-       return security_ops->vm_enough_memory(current->mm, pages);
-}
-
-static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
-{
-       return security_ops->vm_enough_memory(mm, pages);
-}
-
-static inline int security_bprm_alloc (struct linux_binprm *bprm)
-{
-       return security_ops->bprm_alloc_security (bprm);
-}
-static inline void security_bprm_free (struct linux_binprm *bprm)
-{
-       security_ops->bprm_free_security (bprm);
-}
-static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
-{
-       security_ops->bprm_apply_creds (bprm, unsafe);
-}
-static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm)
-{
-       security_ops->bprm_post_apply_creds (bprm);
-}
-static inline int security_bprm_set (struct linux_binprm *bprm)
-{
-       return security_ops->bprm_set_security (bprm);
-}
-
-static inline int security_bprm_check (struct linux_binprm *bprm)
-{
-       return security_ops->bprm_check_security (bprm);
-}
-
-static inline int security_bprm_secureexec (struct linux_binprm *bprm)
-{
-       return security_ops->bprm_secureexec (bprm);
-}
-
-static inline int security_sb_alloc (struct super_block *sb)
-{
-       return security_ops->sb_alloc_security (sb);
-}
-
-static inline void security_sb_free (struct super_block *sb)
-{
-       security_ops->sb_free_security (sb);
-}
-
-static inline int security_sb_copy_data (struct file_system_type *type,
-                                        void *orig, void *copy)
-{
-       return security_ops->sb_copy_data (type, orig, copy);
-}
-
-static inline int security_sb_kern_mount (struct super_block *sb, void *data)
-{
-       return security_ops->sb_kern_mount (sb, data);
-}
-
-static inline int security_sb_statfs (struct dentry *dentry)
-{
-       return security_ops->sb_statfs (dentry);
-}
-
-static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
-                                   char *type, unsigned long flags,
-                                   void *data)
-{
-       return security_ops->sb_mount (dev_name, nd, type, flags, data);
-}
-
-static inline int security_sb_check_sb (struct vfsmount *mnt,
-                                       struct nameidata *nd)
-{
-       return security_ops->sb_check_sb (mnt, nd);
-}
-
-static inline int security_sb_umount (struct vfsmount *mnt, int flags)
-{
-       return security_ops->sb_umount (mnt, flags);
-}
-
-static inline void security_sb_umount_close (struct vfsmount *mnt)
-{
-       security_ops->sb_umount_close (mnt);
-}
-
-static inline void security_sb_umount_busy (struct vfsmount *mnt)
-{
-       security_ops->sb_umount_busy (mnt);
-}
-
-static inline void security_sb_post_remount (struct vfsmount *mnt,
-                                            unsigned long flags, void *data)
-{
-       security_ops->sb_post_remount (mnt, flags, data);
-}
-
-static inline void security_sb_post_mountroot (void)
-{
-       security_ops->sb_post_mountroot ();
-}
-
-static inline void security_sb_post_addmount (struct vfsmount *mnt,
-                                             struct nameidata *mountpoint_nd)
-{
-       security_ops->sb_post_addmount (mnt, mountpoint_nd);
-}
-
-static inline int security_sb_pivotroot (struct nameidata *old_nd,
-                                        struct nameidata *new_nd)
-{
-       return security_ops->sb_pivotroot (old_nd, new_nd);
-}
-
-static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
-                                              struct nameidata *new_nd)
-{
-       security_ops->sb_post_pivotroot (old_nd, new_nd);
-}
-
-static inline int security_inode_alloc (struct inode *inode)
-{
-       inode->i_security = NULL;
-       return security_ops->inode_alloc_security (inode);
-}
-
-static inline void security_inode_free (struct inode *inode)
-{
-       security_ops->inode_free_security (inode);
-}
-
-static inline int security_inode_init_security (struct inode *inode,
-                                               struct inode *dir,
-                                               char **name,
-                                               void **value,
-                                               size_t *len)
-{
-       if (unlikely (IS_PRIVATE (inode)))
-               return -EOPNOTSUPP;
-       return security_ops->inode_init_security (inode, dir, name, value, len);
-}
-       
-static inline int security_inode_create (struct inode *dir,
-                                        struct dentry *dentry,
-                                        int mode)
-{
-       if (unlikely (IS_PRIVATE (dir)))
-               return 0;
-       return security_ops->inode_create (dir, dentry, mode);
-}
-
-static inline int security_inode_link (struct dentry *old_dentry,
-                                      struct inode *dir,
-                                      struct dentry *new_dentry)
-{
-       if (unlikely (IS_PRIVATE (old_dentry->d_inode)))
-               return 0;
-       return security_ops->inode_link (old_dentry, dir, new_dentry);
-}
-
-static inline int security_inode_unlink (struct inode *dir,
-                                        struct dentry *dentry)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_unlink (dir, dentry);
-}
-
-static inline int security_inode_symlink (struct inode *dir,
-                                         struct dentry *dentry,
-                                         const char *old_name)
-{
-       if (unlikely (IS_PRIVATE (dir)))
-               return 0;
-       return security_ops->inode_symlink (dir, dentry, old_name);
-}
-
-static inline int security_inode_mkdir (struct inode *dir,
-                                       struct dentry *dentry,
-                                       int mode)
-{
-       if (unlikely (IS_PRIVATE (dir)))
-               return 0;
-       return security_ops->inode_mkdir (dir, dentry, mode);
-}
-
-static inline int security_inode_rmdir (struct inode *dir,
-                                       struct dentry *dentry)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_rmdir (dir, dentry);
-}
-
-static inline int security_inode_mknod (struct inode *dir,
-                                       struct dentry *dentry,
-                                       int mode, dev_t dev)
-{
-       if (unlikely (IS_PRIVATE (dir)))
-               return 0;
-       return security_ops->inode_mknod (dir, dentry, mode, dev);
-}
-
-static inline int security_inode_rename (struct inode *old_dir,
-                                        struct dentry *old_dentry,
-                                        struct inode *new_dir,
-                                        struct dentry *new_dentry)
-{
-        if (unlikely (IS_PRIVATE (old_dentry->d_inode) ||
-            (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode))))
-               return 0;
-       return security_ops->inode_rename (old_dir, old_dentry,
-                                          new_dir, new_dentry);
-}
-
-static inline int security_inode_readlink (struct dentry *dentry)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_readlink (dentry);
-}
-
-static inline int security_inode_follow_link (struct dentry *dentry,
-                                             struct nameidata *nd)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_follow_link (dentry, nd);
-}
-
-static inline int security_inode_permission (struct inode *inode, int mask,
-                                            struct nameidata *nd)
-{
-       if (unlikely (IS_PRIVATE (inode)))
-               return 0;
-       return security_ops->inode_permission (inode, mask, nd);
-}
-
-static inline int security_inode_setattr (struct dentry *dentry,
-                                         struct iattr *attr)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_setattr (dentry, attr);
-}
-
-static inline int security_inode_getattr (struct vfsmount *mnt,
-                                         struct dentry *dentry)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_getattr (mnt, dentry);
-}
-
-static inline void security_inode_delete (struct inode *inode)
-{
-       if (unlikely (IS_PRIVATE (inode)))
-               return;
-       security_ops->inode_delete (inode);
-}
-
-static inline int security_inode_setxattr (struct dentry *dentry, char *name,
-                                          void *value, size_t size, int flags)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_setxattr (dentry, name, value, size, flags);
-}
-
-static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
-                                               void *value, size_t size, int flags)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return;
-       security_ops->inode_post_setxattr (dentry, name, value, size, flags);
-}
-
-static inline int security_inode_getxattr (struct dentry *dentry, char *name)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_getxattr (dentry, name);
-}
-
-static inline int security_inode_listxattr (struct dentry *dentry)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_listxattr (dentry);
-}
-
-static inline int security_inode_removexattr (struct dentry *dentry, char *name)
-{
-       if (unlikely (IS_PRIVATE (dentry->d_inode)))
-               return 0;
-       return security_ops->inode_removexattr (dentry, name);
-}
-
-static inline const char *security_inode_xattr_getsuffix(void)
-{
-       return security_ops->inode_xattr_getsuffix();
-}
-
-static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
-{
-       if (unlikely (IS_PRIVATE (inode)))
-               return 0;
-       return security_ops->inode_getsecurity(inode, name, buffer, size, err);
-}
-
-static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
-{
-       if (unlikely (IS_PRIVATE (inode)))
-               return 0;
-       return security_ops->inode_setsecurity(inode, name, value, size, flags);
-}
-
-static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
-{
-       if (unlikely (IS_PRIVATE (inode)))
-               return 0;
-       return security_ops->inode_listsecurity(inode, buffer, buffer_size);
-}
-
-static inline int security_file_permission (struct file *file, int mask)
-{
-       return security_ops->file_permission (file, mask);
-}
-
-static inline int security_file_alloc (struct file *file)
-{
-       return security_ops->file_alloc_security (file);
-}
-
-static inline void security_file_free (struct file *file)
-{
-       security_ops->file_free_security (file);
-}
-
-static inline int security_file_ioctl (struct file *file, unsigned int cmd,
-                                      unsigned long arg)
-{
-       return security_ops->file_ioctl (file, cmd, arg);
-}
-
-static inline int security_file_mmap (struct file *file, unsigned long reqprot,
-                                     unsigned long prot,
-                                     unsigned long flags,
-                                     unsigned long addr,
-                                     unsigned long addr_only)
-{
-       return security_ops->file_mmap (file, reqprot, prot, flags, addr,
-                                       addr_only);
-}
-
-static inline int security_file_mprotect (struct vm_area_struct *vma,
-                                         unsigned long reqprot,
-                                         unsigned long prot)
-{
-       return security_ops->file_mprotect (vma, reqprot, prot);
-}
-
-static inline int security_file_lock (struct file *file, unsigned int cmd)
-{
-       return security_ops->file_lock (file, cmd);
-}
-
-static inline int security_file_fcntl (struct file *file, unsigned int cmd,
-                                      unsigned long arg)
-{
-       return security_ops->file_fcntl (file, cmd, arg);
-}
-
-static inline int security_file_set_fowner (struct file *file)
-{
-       return security_ops->file_set_fowner (file);
-}
-
-static inline int security_file_send_sigiotask (struct task_struct *tsk,
-                                               struct fown_struct *fown,
-                                               int sig)
-{
-       return security_ops->file_send_sigiotask (tsk, fown, sig);
-}
-
-static inline int security_file_receive (struct file *file)
-{
-       return security_ops->file_receive (file);
-}
-
-static inline int security_dentry_open (struct file *file)
-{
-       return security_ops->dentry_open (file);
-}
-
-static inline int security_task_create (unsigned long clone_flags)
-{
-       return security_ops->task_create (clone_flags);
-}
-
-static inline int security_task_alloc (struct task_struct *p)
-{
-       return security_ops->task_alloc_security (p);
-}
-
-static inline void security_task_free (struct task_struct *p)
-{
-       security_ops->task_free_security (p);
-}
-
-static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2,
-                                       int flags)
-{
-       return security_ops->task_setuid (id0, id1, id2, flags);
-}
-
-static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid,
-                                            uid_t old_suid, int flags)
-{
-       return security_ops->task_post_setuid (old_ruid, old_euid, old_suid, flags);
-}
-
-static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2,
-                                       int flags)
-{
-       return security_ops->task_setgid (id0, id1, id2, flags);
-}
-
-static inline int security_task_setpgid (struct task_struct *p, pid_t pgid)
-{
-       return security_ops->task_setpgid (p, pgid);
-}
-
-static inline int security_task_getpgid (struct task_struct *p)
-{
-       return security_ops->task_getpgid (p);
-}
-
-static inline int security_task_getsid (struct task_struct *p)
-{
-       return security_ops->task_getsid (p);
-}
-
-static inline void security_task_getsecid (struct task_struct *p, u32 *secid)
-{
-       security_ops->task_getsecid (p, secid);
-}
-
-static inline int security_task_setgroups (struct group_info *group_info)
-{
-       return security_ops->task_setgroups (group_info);
-}
-
-static inline int security_task_setnice (struct task_struct *p, int nice)
-{
-       return security_ops->task_setnice (p, nice);
-}
-
-static inline int security_task_setioprio (struct task_struct *p, int ioprio)
-{
-       return security_ops->task_setioprio (p, ioprio);
-}
-
-static inline int security_task_getioprio (struct task_struct *p)
-{
-       return security_ops->task_getioprio (p);
-}
-
-static inline int security_task_setrlimit (unsigned int resource,
-                                          struct rlimit *new_rlim)
-{
-       return security_ops->task_setrlimit (resource, new_rlim);
-}
-
-static inline int security_task_setscheduler (struct task_struct *p,
-                                             int policy,
-                                             struct sched_param *lp)
-{
-       return security_ops->task_setscheduler (p, policy, lp);
-}
-
-static inline int security_task_getscheduler (struct task_struct *p)
-{
-       return security_ops->task_getscheduler (p);
-}
-
-static inline int security_task_movememory (struct task_struct *p)
-{
-       return security_ops->task_movememory (p);
-}
-
-static inline int security_task_kill (struct task_struct *p,
-                                     struct siginfo *info, int sig,
-                                     u32 secid)
-{
-       return security_ops->task_kill (p, info, sig, secid);
-}
-
-static inline int security_task_wait (struct task_struct *p)
-{
-       return security_ops->task_wait (p);
-}
-
-static inline int security_task_prctl (int option, unsigned long arg2,
-                                      unsigned long arg3,
-                                      unsigned long arg4,
-                                      unsigned long arg5)
-{
-       return security_ops->task_prctl (option, arg2, arg3, arg4, arg5);
-}
-
-static inline void security_task_reparent_to_init (struct task_struct *p)
-{
-       security_ops->task_reparent_to_init (p);
-}
-
-static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
-{
-       security_ops->task_to_inode(p, inode);
-}
-
-static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
-                                          short flag)
-{
-       return security_ops->ipc_permission (ipcp, flag);
-}
-
-static inline int security_msg_msg_alloc (struct msg_msg * msg)
-{
-       return security_ops->msg_msg_alloc_security (msg);
-}
-
-static inline void security_msg_msg_free (struct msg_msg * msg)
-{
-       security_ops->msg_msg_free_security(msg);
-}
-
-static inline int security_msg_queue_alloc (struct msg_queue *msq)
-{
-       return security_ops->msg_queue_alloc_security (msq);
-}
-
-static inline void security_msg_queue_free (struct msg_queue *msq)
-{
-       security_ops->msg_queue_free_security (msq);
-}
-
-static inline int security_msg_queue_associate (struct msg_queue * msq, 
-                                               int msqflg)
-{
-       return security_ops->msg_queue_associate (msq, msqflg);
-}
-
-static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd)
-{
-       return security_ops->msg_queue_msgctl (msq, cmd);
-}
-
-static inline int security_msg_queue_msgsnd (struct msg_queue * msq,
-                                            struct msg_msg * msg, int msqflg)
-{
-       return security_ops->msg_queue_msgsnd (msq, msg, msqflg);
-}
-
-static inline int security_msg_queue_msgrcv (struct msg_queue * msq,
-                                            struct msg_msg * msg,
-                                            struct task_struct * target,
-                                            long type, int mode)
-{
-       return security_ops->msg_queue_msgrcv (msq, msg, target, type, mode);
-}
-
-static inline int security_shm_alloc (struct shmid_kernel *shp)
-{
-       return security_ops->shm_alloc_security (shp);
-}
-
-static inline void security_shm_free (struct shmid_kernel *shp)
-{
-       security_ops->shm_free_security (shp);
-}
-
-static inline int security_shm_associate (struct shmid_kernel * shp, 
-                                         int shmflg)
-{
-       return security_ops->shm_associate(shp, shmflg);
-}
-
-static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd)
-{
-       return security_ops->shm_shmctl (shp, cmd);
-}
-
-static inline int security_shm_shmat (struct shmid_kernel * shp, 
-                                     char __user *shmaddr, int shmflg)
-{
-       return security_ops->shm_shmat(shp, shmaddr, shmflg);
-}
-
-static inline int security_sem_alloc (struct sem_array *sma)
-{
-       return security_ops->sem_alloc_security (sma);
-}
-
-static inline void security_sem_free (struct sem_array *sma)
-{
-       security_ops->sem_free_security (sma);
-}
-
-static inline int security_sem_associate (struct sem_array * sma, int semflg)
-{
-       return security_ops->sem_associate (sma, semflg);
-}
-
-static inline int security_sem_semctl (struct sem_array * sma, int cmd)
-{
-       return security_ops->sem_semctl(sma, cmd);
-}
-
-static inline int security_sem_semop (struct sem_array * sma, 
-                                     struct sembuf * sops, unsigned nsops, 
-                                     int alter)
-{
-       return security_ops->sem_semop(sma, sops, nsops, alter);
-}
-
-static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
-{
-       if (unlikely (inode && IS_PRIVATE (inode)))
-               return;
-       security_ops->d_instantiate (dentry, inode);
-}
-
-static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
-{
-       return security_ops->getprocattr(p, name, value);
-}
-
-static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
-{
-       return security_ops->setprocattr(p, name, value, size);
-}
-
-static inline int security_netlink_send(struct sock *sk, struct sk_buff * skb)
-{
-       return security_ops->netlink_send(sk, skb);
-}
-
-static inline int security_netlink_recv(struct sk_buff * skb, int cap)
-{
-       return security_ops->netlink_recv(skb, cap);
-}
-
-static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
-{
-       return security_ops->secid_to_secctx(secid, secdata, seclen);
-}
-
-static inline void security_release_secctx(char *secdata, u32 seclen)
-{
-       return security_ops->release_secctx(secdata, seclen);
-}
-
 /* prototypes */
 extern int security_init       (void);
 extern int register_security   (struct security_operations *ops);
-extern int unregister_security (struct security_operations *ops);
 extern int mod_reg_security    (const char *name, struct security_operations *ops);
-extern int mod_unreg_security  (const char *name, struct security_operations *ops);
 extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
                                             struct dentry *parent, void *data,
                                             const struct file_operations *fops);
@@ -2158,6 +1433,158 @@ extern struct dentry *securityfs_create_dir(const char *name, struct dentry *par
 extern void securityfs_remove(struct dentry *dentry);
 
 
+/* Security operations */
+int security_ptrace(struct task_struct *parent, struct task_struct *child);
+int security_capget(struct task_struct *target,
+                    kernel_cap_t *effective,
+                    kernel_cap_t *inheritable,
+                    kernel_cap_t *permitted);
+int security_capset_check(struct task_struct *target,
+                          kernel_cap_t *effective,
+                          kernel_cap_t *inheritable,
+                          kernel_cap_t *permitted);
+void security_capset_set(struct task_struct *target,
+                         kernel_cap_t *effective,
+                         kernel_cap_t *inheritable,
+                         kernel_cap_t *permitted);
+int security_capable(struct task_struct *tsk, int cap);
+int security_acct(struct file *file);
+int security_sysctl(struct ctl_table *table, int op);
+int security_quotactl(int cmds, int type, int id, struct super_block *sb);
+int security_quota_on(struct dentry *dentry);
+int security_syslog(int type);
+int security_settime(struct timespec *ts, struct timezone *tz);
+int security_vm_enough_memory(long pages);
+int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
+int security_bprm_alloc(struct linux_binprm *bprm);
+void security_bprm_free(struct linux_binprm *bprm);
+void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
+void security_bprm_post_apply_creds(struct linux_binprm *bprm);
+int security_bprm_set(struct linux_binprm *bprm);
+int security_bprm_check(struct linux_binprm *bprm);
+int security_bprm_secureexec(struct linux_binprm *bprm);
+int security_sb_alloc(struct super_block *sb);
+void security_sb_free(struct super_block *sb);
+int security_sb_copy_data(struct file_system_type *type, void *orig, void *copy);
+int security_sb_kern_mount(struct super_block *sb, void *data);
+int security_sb_statfs(struct dentry *dentry);
+int security_sb_mount(char *dev_name, struct nameidata *nd,
+                       char *type, unsigned long flags, void *data);
+int security_sb_check_sb(struct vfsmount *mnt, struct nameidata *nd);
+int security_sb_umount(struct vfsmount *mnt, int flags);
+void security_sb_umount_close(struct vfsmount *mnt);
+void security_sb_umount_busy(struct vfsmount *mnt);
+void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
+void security_sb_post_mountroot(void);
+void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd);
+int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
+void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
+int security_inode_alloc(struct inode *inode);
+void security_inode_free(struct inode *inode);
+int security_inode_init_security(struct inode *inode, struct inode *dir,
+                                 char **name, void **value, size_t *len);
+int security_inode_create(struct inode *dir, struct dentry *dentry, int mode);
+int security_inode_link(struct dentry *old_dentry, struct inode *dir,
+                        struct dentry *new_dentry);
+int security_inode_unlink(struct inode *dir, struct dentry *dentry);
+int security_inode_symlink(struct inode *dir, struct dentry *dentry,
+                           const char *old_name);
+int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode);
+int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
+int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev);
+int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
+                          struct inode *new_dir, struct dentry *new_dentry);
+int security_inode_readlink(struct dentry *dentry);
+int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
+int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
+int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
+int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
+void security_inode_delete(struct inode *inode);
+int security_inode_setxattr(struct dentry *dentry, char *name,
+                            void *value, size_t size, int flags);
+void security_inode_post_setxattr(struct dentry *dentry, char *name,
+                                  void *value, size_t size, int flags);
+int security_inode_getxattr(struct dentry *dentry, char *name);
+int security_inode_listxattr(struct dentry *dentry);
+int security_inode_removexattr(struct dentry *dentry, char *name);
+int security_inode_need_killpriv(struct dentry *dentry);
+int security_inode_killpriv(struct dentry *dentry);
+int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
+int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags);
+int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size);
+int security_file_permission(struct file *file, int mask);
+int security_file_alloc(struct file *file);
+void security_file_free(struct file *file);
+int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+int security_file_mmap(struct file *file, unsigned long reqprot,
+                       unsigned long prot, unsigned long flags,
+                       unsigned long addr, unsigned long addr_only);
+int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
+                           unsigned long prot);
+int security_file_lock(struct file *file, unsigned int cmd);
+int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
+int security_file_set_fowner(struct file *file);
+int security_file_send_sigiotask(struct task_struct *tsk,
+                                 struct fown_struct *fown, int sig);
+int security_file_receive(struct file *file);
+int security_dentry_open(struct file *file);
+int security_task_create(unsigned long clone_flags);
+int security_task_alloc(struct task_struct *p);
+void security_task_free(struct task_struct *p);
+int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
+int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
+                              uid_t old_suid, int flags);
+int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
+int security_task_setpgid(struct task_struct *p, pid_t pgid);
+int security_task_getpgid(struct task_struct *p);
+int security_task_getsid(struct task_struct *p);
+void security_task_getsecid(struct task_struct *p, u32 *secid);
+int security_task_setgroups(struct group_info *group_info);
+int security_task_setnice(struct task_struct *p, int nice);
+int security_task_setioprio(struct task_struct *p, int ioprio);
+int security_task_getioprio(struct task_struct *p);
+int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim);
+int security_task_setscheduler(struct task_struct *p,
+                               int policy, struct sched_param *lp);
+int security_task_getscheduler(struct task_struct *p);
+int security_task_movememory(struct task_struct *p);
+int security_task_kill(struct task_struct *p, struct siginfo *info,
+                       int sig, u32 secid);
+int security_task_wait(struct task_struct *p);
+int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
+                        unsigned long arg4, unsigned long arg5);
+void security_task_reparent_to_init(struct task_struct *p);
+void security_task_to_inode(struct task_struct *p, struct inode *inode);
+int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
+int security_msg_msg_alloc(struct msg_msg *msg);
+void security_msg_msg_free(struct msg_msg *msg);
+int security_msg_queue_alloc(struct msg_queue *msq);
+void security_msg_queue_free(struct msg_queue *msq);
+int security_msg_queue_associate(struct msg_queue *msq, int msqflg);
+int security_msg_queue_msgctl(struct msg_queue *msq, int cmd);
+int security_msg_queue_msgsnd(struct msg_queue *msq,
+                              struct msg_msg *msg, int msqflg);
+int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
+                              struct task_struct *target, long type, int mode);
+int security_shm_alloc(struct shmid_kernel *shp);
+void security_shm_free(struct shmid_kernel *shp);
+int security_shm_associate(struct shmid_kernel *shp, int shmflg);
+int security_shm_shmctl(struct shmid_kernel *shp, int cmd);
+int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg);
+int security_sem_alloc(struct sem_array *sma);
+void security_sem_free(struct sem_array *sma);
+int security_sem_associate(struct sem_array *sma, int semflg);
+int security_sem_semctl(struct sem_array *sma, int cmd);
+int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
+                       unsigned nsops, int alter);
+void security_d_instantiate (struct dentry *dentry, struct inode *inode);
+int security_getprocattr(struct task_struct *p, char *name, char **value);
+int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
+int security_netlink_send(struct sock *sk, struct sk_buff *skb);
+int security_netlink_recv(struct sk_buff *skb, int cap);
+int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
+void security_release_secctx(char *secdata, u32 seclen);
+
 #else /* CONFIG_SECURITY */
 
 /*
@@ -2476,9 +1903,14 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
        return cap_inode_removexattr(dentry, name);
 }
 
-static inline const char *security_inode_xattr_getsuffix (void)
+static inline int security_inode_need_killpriv(struct dentry *dentry)
+{
+       return cap_inode_need_killpriv(dentry);
+}
+
+static inline int security_inode_killpriv(struct dentry *dentry)
 {
-       return NULL ;
+       return cap_inode_killpriv(dentry);
 }
 
 static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
@@ -2620,12 +2052,12 @@ static inline int security_task_setgroups (struct group_info *group_info)
 
 static inline int security_task_setnice (struct task_struct *p, int nice)
 {
-       return 0;
+       return cap_task_setnice(p, nice);
 }
 
 static inline int security_task_setioprio (struct task_struct *p, int ioprio)
 {
-       return 0;
+       return cap_task_setioprio(p, ioprio);
 }
 
 static inline int security_task_getioprio (struct task_struct *p)
@@ -2643,7 +2075,7 @@ static inline int security_task_setscheduler (struct task_struct *p,
                                              int policy,
                                              struct sched_param *lp)
 {
-       return 0;
+       return cap_task_setscheduler(p, policy, lp);
 }
 
 static inline int security_task_getscheduler (struct task_struct *p)
@@ -2660,7 +2092,7 @@ static inline int security_task_kill (struct task_struct *p,
                                      struct siginfo *info, int sig,
                                      u32 secid)
 {
-       return 0;
+       return cap_task_kill(p, info, sig, secid);
 }
 
 static inline int security_task_wait (struct task_struct *p)
@@ -2834,170 +2266,43 @@ static inline void security_release_secctx(char *secdata, u32 seclen)
 #endif /* CONFIG_SECURITY */
 
 #ifdef CONFIG_SECURITY_NETWORK
-static inline int security_unix_stream_connect(struct socket * sock,
-                                              struct socket * other, 
-                                              struct sock * newsk)
-{
-       return security_ops->unix_stream_connect(sock, other, newsk);
-}
-
-
-static inline int security_unix_may_send(struct socket * sock, 
-                                        struct socket * other)
-{
-       return security_ops->unix_may_send(sock, other);
-}
-
-static inline int security_socket_create (int family, int type,
-                                         int protocol, int kern)
-{
-       return security_ops->socket_create(family, type, protocol, kern);
-}
-
-static inline int security_socket_post_create(struct socket * sock,
-                                             int family,
-                                             int type,
-                                             int protocol, int kern)
-{
-       return security_ops->socket_post_create(sock, family, type,
-                                               protocol, kern);
-}
-
-static inline int security_socket_bind(struct socket * sock, 
-                                      struct sockaddr * address, 
-                                      int addrlen)
-{
-       return security_ops->socket_bind(sock, address, addrlen);
-}
-
-static inline int security_socket_connect(struct socket * sock, 
-                                         struct sockaddr * address, 
-                                         int addrlen)
-{
-       return security_ops->socket_connect(sock, address, addrlen);
-}
-
-static inline int security_socket_listen(struct socket * sock, int backlog)
-{
-       return security_ops->socket_listen(sock, backlog);
-}
-
-static inline int security_socket_accept(struct socket * sock, 
-                                        struct socket * newsock)
-{
-       return security_ops->socket_accept(sock, newsock);
-}
-
-static inline void security_socket_post_accept(struct socket * sock, 
-                                              struct socket * newsock)
-{
-       security_ops->socket_post_accept(sock, newsock);
-}
-
-static inline int security_socket_sendmsg(struct socket * sock, 
-                                         struct msghdr * msg, int size)
-{
-       return security_ops->socket_sendmsg(sock, msg, size);
-}
-
-static inline int security_socket_recvmsg(struct socket * sock, 
-                                         struct msghdr * msg, int size, 
-                                         int flags)
-{
-       return security_ops->socket_recvmsg(sock, msg, size, flags);
-}
-
-static inline int security_socket_getsockname(struct socket * sock)
-{
-       return security_ops->socket_getsockname(sock);
-}
-
-static inline int security_socket_getpeername(struct socket * sock)
-{
-       return security_ops->socket_getpeername(sock);
-}
-
-static inline int security_socket_getsockopt(struct socket * sock, 
-                                            int level, int optname)
-{
-       return security_ops->socket_getsockopt(sock, level, optname);
-}
-
-static inline int security_socket_setsockopt(struct socket * sock, 
-                                            int level, int optname)
-{
-       return security_ops->socket_setsockopt(sock, level, optname);
-}
-
-static inline int security_socket_shutdown(struct socket * sock, int how)
-{
-       return security_ops->socket_shutdown(sock, how);
-}
-
-static inline int security_sock_rcv_skb (struct sock * sk, 
-                                        struct sk_buff * skb)
-{
-       return security_ops->socket_sock_rcv_skb (sk, skb);
-}
-
-static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
-                                                   int __user *optlen, unsigned len)
-{
-       return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
-}
-
-static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
-{
-       return security_ops->socket_getpeersec_dgram(sock, skb, secid);
-}
-
-static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
-{
-       return security_ops->sk_alloc_security(sk, family, priority);
-}
-
-static inline void security_sk_free(struct sock *sk)
-{
-       return security_ops->sk_free_security(sk);
-}
-
-static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
-{
-       return security_ops->sk_clone_security(sk, newsk);
-}
-
-static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
-{
-       security_ops->sk_getsecid(sk, &fl->secid);
-}
-
-static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
-{
-       security_ops->req_classify_flow(req, fl);
-}
-
-static inline void security_sock_graft(struct sock* sk, struct socket *parent)
-{
-       security_ops->sock_graft(sk, parent);
-}
-
-static inline int security_inet_conn_request(struct sock *sk,
-                       struct sk_buff *skb, struct request_sock *req)
-{
-       return security_ops->inet_conn_request(sk, skb, req);
-}
 
-static inline void security_inet_csk_clone(struct sock *newsk,
-                       const struct request_sock *req)
-{
-       security_ops->inet_csk_clone(newsk, req);
-}
+int security_unix_stream_connect(struct socket *sock, struct socket *other,
+                                struct sock *newsk);
+int security_unix_may_send(struct socket *sock,  struct socket *other);
+int security_socket_create(int family, int type, int protocol, int kern);
+int security_socket_post_create(struct socket *sock, int family,
+                               int type, int protocol, int kern);
+int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen);
+int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
+int security_socket_listen(struct socket *sock, int backlog);
+int security_socket_accept(struct socket *sock, struct socket *newsock);
+void security_socket_post_accept(struct socket *sock, struct socket *newsock);
+int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
+int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
+                           int size, int flags);
+int security_socket_getsockname(struct socket *sock);
+int security_socket_getpeername(struct socket *sock);
+int security_socket_getsockopt(struct socket *sock, int level, int optname);
+int security_socket_setsockopt(struct socket *sock, int level, int optname);
+int security_socket_shutdown(struct socket *sock, int how);
+int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb);
+int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
+                                     int __user *optlen, unsigned len);
+int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid);
+int security_sk_alloc(struct sock *sk, int family, gfp_t priority);
+void security_sk_free(struct sock *sk);
+void security_sk_clone(const struct sock *sk, struct sock *newsk);
+void security_sk_classify_flow(struct sock *sk, struct flowi *fl);
+void security_req_classify_flow(const struct request_sock *req, struct flowi *fl);
+void security_sock_graft(struct sock*sk, struct socket *parent);
+int security_inet_conn_request(struct sock *sk,
+                       struct sk_buff *skb, struct request_sock *req);
+void security_inet_csk_clone(struct sock *newsk,
+                       const struct request_sock *req);
+void security_inet_conn_established(struct sock *sk,
+                       struct sk_buff *skb);
 
-static inline void security_inet_conn_established(struct sock *sk,
-                       struct sk_buff *skb)
-{
-       security_ops->inet_conn_established(sk, skb);
-}
 #else  /* CONFIG_SECURITY_NETWORK */
 static inline int security_unix_stream_connect(struct socket * sock,
                                               struct socket * other,
@@ -3155,77 +2460,24 @@ static inline void security_inet_conn_established(struct sock *sk,
 #endif /* CONFIG_SECURITY_NETWORK */
 
 #ifdef CONFIG_SECURITY_NETWORK_XFRM
-static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
-{
-       return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
-}
-
-static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
-{
-       return security_ops->xfrm_policy_clone_security(old, new);
-}
-
-static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
-{
-       security_ops->xfrm_policy_free_security(xp);
-}
-
-static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
-{
-       return security_ops->xfrm_policy_delete_security(xp);
-}
-
-static inline int security_xfrm_state_alloc(struct xfrm_state *x,
-                       struct xfrm_user_sec_ctx *sec_ctx)
-{
-       return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0);
-}
-
-static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
-                               struct xfrm_sec_ctx *polsec, u32 secid)
-{
-       if (!polsec)
-               return 0;
-       /*
-        * We want the context to be taken from secid which is usually
-        * from the sock.
-        */
-       return security_ops->xfrm_state_alloc_security(x, NULL, secid);
-}
-
-static inline int security_xfrm_state_delete(struct xfrm_state *x)
-{
-       return security_ops->xfrm_state_delete_security(x);
-}
-
-static inline void security_xfrm_state_free(struct xfrm_state *x)
-{
-       security_ops->xfrm_state_free_security(x);
-}
-
-static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
-{
-       return security_ops->xfrm_policy_lookup(xp, fl_secid, dir);
-}
-
-static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
-                       struct xfrm_policy *xp, struct flowi *fl)
-{
-       return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
-}
-
-static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
-{
-       return security_ops->xfrm_decode_session(skb, secid, 1);
-}
 
-static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
-{
-       int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
+int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
+int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new);
+void security_xfrm_policy_free(struct xfrm_policy *xp);
+int security_xfrm_policy_delete(struct xfrm_policy *xp);
+int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
+int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
+                                     struct xfrm_sec_ctx *polsec, u32 secid);
+int security_xfrm_state_delete(struct xfrm_state *x);
+void security_xfrm_state_free(struct xfrm_state *x);
+int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
+int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
+                                      struct xfrm_policy *xp, struct flowi *fl);
+int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
+void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
 
-       BUG_ON(rc);
-}
 #else  /* CONFIG_SECURITY_NETWORK_XFRM */
+
 static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
 {
        return 0;
@@ -3290,24 +2542,11 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
 
 #ifdef CONFIG_KEYS
 #ifdef CONFIG_SECURITY
-static inline int security_key_alloc(struct key *key,
-                                    struct task_struct *tsk,
-                                    unsigned long flags)
-{
-       return security_ops->key_alloc(key, tsk, flags);
-}
-
-static inline void security_key_free(struct key *key)
-{
-       security_ops->key_free(key);
-}
 
-static inline int security_key_permission(key_ref_t key_ref,
-                                         struct task_struct *context,
-                                         key_perm_t perm)
-{
-       return security_ops->key_permission(key_ref, context, perm);
-}
+int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long flags);
+void security_key_free(struct key *key);
+int security_key_permission(key_ref_t key_ref,
+                           struct task_struct *context, key_perm_t perm);
 
 #else
 
index 8bf1e05115b42c341de6e9c1e0af615c897e656c..ebbc02b325fc88cc65dbab470def7e3d80084608 100644 (file)
@@ -18,7 +18,7 @@ struct seq_file {
        size_t from;
        size_t count;
        loff_t index;
-       loff_t version;
+       u64 version;
        struct mutex lock;
        const struct seq_operations *op;
        void *private;
index ad2e3af6599710d43269a7f4c243ebd90171925d..bea65d9c93ef1c9da525bf5c6fb79a206f2e51f7 100644 (file)
@@ -16,7 +16,9 @@
 #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
 #define SHMSEG SHMMNI                   /* max shared segs per process */
 
+#ifdef __KERNEL__
 #include <asm/shmparam.h>
+#endif
 
 /* Obsolete, used only for backwards compatibility and libc5 compiles */
 struct shmid_ds {
index 4c9ff0910ae01d39f691a23c9acf5d1db48b06d2..86f9b1ef0e0934c9a354b44a67ab396be61ccbe4 100644 (file)
 
 
 struct signalfd_siginfo {
-       __u32 signo;
-       __s32 err;
-       __s32 code;
-       __u32 pid;
-       __u32 uid;
-       __s32 fd;
-       __u32 tid;
-       __u32 band;
-       __u32 overrun;
-       __u32 trapno;
-       __s32 status;
-       __s32 svint;
-       __u64 svptr;
-       __u64 utime;
-       __u64 stime;
-       __u64 addr;
+       __u32 ssi_signo;
+       __s32 ssi_errno;
+       __s32 ssi_code;
+       __u32 ssi_pid;
+       __u32 ssi_uid;
+       __s32 ssi_fd;
+       __u32 ssi_tid;
+       __u32 ssi_band;
+       __u32 ssi_overrun;
+       __u32 ssi_trapno;
+       __s32 ssi_status;
+       __s32 ssi_int;
+       __u64 ssi_ptr;
+       __u64 ssi_utime;
+       __u64 ssi_stime;
+       __u64 ssi_addr;
 
        /*
         * Pad strcture to 128 bytes. Remember to update the
index 3a5bad3ad126c2a901cac50e7a69579c3f4e40a5..f3a8eecd99f3c4b5eb68d10389e3b96546699f4d 100644 (file)
@@ -53,7 +53,7 @@ int slab_is_available(void);
 
 struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
                        unsigned long,
-                       void (*)(void *, struct kmem_cache *, unsigned long));
+                       void (*)(struct kmem_cache *, void *));
 void kmem_cache_destroy(struct kmem_cache *);
 int kmem_cache_shrink(struct kmem_cache *);
 void kmem_cache_free(struct kmem_cache *, void *);
index d65159d1d4f5cd6437ee7abda73a10584c7e1adb..40801e754afb48430e3af7c59497b5726e298250 100644 (file)
@@ -49,7 +49,7 @@ struct kmem_cache {
        /* Allocation and freeing of slabs */
        int objects;            /* Number of objects in slab */
        int refcount;           /* Refcount for slab cache destroy */
-       void (*ctor)(void *, struct kmem_cache *, unsigned long);
+       void (*ctor)(struct kmem_cache *, void *);
        int inuse;              /* Offset to metadata */
        int align;              /* Alignment */
        const char *name;       /* Name (only for display!) */
index edf681a7fd8f95a66ff2fb020a199831090cda3f..4f3838adbb30626ec0e4df84a145e95f091b2aa6 100644 (file)
@@ -158,11 +158,6 @@ struct swap_list_t {
 /* Swap 50% full? Release swapcache more aggressively.. */
 #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
 
-/* linux/mm/oom_kill.c */
-extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
-extern int register_oom_notifier(struct notifier_block *nb);
-extern int unregister_oom_notifier(struct notifier_block *nb);
-
 /* linux/mm/memory.c */
 extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
 
index 6a5f503b4f1d6a7fbed3175f88aa3110ff1e6ea6..b04136d60a2f79c5293ddc641e664afa18820ee0 100644 (file)
@@ -92,7 +92,7 @@ static inline struct timespec timespec_sub(struct timespec lhs,
 
 extern struct timespec xtime;
 extern struct timespec wall_to_monotonic;
-extern seqlock_t xtime_lock __attribute__((weak));
+extern seqlock_t xtime_lock;
 
 extern unsigned long read_persistent_clock(void);
 extern int update_persistent_clock(struct timespec now);
index 60478f6e5dc63ee04f305c535f397a98377a82a2..56164d7ba0add0efa325214715706c611b091486 100644 (file)
@@ -80,11 +80,6 @@ struct tty_bufhead {
        struct tty_buffer *free;        /* Free queue head */
        int memory_used;                /* Buffer space used excluding free queue */
 };
-/*
- * The pty uses char_buf and flag_buf as a contiguous buffer
- */
-#define PTY_BUF_SIZE   4*TTY_FLIPBUF_SIZE
-
 /*
  * When a break, frame error, or parity error happens, these codes are
  * stuffed into the flags buffer.
@@ -321,6 +316,9 @@ extern void tty_flip_buffer_push(struct tty_struct *tty);
 extern speed_t tty_get_baud_rate(struct tty_struct *tty);
 extern speed_t tty_termios_baud_rate(struct ktermios *termios);
 extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
+extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud);
+extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud);
+extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
 
 extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
 extern void tty_ldisc_deref(struct tty_ldisc *);
index daeba22b765695d9daffdce3b9249ac6e36a2179..10b854d3561fd982a42d976eddbdad8aa6a538fa 100644 (file)
@@ -46,11 +46,6 @@ typedef __u32 __bitwise __fs32;
 typedef __u16 __bitwise __fs16;
 #endif
 
-#ifdef __KERNEL__
-#include <linux/ufs_fs_i.h>
-#include <linux/ufs_fs_sb.h>
-#endif
-
 #define UFS_BBLOCK 0
 #define UFS_BBSIZE 8192
 #define UFS_SBLOCK 8192
@@ -170,8 +165,9 @@ typedef __u16 __bitwise __fs16;
 #define UFS_ST_MASK            0x00000700      /* mask for the following */
 #define UFS_ST_OLD             0x00000000
 #define UFS_ST_44BSD           0x00000100
-#define UFS_ST_SUN             0x00000200
-#define UFS_ST_SUNx86          0x00000400
+#define UFS_ST_SUN             0x00000200 /* Solaris */
+#define UFS_ST_SUNOS           0x00000300
+#define UFS_ST_SUNx86          0x00000400 /* Solaris x86 */
 /*cylinder group encoding */
 #define UFS_CG_MASK            0x00003000      /* mask for the following */
 #define UFS_CG_OLD             0x00000000
@@ -187,28 +183,6 @@ typedef __u16 __bitwise __fs16;
 #define UFS_42INODEFMT -1
 #define UFS_44INODEFMT 2
 
-/* mount options */
-#define UFS_MOUNT_ONERROR              0x0000000F
-#define UFS_MOUNT_ONERROR_PANIC                0x00000001
-#define UFS_MOUNT_ONERROR_LOCK         0x00000002
-#define UFS_MOUNT_ONERROR_UMOUNT       0x00000004
-#define UFS_MOUNT_ONERROR_REPAIR       0x00000008
-
-#define UFS_MOUNT_UFSTYPE              0x0000FFF0
-#define UFS_MOUNT_UFSTYPE_OLD          0x00000010
-#define UFS_MOUNT_UFSTYPE_44BSD                0x00000020
-#define UFS_MOUNT_UFSTYPE_SUN          0x00000040
-#define UFS_MOUNT_UFSTYPE_NEXTSTEP     0x00000080
-#define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD  0x00000100
-#define UFS_MOUNT_UFSTYPE_OPENSTEP     0x00000200
-#define UFS_MOUNT_UFSTYPE_SUNx86       0x00000400
-#define UFS_MOUNT_UFSTYPE_HP           0x00000800
-#define UFS_MOUNT_UFSTYPE_UFS2         0x00001000
-
-#define ufs_clear_opt(o,opt)   o &= ~UFS_MOUNT_##opt
-#define ufs_set_opt(o,opt)     o |= UFS_MOUNT_##opt
-#define ufs_test_opt(o,opt)    ((o) & UFS_MOUNT_##opt)
-
 /*
  * MINFREE gives the minimum acceptable percentage of file system
  * blocks which may be free. If the freelist drops below this level
@@ -223,19 +197,6 @@ typedef __u16 __bitwise __fs16;
  */
 #define UFS_MINFREE         5
 #define UFS_DEFAULTOPT      UFS_OPTTIME
-
-/*
- * Debug code
- */
-#ifdef CONFIG_UFS_DEBUG
-#      define UFSD(f, a...)    {                                       \
-               printk ("UFSD (%s, %d): %s:",                           \
-                       __FILE__, __LINE__, __FUNCTION__);              \
-               printk (f, ## a);                                       \
-       }
-#else
-#      define UFSD(f, a...)    /**/
-#endif
             
 /*
  * Turn file system block numbers into disk block addresses.
@@ -374,7 +335,14 @@ struct ufs_csum_core {
  * struct ufs_super_block_(first,second,third) instead.
  */
 struct ufs_super_block {
-       __fs32  fs_link;        /* UNUSED */
+       union {
+               struct {
+                       __fs32  fs_link;        /* UNUSED */
+               } fs_42;
+               struct {
+                       __fs32  fs_state;       /* file system state flag */
+               } fs_sun;
+       } fs_u0;
        __fs32  fs_rlink;       /* UNUSED */
        __fs32  fs_sblkno;      /* addr of super-block in filesys */
        __fs32  fs_cblkno;      /* offset of cyl-block in filesys */
@@ -545,6 +513,15 @@ struct ufs_super_block {
 #define        CG_MAGIC        0x090255
 #define ufs_cg_chkmagic(sb, ucg) \
        (fs32_to_cpu((sb), (ucg)->cg_magic) == CG_MAGIC)
+/*
+ * Macros for access to old cylinder group array structures
+ */
+#define ufs_ocg_blktot(sb, ucg)      fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_btot)
+#define ufs_ocg_blks(sb, ucg, cylno) fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_b[cylno])
+#define ufs_ocg_inosused(sb, ucg)    fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_iused)
+#define ufs_ocg_blksfree(sb, ucg)    fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_free)
+#define ufs_ocg_chkmagic(sb, ucg) \
+       (fs32_to_cpu((sb), ((struct ufs_old_cylinder_group *)(ucg))->cg_magic) == CG_MAGIC)
 
 /*
  * size of this structure is 172 B
@@ -590,6 +567,28 @@ struct     ufs_cylinder_group {
 /* actually longer */
 };
 
+/* Historic Cylinder group info */
+struct ufs_old_cylinder_group {
+       __fs32  cg_link;                /* linked list of cyl groups */
+       __fs32  cg_rlink;               /* for incore cyl groups     */
+       __fs32  cg_time;                /* time last written */
+       __fs32  cg_cgx;                 /* we are the cgx'th cylinder group */
+       __fs16  cg_ncyl;                /* number of cyl's this cg */
+       __fs16  cg_niblk;               /* number of inode blocks this cg */
+       __fs32  cg_ndblk;               /* number of data blocks this cg */
+       struct  ufs_csum cg_cs;         /* cylinder summary information */
+       __fs32  cg_rotor;               /* position of last used block */
+       __fs32  cg_frotor;              /* position of last used frag */
+       __fs32  cg_irotor;              /* position of last used inode */
+       __fs32  cg_frsum[8];            /* counts of available frags */
+       __fs32  cg_btot[32];            /* block totals per cylinder */
+       __fs16  cg_b[32][8];            /* positions of free blocks */
+       __u8    cg_iused[256];          /* used inode map */
+       __fs32  cg_magic;               /* magic number */
+       __u8    cg_free[1];             /* free block map */
+/* actually longer */
+};
+
 /*
  * structure of an on-disk inode
  */
@@ -796,7 +795,14 @@ struct ufs_sb_private_info {
  *     ufs_super_block_third   356
  */
 struct ufs_super_block_first {
-       __fs32  fs_link;
+       union {
+               struct {
+                       __fs32  fs_link;        /* UNUSED */
+               } fs_42;
+               struct {
+                       __fs32  fs_state;       /* file system state flag */
+               } fs_sun;
+       } fs_u0;
        __fs32  fs_rlink;
        __fs32  fs_sblkno;
        __fs32  fs_cblkno;
@@ -944,89 +950,4 @@ struct ufs_super_block_third {
        __u8    fs_space[1];
 };
 
-#ifdef __KERNEL__
-
-/* balloc.c */
-extern void ufs_free_fragments (struct inode *, u64, unsigned);
-extern void ufs_free_blocks (struct inode *, u64, unsigned);
-extern u64 ufs_new_fragments(struct inode *, void *, u64, u64,
-                            unsigned, int *, struct page *);
-
-/* cylinder.c */
-extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
-extern void ufs_put_cylinder (struct super_block *, unsigned);
-
-/* dir.c */
-extern const struct inode_operations ufs_dir_inode_operations;
-extern int ufs_add_link (struct dentry *, struct inode *);
-extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
-extern int ufs_make_empty(struct inode *, struct inode *);
-extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **);
-extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
-extern int ufs_empty_dir (struct inode *);
-extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
-extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
-                        struct page *page, struct inode *inode);
-
-/* file.c */
-extern const struct inode_operations ufs_file_inode_operations;
-extern const struct file_operations ufs_file_operations;
-
-extern const struct address_space_operations ufs_aops;
-
-/* ialloc.c */
-extern void ufs_free_inode (struct inode *inode);
-extern struct inode * ufs_new_inode (struct inode *, int);
-
-/* inode.c */
-extern void ufs_read_inode (struct inode *);
-extern void ufs_put_inode (struct inode *);
-extern int ufs_write_inode (struct inode *, int);
-extern int ufs_sync_inode (struct inode *);
-extern void ufs_delete_inode (struct inode *);
-extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
-extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
-
-/* namei.c */
-extern const struct file_operations ufs_dir_operations;
-        
-/* super.c */
-extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
-extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
-extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
-
-/* symlink.c */
-extern const struct inode_operations ufs_fast_symlink_inode_operations;
-
-/* truncate.c */
-extern int ufs_truncate (struct inode *, loff_t);
-
-static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
-{
-       return sb->s_fs_info;
-}
-
-static inline struct ufs_inode_info *UFS_I(struct inode *inode)
-{
-       return container_of(inode, struct ufs_inode_info, vfs_inode);
-}
-
-/*
- * Give cylinder group number for a file system block.
- * Give cylinder group block number for a file system block.
- */
-/* #define     ufs_dtog(d)     ((d) / uspi->s_fpg) */
-static inline u64 ufs_dtog(struct ufs_sb_private_info * uspi, u64 b)
-{
-       do_div(b, uspi->s_fpg);
-       return b;
-}
-/* #define     ufs_dtogd(d)    ((d) % uspi->s_fpg) */
-static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b)
-{
-       return do_div(b, uspi->s_fpg);
-}
-
-#endif /* __KERNEL__ */
-
 #endif /* __LINUX_UFS_FS_H */
diff --git a/include/linux/ufs_fs_i.h b/include/linux/ufs_fs_i.h
deleted file mode 100644 (file)
index 6496caa..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  linux/include/linux/ufs_fs_i.h
- *
- * Copyright (C) 1996
- * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
- * Laboratory for Computer Science Research Computing Facility
- * Rutgers, The State University of New Jersey
- *
- * NeXTstep support added on February 5th 1998 by
- * Niels Kristian Bech Jensen <nkbj@image.dk>.
- */
-
-#ifndef _LINUX_UFS_FS_I_H
-#define _LINUX_UFS_FS_I_H
-
-struct ufs_inode_info {
-       union {
-               __fs32  i_data[15];
-               __u8    i_symlink[4*15];
-               __fs64  u2_i_data[15];
-       } i_u1;
-       __u32   i_flags;
-       __u32   i_shadow;
-       __u32   i_unused1;
-       __u32   i_unused2;
-       __u32   i_oeftflag;
-       __u16   i_osync;
-       __u64   i_lastfrag;
-       __u32   i_dir_start_lookup;
-       struct inode vfs_inode;
-};
-
-#endif /* _LINUX_UFS_FS_I_H */
diff --git a/include/linux/ufs_fs_sb.h b/include/linux/ufs_fs_sb.h
deleted file mode 100644 (file)
index e114c93..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 
- *  linux/include/linux/ufs_fs_sb.h
- *
- * Copyright (C) 1996
- * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
- * Laboratory for Computer Science Research Computing Facility
- * Rutgers, The State University of New Jersey
- *
- * $Id: ufs_fs_sb.h,v 1.8 1998/05/06 12:04:40 jj Exp $
- *
- * Write support by Daniel Pirkl <daniel.pirkl@email.cz>
- */
-
-#ifndef __LINUX_UFS_FS_SB_H
-#define __LINUX_UFS_FS_SB_H
-
-
-#define UFS_MAX_GROUP_LOADED 8
-#define UFS_CGNO_EMPTY ((unsigned)-1)
-
-struct ufs_sb_private_info;
-struct ufs_cg_private_info;
-struct ufs_csum;
-
-struct ufs_sb_info {
-       struct ufs_sb_private_info * s_uspi;    
-       struct ufs_csum * s_csp;
-       unsigned s_bytesex;
-       unsigned s_flags;
-       struct buffer_head ** s_ucg;
-       struct ufs_cg_private_info * s_ucpi[UFS_MAX_GROUP_LOADED]; 
-       unsigned s_cgno[UFS_MAX_GROUP_LOADED];
-       unsigned short s_cg_loaded;
-       unsigned s_mount_opt;
-};
-
-#endif
index 699b7e9864fa8c675c5c9d3d677bf59a1a872c21..feb5e99a1079c97c0854669fcf46fcca595ab5f3 100644 (file)
@@ -87,6 +87,7 @@ extern int unbind_con_driver(const struct consw *csw, int first, int last,
 extern char con_buf[CON_BUF_SIZE];
 extern struct mutex con_buf_mtx;
 extern char vt_dont_switch;
+extern int default_utf8;
 
 struct vt_spawn_console {
        spinlock_t lock;
index d1321a81c9c444342981ef0aedd8e7fc257b6f00..bef7d66601cbfc2b52e07b841fceb7fddd77e1cb 100644 (file)
@@ -62,13 +62,13 @@ struct writeback_control {
        unsigned for_reclaim:1;         /* Invoked from the page allocator */
        unsigned for_writepages:1;      /* This is a writepages() call */
        unsigned range_cyclic:1;        /* range_start is cyclic */
+       unsigned more_io:1;             /* more io to be dispatched */
 };
 
 /*
  * fs/fs-writeback.c
  */    
 void writeback_inodes(struct writeback_control *wbc);
-void wake_up_inode(struct inode *inode);
 int inode_wait(void *);
 void sync_inodes_sb(struct super_block *, int wait);
 void sync_inodes(int wait);
@@ -80,6 +80,13 @@ static inline void wait_on_inode(struct inode *inode)
        wait_on_bit(&inode->i_state, __I_LOCK, inode_wait,
                                                        TASK_UNINTERRUPTIBLE);
 }
+static inline void inode_sync_wait(struct inode *inode)
+{
+       might_sleep();
+       wait_on_bit(&inode->i_state, __I_SYNC, inode_wait,
+                                                       TASK_UNINTERRUPTIBLE);
+}
+
 
 /*
  * mm/page-writeback.c
@@ -97,6 +104,10 @@ extern int dirty_expire_interval;
 extern int block_dump;
 extern int laptop_mode;
 
+extern int dirty_ratio_handler(struct ctl_table *table, int write,
+               struct file *filp, void __user *buffer, size_t *lenp,
+               loff_t *ppos);
+
 struct ctl_table;
 struct file;
 int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
deleted file mode 100644 (file)
index 744f850..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-header-y += scsi.h
-
-unifdef-y += scsi_ioctl.h
-unifdef-y += sg.h
index 54f31a191b8813a1bac92190cd237023c30a684d..a29a688c47d3128dc63fed1c70e799351ca38449 100644 (file)
@@ -689,3 +689,6 @@ config STOP_MACHINE
          Need stop_machine() primitive.
 
 source "block/Kconfig"
+
+config PREEMPT_NOTIFIERS
+       bool
index a88934a1b76906e71663f163cd175ab5bce8c0dd..79e24e878c1eae6d2dc1247f72dec8de71ce2108 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/sysctl.h>
 #include <linux/uaccess.h>
 
-#ifdef CONFIG_IPC_NS
 static void *get_ipc(ctl_table *table)
 {
        char *which = table->data;
@@ -23,9 +22,6 @@ static void *get_ipc(ctl_table *table)
        which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns;
        return which;
 }
-#else
-#define get_ipc(T) ((T)->data)
-#endif
 
 #ifdef CONFIG_PROC_FS
 static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp,
index 24df3347ad4b4ca47d60a8f6c33f4e4d9dea1c40..774843cff756fe169948b8a084649d5f36dcb7fa 100644 (file)
@@ -211,7 +211,7 @@ static int mqueue_get_sb(struct file_system_type *fs_type,
        return get_sb_single(fs_type, flags, data, mqueue_fill_super, mnt);
 }
 
-static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo;
 
index a86a3a5c8a19589698dc8b9ec555e1d98891466d..5fc5cf50cf1b847fc630cf2e127f37005337bb94 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -233,7 +233,7 @@ static int shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 }
 
 #ifdef CONFIG_NUMA
-int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
+static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
 {
        struct file *file = vma->vm_file;
        struct shm_file_data *sfd = shm_file_data(file);
@@ -243,7 +243,8 @@ int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
        return err;
 }
 
-struct mempolicy *shm_get_policy(struct vm_area_struct *vma, unsigned long addr)
+static struct mempolicy *shm_get_policy(struct vm_area_struct *vma,
+                                       unsigned long addr)
 {
        struct file *file = vma->vm_file;
        struct shm_file_data *sfd = shm_file_data(file);
@@ -906,7 +907,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
                goto out_unlock;
 
        path.dentry = dget(shp->shm_file->f_path.dentry);
-       path.mnt    = mntget(shp->shm_file->f_path.mnt);
+       path.mnt    = shp->shm_file->f_path.mnt;
        shp->shm_nattch++;
        size = i_size_read(path.dentry->d_inode);
        shm_unlock(shp);
@@ -914,18 +915,16 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
        err = -ENOMEM;
        sfd = kzalloc(sizeof(*sfd), GFP_KERNEL);
        if (!sfd)
-               goto out_put_path;
+               goto out_put_dentry;
 
        err = -ENOMEM;
-       file = get_empty_filp();
+
+       file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations);
        if (!file)
                goto out_free;
 
-       file->f_op = &shm_file_operations;
        file->private_data = sfd;
-       file->f_path = path;
        file->f_mapping = shp->shm_file->f_mapping;
-       file->f_mode = f_mode;
        sfd->id = shp->id;
        sfd->ns = get_ipc_ns(ns);
        sfd->file = shp->shm_file;
@@ -976,9 +975,8 @@ out_unlock:
 
 out_free:
        kfree(sfd);
-out_put_path:
+out_put_dentry:
        dput(path.dentry);
-       mntput(path.mnt);
        goto out_nattch;
 }
 
index 6b066632e40c2a9f0621d487d0caf5a7700c7b41..c64ce9c14207644bfc07c5f2c729f5fe9b66c5b6 100644 (file)
@@ -63,6 +63,3 @@ config PREEMPT_BKL
          Say Y here if you are building a kernel for a desktop system.
          Say N if you are unsure.
 
-config PREEMPT_NOTIFIERS
-       bool
-
index 0ae703c157ba3033a4e34c0ed012ca8812ba2e54..938e60a61882008d732bcdf83377fc29d3fa8368 100644 (file)
@@ -45,7 +45,6 @@
 #include <linux/init.h>
 #include <asm/types.h>
 #include <asm/atomic.h>
-#include <asm/types.h>
 #include <linux/fs.h>
 #include <linux/namei.h>
 #include <linux/mm.h>
index c8d3c776203490b763c0cc65bd7444a29655804a..4e350a36ed6a177a5422cf097c8120269490d785 100644 (file)
@@ -17,9 +17,6 @@
 unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */
 kernel_cap_t cap_bset = CAP_INIT_EFF_SET;
 
-EXPORT_SYMBOL(securebits);
-EXPORT_SYMBOL(cap_bset);
-
 /*
  * This lock protects task->cap_* for all tasks including current.
  * Locking rule: acquire this prior to tasklist_lock.
@@ -244,7 +241,6 @@ int __capable(struct task_struct *t, int cap)
        }
        return 0;
 }
-EXPORT_SYMBOL(__capable);
 
 int capable(int cap)
 {
index 0864f4097930e1195450c4359c144e96369786e9..2eb2e50db0d6a7c1c93915116ee9d8e125ad2981 100644 (file)
@@ -2506,41 +2506,20 @@ int cpuset_mem_spread_node(void)
 EXPORT_SYMBOL_GPL(cpuset_mem_spread_node);
 
 /**
- * cpuset_excl_nodes_overlap - Do we overlap @p's mem_exclusive ancestors?
- * @p: pointer to task_struct of some other task.
- *
- * Description: Return true if the nearest mem_exclusive ancestor
- * cpusets of tasks @p and current overlap.  Used by oom killer to
- * determine if task @p's memory usage might impact the memory
- * available to the current task.
- *
- * Call while holding callback_mutex.
+ * cpuset_mems_allowed_intersects - Does @tsk1's mems_allowed intersect @tsk2's?
+ * @tsk1: pointer to task_struct of some task.
+ * @tsk2: pointer to task_struct of some other task.
+ *
+ * Description: Return true if @tsk1's mems_allowed intersects the
+ * mems_allowed of @tsk2.  Used by the OOM killer to determine if
+ * one of the task's memory usage might impact the memory available
+ * to the other.
  **/
 
-int cpuset_excl_nodes_overlap(const struct task_struct *p)
+int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
+                                  const struct task_struct *tsk2)
 {
-       const struct cpuset *cs1, *cs2; /* my and p's cpuset ancestors */
-       int overlap = 1;                /* do cpusets overlap? */
-
-       task_lock(current);
-       if (current->flags & PF_EXITING) {
-               task_unlock(current);
-               goto done;
-       }
-       cs1 = nearest_exclusive_ancestor(current->cpuset);
-       task_unlock(current);
-
-       task_lock((struct task_struct *)p);
-       if (p->flags & PF_EXITING) {
-               task_unlock((struct task_struct *)p);
-               goto done;
-       }
-       cs2 = nearest_exclusive_ancestor(p->cpuset);
-       task_unlock((struct task_struct *)p);
-
-       overlap = nodes_intersects(cs1->mems_allowed, cs2->mems_allowed);
-done:
-       return overlap;
+       return nodes_intersects(tsk1->mems_allowed, tsk2->mems_allowed);
 }
 
 /*
index 7f7959de4a87b22e013d001b05f0cba4dfe0cefa..2c704c86edb3200864d4ec950c4e2bd89cbf3443 100644 (file)
@@ -44,7 +44,6 @@
 #include <linux/resource.h>
 #include <linux/blkdev.h>
 #include <linux/task_io_accounting_ops.h>
-#include <linux/freezer.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -93,10 +92,9 @@ static void __exit_signal(struct task_struct *tsk)
                 * If there is any task waiting for the group exit
                 * then notify it:
                 */
-               if (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count) {
+               if (sig->group_exit_task && atomic_read(&sig->count) == sig->notify_count)
                        wake_up_process(sig->group_exit_task);
-                       sig->group_exit_task = NULL;
-               }
+
                if (tsk == sig->curr_target)
                        sig->curr_target = next_thread(tsk);
                /*
@@ -593,17 +591,6 @@ static void exit_mm(struct task_struct * tsk)
        mmput(mm);
 }
 
-static inline void
-choose_new_parent(struct task_struct *p, struct task_struct *reaper)
-{
-       /*
-        * Make sure we're not reparenting to ourselves and that
-        * the parent is not a zombie.
-        */
-       BUG_ON(p == reaper || reaper->exit_state);
-       p->real_parent = reaper;
-}
-
 static void
 reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
 {
@@ -711,7 +698,7 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
 
                if (father == p->real_parent) {
                        /* reparent with a reaper, real father it's us */
-                       choose_new_parent(p, reaper);
+                       p->real_parent = reaper;
                        reparent_thread(p, father, 0);
                } else {
                        /* reparent ptraced task to its real parent */
@@ -732,7 +719,7 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
        }
        list_for_each_safe(_p, _n, &father->ptrace_children) {
                p = list_entry(_p, struct task_struct, ptrace_list);
-               choose_new_parent(p, reaper);
+               p->real_parent = reaper;
                reparent_thread(p, father, 1);
        }
 }
@@ -759,13 +746,11 @@ static void exit_notify(struct task_struct *tsk)
                 * Now we'll wake all the threads in the group just to make
                 * sure someone gets all the pending signals.
                 */
-               read_lock(&tasklist_lock);
                spin_lock_irq(&tsk->sighand->siglock);
                for (t = next_thread(tsk); t != tsk; t = next_thread(t))
                        if (!signal_pending(t) && !(t->flags & PF_EXITING))
                                recalc_sigpending_and_wake(t);
                spin_unlock_irq(&tsk->sighand->siglock);
-               read_unlock(&tasklist_lock);
        }
 
        write_lock_irq(&tasklist_lock);
@@ -793,9 +778,8 @@ static void exit_notify(struct task_struct *tsk)
         * and we were the only connection outside, so our pgrp
         * is about to become orphaned.
         */
-        
        t = tsk->real_parent;
-       
+
        pgrp = task_pgrp(tsk);
        if ((task_pgrp(t) != pgrp) &&
            (task_session(t) == task_session(tsk)) &&
@@ -842,6 +826,11 @@ static void exit_notify(struct task_struct *tsk)
                state = EXIT_DEAD;
        tsk->exit_state = state;
 
+       if (thread_group_leader(tsk) &&
+           tsk->signal->notify_count < 0 &&
+           tsk->signal->group_exit_task)
+               wake_up_process(tsk->signal->group_exit_task);
+
        write_unlock_irq(&tasklist_lock);
 
        list_for_each_safe(_p, _n, &ptrace_dead) {
@@ -883,6 +872,14 @@ static void check_stack_usage(void)
 static inline void check_stack_usage(void) {}
 #endif
 
+static inline void exit_child_reaper(struct task_struct *tsk)
+{
+       if (likely(tsk->group_leader != child_reaper(tsk)))
+               return;
+
+       panic("Attempted to kill init!");
+}
+
 fastcall NORET_TYPE void do_exit(long code)
 {
        struct task_struct *tsk = current;
@@ -896,13 +893,6 @@ fastcall NORET_TYPE void do_exit(long code)
                panic("Aiee, killing interrupt handler!");
        if (unlikely(!tsk->pid))
                panic("Attempted to kill the idle task!");
-       if (unlikely(tsk == child_reaper(tsk))) {
-               if (tsk->nsproxy->pid_ns != &init_pid_ns)
-                       tsk->nsproxy->pid_ns->child_reaper = init_pid_ns.child_reaper;
-               else
-                       panic("Attempted to kill init!");
-       }
-
 
        if (unlikely(current->ptrace & PT_TRACE_EXIT)) {
                current->ptrace_message = code;
@@ -932,13 +922,13 @@ fastcall NORET_TYPE void do_exit(long code)
                schedule();
        }
 
+       tsk->flags |= PF_EXITING;
        /*
         * tsk->flags are checked in the futex code to protect against
         * an exiting task cleaning up the robust pi futexes.
         */
-       spin_lock_irq(&tsk->pi_lock);
-       tsk->flags |= PF_EXITING;
-       spin_unlock_irq(&tsk->pi_lock);
+       smp_mb();
+       spin_unlock_wait(&tsk->pi_lock);
 
        if (unlikely(in_atomic()))
                printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
@@ -952,15 +942,18 @@ fastcall NORET_TYPE void do_exit(long code)
        }
        group_dead = atomic_dec_and_test(&tsk->signal->live);
        if (group_dead) {
+               exit_child_reaper(tsk);
                hrtimer_cancel(&tsk->signal->real_timer);
                exit_itimers(tsk->signal);
        }
        acct_collect(code, group_dead);
+#ifdef CONFIG_FUTEX
        if (unlikely(tsk->robust_list))
                exit_robust_list(tsk);
-#if defined(CONFIG_FUTEX) && defined(CONFIG_COMPAT)
+#ifdef CONFIG_COMPAT
        if (unlikely(tsk->compat_robust_list))
                compat_exit_robust_list(tsk);
+#endif
 #endif
        if (group_dead)
                tty_audit_exit();
@@ -996,6 +989,7 @@ fastcall NORET_TYPE void do_exit(long code)
        mpol_free(tsk->mempolicy);
        tsk->mempolicy = NULL;
 #endif
+#ifdef CONFIG_FUTEX
        /*
         * This must happen late, after the PID is not
         * hashed anymore:
@@ -1004,6 +998,7 @@ fastcall NORET_TYPE void do_exit(long code)
                exit_pi_state_list(tsk);
        if (unlikely(current->pi_state_cache))
                kfree(current->pi_state_cache);
+#endif
        /*
         * Make sure we are holding no locks:
         */
@@ -1168,8 +1163,7 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
                            int __user *stat_addr, struct rusage __user *ru)
 {
        unsigned long state;
-       int retval;
-       int status;
+       int retval, status, traced;
 
        if (unlikely(noreap)) {
                pid_t pid = p->pid;
@@ -1203,15 +1197,11 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
                BUG_ON(state != EXIT_DEAD);
                return 0;
        }
-       if (unlikely(p->exit_signal == -1 && p->ptrace == 0)) {
-               /*
-                * This can only happen in a race with a ptraced thread
-                * dying on another processor.
-                */
-               return 0;
-       }
 
-       if (likely(p->real_parent == p->parent) && likely(p->signal)) {
+       /* traced means p->ptrace, but not vice versa */
+       traced = (p->real_parent != p->parent);
+
+       if (likely(!traced)) {
                struct signal_struct *psig;
                struct signal_struct *sig;
 
@@ -1298,35 +1288,30 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
                retval = put_user(p->pid, &infop->si_pid);
        if (!retval && infop)
                retval = put_user(p->uid, &infop->si_uid);
-       if (retval) {
-               // TODO: is this safe?
-               p->exit_state = EXIT_ZOMBIE;
-               return retval;
-       }
-       retval = p->pid;
-       if (p->real_parent != p->parent) {
+       if (!retval)
+               retval = p->pid;
+
+       if (traced) {
                write_lock_irq(&tasklist_lock);
-               /* Double-check with lock held.  */
-               if (p->real_parent != p->parent) {
-                       __ptrace_unlink(p);
-                       // TODO: is this safe?
-                       p->exit_state = EXIT_ZOMBIE;
-                       /*
-                        * If this is not a detached task, notify the parent.
-                        * If it's still not detached after that, don't release
-                        * it now.
-                        */
+               /* We dropped tasklist, ptracer could die and untrace */
+               ptrace_unlink(p);
+               /*
+                * If this is not a detached task, notify the parent.
+                * If it's still not detached after that, don't release
+                * it now.
+                */
+               if (p->exit_signal != -1) {
+                       do_notify_parent(p, p->exit_signal);
                        if (p->exit_signal != -1) {
-                               do_notify_parent(p, p->exit_signal);
-                               if (p->exit_signal != -1)
-                                       p = NULL;
+                               p->exit_state = EXIT_ZOMBIE;
+                               p = NULL;
                        }
                }
                write_unlock_irq(&tasklist_lock);
        }
        if (p != NULL)
                release_task(p);
-       BUG_ON(!retval);
+
        return retval;
 }
 
@@ -1345,7 +1330,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
        if (!p->exit_code)
                return 0;
        if (delayed_group_leader && !(p->ptrace & PT_PTRACED) &&
-           p->signal && p->signal->group_stop_count > 0)
+           p->signal->group_stop_count > 0)
                /*
                 * A group stop is in progress and this is the group leader.
                 * We won't report until all threads have stopped.
@@ -1459,9 +1444,6 @@ static int wait_task_continued(struct task_struct *p, int noreap,
        pid_t pid;
        uid_t uid;
 
-       if (unlikely(!p->signal))
-               return 0;
-
        if (!(p->signal->flags & SIGNAL_STOP_CONTINUED))
                return 0;
 
index 3fc3c1383912a8cf105ddbb218b00dfa88d76233..490495a39c7e65cb0eb239b2b6474ce5d58b718b 100644 (file)
@@ -107,6 +107,7 @@ static struct kmem_cache *mm_cachep;
 
 void free_task(struct task_struct *tsk)
 {
+       prop_local_destroy_single(&tsk->dirties);
        free_thread_info(tsk->stack);
        rt_mutex_debug_task_free(tsk);
        free_task_struct(tsk);
@@ -163,6 +164,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
 {
        struct task_struct *tsk;
        struct thread_info *ti;
+       int err;
 
        prepare_to_copy(orig);
 
@@ -178,6 +180,14 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
 
        *tsk = *orig;
        tsk->stack = ti;
+
+       err = prop_local_init_single(&tsk->dirties);
+       if (err) {
+               free_thread_info(ti);
+               free_task_struct(tsk);
+               return NULL;
+       }
+
        setup_thread_stack(tsk, orig);
 
 #ifdef CONFIG_CC_STACKPROTECTOR
@@ -1069,7 +1079,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
        do_posix_clock_monotonic_gettime(&p->start_time);
        p->real_start_time = p->start_time;
        monotonic_to_bootbased(&p->real_start_time);
+#ifdef CONFIG_SECURITY
        p->security = NULL;
+#endif
        p->io_context = NULL;
        p->io_wait = NULL;
        p->audit_context = NULL;
@@ -1146,13 +1158,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
         * Clear TID on mm_release()?
         */
        p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
+#ifdef CONFIG_FUTEX
        p->robust_list = NULL;
 #ifdef CONFIG_COMPAT
        p->compat_robust_list = NULL;
 #endif
        INIT_LIST_HEAD(&p->pi_state_list);
        p->pi_state_cache = NULL;
-
+#endif
        /*
         * sigaltstack should be cleared when sharing the same VM
         */
@@ -1435,8 +1448,7 @@ long do_fork(unsigned long clone_flags,
 #define ARCH_MIN_MMSTRUCT_ALIGN 0
 #endif
 
-static void sighand_ctor(void *data, struct kmem_cache *cachep,
-                       unsigned long flags)
+static void sighand_ctor(struct kmem_cache *cachep, void *data)
 {
        struct sighand_struct *sighand = data;
 
index fcc94e7b40864afcb72170f19d832f8117e517fc..d725676d84f3580813161678394bc9220630af82 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/syscalls.h>
 #include <linux/signal.h>
 #include <linux/module.h>
+#include <linux/magic.h>
 #include <asm/futex.h>
 
 #include "rtmutex_common.h"
@@ -2080,7 +2081,7 @@ static int futexfs_get_sb(struct file_system_type *fs_type,
                          int flags, const char *dev_name, void *data,
                          struct vfsmount *mnt)
 {
-       return get_sb_pseudo(fs_type, "futex", NULL, 0xBAD1DEA, mnt);
+       return get_sb_pseudo(fs_type, "futex", NULL, FUTEXFS_SUPER_MAGIC, mnt);
 }
 
 static struct file_system_type futex_fs_type = {
index f1a73f0b54e775d29a9e2184d3d13cfae75af239..9b5dff6b3f6a2bcf3a0ae76625b48edeb4f4334b 100644 (file)
@@ -503,7 +503,6 @@ out_unlock:
        spin_unlock(&desc->lock);
 }
 
-#ifdef CONFIG_SMP
 /**
  *     handle_percpu_IRQ - Per CPU local irq handler
  *     @irq:   the interrupt number
@@ -529,8 +528,6 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc)
                desc->chip->eoi(irq);
 }
 
-#endif /* CONFIG_SMP */
-
 void
 __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
                  const char *name)
index 7230d914eaa28b86eaba939b5644c899d9872ce3..80eab7a0420597ec0c27fe7eaefe12a5868674b9 100644 (file)
@@ -405,7 +405,6 @@ void free_irq(unsigned int irq, void *dev_id)
        struct irq_desc *desc;
        struct irqaction **p;
        unsigned long flags;
-       irqreturn_t (*handler)(int, void *) = NULL;
 
        WARN_ON(in_interrupt());
        if (irq >= NR_IRQS)
@@ -445,8 +444,21 @@ void free_irq(unsigned int irq, void *dev_id)
 
                        /* Make sure it's not being used on another CPU */
                        synchronize_irq(irq);
-                       if (action->flags & IRQF_SHARED)
-                               handler = action->handler;
+#ifdef CONFIG_DEBUG_SHIRQ
+                       /*
+                        * It's a shared IRQ -- the driver ought to be
+                        * prepared for it to happen even now it's
+                        * being freed, so let's make sure....  We do
+                        * this after actually deregistering it, to
+                        * make sure that a 'real' IRQ doesn't run in
+                        * parallel with our fake
+                        */
+                       if (action->flags & IRQF_SHARED) {
+                               local_irq_save(flags);
+                               action->handler(irq, dev_id);
+                               local_irq_restore(flags);
+                       }
+#endif
                        kfree(action);
                        return;
                }
@@ -454,19 +466,6 @@ void free_irq(unsigned int irq, void *dev_id)
                spin_unlock_irqrestore(&desc->lock, flags);
                return;
        }
-#ifdef CONFIG_DEBUG_SHIRQ
-       if (handler) {
-               /*
-                * It's a shared IRQ -- the driver ought to be prepared for it
-                * to happen even now it's being freed, so let's make sure....
-                * We do this after actually deregistering it, to make sure that
-                * a 'real' IRQ doesn't run in parallel with our fake
-                */
-               local_irq_save(flags);
-               handler(irq, dev_id);
-               local_irq_restore(flags);
-       }
-#endif
 }
 EXPORT_SYMBOL(free_irq);
 
index 25db14b89e82c529fcb217e311fbebf66c440c60..7885269b0da2589f08fcf655cc0ecfa9c28c9a37 100644 (file)
 #include <linux/highmem.h>
 #include <linux/syscalls.h>
 #include <linux/reboot.h>
-#include <linux/syscalls.h>
 #include <linux/ioport.h>
 #include <linux/hardirq.h>
 #include <linux/elf.h>
 #include <linux/elfcore.h>
+#include <linux/utsrelease.h>
+#include <linux/utsname.h>
+#include <linux/numa.h>
 
 #include <asm/page.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/semaphore.h>
+#include <asm/sections.h>
 
 /* Per cpu memory for storing cpu states in case of system crash. */
 note_buf_t* crash_notes;
 
+/* vmcoreinfo stuff */
+unsigned char vmcoreinfo_data[VMCOREINFO_BYTES];
+u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
+size_t vmcoreinfo_size;
+size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data);
+
 /* Location of the reserved area for the crash kernel */
 struct resource crashk_res = {
        .name  = "Crash kernel",
@@ -1061,6 +1070,7 @@ void crash_kexec(struct pt_regs *regs)
                if (kexec_crash_image) {
                        struct pt_regs fixed_regs;
                        crash_setup_regs(&fixed_regs, regs);
+                       crash_save_vmcoreinfo();
                        machine_crash_shutdown(&fixed_regs);
                        machine_kexec(kexec_crash_image);
                }
@@ -1135,3 +1145,104 @@ static int __init crash_notes_memory_init(void)
        return 0;
 }
 module_init(crash_notes_memory_init)
+
+void crash_save_vmcoreinfo(void)
+{
+       u32 *buf;
+
+       if (!vmcoreinfo_size)
+               return;
+
+       vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds());
+
+       buf = (u32 *)vmcoreinfo_note;
+
+       buf = append_elf_note(buf, VMCOREINFO_NOTE_NAME, 0, vmcoreinfo_data,
+                             vmcoreinfo_size);
+
+       final_note(buf);
+}
+
+void vmcoreinfo_append_str(const char *fmt, ...)
+{
+       va_list args;
+       char buf[0x50];
+       int r;
+
+       va_start(args, fmt);
+       r = vsnprintf(buf, sizeof(buf), fmt, args);
+       va_end(args);
+
+       if (r + vmcoreinfo_size > vmcoreinfo_max_size)
+               r = vmcoreinfo_max_size - vmcoreinfo_size;
+
+       memcpy(&vmcoreinfo_data[vmcoreinfo_size], buf, r);
+
+       vmcoreinfo_size += r;
+}
+
+/*
+ * provide an empty default implementation here -- architecture
+ * code may override this
+ */
+void __attribute__ ((weak)) arch_crash_save_vmcoreinfo(void)
+{}
+
+unsigned long __attribute__ ((weak)) paddr_vmcoreinfo_note(void)
+{
+       return __pa((unsigned long)(char *)&vmcoreinfo_note);
+}
+
+static int __init crash_save_vmcoreinfo_init(void)
+{
+       vmcoreinfo_append_str("OSRELEASE=%s\n", init_uts_ns.name.release);
+       vmcoreinfo_append_str("PAGESIZE=%ld\n", PAGE_SIZE);
+
+       VMCOREINFO_SYMBOL(init_uts_ns);
+       VMCOREINFO_SYMBOL(node_online_map);
+       VMCOREINFO_SYMBOL(swapper_pg_dir);
+       VMCOREINFO_SYMBOL(_stext);
+
+#ifndef CONFIG_NEED_MULTIPLE_NODES
+       VMCOREINFO_SYMBOL(mem_map);
+       VMCOREINFO_SYMBOL(contig_page_data);
+#endif
+#ifdef CONFIG_SPARSEMEM
+       VMCOREINFO_SYMBOL(mem_section);
+       VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS);
+       VMCOREINFO_SIZE(mem_section);
+       VMCOREINFO_OFFSET(mem_section, section_mem_map);
+#endif
+       VMCOREINFO_SIZE(page);
+       VMCOREINFO_SIZE(pglist_data);
+       VMCOREINFO_SIZE(zone);
+       VMCOREINFO_SIZE(free_area);
+       VMCOREINFO_SIZE(list_head);
+       VMCOREINFO_TYPEDEF_SIZE(nodemask_t);
+       VMCOREINFO_OFFSET(page, flags);
+       VMCOREINFO_OFFSET(page, _count);
+       VMCOREINFO_OFFSET(page, mapping);
+       VMCOREINFO_OFFSET(page, lru);
+       VMCOREINFO_OFFSET(pglist_data, node_zones);
+       VMCOREINFO_OFFSET(pglist_data, nr_zones);
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
+       VMCOREINFO_OFFSET(pglist_data, node_mem_map);
+#endif
+       VMCOREINFO_OFFSET(pglist_data, node_start_pfn);
+       VMCOREINFO_OFFSET(pglist_data, node_spanned_pages);
+       VMCOREINFO_OFFSET(pglist_data, node_id);
+       VMCOREINFO_OFFSET(zone, free_area);
+       VMCOREINFO_OFFSET(zone, vm_stat);
+       VMCOREINFO_OFFSET(zone, spanned_pages);
+       VMCOREINFO_OFFSET(free_area, free_list);
+       VMCOREINFO_OFFSET(list_head, next);
+       VMCOREINFO_OFFSET(list_head, prev);
+       VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER);
+       VMCOREINFO_NUMBER(NR_FREE_PAGES);
+
+       arch_crash_save_vmcoreinfo();
+
+       return 0;
+}
+
+module_init(crash_save_vmcoreinfo_init)
index 6046939d08047fc1f68db06b5366eada62c133d1..65daa5373ca6354afc0c575c1938ed1e9a08c300 100644 (file)
@@ -61,6 +61,15 @@ static ssize_t kexec_crash_loaded_show(struct kset *kset, char *page)
        return sprintf(page, "%d\n", !!kexec_crash_image);
 }
 KERNEL_ATTR_RO(kexec_crash_loaded);
+
+static ssize_t vmcoreinfo_show(struct kset *kset, char *page)
+{
+       return sprintf(page, "%lx %x\n",
+                      paddr_vmcoreinfo_note(),
+                      (unsigned int)vmcoreinfo_max_size);
+}
+KERNEL_ATTR_RO(vmcoreinfo);
+
 #endif /* CONFIG_KEXEC */
 
 /*
@@ -96,6 +105,7 @@ static struct attribute * kernel_attrs[] = {
 #ifdef CONFIG_KEXEC
        &kexec_loaded_attr.attr,
        &kexec_crash_loaded_attr.attr,
+       &vmcoreinfo_attr.attr,
 #endif
        NULL
 };
index db0ead0363e2504be6760e73cbef5a2b981a8565..a389b423c279dcb6e5f2b94ffcf56e534b06875e 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/moduleloader.h>
 #include <linux/init.h>
 #include <linux/kallsyms.h>
+#include <linux/sysfs.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
@@ -692,8 +693,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
        }
 
        /* If it has an init func, it must have an exit func to unload */
-       if ((mod->init != NULL && mod->exit == NULL)
-           || mod->unsafe) {
+       if (mod->init && !mod->exit) {
                forced = try_force_unload(flags);
                if (!forced) {
                        /* This module can't be removed */
@@ -741,11 +741,6 @@ static void print_unload_info(struct seq_file *m, struct module *mod)
                seq_printf(m, "%s,", use->module_which_uses->name);
        }
 
-       if (mod->unsafe) {
-               printed_something = 1;
-               seq_printf(m, "[unsafe],");
-       }
-
        if (mod->init != NULL && mod->exit == NULL) {
                printed_something = 1;
                seq_printf(m, "[permanent],");
@@ -1053,6 +1048,100 @@ static void remove_sect_attrs(struct module *mod)
        }
 }
 
+/*
+ * /sys/module/foo/notes/.section.name gives contents of SHT_NOTE sections.
+ */
+
+struct module_notes_attrs {
+       struct kobject *dir;
+       unsigned int notes;
+       struct bin_attribute attrs[0];
+};
+
+static ssize_t module_notes_read(struct kobject *kobj,
+                                struct bin_attribute *bin_attr,
+                                char *buf, loff_t pos, size_t count)
+{
+       /*
+        * The caller checked the pos and count against our size.
+        */
+       memcpy(buf, bin_attr->private + pos, count);
+       return count;
+}
+
+static void free_notes_attrs(struct module_notes_attrs *notes_attrs,
+                            unsigned int i)
+{
+       if (notes_attrs->dir) {
+               while (i-- > 0)
+                       sysfs_remove_bin_file(notes_attrs->dir,
+                                             &notes_attrs->attrs[i]);
+               kobject_del(notes_attrs->dir);
+       }
+       kfree(notes_attrs);
+}
+
+static void add_notes_attrs(struct module *mod, unsigned int nsect,
+                           char *secstrings, Elf_Shdr *sechdrs)
+{
+       unsigned int notes, loaded, i;
+       struct module_notes_attrs *notes_attrs;
+       struct bin_attribute *nattr;
+
+       /* Count notes sections and allocate structures.  */
+       notes = 0;
+       for (i = 0; i < nsect; i++)
+               if ((sechdrs[i].sh_flags & SHF_ALLOC) &&
+                   (sechdrs[i].sh_type == SHT_NOTE))
+                       ++notes;
+
+       if (notes == 0)
+               return;
+
+       notes_attrs = kzalloc(sizeof(*notes_attrs)
+                             + notes * sizeof(notes_attrs->attrs[0]),
+                             GFP_KERNEL);
+       if (notes_attrs == NULL)
+               return;
+
+       notes_attrs->notes = notes;
+       nattr = &notes_attrs->attrs[0];
+       for (loaded = i = 0; i < nsect; ++i) {
+               if (!(sechdrs[i].sh_flags & SHF_ALLOC))
+                       continue;
+               if (sechdrs[i].sh_type == SHT_NOTE) {
+                       nattr->attr.name = mod->sect_attrs->attrs[loaded].name;
+                       nattr->attr.mode = S_IRUGO;
+                       nattr->size = sechdrs[i].sh_size;
+                       nattr->private = (void *) sechdrs[i].sh_addr;
+                       nattr->read = module_notes_read;
+                       ++nattr;
+               }
+               ++loaded;
+       }
+
+       notes_attrs->dir = kobject_add_dir(&mod->mkobj.kobj, "notes");
+       if (!notes_attrs->dir)
+               goto out;
+
+       for (i = 0; i < notes; ++i)
+               if (sysfs_create_bin_file(notes_attrs->dir,
+                                         &notes_attrs->attrs[i]))
+                       goto out;
+
+       mod->notes_attrs = notes_attrs;
+       return;
+
+  out:
+       free_notes_attrs(notes_attrs, i);
+}
+
+static void remove_notes_attrs(struct module *mod)
+{
+       if (mod->notes_attrs)
+               free_notes_attrs(mod->notes_attrs, mod->notes_attrs->notes);
+}
+
 #else
 
 static inline void add_sect_attrs(struct module *mod, unsigned int nsect,
@@ -1063,6 +1152,15 @@ static inline void add_sect_attrs(struct module *mod, unsigned int nsect,
 static inline void remove_sect_attrs(struct module *mod)
 {
 }
+
+static inline void add_notes_attrs(struct module *mod, unsigned int nsect,
+                                  char *sectstrings, Elf_Shdr *sechdrs)
+{
+}
+
+static inline void remove_notes_attrs(struct module *mod)
+{
+}
 #endif /* CONFIG_KALLSYMS */
 
 #ifdef CONFIG_SYSFS
@@ -1197,6 +1295,7 @@ static void free_module(struct module *mod)
 {
        /* Delete from various lists */
        stop_machine_run(__unlink_module, mod, NR_CPUS);
+       remove_notes_attrs(mod);
        remove_sect_attrs(mod);
        mod_kobject_remove(mod);
 
@@ -1782,7 +1881,8 @@ static struct module *load_module(void __user *umod,
        module_unload_init(mod);
 
        /* Initialize kobject, so we can reference it. */
-       if (mod_sysfs_init(mod) != 0)
+       err = mod_sysfs_init(mod);
+       if (err)
                goto cleanup;
 
        /* Set up license info based on the info section */
@@ -1924,6 +2024,7 @@ static struct module *load_module(void __user *umod,
        if (err < 0)
                goto arch_cleanup;
        add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
+       add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
 
        /* Size of section 0 is 0, so this works well if no unwind info. */
        mod->unwind_info = unwind_add_table(mod,
@@ -2011,15 +2112,10 @@ sys_init_module(void __user *umod,
                    buggy refcounters. */
                mod->state = MODULE_STATE_GOING;
                synchronize_sched();
-               if (mod->unsafe)
-                       printk(KERN_ERR "%s: module is now stuck!\n",
-                              mod->name);
-               else {
-                       module_put(mod);
-                       mutex_lock(&module_mutex);
-                       free_module(mod);
-                       mutex_unlock(&module_mutex);
-               }
+               module_put(mod);
+               mutex_lock(&module_mutex);
+               free_module(mod);
+               mutex_unlock(&module_mutex);
                return ret;
        }
 
index f1decd21a534c248054bef7c1c6f9f6ec7da072c..049e7c0ac5668964cb08554aee935ee687642852 100644 (file)
@@ -203,8 +203,7 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags,
 
 static int __init nsproxy_cache_init(void)
 {
-       nsproxy_cachep = kmem_cache_create("nsproxy", sizeof(struct nsproxy),
-                                          0, SLAB_PANIC, NULL);
+       nsproxy_cachep = KMEM_CACHE(nsproxy, SLAB_PANIC);
        return 0;
 }
 
index 4e57732fcfb41c03ddb38841d7c1876d5372e862..1d6aca288cdcb078ed5a3a6790d9f532f98d8f88 100644 (file)
@@ -252,8 +252,9 @@ int param_get_bool(char *buffer, struct kernel_param *kp)
 int param_set_invbool(const char *val, struct kernel_param *kp)
 {
        int boolval, ret;
-       struct kernel_param dummy = { .arg = &boolval };
+       struct kernel_param dummy;
 
+       dummy.arg = &boolval;
        ret = param_set_bool(val, &dummy);
        if (ret == 0)
                *(int *)kp->arg = !boolval;
@@ -262,11 +263,7 @@ int param_set_invbool(const char *val, struct kernel_param *kp)
 
 int param_get_invbool(char *buffer, struct kernel_param *kp)
 {
-       int val;
-       struct kernel_param dummy = { .arg = &val };
-
-       val = !*(int *)kp->arg;
-       return param_get_bool(buffer, &dummy);
+       return sprintf(buffer, "%c", (*(int *)kp->arg) ? 'N' : 'Y');
 }
 
 /* We break the rule and mangle the string. */
@@ -325,7 +322,7 @@ static int param_array(const char *name,
 
 int param_array_set(const char *val, struct kernel_param *kp)
 {
-       struct kparam_array *arr = kp->arg;
+       const struct kparam_array *arr = kp->arr;
        unsigned int temp_num;
 
        return param_array(kp->name, val, 1, arr->max, arr->elem,
@@ -335,7 +332,7 @@ int param_array_set(const char *val, struct kernel_param *kp)
 int param_array_get(char *buffer, struct kernel_param *kp)
 {
        int i, off, ret;
-       struct kparam_array *arr = kp->arg;
+       const struct kparam_array *arr = kp->arr;
        struct kernel_param p;
 
        p = *kp;
@@ -354,7 +351,7 @@ int param_array_get(char *buffer, struct kernel_param *kp)
 
 int param_set_copystring(const char *val, struct kernel_param *kp)
 {
-       struct kparam_string *kps = kp->arg;
+       const struct kparam_string *kps = kp->str;
 
        if (!val) {
                printk(KERN_ERR "%s: missing param set value\n", kp->name);
@@ -371,7 +368,7 @@ int param_set_copystring(const char *val, struct kernel_param *kp)
 
 int param_get_string(char *buffer, struct kernel_param *kp)
 {
-       struct kparam_string *kps = kp->arg;
+       const struct kparam_string *kps = kp->str;
        return strlcpy(buffer, kps->string, kps->maxlen);
 }
 
index 57efe0400bc2a133b7b1bb055e597345c567450f..d71ed09fe1dddd985e79f882ff30dd26bf1d28a2 100644 (file)
@@ -241,7 +241,8 @@ static __init int init_posix_timers(void)
        register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
 
        posix_timers_cache = kmem_cache_create("posix_timers_cache",
-                                       sizeof (struct k_itimer), 0, 0, NULL);
+                                       sizeof (struct k_itimer), 0, SLAB_PANIC,
+                                       NULL);
        idr_init(&posix_timers_id);
        return 0;
 }
index b2b5c3a22a36b302da177fafae653740f7eeeddf..52493474f0abafdfd7939ab57f3f2d6ad2006695 100644 (file)
@@ -219,6 +219,58 @@ static inline void boot_delay_msec(void)
 }
 #endif
 
+/*
+ * Return the number of unread characters in the log buffer.
+ */
+int log_buf_get_len(void)
+{
+       return logged_chars;
+}
+
+/*
+ * Copy a range of characters from the log buffer.
+ */
+int log_buf_copy(char *dest, int idx, int len)
+{
+       int ret, max;
+       bool took_lock = false;
+
+       if (!oops_in_progress) {
+               spin_lock_irq(&logbuf_lock);
+               took_lock = true;
+       }
+
+       max = log_buf_get_len();
+       if (idx < 0 || idx >= max) {
+               ret = -1;
+       } else {
+               if (len > max)
+                       len = max;
+               ret = len;
+               idx += (log_end - max);
+               while (len-- > 0)
+                       dest[len] = LOG_BUF(idx + len);
+       }
+
+       if (took_lock)
+               spin_unlock_irq(&logbuf_lock);
+
+       return ret;
+}
+
+/*
+ * Extract a single character from the log buffer.
+ */
+int log_buf_read(int idx)
+{
+       char ret;
+
+       if (log_buf_copy(&ret, idx, 1) == 1)
+               return ret;
+       else
+               return -1;
+}
+
 /*
  * Commands to do_syslog:
  *
index 6f69bf792d964b7e262f7f5c066375d8fdeb8c77..631b75c25d7ed40c9a38b4e52244f58f4436d74b 100644 (file)
@@ -37,7 +37,7 @@ struct profile_hit {
 #define NR_PROFILE_GRP         (NR_PROFILE_HIT/PROFILE_GRPSZ)
 
 /* Oprofile timer tick hook */
-int (*timer_hook)(struct pt_regs *) __read_mostly;
+static int (*timer_hook)(struct pt_regs *) __read_mostly;
 
 static atomic_t *prof_buffer;
 static unsigned long prof_len, prof_shift;
index 130214f3d229009d461a26ea01aae9e36a153d3a..a66d4d1615f7ff978616c86a350d582cc11ff20f 100644 (file)
@@ -45,7 +45,6 @@
 #include <linux/moduleparam.h>
 #include <linux/percpu.h>
 #include <linux/notifier.h>
-#include <linux/rcupdate.h>
 #include <linux/cpu.h>
 #include <linux/mutex.h>
 
index ddff33247785aa95a95f00356f9909dde2ff3196..c3e165c2318f16657023d7693dd6a77762945861 100644 (file)
 #include <linux/sched.h>
 #include <asm/atomic.h>
 #include <linux/bitops.h>
-#include <linux/module.h>
 #include <linux/completion.h>
 #include <linux/moduleparam.h>
 #include <linux/percpu.h>
 #include <linux/notifier.h>
 #include <linux/freezer.h>
 #include <linux/cpu.h>
-#include <linux/random.h>
 #include <linux/delay.h>
 #include <linux/byteorder/swabb.h>
 #include <linux/stat.h>
@@ -166,16 +164,14 @@ struct rcu_random_state {
 
 /*
  * Crude but fast random-number generator.  Uses a linear congruential
- * generator, with occasional help from get_random_bytes().
+ * generator, with occasional help from cpu_clock().
  */
 static unsigned long
 rcu_random(struct rcu_random_state *rrsp)
 {
-       long refresh;
-
        if (--rrsp->rrs_count < 0) {
-               get_random_bytes(&refresh, sizeof(refresh));
-               rrsp->rrs_state += refresh;
+               rrsp->rrs_state +=
+                       (unsigned long)cpu_clock(raw_smp_processor_id());
                rrsp->rrs_count = RCU_RANDOM_REFRESH;
        }
        rrsp->rrs_state = rrsp->rrs_state * RCU_RANDOM_MULT + RCU_RANDOM_ADD;
index 5aedbee014dfca7f2ebdce84e62d1c1bac87fab2..6b0703db152d2a61411595380ce4b608e98f6890 100644 (file)
@@ -82,12 +82,7 @@ do {                                         \
  * into the tracing code when doing error printk or
  * executing a BUG():
  */
-int rt_trace_on = 1;
-
-void deadlock_trace_off(void)
-{
-       rt_trace_on = 0;
-}
+static int rt_trace_on = 1;
 
 static void printk_task(struct task_struct *p)
 {
index 0da2b2635c54b0257ceb3dcbdc49a8b9a5840762..c4889abc00b6b3833d8d4202ea4d9bf0e095ea85 100644 (file)
@@ -5060,6 +5060,17 @@ wait_to_die:
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
+
+static int __migrate_task_irq(struct task_struct *p, int src_cpu, int dest_cpu)
+{
+       int ret;
+
+       local_irq_disable();
+       ret = __migrate_task(p, src_cpu, dest_cpu);
+       local_irq_enable();
+       return ret;
+}
+
 /*
  * Figure out where task on dead CPU should go, use force if neccessary.
  * NOTE: interrupts should be disabled by the caller
@@ -5098,7 +5109,7 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
                                       "longer affine to cpu%d\n",
                                       p->pid, p->comm, dead_cpu);
                }
-       } while (!__migrate_task(p, dead_cpu, dest_cpu));
+       } while (!__migrate_task_irq(p, dead_cpu, dest_cpu));
 }
 
 /*
@@ -5126,7 +5137,7 @@ static void migrate_live_tasks(int src_cpu)
 {
        struct task_struct *p, *t;
 
-       write_lock_irq(&tasklist_lock);
+       read_lock(&tasklist_lock);
 
        do_each_thread(t, p) {
                if (p == current)
@@ -5136,7 +5147,7 @@ static void migrate_live_tasks(int src_cpu)
                        move_task_off_dead_cpu(src_cpu, p);
        } while_each_thread(t, p);
 
-       write_unlock_irq(&tasklist_lock);
+       read_unlock(&tasklist_lock);
 }
 
 /*
@@ -5214,11 +5225,10 @@ static void migrate_dead(unsigned int dead_cpu, struct task_struct *p)
         * Drop lock around migration; if someone else moves it,
         * that's OK.  No task can be added to this CPU, so iteration is
         * fine.
-        * NOTE: interrupts should be left disabled  --dev@
         */
-       spin_unlock(&rq->lock);
+       spin_unlock_irq(&rq->lock);
        move_task_off_dead_cpu(dead_cpu, p);
-       spin_lock(&rq->lock);
+       spin_lock_irq(&rq->lock);
 
        put_task_struct(p);
 }
@@ -5447,14 +5457,14 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
                kthread_stop(rq->migration_thread);
                rq->migration_thread = NULL;
                /* Idle task back to normal (off runqueue, low prio) */
-               rq = task_rq_lock(rq->idle, &flags);
+               spin_lock_irq(&rq->lock);
                update_rq_clock(rq);
                deactivate_task(rq, rq->idle, 0);
                rq->idle->static_prio = MAX_PRIO;
                __setscheduler(rq, rq->idle, SCHED_NORMAL, 0);
                rq->idle->sched_class = &idle_sched_class;
                migrate_dead_tasks(cpu);
-               task_rq_unlock(rq, &flags);
+               spin_unlock_irq(&rq->lock);
                migrate_nr_uninterruptible(rq);
                BUG_ON(rq->nr_running != 0);
 
index 7929523810928d9aa405aa74cb2e390a6083491f..2124ffadcfdefff5a6cf0fbc2da37c3ac19d8a44 100644 (file)
@@ -909,8 +909,7 @@ __group_complete_signal(int sig, struct task_struct *p)
                        do {
                                sigaddset(&t->pending.signal, SIGKILL);
                                signal_wake_up(t, 1);
-                               t = next_thread(t);
-                       } while (t != p);
+                       } while_each_thread(p, t);
                        return;
                }
 
@@ -928,13 +927,11 @@ __group_complete_signal(int sig, struct task_struct *p)
                rm_from_queue(SIG_KERNEL_STOP_MASK, &p->signal->shared_pending);
                p->signal->group_stop_count = 0;
                p->signal->group_exit_task = t;
-               t = p;
+               p = t;
                do {
                        p->signal->group_stop_count++;
-                       signal_wake_up(t, 0);
-                       t = next_thread(t);
-               } while (t != p);
-               wake_up_process(p->signal->group_exit_task);
+                       signal_wake_up(t, t == p);
+               } while_each_thread(p, t);
                return;
        }
 
@@ -985,9 +982,6 @@ void zap_other_threads(struct task_struct *p)
        p->signal->flags = SIGNAL_GROUP_EXIT;
        p->signal->group_stop_count = 0;
 
-       if (thread_group_empty(p))
-               return;
-
        for (t = next_thread(p); t != p; t = next_thread(t)) {
                /*
                 * Don't bother with already dead threads
@@ -2300,15 +2294,6 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
        k = &current->sighand->action[sig-1];
 
        spin_lock_irq(&current->sighand->siglock);
-       if (signal_pending(current)) {
-               /*
-                * If there might be a fatal signal pending on multiple
-                * threads, make sure we take it before changing the action.
-                */
-               spin_unlock_irq(&current->sighand->siglock);
-               return -ERESTARTNOINTR;
-       }
-
        if (oact)
                *oact = *k;
 
@@ -2335,7 +2320,6 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
                        rm_from_queue_full(&mask, &t->signal->shared_pending);
                        do {
                                rm_from_queue_full(&mask, &t->pending);
-                               recalc_sigpending_and_wake(t);
                                t = next_thread(t);
                        } while (t != current);
                }
index 708d4882c0c391bffa47a24ae0153bccabd0a1c7..edeeef3a6a322917b5b2befb95238df5557a9af5 100644 (file)
 #include <linux/notifier.h>
 #include <linux/module.h>
 
+#include <asm/irq_regs.h>
+
 static DEFINE_SPINLOCK(print_lock);
 
 static DEFINE_PER_CPU(unsigned long, touch_timestamp);
 static DEFINE_PER_CPU(unsigned long, print_timestamp);
 static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
 
-static int did_panic = 0;
+static int did_panic;
+int softlockup_thresh = 10;
 
 static int
 softlock_panic(struct notifier_block *this, unsigned long event, void *ptr)
@@ -40,14 +43,16 @@ static struct notifier_block panic_block = {
  * resolution, and we don't need to waste time with a big divide when
  * 2^30ns == 1.074s.
  */
-static unsigned long get_timestamp(void)
+static unsigned long get_timestamp(int this_cpu)
 {
-       return sched_clock() >> 30;  /* 2^30 ~= 10^9 */
+       return cpu_clock(this_cpu) >> 30;  /* 2^30 ~= 10^9 */
 }
 
 void touch_softlockup_watchdog(void)
 {
-       __raw_get_cpu_var(touch_timestamp) = get_timestamp();
+       int this_cpu = raw_smp_processor_id();
+
+       __raw_get_cpu_var(touch_timestamp) = get_timestamp(this_cpu);
 }
 EXPORT_SYMBOL(touch_softlockup_watchdog);
 
@@ -70,6 +75,7 @@ void softlockup_tick(void)
        int this_cpu = smp_processor_id();
        unsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu);
        unsigned long print_timestamp;
+       struct pt_regs *regs = get_irq_regs();
        unsigned long now;
 
        if (touch_timestamp == 0) {
@@ -80,10 +86,11 @@ void softlockup_tick(void)
        print_timestamp = per_cpu(print_timestamp, this_cpu);
 
        /* report at most once a second */
-       if (print_timestamp < (touch_timestamp + 1) ||
-               did_panic ||
-                       !per_cpu(watchdog_task, this_cpu))
+       if ((print_timestamp >= touch_timestamp &&
+                       print_timestamp < (touch_timestamp + 1)) ||
+                       did_panic || !per_cpu(watchdog_task, this_cpu)) {
                return;
+       }
 
        /* do not print during early bootup: */
        if (unlikely(system_state != SYSTEM_RUNNING)) {
@@ -91,28 +98,33 @@ void softlockup_tick(void)
                return;
        }
 
-       now = get_timestamp();
+       now = get_timestamp(this_cpu);
 
        /* Wake up the high-prio watchdog task every second: */
        if (now > (touch_timestamp + 1))
                wake_up_process(per_cpu(watchdog_task, this_cpu));
 
        /* Warn about unreasonable 10+ seconds delays: */
-       if (now > (touch_timestamp + 10)) {
-               per_cpu(print_timestamp, this_cpu) = touch_timestamp;
+       if (now <= (touch_timestamp + softlockup_thresh))
+               return;
 
-               spin_lock(&print_lock);
-               printk(KERN_ERR "BUG: soft lockup detected on CPU#%d!\n",
-                       this_cpu);
+       per_cpu(print_timestamp, this_cpu) = touch_timestamp;
+
+       spin_lock(&print_lock);
+       printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n",
+                       this_cpu, now - touch_timestamp,
+                               current->comm, current->pid);
+       if (regs)
+               show_regs(regs);
+       else
                dump_stack();
-               spin_unlock(&print_lock);
-       }
+       spin_unlock(&print_lock);
 }
 
 /*
  * The watchdog thread - runs every second and touches the timestamp.
  */
-static int watchdog(void * __bind_cpu)
+static int watchdog(void *__bind_cpu)
 {
        struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
 
@@ -150,13 +162,13 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
                BUG_ON(per_cpu(watchdog_task, hotcpu));
                p = kthread_create(watchdog, hcpu, "watchdog/%d", hotcpu);
                if (IS_ERR(p)) {
-                       printk("watchdog for %i failed\n", hotcpu);
+                       printk(KERN_ERR "watchdog for %i failed\n", hotcpu);
                        return NOTIFY_BAD;
                }
-               per_cpu(touch_timestamp, hotcpu) = 0;
-               per_cpu(watchdog_task, hotcpu) = p;
+               per_cpu(touch_timestamp, hotcpu) = 0;
+               per_cpu(watchdog_task, hotcpu) = p;
                kthread_bind(p, hotcpu);
-               break;
+               break;
        case CPU_ONLINE:
        case CPU_ONLINE_FROZEN:
                wake_up_process(per_cpu(watchdog_task, hotcpu));
@@ -176,7 +188,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
                kthread_stop(p);
                break;
 #endif /* CONFIG_HOTPLUG_CPU */
-       }
+       }
        return NOTIFY_OK;
 }
 
index b0ec498a18d9d86eca840aced3f1580744ef8b71..52c7a151e298fbcd2a467697e7e448720beca175 100644 (file)
@@ -4,6 +4,10 @@
 
 #include <asm/unistd.h>
 
+/*  we can't #include <linux/syscalls.h> here,
+    but tell gcc to not warn with -Wmissing-prototypes  */
+asmlinkage long sys_ni_syscall(void);
+
 /*
  * Non-implemented system calls get redirected here.
  */
index 96efbb859997e5b98be42f10c2bda73a920e7882..dde3d53e8adc0fd8aabbf871d0b5c6751dfb9907 100644 (file)
@@ -63,6 +63,7 @@ extern int print_fatal_signals;
 extern int sysctl_overcommit_memory;
 extern int sysctl_overcommit_ratio;
 extern int sysctl_panic_on_oom;
+extern int sysctl_oom_kill_allocating_task;
 extern int max_threads;
 extern int core_uses_pid;
 extern int suid_dumpable;
@@ -79,6 +80,19 @@ extern int maps_protect;
 extern int sysctl_stat_interval;
 extern int audit_argv_kb;
 
+/* Constants used for minimum and  maximum */
+#ifdef CONFIG_DETECT_SOFTLOCKUP
+static int one = 1;
+static int sixty = 60;
+#endif
+
+#ifdef CONFIG_MMU
+static int two = 2;
+#endif
+
+static int zero;
+static int one_hundred = 100;
+
 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
 static int maxolduid = 65535;
 static int minolduid;
@@ -710,6 +724,19 @@ static ctl_table kern_table[] = {
                .proc_handler   = &proc_dointvec,
        },
 #endif
+#ifdef CONFIG_DETECT_SOFTLOCKUP
+       {
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "softlockup_thresh",
+               .data           = &softlockup_thresh,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec_minmax,
+               .strategy       = &sysctl_intvec,
+               .extra1         = &one,
+               .extra2         = &sixty,
+       },
+#endif
 #ifdef CONFIG_COMPAT
        {
                .ctl_name       = KERN_COMPAT_LOG,
@@ -756,13 +783,6 @@ static ctl_table kern_table[] = {
        { .ctl_name = 0 }
 };
 
-/* Constants for minimum and maximum testing in vm_table.
-   We use these as one-element integer vectors. */
-static int zero;
-static int two = 2;
-static int one_hundred = 100;
-
-
 static ctl_table vm_table[] = {
        {
                .ctl_name       = VM_OVERCOMMIT_MEMORY,
@@ -780,6 +800,14 @@ static ctl_table vm_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_dointvec,
        },
+       {
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "oom_kill_allocating_task",
+               .data           = &sysctl_oom_kill_allocating_task,
+               .maxlen         = sizeof(sysctl_oom_kill_allocating_task),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
        {
                .ctl_name       = VM_OVERCOMMIT_RATIO,
                .procname       = "overcommit_ratio",
@@ -813,7 +841,7 @@ static ctl_table vm_table[] = {
                .data           = &vm_dirty_ratio,
                .maxlen         = sizeof(vm_dirty_ratio),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
+               .proc_handler   = &dirty_ratio_handler,
                .strategy       = &sysctl_intvec,
                .extra1         = &zero,
                .extra2         = &one_hundred,
index 059431ed67db4bd10b90bf126b32ff59fd4057f9..7d4d7f9c1bb2a0575cf15f9119c403e696657bb8 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/taskstats_kern.h>
 #include <linux/tsacct_kern.h>
 #include <linux/delayacct.h>
-#include <linux/tsacct_kern.h>
 #include <linux/cpumask.h>
 #include <linux/percpu.h>
 #include <net/genetlink.h>
index 1afcc78dc3b1d9a3da6439497d2d69e65bc05913..2d5b6a682138d12af18eb2b93caeca9c4443c56f 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/syscalls.h>
 #include <linux/security.h>
 #include <linux/fs.h>
-#include <linux/module.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
index fc3fc79b3d593c7e4c5e170431a6204228f2e697..fab9dd8bbd6b14a92abe6f0013e5589f45cca818 100644 (file)
@@ -274,21 +274,12 @@ out:
  */
 void tick_broadcast_on_off(unsigned long reason, int *oncpu)
 {
-       int cpu = get_cpu();
-
-       if (!cpu_isset(*oncpu, cpu_online_map)) {
+       if (!cpu_isset(*oncpu, cpu_online_map))
                printk(KERN_ERR "tick-braodcast: ignoring broadcast for "
                       "offline CPU #%d\n", *oncpu);
-       } else {
-
-               if (cpu == *oncpu)
-                       tick_do_broadcast_on_off(&reason);
-               else
-                       smp_call_function_single(*oncpu,
-                                                tick_do_broadcast_on_off,
-                                                &reason, 1, 1);
-       }
-       put_cpu();
+       else
+               smp_call_function_single(*oncpu, tick_do_broadcast_on_off,
+                                        &reason, 1, 1);
 }
 
 /*
index 8c3fef1db09ccb03507a89de6cbd7971dd803f41..ce89ffb474d0cbeba8b2d84af5c3a6c9ae5f7389 100644 (file)
@@ -570,7 +570,7 @@ void tick_setup_sched_timer(void)
        /* Get the next period (per cpu) */
        ts->sched_timer.expires = tick_init_jiffy_update();
        offset = ktime_to_ns(tick_period) >> 1;
-       do_div(offset, NR_CPUS);
+       do_div(offset, num_possible_cpus());
        offset *= smp_processor_id();
        ts->sched_timer.expires = ktime_add_ns(ts->sched_timer.expires, offset);
 
index 7e8983aecf830b37ac9255f9b0919f15c53a4bec..e5e466b2759893ccd21cea1e2242b8fbf7dac9a5 100644 (file)
@@ -24,9 +24,7 @@
  * This read-write spinlock protects us from races in SMP while
  * playing with xtime and avenrun.
  */
-__attribute__((weak)) __cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
-
-EXPORT_SYMBOL(xtime_lock);
+__cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
 
 
 /*
@@ -47,7 +45,6 @@ EXPORT_SYMBOL(xtime_lock);
 struct timespec xtime __attribute__ ((aligned (16)));
 struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
 static unsigned long total_sleep_time;         /* seconds */
-EXPORT_SYMBOL(xtime);
 
 static struct timespec xtime_cache __attribute__ ((aligned (16)));
 static inline void update_xtime_cache(u64 nsec)
index f0e561e6d085a8f1a899c85d51c555aa18570d79..9cb6f6403561d70e24f6a7e94db068e343d8fa3c 100644 (file)
@@ -44,7 +44,6 @@ struct user_struct root_user = {
        .processes      = ATOMIC_INIT(1),
        .files          = ATOMIC_INIT(0),
        .sigpending     = ATOMIC_INIT(0),
-       .mq_bytes       = 0,
        .locked_shm     = 0,
 #ifdef CONFIG_KEYS
        .uid_keyring    = &root_user_keyring,
@@ -58,19 +57,17 @@ struct user_struct root_user = {
 /*
  * These routines must be called with the uidhash spinlock held!
  */
-static inline void uid_hash_insert(struct user_struct *up,
-                                               struct hlist_head *hashent)
+static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent)
 {
        hlist_add_head(&up->uidhash_node, hashent);
 }
 
-static inline void uid_hash_remove(struct user_struct *up)
+static void uid_hash_remove(struct user_struct *up)
 {
        hlist_del_init(&up->uidhash_node);
 }
 
-static inline struct user_struct *uid_hash_find(uid_t uid,
-                                               struct hlist_head *hashent)
+static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
 {
        struct user_struct *user;
        struct hlist_node *h;
@@ -343,8 +340,9 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
                atomic_set(&new->inotify_watches, 0);
                atomic_set(&new->inotify_devs, 0);
 #endif
-
+#ifdef CONFIG_POSIX_MQUEUE
                new->mq_bytes = 0;
+#endif
                new->locked_shm = 0;
 
                if (alloc_uid_keyring(new, current) < 0) {
index 6c4ea33bb2cb0f8ffe2e1010f29ec11c375d2ddf..c5f215d509d3e36429f8f9a8eb1fd52fb9411dcc 100644 (file)
@@ -5,7 +5,8 @@
 lib-y := ctype.o string.o vsprintf.o cmdline.o \
         rbtree.o radix-tree.o dump_stack.o \
         idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \
-        sha1.o irq_regs.o reciprocal_div.o argv_split.o
+        sha1.o irq_regs.o reciprocal_div.o argv_split.o \
+        proportions.o
 
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
index 4096ed42f490869c252b1e33ea76050fe8f1ec92..fad6ce4f7b57e353bf9b4a9d8c2dca502b4d5938 100644 (file)
@@ -75,7 +75,9 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp)
        if (argv == NULL)
                goto out;
 
-       *argcp = argc;
+       if (argcp)
+               *argcp = argc;
+
        argvp = argv;
 
        while (*str) {
index accb3565816993630ab98bc7818f3afe75307fa5..486da62b2b070368f30d53b8feb2de33f0a5167a 100644 (file)
 void __attribute__((weak)) bust_spinlocks(int yes)
 {
        if (yes) {
-               oops_in_progress = 1;
+               ++oops_in_progress;
        } else {
 #ifdef CONFIG_VT
                unblank_screen();
 #endif
-               oops_in_progress = 0;
-               wake_up_klogd();
+               if (--oops_in_progress == 0)
+                       wake_up_klogd();
        }
 }
 
index 09cbe2b69edb22ddc18c2feea74ff35b315e5018..afbb0b1023d46cd5a3619175730c7ced7bc1e419 100644 (file)
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -580,8 +580,7 @@ void *idr_replace(struct idr *idp, void *ptr, int id)
 }
 EXPORT_SYMBOL(idr_replace);
 
-static void idr_cache_ctor(void * idr_layer, struct kmem_cache *idr_layer_cache,
-               unsigned long flags)
+static void idr_cache_ctor(struct kmem_cache *idr_layer_cache, void *idr_layer)
 {
        memset(idr_layer, 0, sizeof(struct idr_layer));
 }
index 864f2ec1966ec46fe66d5e30634c28ccf4ea26a8..72c42687ba1095e1357e81a0aa259275dd5cc618 100644 (file)
@@ -40,7 +40,7 @@ static void bad_io_access(unsigned long port, const char *access)
        static int count = 10;
        if (count) {
                count--;
-               printk(KERN_ERR "Bad IO access at port %lx (%s)\n", port, access);
+               printk(KERN_ERR "Bad IO access at port %#lx (%s)\n", port, access);
                WARN_ON(1);
        }
 }
index 760521417b696762ff84f0508129fe79c70f0e9f..14c6078f17a2a2aa26da4ac638da4a7e966649ed 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/vmalloc.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
+#include <linux/io.h>
 #include <asm/cacheflush.h>
 #include <asm/pgtable.h>
 
index cf22c617baa44db8708f9908efc64b9f767e0c92..9659eabffc319c5235669a87687949d270536b4e 100644 (file)
@@ -14,15 +14,29 @@ static LIST_HEAD(percpu_counters);
 static DEFINE_MUTEX(percpu_counters_lock);
 #endif
 
-void percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
+void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
 {
-       long count;
+       int cpu;
+
+       spin_lock(&fbc->lock);
+       for_each_possible_cpu(cpu) {
+               s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
+               *pcount = 0;
+       }
+       fbc->count = amount;
+       spin_unlock(&fbc->lock);
+}
+EXPORT_SYMBOL(percpu_counter_set);
+
+void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
+{
+       s64 count;
        s32 *pcount;
        int cpu = get_cpu();
 
        pcount = per_cpu_ptr(fbc->counters, cpu);
        count = *pcount + amount;
-       if (count >= FBC_BATCH || count <= -FBC_BATCH) {
+       if (count >= batch || count <= -batch) {
                spin_lock(&fbc->lock);
                fbc->count += count;
                *pcount = 0;
@@ -32,13 +46,13 @@ void percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
        }
        put_cpu();
 }
-EXPORT_SYMBOL(percpu_counter_mod);
+EXPORT_SYMBOL(__percpu_counter_add);
 
 /*
  * Add up all the per-cpu counts, return the result.  This is a more accurate
  * but much slower version of percpu_counter_read_positive()
  */
-s64 percpu_counter_sum(struct percpu_counter *fbc)
+s64 __percpu_counter_sum(struct percpu_counter *fbc)
 {
        s64 ret;
        int cpu;
@@ -50,25 +64,43 @@ s64 percpu_counter_sum(struct percpu_counter *fbc)
                ret += *pcount;
        }
        spin_unlock(&fbc->lock);
-       return ret < 0 ? 0 : ret;
+       return ret;
 }
-EXPORT_SYMBOL(percpu_counter_sum);
+EXPORT_SYMBOL(__percpu_counter_sum);
+
+static struct lock_class_key percpu_counter_irqsafe;
 
-void percpu_counter_init(struct percpu_counter *fbc, s64 amount)
+int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
 {
        spin_lock_init(&fbc->lock);
        fbc->count = amount;
        fbc->counters = alloc_percpu(s32);
+       if (!fbc->counters)
+               return -ENOMEM;
 #ifdef CONFIG_HOTPLUG_CPU
        mutex_lock(&percpu_counters_lock);
        list_add(&fbc->list, &percpu_counters);
        mutex_unlock(&percpu_counters_lock);
 #endif
+       return 0;
 }
 EXPORT_SYMBOL(percpu_counter_init);
 
+int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount)
+{
+       int err;
+
+       err = percpu_counter_init(fbc, amount);
+       if (!err)
+               lockdep_set_class(&fbc->lock, &percpu_counter_irqsafe);
+       return err;
+}
+
 void percpu_counter_destroy(struct percpu_counter *fbc)
 {
+       if (!fbc->counters)
+               return;
+
        free_percpu(fbc->counters);
 #ifdef CONFIG_HOTPLUG_CPU
        mutex_lock(&percpu_counters_lock);
diff --git a/lib/proportions.c b/lib/proportions.c
new file mode 100644 (file)
index 0000000..332d8c5
--- /dev/null
@@ -0,0 +1,384 @@
+/*
+ * Floating proportions
+ *
+ *  Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
+ *
+ * Description:
+ *
+ * The floating proportion is a time derivative with an exponentially decaying
+ * history:
+ *
+ *   p_{j} = \Sum_{i=0} (dx_{j}/dt_{-i}) / 2^(1+i)
+ *
+ * Where j is an element from {prop_local}, x_{j} is j's number of events,
+ * and i the time period over which the differential is taken. So d/dt_{-i} is
+ * the differential over the i-th last period.
+ *
+ * The decaying history gives smooth transitions. The time differential carries
+ * the notion of speed.
+ *
+ * The denominator is 2^(1+i) because we want the series to be normalised, ie.
+ *
+ *   \Sum_{i=0} 1/2^(1+i) = 1
+ *
+ * Further more, if we measure time (t) in the same events as x; so that:
+ *
+ *   t = \Sum_{j} x_{j}
+ *
+ * we get that:
+ *
+ *   \Sum_{j} p_{j} = 1
+ *
+ * Writing this in an iterative fashion we get (dropping the 'd's):
+ *
+ *   if (++x_{j}, ++t > period)
+ *     t /= 2;
+ *     for_each (j)
+ *       x_{j} /= 2;
+ *
+ * so that:
+ *
+ *   p_{j} = x_{j} / t;
+ *
+ * We optimize away the '/= 2' for the global time delta by noting that:
+ *
+ *   if (++t > period) t /= 2:
+ *
+ * Can be approximated by:
+ *
+ *   period/2 + (++t % period/2)
+ *
+ * [ Furthermore, when we choose period to be 2^n it can be written in terms of
+ *   binary operations and wraparound artefacts disappear. ]
+ *
+ * Also note that this yields a natural counter of the elapsed periods:
+ *
+ *   c = t / (period/2)
+ *
+ * [ Its monotonic increasing property can be applied to mitigate the wrap-
+ *   around issue. ]
+ *
+ * This allows us to do away with the loop over all prop_locals on each period
+ * expiration. By remembering the period count under which it was last accessed
+ * as c_{j}, we can obtain the number of 'missed' cycles from:
+ *
+ *   c - c_{j}
+ *
+ * We can then lazily catch up to the global period count every time we are
+ * going to use x_{j}, by doing:
+ *
+ *   x_{j} /= 2^(c - c_{j}), c_{j} = c
+ */
+
+#include <linux/proportions.h>
+#include <linux/rcupdate.h>
+
+/*
+ * Limit the time part in order to ensure there are some bits left for the
+ * cycle counter.
+ */
+#define PROP_MAX_SHIFT (3*BITS_PER_LONG/4)
+
+int prop_descriptor_init(struct prop_descriptor *pd, int shift)
+{
+       int err;
+
+       if (shift > PROP_MAX_SHIFT)
+               shift = PROP_MAX_SHIFT;
+
+       pd->index = 0;
+       pd->pg[0].shift = shift;
+       mutex_init(&pd->mutex);
+       err = percpu_counter_init_irq(&pd->pg[0].events, 0);
+       if (err)
+               goto out;
+
+       err = percpu_counter_init_irq(&pd->pg[1].events, 0);
+       if (err)
+               percpu_counter_destroy(&pd->pg[0].events);
+
+out:
+       return err;
+}
+
+/*
+ * We have two copies, and flip between them to make it seem like an atomic
+ * update. The update is not really atomic wrt the events counter, but
+ * it is internally consistent with the bit layout depending on shift.
+ *
+ * We copy the events count, move the bits around and flip the index.
+ */
+void prop_change_shift(struct prop_descriptor *pd, int shift)
+{
+       int index;
+       int offset;
+       u64 events;
+       unsigned long flags;
+
+       if (shift > PROP_MAX_SHIFT)
+               shift = PROP_MAX_SHIFT;
+
+       mutex_lock(&pd->mutex);
+
+       index = pd->index ^ 1;
+       offset = pd->pg[pd->index].shift - shift;
+       if (!offset)
+               goto out;
+
+       pd->pg[index].shift = shift;
+
+       local_irq_save(flags);
+       events = percpu_counter_sum(&pd->pg[pd->index].events);
+       if (offset < 0)
+               events <<= -offset;
+       else
+               events >>= offset;
+       percpu_counter_set(&pd->pg[index].events, events);
+
+       /*
+        * ensure the new pg is fully written before the switch
+        */
+       smp_wmb();
+       pd->index = index;
+       local_irq_restore(flags);
+
+       synchronize_rcu();
+
+out:
+       mutex_unlock(&pd->mutex);
+}
+
+/*
+ * wrap the access to the data in an rcu_read_lock() section;
+ * this is used to track the active references.
+ */
+static struct prop_global *prop_get_global(struct prop_descriptor *pd)
+{
+       int index;
+
+       rcu_read_lock();
+       index = pd->index;
+       /*
+        * match the wmb from vcd_flip()
+        */
+       smp_rmb();
+       return &pd->pg[index];
+}
+
+static void prop_put_global(struct prop_descriptor *pd, struct prop_global *pg)
+{
+       rcu_read_unlock();
+}
+
+static void
+prop_adjust_shift(int *pl_shift, unsigned long *pl_period, int new_shift)
+{
+       int offset = *pl_shift - new_shift;
+
+       if (!offset)
+               return;
+
+       if (offset < 0)
+               *pl_period <<= -offset;
+       else
+               *pl_period >>= offset;
+
+       *pl_shift = new_shift;
+}
+
+/*
+ * PERCPU
+ */
+
+int prop_local_init_percpu(struct prop_local_percpu *pl)
+{
+       spin_lock_init(&pl->lock);
+       pl->shift = 0;
+       pl->period = 0;
+       return percpu_counter_init_irq(&pl->events, 0);
+}
+
+void prop_local_destroy_percpu(struct prop_local_percpu *pl)
+{
+       percpu_counter_destroy(&pl->events);
+}
+
+/*
+ * Catch up with missed period expirations.
+ *
+ *   until (c_{j} == c)
+ *     x_{j} -= x_{j}/2;
+ *     c_{j}++;
+ */
+static
+void prop_norm_percpu(struct prop_global *pg, struct prop_local_percpu *pl)
+{
+       unsigned long period = 1UL << (pg->shift - 1);
+       unsigned long period_mask = ~(period - 1);
+       unsigned long global_period;
+       unsigned long flags;
+
+       global_period = percpu_counter_read(&pg->events);
+       global_period &= period_mask;
+
+       /*
+        * Fast path - check if the local and global period count still match
+        * outside of the lock.
+        */
+       if (pl->period == global_period)
+               return;
+
+       spin_lock_irqsave(&pl->lock, flags);
+       prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
+       /*
+        * For each missed period, we half the local counter.
+        * basically:
+        *   pl->events >> (global_period - pl->period);
+        *
+        * but since the distributed nature of percpu counters make division
+        * rather hard, use a regular subtraction loop. This is safe, because
+        * the events will only every be incremented, hence the subtraction
+        * can never result in a negative number.
+        */
+       while (pl->period != global_period) {
+               unsigned long val = percpu_counter_read(&pl->events);
+               unsigned long half = (val + 1) >> 1;
+
+               /*
+                * Half of zero won't be much less, break out.
+                * This limits the loop to shift iterations, even
+                * if we missed a million.
+                */
+               if (!val)
+                       break;
+
+               percpu_counter_add(&pl->events, -half);
+               pl->period += period;
+       }
+       pl->period = global_period;
+       spin_unlock_irqrestore(&pl->lock, flags);
+}
+
+/*
+ *   ++x_{j}, ++t
+ */
+void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
+{
+       struct prop_global *pg = prop_get_global(pd);
+
+       prop_norm_percpu(pg, pl);
+       percpu_counter_add(&pl->events, 1);
+       percpu_counter_add(&pg->events, 1);
+       prop_put_global(pd, pg);
+}
+
+/*
+ * Obtain a fraction of this proportion
+ *
+ *   p_{j} = x_{j} / (period/2 + t % period/2)
+ */
+void prop_fraction_percpu(struct prop_descriptor *pd,
+               struct prop_local_percpu *pl,
+               long *numerator, long *denominator)
+{
+       struct prop_global *pg = prop_get_global(pd);
+       unsigned long period_2 = 1UL << (pg->shift - 1);
+       unsigned long counter_mask = period_2 - 1;
+       unsigned long global_count;
+
+       prop_norm_percpu(pg, pl);
+       *numerator = percpu_counter_read_positive(&pl->events);
+
+       global_count = percpu_counter_read(&pg->events);
+       *denominator = period_2 + (global_count & counter_mask);
+
+       prop_put_global(pd, pg);
+}
+
+/*
+ * SINGLE
+ */
+
+int prop_local_init_single(struct prop_local_single *pl)
+{
+       spin_lock_init(&pl->lock);
+       pl->shift = 0;
+       pl->period = 0;
+       pl->events = 0;
+       return 0;
+}
+
+void prop_local_destroy_single(struct prop_local_single *pl)
+{
+}
+
+/*
+ * Catch up with missed period expirations.
+ */
+static
+void prop_norm_single(struct prop_global *pg, struct prop_local_single *pl)
+{
+       unsigned long period = 1UL << (pg->shift - 1);
+       unsigned long period_mask = ~(period - 1);
+       unsigned long global_period;
+       unsigned long flags;
+
+       global_period = percpu_counter_read(&pg->events);
+       global_period &= period_mask;
+
+       /*
+        * Fast path - check if the local and global period count still match
+        * outside of the lock.
+        */
+       if (pl->period == global_period)
+               return;
+
+       spin_lock_irqsave(&pl->lock, flags);
+       prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
+       /*
+        * For each missed period, we half the local counter.
+        */
+       period = (global_period - pl->period) >> (pg->shift - 1);
+       if (likely(period < BITS_PER_LONG))
+               pl->events >>= period;
+       else
+               pl->events = 0;
+       pl->period = global_period;
+       spin_unlock_irqrestore(&pl->lock, flags);
+}
+
+/*
+ *   ++x_{j}, ++t
+ */
+void __prop_inc_single(struct prop_descriptor *pd, struct prop_local_single *pl)
+{
+       struct prop_global *pg = prop_get_global(pd);
+
+       prop_norm_single(pg, pl);
+       pl->events++;
+       percpu_counter_add(&pg->events, 1);
+       prop_put_global(pd, pg);
+}
+
+/*
+ * Obtain a fraction of this proportion
+ *
+ *   p_{j} = x_{j} / (period/2 + t % period/2)
+ */
+void prop_fraction_single(struct prop_descriptor *pd,
+               struct prop_local_single *pl,
+               long *numerator, long *denominator)
+{
+       struct prop_global *pg = prop_get_global(pd);
+       unsigned long period_2 = 1UL << (pg->shift - 1);
+       unsigned long counter_mask = period_2 - 1;
+       unsigned long global_count;
+
+       prop_norm_single(pg, pl);
+       *numerator = pl->events;
+
+       global_count = percpu_counter_read(&pg->events);
+       *denominator = period_2 + (global_count & counter_mask);
+
+       prop_put_global(pd, pg);
+}
index 6b26f9d3980079a8d889e8d57859ce9a7cbb89bd..48c250fe2233d82c6d8fd563e83c234cdf1109ee 100644 (file)
@@ -1042,19 +1042,21 @@ int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag)
 EXPORT_SYMBOL(radix_tree_tagged);
 
 static void
-radix_tree_node_ctor(void *node, struct kmem_cache *cachep, unsigned long flags)
+radix_tree_node_ctor(struct kmem_cache *cachep, void *node)
 {
        memset(node, 0, sizeof(struct radix_tree_node));
 }
 
 static __init unsigned long __maxindex(unsigned int height)
 {
-       unsigned int tmp = height * RADIX_TREE_MAP_SHIFT;
-       unsigned long index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1;
-
-       if (tmp >= RADIX_TREE_INDEX_BITS)
-               index = ~0UL;
-       return index;
+       unsigned int width = height * RADIX_TREE_MAP_SHIFT;
+       int shift = RADIX_TREE_INDEX_BITS - width;
+
+       if (shift < 0)
+               return ~0UL;
+       if (shift >= BITS_PER_LONG)
+               return 0UL;
+       return ~0UL >> shift;
 }
 
 static __init void radix_tree_init_maxindex(void)
index 961567894d16b89a208244ea957e44a3d9afd668..6abbaf3d5858e587705881a4ab6d45a65b8f4e89 100644 (file)
@@ -67,7 +67,7 @@ void sort(void *base, size_t num, size_t size,
        }
 
        /* sort */
-       for (i = n - size; i >= 0; i -= size) {
+       for (i = n - size; i > 0; i -= size) {
                swap(base, base + i, size);
                for (r = 0; r * 2 + size < i; r = c) {
                        c = r * 2 + size;
index f50a2811f9dc86b876d24e75333558583c075f1d..b0ceb29da4c7a9b8c230e1956e324b62b1905727 100644 (file)
@@ -5,6 +5,41 @@
 #include <linux/sched.h>
 #include <linux/module.h>
 
+int bdi_init(struct backing_dev_info *bdi)
+{
+       int i, j;
+       int err;
+
+       for (i = 0; i < NR_BDI_STAT_ITEMS; i++) {
+               err = percpu_counter_init_irq(&bdi->bdi_stat[i], 0);
+               if (err)
+                       goto err;
+       }
+
+       bdi->dirty_exceeded = 0;
+       err = prop_local_init_percpu(&bdi->completions);
+
+       if (err) {
+err:
+               for (j = 0; j < i; j++)
+                       percpu_counter_destroy(&bdi->bdi_stat[i]);
+       }
+
+       return err;
+}
+EXPORT_SYMBOL(bdi_init);
+
+void bdi_destroy(struct backing_dev_info *bdi)
+{
+       int i;
+
+       for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
+               percpu_counter_destroy(&bdi->bdi_stat[i]);
+
+       prop_local_destroy_percpu(&bdi->completions);
+}
+EXPORT_SYMBOL(bdi_destroy);
+
 static wait_queue_head_t congestion_wqh[2] = {
                __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
                __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
@@ -55,15 +90,3 @@ long congestion_wait(int rw, long timeout)
 }
 EXPORT_SYMBOL(congestion_wait);
 
-/**
- * congestion_end - wake up sleepers on a congested backing_dev_info
- * @rw: READ or WRITE
- */
-void congestion_end(int rw)
-{
-       wait_queue_head_t *wqh = &congestion_wqh[rw];
-
-       if (waitqueue_active(wqh))
-               wake_up(wqh);
-}
-EXPORT_SYMBOL(congestion_end);
index c6049e947cd9968a2870ed0805f5aae5ed4355ff..79f24a969cb4dfef1de95045bb5e9ced44e6243c 100644 (file)
@@ -63,6 +63,7 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
  *    ->private_lock           (__free_pte->__set_page_dirty_buffers)
  *      ->swap_lock            (exclusive_swap_page, others)
  *        ->mapping->tree_lock
+ *          ->zone.lock
  *
  *  ->i_mutex
  *    ->i_mmap_lock            (truncate->unmap_mapping_range)
@@ -1626,12 +1627,18 @@ int __remove_suid(struct dentry *dentry, int kill)
 
 int remove_suid(struct dentry *dentry)
 {
-       int kill = should_remove_suid(dentry);
+       int killsuid = should_remove_suid(dentry);
+       int killpriv = security_inode_need_killpriv(dentry);
+       int error = 0;
 
-       if (unlikely(kill))
-               return __remove_suid(dentry, kill);
+       if (killpriv < 0)
+               return killpriv;
+       if (killpriv)
+               error = security_inode_killpriv(dentry);
+       if (!error && killsuid)
+               error = __remove_suid(dentry, killsuid);
 
-       return 0;
+       return error;
 }
 EXPORT_SYMBOL(remove_suid);
 
index 95bcb5641c722b6f4d7eb49801320e0a266f7c83..14bd3bf7826edcecd2f61e6465b61078a84b2340 100644 (file)
@@ -5,7 +5,7 @@
  *
  * started by Ingo Molnar, Copyright (C) 2002, 2003
  */
-
+#include <linux/backing-dev.h>
 #include <linux/mm.h>
 #include <linux/swap.h>
 #include <linux/file.h>
@@ -97,26 +97,28 @@ static int populate_range(struct mm_struct *mm, struct vm_area_struct *vma,
 
 }
 
-/***
- * sys_remap_file_pages - remap arbitrary pages of a shared backing store
- *                        file within an existing vma.
+/**
+ * sys_remap_file_pages - remap arbitrary pages of an existing VM_SHARED vma
  * @start: start of the remapped virtual memory range
  * @size: size of the remapped virtual memory range
- * @prot: new protection bits of the range
- * @pgoff: to be mapped page of the backing store file
+ * @prot: new protection bits of the range (see NOTE)
+ * @pgoff: to-be-mapped page of the backing store file
  * @flags: 0 or MAP_NONBLOCKED - the later will cause no IO.
  *
- * this syscall works purely via pagetables, so it's the most efficient
+ * sys_remap_file_pages remaps arbitrary pages of an existing VM_SHARED vma
+ * (shared backing store file).
+ *
+ * This syscall works purely via pagetables, so it's the most efficient
  * way to map the same (large) file into a given virtual window. Unlike
  * mmap()/mremap() it does not create any new vmas. The new mappings are
  * also safe across swapout.
  *
- * NOTE: the 'prot' parameter right now is ignored, and the vma's default
- * protection is used. Arbitrary protections might be implemented in the
- * future.
+ * NOTE: the 'prot' parameter right now is ignored (but must be zero),
+ * and the vma's default protection is used. Arbitrary protections
+ * might be implemented in the future.
  */
 asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
-       unsigned long __prot, unsigned long pgoff, unsigned long flags)
+       unsigned long prot, unsigned long pgoff, unsigned long flags)
 {
        struct mm_struct *mm = current->mm;
        struct address_space *mapping;
@@ -125,7 +127,7 @@ asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
        int err = -EINVAL;
        int has_write_lock = 0;
 
-       if (__prot)
+       if (prot)
                return err;
        /*
         * Sanitize the syscall parameters:
index 0d40e66c841b2d2cad8e03ebc6d5e16491b0774b..4275e81e25ba69cf49b777ca2819fb6295d7b084 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/slab.h>
+#include <linux/backing-dev.h>
 #include <linux/mm.h>
 #include <linux/shm.h>
 #include <linux/mman.h>
@@ -180,8 +181,6 @@ error:
        return -ENOMEM;
 }
 
-EXPORT_SYMBOL(__vm_enough_memory);
-
 /*
  * Requires inode->i_mapping->i_mmap_lock
  */
index 8ed0cb43118a1fc0586b165b49e6ad8e7c8a8efb..42fb84e9e8152819701d3da1cd449c30a0466db0 100644 (file)
@@ -44,7 +44,6 @@ int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
 int heap_stack_gap = 0;
 
 EXPORT_SYMBOL(mem_map);
-EXPORT_SYMBOL(__vm_enough_memory);
 EXPORT_SYMBOL(num_physpages);
 
 /* list of shareable VMAs */
index 41b4e362221d943ba1759d9de3d740222f067c98..a64decb5b13fb3922e05a70559855dde685b57b4 100644 (file)
@@ -27,6 +27,8 @@
 #include <linux/notifier.h>
 
 int sysctl_panic_on_oom;
+int sysctl_oom_kill_allocating_task;
+static DEFINE_SPINLOCK(zone_scan_mutex);
 /* #define DEBUG */
 
 /**
@@ -141,7 +143,7 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
         * because p may have allocated or otherwise mapped memory on
         * this node before. However it will be less likely.
         */
-       if (!cpuset_excl_nodes_overlap(p))
+       if (!cpuset_mems_allowed_intersects(current, p))
                points /= 8;
 
        /*
@@ -163,17 +165,11 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
        return points;
 }
 
-/*
- * Types of limitations to the nodes from which allocations may occur
- */
-#define CONSTRAINT_NONE 1
-#define CONSTRAINT_MEMORY_POLICY 2
-#define CONSTRAINT_CPUSET 3
-
 /*
  * Determine the type of allocation constraint.
  */
-static inline int constrained_alloc(struct zonelist *zonelist, gfp_t gfp_mask)
+static inline enum oom_constraint constrained_alloc(struct zonelist *zonelist,
+                                                   gfp_t gfp_mask)
 {
 #ifdef CONFIG_NUMA
        struct zone **z;
@@ -337,12 +333,20 @@ static int oom_kill_task(struct task_struct *p)
        return 0;
 }
 
-static int oom_kill_process(struct task_struct *p, unsigned long points,
-               const char *message)
+static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
+                           unsigned long points, const char *message)
 {
        struct task_struct *c;
        struct list_head *tsk;
 
+       if (printk_ratelimit()) {
+               printk(KERN_WARNING "%s invoked oom-killer: "
+                       "gfp_mask=0x%x, order=%d, oomkilladj=%d\n",
+                       current->comm, gfp_mask, order, current->oomkilladj);
+               dump_stack();
+               show_mem();
+       }
+
        /*
         * If the task is already exiting, don't alarm the sysadmin or kill
         * its children or threads, just set TIF_MEMDIE so it can die quickly
@@ -380,6 +384,57 @@ int unregister_oom_notifier(struct notifier_block *nb)
 }
 EXPORT_SYMBOL_GPL(unregister_oom_notifier);
 
+/*
+ * Try to acquire the OOM killer lock for the zones in zonelist.  Returns zero
+ * if a parallel OOM killing is already taking place that includes a zone in
+ * the zonelist.  Otherwise, locks all zones in the zonelist and returns 1.
+ */
+int try_set_zone_oom(struct zonelist *zonelist)
+{
+       struct zone **z;
+       int ret = 1;
+
+       z = zonelist->zones;
+
+       spin_lock(&zone_scan_mutex);
+       do {
+               if (zone_is_oom_locked(*z)) {
+                       ret = 0;
+                       goto out;
+               }
+       } while (*(++z) != NULL);
+
+       /*
+        * Lock each zone in the zonelist under zone_scan_mutex so a parallel
+        * invocation of try_set_zone_oom() doesn't succeed when it shouldn't.
+        */
+       z = zonelist->zones;
+       do {
+               zone_set_flag(*z, ZONE_OOM_LOCKED);
+       } while (*(++z) != NULL);
+out:
+       spin_unlock(&zone_scan_mutex);
+       return ret;
+}
+
+/*
+ * Clears the ZONE_OOM_LOCKED flag for all zones in the zonelist so that failed
+ * allocation attempts with zonelists containing them may now recall the OOM
+ * killer, if necessary.
+ */
+void clear_zonelist_oom(struct zonelist *zonelist)
+{
+       struct zone **z;
+
+       z = zonelist->zones;
+
+       spin_lock(&zone_scan_mutex);
+       do {
+               zone_clear_flag(*z, ZONE_OOM_LOCKED);
+       } while (*(++z) != NULL);
+       spin_unlock(&zone_scan_mutex);
+}
+
 /**
  * out_of_memory - kill the "best" process when we run out of memory
  *
@@ -393,21 +448,13 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
        struct task_struct *p;
        unsigned long points = 0;
        unsigned long freed = 0;
-       int constraint;
+       enum oom_constraint constraint;
 
        blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
        if (freed > 0)
                /* Got some memory back in the last second. */
                return;
 
-       if (printk_ratelimit()) {
-               printk(KERN_WARNING "%s invoked oom-killer: "
-                       "gfp_mask=0x%x, order=%d, oomkilladj=%d\n",
-                       current->comm, gfp_mask, order, current->oomkilladj);
-               dump_stack();
-               show_mem();
-       }
-
        if (sysctl_panic_on_oom == 2)
                panic("out of memory. Compulsory panic_on_oom is selected.\n");
 
@@ -416,23 +463,24 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
         * NUMA) that may require different handling.
         */
        constraint = constrained_alloc(zonelist, gfp_mask);
-       cpuset_lock();
        read_lock(&tasklist_lock);
 
        switch (constraint) {
        case CONSTRAINT_MEMORY_POLICY:
-               oom_kill_process(current, points,
+               oom_kill_process(current, gfp_mask, order, points,
                                "No available memory (MPOL_BIND)");
                break;
 
-       case CONSTRAINT_CPUSET:
-               oom_kill_process(current, points,
-                               "No available memory in cpuset");
-               break;
-
        case CONSTRAINT_NONE:
                if (sysctl_panic_on_oom)
                        panic("out of memory. panic_on_oom is selected\n");
+               /* Fall-through */
+       case CONSTRAINT_CPUSET:
+               if (sysctl_oom_kill_allocating_task) {
+                       oom_kill_process(current, gfp_mask, order, points,
+                                       "Out of memory (oom_kill_allocating_task)");
+                       break;
+               }
 retry:
                /*
                 * Rambo mode: Shoot down a process and hope it solves whatever
@@ -446,11 +494,11 @@ retry:
                /* Found nothing?!?! Either we hang forever, or we panic. */
                if (!p) {
                        read_unlock(&tasklist_lock);
-                       cpuset_unlock();
                        panic("Out of memory and no killable processes...\n");
                }
 
-               if (oom_kill_process(p, points, "Out of memory"))
+               if (oom_kill_process(p, points, gfp_mask, order,
+                                    "Out of memory"))
                        goto retry;
 
                break;
@@ -458,7 +506,6 @@ retry:
 
 out:
        read_unlock(&tasklist_lock);
-       cpuset_unlock();
 
        /*
         * Give "p" a good chance of killing itself before we
index d821321326e3f6fcff609d7f87ecb5c0890213c9..7845462064f4c13457528852c09e5db9e770596b 100644 (file)
@@ -2,6 +2,7 @@
  * mm/page-writeback.c
  *
  * Copyright (C) 2002, Linus Torvalds.
+ * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
  *
  * Contains functions related to writing back dirty pages at the
  * address_space level.
@@ -36,7 +37,7 @@
 
 /*
  * The maximum number of pages to writeout in a single bdflush/kupdate
- * operation.  We do this so we don't hold I_LOCK against an inode for
+ * operation.  We do this so we don't hold I_SYNC against an inode for
  * enormous amounts of time, which would block a userspace task which has
  * been forced to throttle against that inode.  Also, the code reevaluates
  * the dirty each time it has written this many pages.
@@ -49,8 +50,6 @@
  */
 static long ratelimit_pages = 32;
 
-static int dirty_exceeded __cacheline_aligned_in_smp;  /* Dirty mem may be over limit */
-
 /*
  * When balance_dirty_pages decides that the caller needs to perform some
  * non-background writeback, this is how many pages it will attempt to write.
@@ -102,6 +101,141 @@ EXPORT_SYMBOL(laptop_mode);
 
 static void background_writeout(unsigned long _min_pages);
 
+/*
+ * Scale the writeback cache size proportional to the relative writeout speeds.
+ *
+ * We do this by keeping a floating proportion between BDIs, based on page
+ * writeback completions [end_page_writeback()]. Those devices that write out
+ * pages fastest will get the larger share, while the slower will get a smaller
+ * share.
+ *
+ * We use page writeout completions because we are interested in getting rid of
+ * dirty pages. Having them written out is the primary goal.
+ *
+ * We introduce a concept of time, a period over which we measure these events,
+ * because demand can/will vary over time. The length of this period itself is
+ * measured in page writeback completions.
+ *
+ */
+static struct prop_descriptor vm_completions;
+static struct prop_descriptor vm_dirties;
+
+static unsigned long determine_dirtyable_memory(void);
+
+/*
+ * couple the period to the dirty_ratio:
+ *
+ *   period/2 ~ roundup_pow_of_two(dirty limit)
+ */
+static int calc_period_shift(void)
+{
+       unsigned long dirty_total;
+
+       dirty_total = (vm_dirty_ratio * determine_dirtyable_memory()) / 100;
+       return 2 + ilog2(dirty_total - 1);
+}
+
+/*
+ * update the period when the dirty ratio changes.
+ */
+int dirty_ratio_handler(struct ctl_table *table, int write,
+               struct file *filp, void __user *buffer, size_t *lenp,
+               loff_t *ppos)
+{
+       int old_ratio = vm_dirty_ratio;
+       int ret = proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos);
+       if (ret == 0 && write && vm_dirty_ratio != old_ratio) {
+               int shift = calc_period_shift();
+               prop_change_shift(&vm_completions, shift);
+               prop_change_shift(&vm_dirties, shift);
+       }
+       return ret;
+}
+
+/*
+ * Increment the BDI's writeout completion count and the global writeout
+ * completion count. Called from test_clear_page_writeback().
+ */
+static inline void __bdi_writeout_inc(struct backing_dev_info *bdi)
+{
+       __prop_inc_percpu(&vm_completions, &bdi->completions);
+}
+
+static inline void task_dirty_inc(struct task_struct *tsk)
+{
+       prop_inc_single(&vm_dirties, &tsk->dirties);
+}
+
+/*
+ * Obtain an accurate fraction of the BDI's portion.
+ */
+static void bdi_writeout_fraction(struct backing_dev_info *bdi,
+               long *numerator, long *denominator)
+{
+       if (bdi_cap_writeback_dirty(bdi)) {
+               prop_fraction_percpu(&vm_completions, &bdi->completions,
+                               numerator, denominator);
+       } else {
+               *numerator = 0;
+               *denominator = 1;
+       }
+}
+
+/*
+ * Clip the earned share of dirty pages to that which is actually available.
+ * This avoids exceeding the total dirty_limit when the floating averages
+ * fluctuate too quickly.
+ */
+static void
+clip_bdi_dirty_limit(struct backing_dev_info *bdi, long dirty, long *pbdi_dirty)
+{
+       long avail_dirty;
+
+       avail_dirty = dirty -
+               (global_page_state(NR_FILE_DIRTY) +
+                global_page_state(NR_WRITEBACK) +
+                global_page_state(NR_UNSTABLE_NFS));
+
+       if (avail_dirty < 0)
+               avail_dirty = 0;
+
+       avail_dirty += bdi_stat(bdi, BDI_RECLAIMABLE) +
+               bdi_stat(bdi, BDI_WRITEBACK);
+
+       *pbdi_dirty = min(*pbdi_dirty, avail_dirty);
+}
+
+static inline void task_dirties_fraction(struct task_struct *tsk,
+               long *numerator, long *denominator)
+{
+       prop_fraction_single(&vm_dirties, &tsk->dirties,
+                               numerator, denominator);
+}
+
+/*
+ * scale the dirty limit
+ *
+ * task specific dirty limit:
+ *
+ *   dirty -= (dirty/8) * p_{t}
+ */
+void task_dirty_limit(struct task_struct *tsk, long *pdirty)
+{
+       long numerator, denominator;
+       long dirty = *pdirty;
+       u64 inv = dirty >> 3;
+
+       task_dirties_fraction(tsk, &numerator, &denominator);
+       inv *= numerator;
+       do_div(inv, denominator);
+
+       dirty -= inv;
+       if (dirty < *pdirty/2)
+               dirty = *pdirty/2;
+
+       *pdirty = dirty;
+}
+
 /*
  * Work out the current dirty-memory clamping and background writeout
  * thresholds.
@@ -158,8 +292,8 @@ static unsigned long determine_dirtyable_memory(void)
 }
 
 static void
-get_dirty_limits(long *pbackground, long *pdirty,
-                                       struct address_space *mapping)
+get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
+                struct backing_dev_info *bdi)
 {
        int background_ratio;           /* Percentages */
        int dirty_ratio;
@@ -193,6 +327,23 @@ get_dirty_limits(long *pbackground, long *pdirty,
        }
        *pbackground = background;
        *pdirty = dirty;
+
+       if (bdi) {
+               u64 bdi_dirty = dirty;
+               long numerator, denominator;
+
+               /*
+                * Calculate this BDI's share of the dirty ratio.
+                */
+               bdi_writeout_fraction(bdi, &numerator, &denominator);
+
+               bdi_dirty *= numerator;
+               do_div(bdi_dirty, denominator);
+
+               *pbdi_dirty = bdi_dirty;
+               clip_bdi_dirty_limit(bdi, dirty, pbdi_dirty);
+               task_dirty_limit(current, pbdi_dirty);
+       }
 }
 
 /*
@@ -204,9 +355,11 @@ get_dirty_limits(long *pbackground, long *pdirty,
  */
 static void balance_dirty_pages(struct address_space *mapping)
 {
-       long nr_reclaimable;
+       long bdi_nr_reclaimable;
+       long bdi_nr_writeback;
        long background_thresh;
        long dirty_thresh;
+       long bdi_thresh;
        unsigned long pages_written = 0;
        unsigned long write_chunk = sync_writeback_pages();
 
@@ -221,15 +374,15 @@ static void balance_dirty_pages(struct address_space *mapping)
                        .range_cyclic   = 1,
                };
 
-               get_dirty_limits(&background_thresh, &dirty_thresh, mapping);
-               nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
-                                       global_page_state(NR_UNSTABLE_NFS);
-               if (nr_reclaimable + global_page_state(NR_WRITEBACK) <=
-                       dirty_thresh)
-                               break;
+               get_dirty_limits(&background_thresh, &dirty_thresh,
+                               &bdi_thresh, bdi);
+               bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
+               bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
+               if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
+                       break;
 
-               if (!dirty_exceeded)
-                       dirty_exceeded = 1;
+               if (!bdi->dirty_exceeded)
+                       bdi->dirty_exceeded = 1;
 
                /* Note: nr_reclaimable denotes nr_dirty + nr_unstable.
                 * Unstable writes are a feature of certain networked
@@ -237,26 +390,42 @@ static void balance_dirty_pages(struct address_space *mapping)
                 * written to the server's write cache, but has not yet
                 * been flushed to permanent storage.
                 */
-               if (nr_reclaimable) {
+               if (bdi_nr_reclaimable) {
                        writeback_inodes(&wbc);
-                       get_dirty_limits(&background_thresh,
-                                               &dirty_thresh, mapping);
-                       nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
-                                       global_page_state(NR_UNSTABLE_NFS);
-                       if (nr_reclaimable +
-                               global_page_state(NR_WRITEBACK)
-                                       <= dirty_thresh)
-                                               break;
                        pages_written += write_chunk - wbc.nr_to_write;
-                       if (pages_written >= write_chunk)
-                               break;          /* We've done our duty */
+                       get_dirty_limits(&background_thresh, &dirty_thresh,
+                                      &bdi_thresh, bdi);
+               }
+
+               /*
+                * In order to avoid the stacked BDI deadlock we need
+                * to ensure we accurately count the 'dirty' pages when
+                * the threshold is low.
+                *
+                * Otherwise it would be possible to get thresh+n pages
+                * reported dirty, even though there are thresh-m pages
+                * actually dirty; with m+n sitting in the percpu
+                * deltas.
+                */
+               if (bdi_thresh < 2*bdi_stat_error(bdi)) {
+                       bdi_nr_reclaimable = bdi_stat_sum(bdi, BDI_RECLAIMABLE);
+                       bdi_nr_writeback = bdi_stat_sum(bdi, BDI_WRITEBACK);
+               } else if (bdi_nr_reclaimable) {
+                       bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
+                       bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
                }
+
+               if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
+                       break;
+               if (pages_written >= write_chunk)
+                       break;          /* We've done our duty */
+
                congestion_wait(WRITE, HZ/10);
        }
 
-       if (nr_reclaimable + global_page_state(NR_WRITEBACK)
-               <= dirty_thresh && dirty_exceeded)
-                       dirty_exceeded = 0;
+       if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh &&
+                       bdi->dirty_exceeded)
+               bdi->dirty_exceeded = 0;
 
        if (writeback_in_progress(bdi))
                return;         /* pdflush is already working this queue */
@@ -270,7 +439,9 @@ static void balance_dirty_pages(struct address_space *mapping)
         * background_thresh, to keep the amount of dirty memory low.
         */
        if ((laptop_mode && pages_written) ||
-            (!laptop_mode && (nr_reclaimable > background_thresh)))
+                       (!laptop_mode && (global_page_state(NR_FILE_DIRTY)
+                                         + global_page_state(NR_UNSTABLE_NFS)
+                                         > background_thresh)))
                pdflush_operation(background_writeout, 0);
 }
 
@@ -306,7 +477,7 @@ void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
        unsigned long *p;
 
        ratelimit = ratelimit_pages;
-       if (dirty_exceeded)
+       if (mapping->backing_dev_info->dirty_exceeded)
                ratelimit = 8;
 
        /*
@@ -331,18 +502,8 @@ void throttle_vm_writeout(gfp_t gfp_mask)
        long background_thresh;
        long dirty_thresh;
 
-       if ((gfp_mask & (__GFP_FS|__GFP_IO)) != (__GFP_FS|__GFP_IO)) {
-               /*
-                * The caller might hold locks which can prevent IO completion
-                * or progress in the filesystem.  So we cannot just sit here
-                * waiting for IO to complete.
-                */
-               congestion_wait(WRITE, HZ/10);
-               return;
-       }
-
         for ( ; ; ) {
-               get_dirty_limits(&background_thresh, &dirty_thresh, NULL);
+               get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
 
                 /*
                  * Boost the allowable dirty threshold a bit for page
@@ -354,6 +515,14 @@ void throttle_vm_writeout(gfp_t gfp_mask)
                        global_page_state(NR_WRITEBACK) <= dirty_thresh)
                                break;
                 congestion_wait(WRITE, HZ/10);
+
+               /*
+                * The caller might hold locks which can prevent IO completion
+                * or progress in the filesystem.  So we cannot just sit here
+                * waiting for IO to complete.
+                */
+               if ((gfp_mask & (__GFP_FS|__GFP_IO)) != (__GFP_FS|__GFP_IO))
+                       break;
         }
 }
 
@@ -377,11 +546,12 @@ static void background_writeout(unsigned long _min_pages)
                long background_thresh;
                long dirty_thresh;
 
-               get_dirty_limits(&background_thresh, &dirty_thresh, NULL);
+               get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
                if (global_page_state(NR_FILE_DIRTY) +
                        global_page_state(NR_UNSTABLE_NFS) < background_thresh
                                && min_pages <= 0)
                        break;
+               wbc.more_io = 0;
                wbc.encountered_congestion = 0;
                wbc.nr_to_write = MAX_WRITEBACK_PAGES;
                wbc.pages_skipped = 0;
@@ -389,8 +559,9 @@ static void background_writeout(unsigned long _min_pages)
                min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
                if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) {
                        /* Wrote less than expected */
-                       congestion_wait(WRITE, HZ/10);
-                       if (!wbc.encountered_congestion)
+                       if (wbc.encountered_congestion || wbc.more_io)
+                               congestion_wait(WRITE, HZ/10);
+                       else
                                break;
                }
        }
@@ -455,11 +626,12 @@ static void wb_kupdate(unsigned long arg)
                        global_page_state(NR_UNSTABLE_NFS) +
                        (inodes_stat.nr_inodes - inodes_stat.nr_unused);
        while (nr_to_write > 0) {
+               wbc.more_io = 0;
                wbc.encountered_congestion = 0;
                wbc.nr_to_write = MAX_WRITEBACK_PAGES;
                writeback_inodes(&wbc);
                if (wbc.nr_to_write > 0) {
-                       if (wbc.encountered_congestion)
+                       if (wbc.encountered_congestion || wbc.more_io)
                                congestion_wait(WRITE, HZ/10);
                        else
                                break;  /* All the old data is written */
@@ -580,9 +752,15 @@ static struct notifier_block __cpuinitdata ratelimit_nb = {
  */
 void __init page_writeback_init(void)
 {
+       int shift;
+
        mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
        writeback_set_ratelimit();
        register_cpu_notifier(&ratelimit_nb);
+
+       shift = calc_period_shift();
+       prop_descriptor_init(&vm_completions, shift);
+       prop_descriptor_init(&vm_dirties, shift);
 }
 
 /**
@@ -672,8 +850,10 @@ retry:
 
                        ret = (*writepage)(page, wbc, data);
 
-                       if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE))
+                       if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE)) {
                                unlock_page(page);
+                               ret = 0;
+                       }
                        if (ret || (--(wbc->nr_to_write) <= 0))
                                done = 1;
                        if (wbc->nonblocking && bdi_write_congested(bdi)) {
@@ -827,6 +1007,8 @@ int __set_page_dirty_nobuffers(struct page *page)
                        WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
                        if (mapping_cap_account_dirty(mapping)) {
                                __inc_zone_page_state(page, NR_FILE_DIRTY);
+                               __inc_bdi_stat(mapping->backing_dev_info,
+                                               BDI_RECLAIMABLE);
                                task_io_account_write(PAGE_CACHE_SIZE);
                        }
                        radix_tree_tag_set(&mapping->page_tree,
@@ -859,7 +1041,7 @@ EXPORT_SYMBOL(redirty_page_for_writepage);
  * If the mapping doesn't provide a set_page_dirty a_op, then
  * just fall through and assume that it wants buffer_heads.
  */
-int fastcall set_page_dirty(struct page *page)
+static int __set_page_dirty(struct page *page)
 {
        struct address_space *mapping = page_mapping(page);
 
@@ -877,6 +1059,14 @@ int fastcall set_page_dirty(struct page *page)
        }
        return 0;
 }
+
+int fastcall set_page_dirty(struct page *page)
+{
+       int ret = __set_page_dirty(page);
+       if (ret)
+               task_dirty_inc(current);
+       return ret;
+}
 EXPORT_SYMBOL(set_page_dirty);
 
 /*
@@ -961,6 +1151,8 @@ int clear_page_dirty_for_io(struct page *page)
                 */
                if (TestClearPageDirty(page)) {
                        dec_zone_page_state(page, NR_FILE_DIRTY);
+                       dec_bdi_stat(mapping->backing_dev_info,
+                                       BDI_RECLAIMABLE);
                        return 1;
                }
                return 0;
@@ -975,14 +1167,20 @@ int test_clear_page_writeback(struct page *page)
        int ret;
 
        if (mapping) {
+               struct backing_dev_info *bdi = mapping->backing_dev_info;
                unsigned long flags;
 
                write_lock_irqsave(&mapping->tree_lock, flags);
                ret = TestClearPageWriteback(page);
-               if (ret)
+               if (ret) {
                        radix_tree_tag_clear(&mapping->page_tree,
                                                page_index(page),
                                                PAGECACHE_TAG_WRITEBACK);
+                       if (bdi_cap_writeback_dirty(bdi)) {
+                               __dec_bdi_stat(bdi, BDI_WRITEBACK);
+                               __bdi_writeout_inc(bdi);
+                       }
+               }
                write_unlock_irqrestore(&mapping->tree_lock, flags);
        } else {
                ret = TestClearPageWriteback(page);
@@ -998,14 +1196,18 @@ int test_set_page_writeback(struct page *page)
        int ret;
 
        if (mapping) {
+               struct backing_dev_info *bdi = mapping->backing_dev_info;
                unsigned long flags;
 
                write_lock_irqsave(&mapping->tree_lock, flags);
                ret = TestSetPageWriteback(page);
-               if (!ret)
+               if (!ret) {
                        radix_tree_tag_set(&mapping->page_tree,
                                                page_index(page),
                                                PAGECACHE_TAG_WRITEBACK);
+                       if (bdi_cap_writeback_dirty(bdi))
+                               __inc_bdi_stat(bdi, BDI_WRITEBACK);
+               }
                if (!PageDirty(page))
                        radix_tree_tag_clear(&mapping->page_tree,
                                                page_index(page),
index d315e1127dc91891980d180618d78ca51277aae7..43f757fcf30f6b1dc61cffd2c824e791db28c418 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/pagevec.h>
 #include <linux/blkdev.h>
 #include <linux/slab.h>
+#include <linux/oom.h>
 #include <linux/notifier.h>
 #include <linux/topology.h>
 #include <linux/sysctl.h>
@@ -489,7 +490,7 @@ static void free_pages_bulk(struct zone *zone, int count,
                                        struct list_head *list, int order)
 {
        spin_lock(&zone->lock);
-       zone->all_unreclaimable = 0;
+       zone_clear_flag(zone, ZONE_ALL_UNRECLAIMABLE);
        zone->pages_scanned = 0;
        while (count--) {
                struct page *page;
@@ -506,7 +507,7 @@ static void free_pages_bulk(struct zone *zone, int count,
 static void free_one_page(struct zone *zone, struct page *page, int order)
 {
        spin_lock(&zone->lock);
-       zone->all_unreclaimable = 0;
+       zone_clear_flag(zone, ZONE_ALL_UNRECLAIMABLE);
        zone->pages_scanned = 0;
        __free_one_page(page, zone, order);
        spin_unlock(&zone->lock);
@@ -1586,6 +1587,11 @@ nofail_alloc:
                if (page)
                        goto got_pg;
        } else if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) {
+               if (!try_set_zone_oom(zonelist)) {
+                       schedule_timeout_uninterruptible(1);
+                       goto restart;
+               }
+
                /*
                 * Go through the zonelist yet one more time, keep
                 * very high watermark here, this is only to catch
@@ -1594,14 +1600,19 @@ nofail_alloc:
                 */
                page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order,
                                zonelist, ALLOC_WMARK_HIGH|ALLOC_CPUSET);
-               if (page)
+               if (page) {
+                       clear_zonelist_oom(zonelist);
                        goto got_pg;
+               }
 
                /* The OOM killer will not help higher order allocs so fail */
-               if (order > PAGE_ALLOC_COSTLY_ORDER)
+               if (order > PAGE_ALLOC_COSTLY_ORDER) {
+                       clear_zonelist_oom(zonelist);
                        goto nopage;
+               }
 
                out_of_memory(zonelist, gfp_mask, order);
+               clear_zonelist_oom(zonelist);
                goto restart;
        }
 
@@ -1850,7 +1861,7 @@ void show_free_areas(void)
                        K(zone_page_state(zone, NR_INACTIVE)),
                        K(zone->present_pages),
                        zone->pages_scanned,
-                       (zone->all_unreclaimable ? "yes" : "no")
+                       (zone_is_all_unreclaimable(zone) ? "yes" : "no")
                        );
                printk("lowmem_reserve[]:");
                for (i = 0; i < MAX_NR_ZONES; i++)
@@ -3371,7 +3382,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
                zone->nr_scan_active = 0;
                zone->nr_scan_inactive = 0;
                zap_zone_vm_stats(zone);
-               atomic_set(&zone->reclaim_in_progress, 0);
+               zone->flags = 0;
                if (!size)
                        continue;
 
index 229788884010d18a8dba50f65dbcfe7bb37df744..c9c50ca1ec3866b839a85173f3d416a1b17211d1 100644 (file)
@@ -233,6 +233,12 @@ unsigned long max_sane_readahead(unsigned long nr)
                + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2);
 }
 
+static int __init readahead_init(void)
+{
+       return bdi_init(&default_backing_dev_info);
+}
+subsys_initcall(readahead_init);
+
 /*
  * Submit IO for the read-ahead request in file_ra_state.
  */
index 2b9f413c9c00da3ebee3220e1d8f0d64d5b10626..8990f909492f31d8a3f01df258907661db1bccf6 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -36,6 +36,7 @@
  *                 mapping->tree_lock (widely used, in set_page_dirty,
  *                           in arch-dependent flush_dcache_mmap_lock,
  *                           within inode_lock in __sync_single_inode)
+ *                   zone->lock (within radix tree node alloc)
  */
 
 #include <linux/mm.h>
@@ -137,8 +138,7 @@ void anon_vma_unlink(struct vm_area_struct *vma)
                anon_vma_free(anon_vma);
 }
 
-static void anon_vma_ctor(void *data, struct kmem_cache *cachep,
-                         unsigned long flags)
+static void anon_vma_ctor(struct kmem_cache *cachep, void *data)
 {
        struct anon_vma *anon_vma = data;
 
index 8a82342a8595019623c6ad2170cb9763de263b5e..289dbb0a6fd6dff9e983a42ac7d0f1fdd964e5a3 100644 (file)
@@ -2328,8 +2328,7 @@ static void shmem_destroy_inode(struct inode *inode)
        kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));
 }
 
-static void init_once(void *foo, struct kmem_cache *cachep,
-                     unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct shmem_inode_info *p = (struct shmem_inode_info *) foo;
 
@@ -2344,9 +2343,7 @@ static int init_inodecache(void)
 {
        shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
                                sizeof(struct shmem_inode_info),
-                               0, 0, init_once);
-       if (shmem_inode_cachep == NULL)
-               return -ENOMEM;
+                               0, SLAB_PANIC, init_once);
        return 0;
 }
 
@@ -2464,6 +2461,10 @@ static int __init init_tmpfs(void)
 {
        int error;
 
+       error = bdi_init(&shmem_backing_dev_info);
+       if (error)
+               goto out4;
+
        error = init_inodecache();
        if (error)
                goto out3;
@@ -2488,6 +2489,8 @@ out1:
 out2:
        destroy_inodecache();
 out3:
+       bdi_destroy(&shmem_backing_dev_info);
+out4:
        shm_mnt = ERR_PTR(error);
        return error;
 }
@@ -2540,11 +2543,8 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
        d_instantiate(dentry, inode);
        inode->i_size = size;
        inode->i_nlink = 0;     /* It is unlinked */
-       file->f_path.mnt = mntget(shm_mnt);
-       file->f_path.dentry = dentry;
-       file->f_mapping = inode->i_mapping;
-       file->f_op = &shmem_file_operations;
-       file->f_mode = FMODE_WRITE | FMODE_READ;
+       init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
+                       &shmem_file_operations);
        return file;
 
 close_file:
index e34bcb87a6ee19c7fadaa6a0f9ccbb5e956e8b79..3ce9bc024d676c9db1f58a298d5aacc5f1d9c6fa 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -267,11 +267,10 @@ struct array_cache {
        unsigned int batchcount;
        unsigned int touched;
        spinlock_t lock;
-       void *entry[0]; /*
+       void *entry[];  /*
                         * Must have this definition in here for the proper
                         * alignment of array_cache. Also simplifies accessing
                         * the entries.
-                        * [0] is for gcc 2.95. It should really be [].
                         */
 };
 
@@ -408,7 +407,7 @@ struct kmem_cache {
        unsigned int dflags;            /* dynamic flags */
 
        /* constructor func */
-       void (*ctor) (void *, struct kmem_cache *, unsigned long);
+       void (*ctor)(struct kmem_cache *, void *);
 
 /* 5) cache creation/removal */
        const char *name;
@@ -2129,7 +2128,7 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
 struct kmem_cache *
 kmem_cache_create (const char *name, size_t size, size_t align,
        unsigned long flags,
-       void (*ctor)(void*, struct kmem_cache *, unsigned long))
+       void (*ctor)(struct kmem_cache *, void *))
 {
        size_t left_over, slab_size, ralign;
        struct kmem_cache *cachep = NULL, *pc;
@@ -2636,8 +2635,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
                 * They must also be threaded.
                 */
                if (cachep->ctor && !(cachep->flags & SLAB_POISON))
-                       cachep->ctor(objp + obj_offset(cachep), cachep,
-                                    0);
+                       cachep->ctor(cachep, objp + obj_offset(cachep));
 
                if (cachep->flags & SLAB_RED_ZONE) {
                        if (*dbg_redzone2(cachep, objp) != RED_INACTIVE)
@@ -2653,7 +2651,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
                                         cachep->buffer_size / PAGE_SIZE, 0);
 #else
                if (cachep->ctor)
-                       cachep->ctor(objp, cachep, 0);
+                       cachep->ctor(cachep, objp);
 #endif
                slab_bufctl(slabp)[i] = i + 1;
        }
@@ -3078,7 +3076,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
 #endif
        objp += obj_offset(cachep);
        if (cachep->ctor && cachep->flags & SLAB_POISON)
-               cachep->ctor(objp, cachep, 0);
+               cachep->ctor(cachep, objp);
 #if ARCH_SLAB_MINALIGN
        if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) {
                printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n",
index de5d5563a46c624c82290f0c6591428d1a4fd1c2..5bc2ceb692ec94925340e0b65ce4cb8695e2cee1 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -499,12 +499,12 @@ struct kmem_cache {
        unsigned int size, align;
        unsigned long flags;
        const char *name;
-       void (*ctor)(void *, struct kmem_cache *, unsigned long);
+       void (*ctor)(struct kmem_cache *, void *);
 };
 
 struct kmem_cache *kmem_cache_create(const char *name, size_t size,
        size_t align, unsigned long flags,
-       void (*ctor)(void*, struct kmem_cache *, unsigned long))
+       void (*ctor)(struct kmem_cache *, void *))
 {
        struct kmem_cache *c;
 
@@ -548,7 +548,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
                b = slob_new_page(flags, get_order(c->size), node);
 
        if (c->ctor)
-               c->ctor(b, c, 0);
+               c->ctor(c, b);
 
        return b;
 }
index f426f9bc644b992fd12ec535ac8510b93682fe0c..e29a42988c78ca17d9594c2cb9fdb3cb87c257d0 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -980,7 +980,7 @@ __setup("slub_debug", setup_slub_debug);
 
 static unsigned long kmem_cache_flags(unsigned long objsize,
        unsigned long flags, const char *name,
-       void (*ctor)(void *, struct kmem_cache *, unsigned long))
+       void (*ctor)(struct kmem_cache *, void *))
 {
        /*
         * The page->offset field is only 16 bit wide. This is an offset
@@ -1027,7 +1027,7 @@ static inline int check_object(struct kmem_cache *s, struct page *page,
 static inline void add_full(struct kmem_cache_node *n, struct page *page) {}
 static inline unsigned long kmem_cache_flags(unsigned long objsize,
        unsigned long flags, const char *name,
-       void (*ctor)(void *, struct kmem_cache *, unsigned long))
+       void (*ctor)(struct kmem_cache *, void *))
 {
        return flags;
 }
@@ -1071,7 +1071,7 @@ static void setup_object(struct kmem_cache *s, struct page *page,
 {
        setup_object_debug(s, page, object);
        if (unlikely(s->ctor))
-               s->ctor(object, s, 0);
+               s->ctor(s, object);
 }
 
 static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
@@ -1085,9 +1085,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
 
        BUG_ON(flags & GFP_SLAB_BUG_MASK);
 
-       if (flags & __GFP_WAIT)
-               local_irq_enable();
-
        page = allocate_slab(s,
                flags & (GFP_RECLAIM_MASK | GFP_CONSTRAINT_MASK), node);
        if (!page)
@@ -1120,8 +1117,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
        page->freelist = start;
        page->inuse = 0;
 out:
-       if (flags & __GFP_WAIT)
-               local_irq_disable();
        return page;
 }
 
@@ -1505,7 +1500,14 @@ new_slab:
                goto load_freelist;
        }
 
+       if (gfpflags & __GFP_WAIT)
+               local_irq_enable();
+
        new = new_slab(s, gfpflags, node);
+
+       if (gfpflags & __GFP_WAIT)
+               local_irq_disable();
+
        if (new) {
                c = get_cpu_slab(s, smp_processor_id());
                if (c->page) {
@@ -2039,12 +2041,6 @@ static struct kmem_cache_node *early_kmem_cache_node_alloc(gfp_t gfpflags,
        init_kmem_cache_node(n);
        atomic_long_inc(&n->nr_slabs);
        add_partial(n, page);
-
-       /*
-        * new_slab() disables interupts. If we do not reenable interrupts here
-        * then bootup would continue with interrupts disabled.
-        */
-       local_irq_enable();
        return n;
 }
 
@@ -2215,7 +2211,7 @@ static int calculate_sizes(struct kmem_cache *s)
 static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags,
                const char *name, size_t size,
                size_t align, unsigned long flags,
-               void (*ctor)(void *, struct kmem_cache *, unsigned long))
+               void (*ctor)(struct kmem_cache *, void *))
 {
        memset(s, 0, kmem_size);
        s->name = name;
@@ -2805,7 +2801,7 @@ static int slab_unmergeable(struct kmem_cache *s)
 
 static struct kmem_cache *find_mergeable(size_t size,
                size_t align, unsigned long flags, const char *name,
-               void (*ctor)(void *, struct kmem_cache *, unsigned long))
+               void (*ctor)(struct kmem_cache *, void *))
 {
        struct kmem_cache *s;
 
@@ -2846,7 +2842,7 @@ static struct kmem_cache *find_mergeable(size_t size,
 
 struct kmem_cache *kmem_cache_create(const char *name, size_t size,
                size_t align, unsigned long flags,
-               void (*ctor)(void *, struct kmem_cache *, unsigned long))
+               void (*ctor)(struct kmem_cache *, void *))
 {
        struct kmem_cache *s;
 
index d034b2128d2b09d5182e724a4e655a97804803d0..a65eff8a517af30716ffb863b9866098abeccc3d 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -28,6 +28,7 @@
 #include <linux/percpu.h>
 #include <linux/cpu.h>
 #include <linux/notifier.h>
+#include <linux/backing-dev.h>
 
 /* How many pages do we try to swap or page in/out together? */
 int page_cluster;
@@ -547,6 +548,10 @@ void __init swap_setup(void)
 {
        unsigned long megs = num_physpages >> (20 - PAGE_SHIFT);
 
+#ifdef CONFIG_SWAP
+       bdi_init(swapper_space.backing_dev_info);
+#endif
+
        /* Use a smaller cluster for small-memory machines */
        if (megs < 16)
                page_cluster = 2;
index 8803471593fd7135ded6359d2a249c39a0d29815..d436a9c82db7739618dee05886c0088aaea7728a 100644 (file)
@@ -66,24 +66,19 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
        if (!dentry)
                goto put_memory;
 
-       error = -ENFILE;
-       file = get_empty_filp();
-       if (!file)
-               goto put_dentry;
-
        error = -ENOSPC;
        inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0);
        if (!inode)
-               goto close_file;
+               goto put_dentry;
 
        d_instantiate(dentry, inode);
-       inode->i_nlink = 0;     /* It is unlinked */
+       error = -ENFILE;
+       file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
+                       &ramfs_file_operations);
+       if (!file)
+               goto put_dentry;
 
-       file->f_path.mnt = mntget(shm_mnt);
-       file->f_path.dentry = dentry;
-       file->f_mapping = inode->i_mapping;
-       file->f_op = &ramfs_file_operations;
-       file->f_mode = FMODE_WRITE | FMODE_READ;
+       inode->i_nlink = 0;     /* It is unlinked */
 
        /* notify everyone as to the change of file size */
        error = do_truncate(dentry, size, 0, file);
index 5cdfbc1a59fdce4e1a1346ef8c9ddf97f159777d..cadc15653ddeeaa311c80f794b6a564ae2f36fc8 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/backing-dev.h>
 #include <linux/mm.h>
 #include <linux/swap.h>
 #include <linux/module.h>
@@ -72,6 +73,8 @@ void cancel_dirty_page(struct page *page, unsigned int account_size)
                struct address_space *mapping = page->mapping;
                if (mapping && mapping_cap_account_dirty(mapping)) {
                        dec_zone_page_state(page, NR_FILE_DIRTY);
+                       dec_bdi_stat(mapping->backing_dev_info,
+                                       BDI_RECLAIMABLE);
                        if (account_size)
                                task_io_account_cancelled_write(account_size);
                }
index bbd194630c5b0c16dd550d21b81fb2b0865c3538..e1471385d0014a79e4e7834b1c6e1f46c80cba1e 100644 (file)
@@ -1108,8 +1108,6 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
        unsigned long nr_to_scan;
        unsigned long nr_reclaimed = 0;
 
-       atomic_inc(&zone->reclaim_in_progress);
-
        /*
         * Add one to `nr_to_scan' just to make sure that the kernel will
         * slowly sift through the active list.
@@ -1148,8 +1146,6 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
        }
 
        throttle_vm_writeout(sc->gfp_mask);
-
-       atomic_dec(&zone->reclaim_in_progress);
        return nr_reclaimed;
 }
 
@@ -1187,7 +1183,7 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
 
                note_zone_scanning_priority(zone, priority);
 
-               if (zone->all_unreclaimable && priority != DEF_PRIORITY)
+               if (zone_is_all_unreclaimable(zone) && priority != DEF_PRIORITY)
                        continue;       /* Let kswapd poll it */
 
                sc->all_unreclaimable = 0;
@@ -1368,7 +1364,8 @@ loop_again:
                        if (!populated_zone(zone))
                                continue;
 
-                       if (zone->all_unreclaimable && priority != DEF_PRIORITY)
+                       if (zone_is_all_unreclaimable(zone) &&
+                           priority != DEF_PRIORITY)
                                continue;
 
                        if (!zone_watermark_ok(zone, order, zone->pages_high,
@@ -1403,7 +1400,8 @@ loop_again:
                        if (!populated_zone(zone))
                                continue;
 
-                       if (zone->all_unreclaimable && priority != DEF_PRIORITY)
+                       if (zone_is_all_unreclaimable(zone) &&
+                                       priority != DEF_PRIORITY)
                                continue;
 
                        if (!zone_watermark_ok(zone, order, zone->pages_high,
@@ -1424,12 +1422,13 @@ loop_again:
                                                lru_pages);
                        nr_reclaimed += reclaim_state->reclaimed_slab;
                        total_scanned += sc.nr_scanned;
-                       if (zone->all_unreclaimable)
+                       if (zone_is_all_unreclaimable(zone))
                                continue;
                        if (nr_slab == 0 && zone->pages_scanned >=
                                (zone_page_state(zone, NR_ACTIVE)
                                + zone_page_state(zone, NR_INACTIVE)) * 6)
-                                       zone->all_unreclaimable = 1;
+                                       zone_set_flag(zone,
+                                                     ZONE_ALL_UNRECLAIMABLE);
                        /*
                         * If we've done a decent amount of scanning and
                         * the reclaim ratio is low, start doing writepage
@@ -1595,7 +1594,7 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio,
                if (!populated_zone(zone))
                        continue;
 
-               if (zone->all_unreclaimable && prio != DEF_PRIORITY)
+               if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY)
                        continue;
 
                /* For pass = 0 we don't shrink the active list */
@@ -1897,6 +1896,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
 int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
 {
        int node_id;
+       int ret;
 
        /*
         * Zone reclaim reclaims unmapped file backed pages and
@@ -1914,15 +1914,13 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
                        <= zone->min_slab_pages)
                return 0;
 
+       if (zone_is_all_unreclaimable(zone))
+               return 0;
+
        /*
-        * Avoid concurrent zone reclaims, do not reclaim in a zone that does
-        * not have reclaimable pages and if we should not delay the allocation
-        * then do not scan.
+        * Do not scan if the allocation should not be delayed.
         */
-       if (!(gfp_mask & __GFP_WAIT) ||
-               zone->all_unreclaimable ||
-               atomic_read(&zone->reclaim_in_progress) > 0 ||
-               (current->flags & PF_MEMALLOC))
+       if (!(gfp_mask & __GFP_WAIT) || (current->flags & PF_MEMALLOC))
                        return 0;
 
        /*
@@ -1934,6 +1932,12 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
        node_id = zone_to_nid(zone);
        if (node_state(node_id, N_CPU) && node_id != numa_node_id())
                return 0;
-       return __zone_reclaim(zone, gfp_mask, order);
+
+       if (zone_test_and_set_flag(zone, ZONE_RECLAIM_LOCKED))
+               return 0;
+       ret = __zone_reclaim(zone, gfp_mask, order);
+       zone_clear_flag(zone, ZONE_RECLAIM_LOCKED);
+
+       return ret;
 }
 #endif
index 3b5e9043e7db0887612ccd9ea1ce4cd6c04869ca..4651bf153f355998617b9657d0d02eb966d7c3e9 100644 (file)
@@ -704,7 +704,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
                   "\n  all_unreclaimable: %u"
                   "\n  prev_priority:     %i"
                   "\n  start_pfn:         %lu",
-                  zone->all_unreclaimable,
+                          zone_is_all_unreclaimable(zone),
                   zone->prev_priority,
                   zone->zone_start_pfn);
        seq_putc(m, '\n');
index 0803f305ed081c09d29d5c568ada9df7aeb27ee4..c680017f5c8e923f7b59a7d0fc146ed3d4351c8b 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/skbuff.h>
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
+#include <linux/key-type.h>
 #include <net/net_namespace.h>
 #include <net/sock.h>
 #include <net/af_rxrpc.h>
index 7e049ff6ae6045b2d3aae9433d8aef4cc8684563..9a8ff684da79b3c9c98bc7d61ea10290d54f05ff 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/skbuff.h>
-#include <linux/key.h>
+#include <linux/key-type.h>
 #include <linux/crypto.h>
 #include <net/sock.h>
 #include <net/af_rxrpc.h>
@@ -40,7 +40,6 @@ struct key_type key_type_rxrpc = {
        .destroy        = rxrpc_destroy,
        .describe       = rxrpc_describe,
 };
-
 EXPORT_SYMBOL(key_type_rxrpc);
 
 /*
@@ -330,5 +329,32 @@ error:
        _leave(" = -ENOMEM [ins %d]", ret);
        return -ENOMEM;
 }
-
 EXPORT_SYMBOL(rxrpc_get_server_data_key);
+
+/**
+ * rxrpc_get_null_key - Generate a null RxRPC key
+ * @keyname: The name to give the key.
+ *
+ * Generate a null RxRPC key that can be used to indicate anonymous security is
+ * required for a particular domain.
+ */
+struct key *rxrpc_get_null_key(const char *keyname)
+{
+       struct key *key;
+       int ret;
+
+       key = key_alloc(&key_type_rxrpc, keyname, 0, 0, current,
+                       KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA);
+       if (IS_ERR(key))
+               return key;
+
+       ret = key_instantiate_and_link(key, NULL, 0, NULL, NULL);
+       if (ret < 0) {
+               key_revoke(key);
+               key_put(key);
+               return ERR_PTR(ret);
+       }
+
+       return key;
+}
+EXPORT_SYMBOL(rxrpc_get_null_key);
index 81b26c5ffd4b443f1780555ba940c82820acce1f..f5cd96f5fe7421fbee8afcb33e0f558e99877e2a 100644 (file)
@@ -1228,7 +1228,6 @@ SCTP_STATIC __init int sctp_init(void)
        if (status)
                goto err_v6_add_protocol;
 
-       __unsafe(THIS_MODULE);
        status = 0;
 out:
        return status;
index 379b3a3907551f50d42776664d0bc66aafcfa671..540013ea86206e0aeb40d567fc6f1482f6238ba0 100644 (file)
@@ -258,7 +258,7 @@ static void sock_destroy_inode(struct inode *inode)
                        container_of(inode, struct socket_alloc, vfs_inode));
 }
 
-static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags)
+static void init_once(struct kmem_cache *cachep, void *foo)
 {
        struct socket_alloc *ei = (struct socket_alloc *)foo;
 
@@ -364,26 +364,26 @@ static int sock_alloc_fd(struct file **filep)
 
 static int sock_attach_fd(struct socket *sock, struct file *file)
 {
+       struct dentry *dentry;
        struct qstr name = { .name = "" };
 
-       file->f_path.dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name);
-       if (unlikely(!file->f_path.dentry))
+       dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name);
+       if (unlikely(!dentry))
                return -ENOMEM;
 
-       file->f_path.dentry->d_op = &sockfs_dentry_operations;
+       dentry->d_op = &sockfs_dentry_operations;
        /*
         * We dont want to push this dentry into global dentry hash table.
         * We pretend dentry is already hashed, by unsetting DCACHE_UNHASHED
         * This permits a working /proc/$pid/fd/XXX on sockets
         */
-       file->f_path.dentry->d_flags &= ~DCACHE_UNHASHED;
-       d_instantiate(file->f_path.dentry, SOCK_INODE(sock));
-       file->f_path.mnt = mntget(sock_mnt);
-       file->f_mapping = file->f_path.dentry->d_inode->i_mapping;
+       dentry->d_flags &= ~DCACHE_UNHASHED;
+       d_instantiate(dentry, SOCK_INODE(sock));
 
        sock->file = file;
-       file->f_op = SOCK_INODE(sock)->i_fop = &socket_file_ops;
-       file->f_mode = FMODE_READ | FMODE_WRITE;
+       init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
+                 &socket_file_ops);
+       SOCK_INODE(sock)->i_fop = &socket_file_ops;
        file->f_flags = O_RDWR;
        file->f_pos = 0;
        file->private_data = sock;
index c8433e8865aa63e7739fd5c0586fb977af2a207f..18f0a8dcc095d9506699f553c7630aaac363cd54 100644 (file)
@@ -842,7 +842,7 @@ static struct file_system_type rpc_pipe_fs_type = {
 };
 
 static void
-init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+init_once(struct kmem_cache * cachep, void *foo)
 {
        struct rpc_inode *rpci = (struct rpc_inode *) foo;
 
index dae7d30dca0f1886b450311ee0e3c959fc3d40da..59ad83caa210dd5d31af0bb76aa234e3dad0fca6 100755 (executable)
@@ -9,7 +9,7 @@ use strict;
 my $P = $0;
 $P =~ s@.*/@@g;
 
-my $V = '0.09';
+my $V = '0.10';
 
 use Getopt::Long qw(:config no_auto_abbrev);
 
@@ -212,6 +212,11 @@ sub ctx_block_level {
 
        return ctx_block_get($linenr, $remain, 0, '{', '}', 0);
 }
+sub ctx_statement_level {
+       my ($linenr, $remain, $off) = @_;
+
+       return ctx_block_get($linenr, $remain, 0, '(', ')', $off);
+}
 
 sub ctx_locate_comment {
        my ($first_line, $end_line) = @_;
@@ -255,13 +260,42 @@ sub ctx_has_comment {
        return ($cmt ne '');
 }
 
+sub ctx_expr_before {
+       my ($line) = @_;
+
+       ##print "CHECK<$line>\n";
+
+       my $pos = length($line) - 1;
+       my $count = 0;
+       my $c;
+
+       for (; $pos >= 0; $pos--) {
+               $c = substr($line, $pos, 1);
+               ##print "CHECK: c<$c> count<$count>\n";
+               if ($c eq ')') {
+                       $count++;
+               } elsif ($c eq '(') {
+                       last if (--$count == 0);
+               }
+       }
+
+       ##print "CHECK: result<" . substr($line, 0, $pos) . ">\n";
+
+       return substr($line, 0, $pos);
+}
+
 sub cat_vet {
        my ($vet) = @_;
+       my ($res, $coded);
 
-       $vet =~ s/\t/^I/;
-       $vet =~ s/$/\$/;
+       $res = '';
+       while ($vet =~ /([^[:cntrl:]]*)([[:cntrl:]])/g) {
+               $coded = sprintf("^%c", unpack('C', $2) + 64);
+               $res .= $1 . $coded;
+       }
+       $res =~ s/$/\$/;
 
-       return $vet;
+       return $res;
 }
 
 my @report = ();
@@ -310,8 +344,17 @@ sub process {
        my $first_line = 0;
 
        my $Ident       = qr{[A-Za-z\d_]+};
-       my $Storage     = qr{extern|static};
-       my $Sparse      = qr{__user|__kernel|__force|__iomem|__must_check|__init_refok};
+       my $Storage     = qr{extern|static|asmlinkage};
+       my $Sparse      = qr{
+                               __user|
+                               __kernel|
+                               __force|
+                               __iomem|
+                               __must_check|
+                               __init_refok|
+                               fastcall
+                       }x;
+       my $Inline      = qr{inline|__always_inline|noinline};
        my $NonptrType  = qr{
                                \b
                                (?:const\s+)?
@@ -345,11 +388,18 @@ sub process {
                                (?:\s+$Sparse)*
                          }x;
        my $Declare     = qr{(?:$Storage\s+)?$Type};
-       my $Attribute   = qr{const|__read_mostly|__init|__initdata|__meminit};
-
+       my $Attribute   = qr{
+                               const|
+                               __read_mostly|
+                               __(?:mem|cpu|dev|)(?:initdata|init)
+                         }x;
        my $Member      = qr{->$Ident|\.$Ident|\[[^]]*\]};
        my $Lval        = qr{$Ident(?:$Member)*};
 
+       # Possible bare types.
+       my @bare = ();
+       my $Bare = $NonptrType;
+
        # Pre-scan the patch looking for any __setup documentation.
        my @setup_docs = ();
        my $setup_docs = 0;
@@ -477,7 +527,11 @@ sub process {
                next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
 
 #trailing whitespace
-               if ($line =~ /^\+.*\S\s+$/ || $line =~ /^\+\s+$/) {
+               if ($line =~ /^\+.*\015/) {
+                       my $herevet = "$here\n" . cat_vet($line) . "\n";
+                       ERROR("DOS line endings\n" . $herevet);
+
+               } elsif ($line =~ /^\+.*\S\s+$/ || $line =~ /^\+\s+$/) {
                        my $herevet = "$here\n" . cat_vet($line) . "\n";
                        ERROR("trailing whitespace\n" . $herevet);
                }
@@ -509,6 +563,30 @@ sub process {
 # Standardise the strings and chars within the input to simplify matching.
                $line = sanitise_line($line);
 
+# Check for potential 'bare' types
+               if ($realcnt &&
+                   $line !~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?$Type\b/ &&
+                   $line !~ /$Ident:\s*$/ &&
+                   $line !~ /^.\s*$Ident\s*\(/ &&
+                   ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?($Ident)\b/ ||
+                    $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/)) {
+                       my $possible = $1;
+                       if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
+                           $possible ne 'goto' && $possible ne 'return' &&
+                           $possible ne 'struct' && $possible ne 'enum' &&
+                           $possible ne 'case' && $possible ne 'else' &&
+                           $possible ne 'typedef') {
+                               #print "POSSIBLE<$possible>\n";
+                               push(@bare, $possible);
+                               my $bare = join("|", @bare);
+                               $Bare   = qr{
+                                               \b(?:$bare)\b
+                                               (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
+                                               (?:\s+$Sparse)*
+                                         }x;
+                       }
+               }
+
 #
 # Checks which may be anchored in the context.
 #
@@ -531,18 +609,19 @@ sub process {
                                }
                        }
                        if ($err ne '') {
-                               ERROR("switch and case should be at the same indent\n$hereline\n$err\n");
+                               ERROR("switch and case should be at the same indent\n$hereline$err");
                        }
                }
 
 # if/while/etc brace do not go on next line, unless defining a do while loop,
 # or if that brace on the next line is for something else
                if ($line =~ /\b(?:(if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.#/) {
-                       my @ctx = ctx_statement($linenr, $realcnt, 0);
+                       my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
                        my $ctx_ln = $linenr + $#ctx + 1;
                        my $ctx_cnt = $realcnt - $#ctx - 1;
                        my $ctx = join("\n", @ctx);
 
+                       # Skip over any removed lines in the context following statement.
                        while ($ctx_cnt > 0 && $lines[$ctx_ln - 1] =~ /^-/) {
                                $ctx_ln++;
                                $ctx_cnt--;
@@ -553,6 +632,13 @@ sub process {
                                ERROR("That open brace { should be on the previous line\n" .
                                        "$here\n$ctx\n$lines[$ctx_ln - 1]");
                        }
+                       if ($level == 0 && $ctx =~ /\)\s*\;\s*$/ && defined $lines[$ctx_ln - 1]) {
+                               my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]);
+                               if ($nindent > $indent) {
+                                       WARN("Trailing semicolon indicates no statements, indent implies otherwise\n" .
+                                               "$here\n$ctx\n$lines[$ctx_ln - 1]");
+                               }
+                       }
                }
 
 #ignore lines not being added
@@ -619,7 +705,7 @@ sub process {
 # check for new typedefs, only function parameters and sparse annotations
 # make sense.
                if ($line =~ /\btypedef\s/ &&
-                   $line !~ /\btypedef\s+$Type\s+\(\s*\*$Ident\s*\)\s*\(/ &&
+                   $line !~ /\btypedef\s+$Type\s+\(\s*\*?$Ident\s*\)\s*\(/ &&
                    $line !~ /\b__bitwise(?:__|)\b/) {
                        WARN("do not add new typedefs\n" . $herecurr);
                }
@@ -633,11 +719,11 @@ sub process {
                        ERROR("\"(foo $1 )\" should be \"(foo $1)\"\n" .
                                $herecurr);
 
-               } elsif ($line =~ m{$NonptrType(\*+)(?:\s+$Attribute)?\s+[A-Za-z\d_]+}) {
+               } elsif ($line =~ m{$NonptrType(\*+)(?:\s+(?:$Attribute|$Sparse))?\s+[A-Za-z\d_]+}) {
                        ERROR("\"foo$1 bar\" should be \"foo $1bar\"\n" .
                                $herecurr);
 
-               } elsif ($line =~ m{$NonptrType\s+(\*+)(?!\s+$Attribute)\s+[A-Za-z\d_]+}) {
+               } elsif ($line =~ m{$NonptrType\s+(\*+)(?!\s+(?:$Attribute|$Sparse))\s+[A-Za-z\d_]+}) {
                        ERROR("\"foo $1 bar\" should be \"foo $1bar\"\n" .
                                $herecurr);
                }
@@ -693,7 +779,13 @@ sub process {
                $opline = expand_tabs($opline);
                $opline =~ s/^./ /;
                if (!($line=~/\#\s*include/)) {
-                       my @elements = split(/(<<=|>>=|<=|>=|==|!=|\+=|-=|\*=|\/=|%=|\^=|\|=|&=|=>|->|<<|>>|<|>|=|!|~|&&|\|\||,|\^|\+\+|--|;|&|\||\+|-|\*|\/\/|\/)/, $opline);
+                       my $ops = qr{
+                               <<=|>>=|<=|>=|==|!=|
+                               \+=|-=|\*=|\/=|%=|\^=|\|=|&=|
+                               =>|->|<<|>>|<|>|=|!|~|
+                               &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/
+                       }x;
+                       my @elements = split(/($ops|;)/, $opline);
                        my $off = 0;
                        for (my $n = 0; $n < $#elements; $n += 2) {
                                $off += length($elements[$n]);
@@ -733,7 +825,60 @@ sub process {
                                my $ptr = (" " x $off) . "^";
                                my $hereptr = "$hereline$ptr\n";
 
-                               ##print "<$s1:$op:$s2> <$elements[$n]:$elements[$n + 1]:$elements[$n + 2]>\n";
+                               # Classify operators into binary, unary, or
+                               # definitions (* only) where they have more
+                               # than one mode.
+                               my $unary_ctx = $prevline . $ca;
+                               $unary_ctx =~ s/^./ /;
+                               my $is_unary = 0;
+                               my $Unary = qr{
+                                       (?:
+                                               ^|;|,|$ops|\(|\?|:|
+                                               \(\s*$Type\s*\)|
+                                               $Type|
+                                               return|case|else|
+                                               \{|\}|
+                                               \[|
+                                               ^.\#\s*define\s+$Ident\s*(?:\([^\)]*\))?|
+                                               ^.\#\s*else|
+                                               ^.\#\s*endif|
+                                               ^.\#\s*(?:if|ifndef|ifdef)\b.*
+                                       )\s*(?:|\\)\s*$
+                               }x;
+                               my $UnaryFalse = qr{
+                                       sizeof\s*\(\s*$Type\s*\)\s*$
+                               }x;
+                               my $UnaryDefine = qr{
+                                        (?:$Type|$Bare)\s*|
+                                        (?:$Type|$Bare).*,\s*\**
+                               }x;
+                               if ($op eq '-' || $op eq '&' || $op eq '*') {
+                                       # An operator is binary if the left hand
+                                       # side is a value.  Pick out the known
+                                       # non-values.
+                                       if ($unary_ctx =~ /$Unary$/s &&
+                                           $unary_ctx !~ /$UnaryFalse$/s) {
+                                               $is_unary = 1;
+
+                                       # Special handling for ')' check if this
+                                       # brace represents a conditional, if so
+                                       # we are unary.
+                                       } elsif ($unary_ctx =~ /\)\s*$/) {
+                                               my $before = ctx_expr_before($unary_ctx);
+                                               if ($before =~ /(?:for|if|while)\s*$/) {
+                                                       $is_unary = 1;
+                                               }
+                                       }
+
+                                       # Check for type definition for of '*'.
+                                       if ($op eq '*' && $unary_ctx =~ /$UnaryDefine$/) {
+                                               $is_unary = 2;
+                                       }
+                               }
+
+                               #if ($op eq '-' || $op eq '&' || $op eq '*') {
+                               #       print "UNARY: <$is_unary $a:$op:$c> <$ca:$op:$cc> <$unary_ctx>\n";
+                               #}
 
                                # ; should have either the end of line or a space or \ after it
                                if ($op eq ';') {
@@ -757,9 +902,16 @@ sub process {
                                                ERROR("need space after that '$op' $at\n" . $hereptr);
                                        }
 
-                               # unary ! and unary ~ are allowed no space on the right
-                               } elsif ($op eq '!' or $op eq '~') {
-                                       if ($ctx !~ /[WOEB]x./) {
+                               # '*' as part of a type definition -- reported already.
+                               } elsif ($op eq '*' && $is_unary == 2) {
+                                       #warn "'*' is part of type\n";
+
+                               # unary operators should have a space before and
+                               # none after.  May be left adjacent to another
+                               # unary operator, or a cast
+                               } elsif ($op eq '!' || $op eq '~' ||
+                                        ($is_unary && ($op eq '*' || $op eq '-' || $op eq '&'))) {
+                                       if ($ctx !~ /[WEB]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
                                                ERROR("need space before that '$op' $at\n" . $hereptr);
                                        }
                                        if ($ctx =~ /.xW/) {
@@ -775,39 +927,13 @@ sub process {
                                                ERROR("no space before that '$op' $at\n" . $hereptr);
                                        }
 
-                               # & is both unary and binary
-                               # unary:
-                               #       a &b
-                               # binary (consistent spacing):
-                               #       a&b             OK
-                               #       a & b           OK
-                               #
-                               # boiling down to: if there is a space on the right then there
-                               # should be one on the left.
-                               #
-                               # - is the same
-                               #
-                               } elsif ($op eq '&' or $op eq '-') {
-                                       if ($ctx !~ /VxV|[EW]x[WE]|[EWB]x[VO]/) {
-                                               ERROR("need space before that '$op' $at\n" . $hereptr);
-                                       }
-
-                               # * is the same as & only adding:
-                               # type:
-                               #       (foo *)
-                               #       (foo **)
-                               #
-                               } elsif ($op eq '*') {
-                                       if ($ca !~ /$Type$/ && $cb !~ /(\*$;|$;\*)/ &&
-                                           $ctx !~ /VxV|[EW]x[WE]|[EWB]x[VO]|OxV|WxB|BxB/) {
-                                               ERROR("need space before that '$op' $at\n" . $hereptr);
-                                       }
-
                                # << and >> may either have or not have spaces both sides
-                               } elsif ($op eq '<<' or $op eq '>>' or $op eq '+' or $op eq '/' or
-                                        $op eq '^' or $op eq '|')
+                               } elsif ($op eq '<<' or $op eq '>>' or
+                                        $op eq '&' or $op eq '^' or $op eq '|' or
+                                        $op eq '+' or $op eq '-' or
+                                        $op eq '*' or $op eq '/')
                                {
-                                       if ($ctx !~ /VxV|WxW|VxE|WxE/) {
+                                       if ($ctx !~ /VxV|WxW|VxE|WxE|VxO/) {
                                                ERROR("need consistent spacing around '$op' $at\n" .
                                                        $hereptr);
                                        }
@@ -865,10 +991,12 @@ sub process {
                }
 
 # check spacing on paretheses
-               if ($line =~ /\(\s/ && $line !~ /\(\s*$/) {
+               if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ &&
+                   $line !~ /for\s*\(\s+;/) {
                        ERROR("no space after that open parenthesis '('\n" . $herecurr);
                }
-               if ($line =~ /\s\)/) {
+               if ($line =~ /\s\)/ && $line !~ /^.\s*\)/ &&
+                   $line !~ /for\s*\(.*;\s+\)/) {
                        ERROR("no space before that close parenthesis ')'\n" . $herecurr);
                }
 
@@ -926,10 +1054,10 @@ sub process {
 # multi-statement macros should be enclosed in a do while loop, grab the
 # first statement and ensure its the whole macro if its not enclosed
 # in a known goot container
-               if (($prevline=~/\#define.*\\/) and
-                  !($prevline=~/do\s+{/) and !($prevline=~/\(\{/) and
-                  !($line=~/do.*{/) and !($line=~/\(\{/) and
-                  !($line=~/^.\s*$Declare\s/)) {
+               if ($prevline =~ /\#define.*\\/ &&
+                  $prevline !~/(?:do\s+{|\(\{|\{)/ &&
+                  $line !~ /(?:do\s+{|\(\{|\{)/ &&
+                  $line !~ /^.\s*$Declare\s/) {
                        # Grab the first statement, if that is the entire macro
                        # its ok.  This may start either on the #define line
                        # or the one below.
@@ -1027,6 +1155,11 @@ sub process {
                        WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr);
                }
 
+# SPIN_LOCK_UNLOCKED & RW_LOCK_UNLOCKED are deprecated
+               if ($line =~ /\b(SPIN_LOCK_UNLOCKED|RW_LOCK_UNLOCKED)/) {
+                       ERROR("Use of $1 is deprecated: see Documentation/spinlocks.txt\n" . $herecurr);
+               }
+
 # warn about #if 0
                if ($line =~ /^.#\s*if\s+0\b/) {
                        CHK("if this code is redundant consider removing it\n" .
@@ -1073,8 +1206,8 @@ sub process {
 
 # check the location of the inline attribute, that it is between
 # storage class and type.
-               if ($line =~ /$Type\s+(?:inline|__always_inline|noinline)\b/ ||
-                   $line =~ /\b(?:inline|__always_inline|noinline)\s+$Storage/) {
+               if ($line =~ /\b$Type\s+$Inline\b/ ||
+                   $line =~ /\b$Inline\s+$Storage\b/) {
                        ERROR("inline keyword should sit between storage class and type\n" . $herecurr);
                }
 
@@ -1091,6 +1224,11 @@ sub process {
                                CHK("__setup appears un-documented -- check Documentation/kernel-parameters.txt\n" . $herecurr);
                        }
                }
+
+# check for pointless casting of kmalloc return
+               if ($line =~ /\*\s*\)\s*k[czm]alloc\b/) {
+                       WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
+               }
        }
 
        if ($chk_patch && !$is_patch) {
index 663158627155151d60315059a81f1b02d68af697..b458e2acb4acf3e035d7e3bd66a4b4687e8d5965 100755 (executable)
@@ -78,6 +78,9 @@ my (@stack, $re, $x, $xs);
                #     pair for larger users. -- PFM.
                #a00048e0:       d4fc40f0        addi.l  r15,-240,r15
                $re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o;
+       } elsif ($arch =~ /^blackfin$/) {
+               #   0:   00 e8 38 01     LINK 0x4e0;
+               $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o;
        } else {
                print("wrong or unknown architecture\n");
                exit
index 1f5835115cad03b3932dd12225fbe1f3dced2a69..1d1401807e95809a43e2b72c84ee17d4be2854e8 100755 (executable)
@@ -5,6 +5,7 @@ use strict;
 ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved        ##
 ## Copyright (C) 2000, 1  Tim Waugh <twaugh@redhat.com>          ##
 ## Copyright (C) 2001  Simon Huggins                             ##
+## Copyright (C) 2005-2007  Randy Dunlap                         ##
 ##                                                              ##
 ## #define enhancements by Armin Kuster <akuster@mvista.com>    ##
 ## Copyright (c) 2000 MontaVista Software, Inc.                         ##
@@ -161,7 +162,7 @@ my $type_constant = '\%([-_\w]+)';
 my $type_func = '(\w+)\(\)';
 my $type_param = '\@(\w+)';
 my $type_struct = '\&((struct\s*)*[_\w]+)';
-my $type_struct_xml = '\\\amp;((struct\s*)*[_\w]+)';
+my $type_struct_xml = '\\&amp;((struct\s*)*[_\w]+)';
 my $type_env = '(\$\w+)';
 
 # Output conversion substitutions.
@@ -173,7 +174,9 @@ my %highlights_html = ( $type_constant, "<i>\$1</i>",
                        $type_struct_xml, "<i>\$1</i>",
                        $type_env, "<b><i>\$1</i></b>",
                        $type_param, "<tt><b>\$1</b></tt>" );
-my $blankline_html = "<p>";
+my $local_lt = "\\\\\\\\lt:";
+my $local_gt = "\\\\\\\\gt:";
+my $blankline_html = $local_lt . "p" . $local_gt;      # was "<p>"
 
 # XML, docbook format
 my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>",
@@ -391,17 +394,19 @@ sub output_highlight {
 #      confess "output_highlight got called with no args?\n";
 #   }
 
+    if ($output_mode eq "html") {
+       $contents = local_unescape($contents);
+       # convert data read & converted thru xml_escape() into &xyz; format:
+       $contents =~ s/\\\\\\/&/g;
+    }
 #   print STDERR "contents b4:$contents\n";
     eval $dohighlight;
     die $@ if $@;
-    if ($output_mode eq "html") {
-       $contents =~ s/\\\\//;
-    }
 #   print STDERR "contents af:$contents\n";
 
     foreach $line (split "\n", $contents) {
        if ($line eq ""){
-           print $lineprefix, $blankline;
+           print $lineprefix, local_unescape($blankline);
        } else {
            $line =~ s/\\\\\\/\&/g;
            if ($output_mode eq "man" && substr($line, 0, 1) eq ".") {
@@ -1752,7 +1757,13 @@ sub process_state3_type($$) {
     }
 }
 
-# replace <, >, and &
+# xml_escape: replace <, >, and & in the text stream;
+#
+# however, formatting controls that are generated internally/locally in the
+# kernel-doc script are not escaped here; instead, they begin life like
+# $blankline_html (4 of '\' followed by a mnemonic + ':'), then these strings
+# are converted to their mnemonic-expected output, without the 4 * '\' & ':',
+# just before actual output; (this is done by local_unescape())
 sub xml_escape($) {
        my $text = shift;
        if (($output_mode eq "text") || ($output_mode eq "man")) {
@@ -1764,6 +1775,18 @@ sub xml_escape($) {
        return $text;
 }
 
+# convert local escape strings to html
+# local escape strings look like:  '\\\\menmonic:' (that's 4 backslashes)
+sub local_unescape($) {
+       my $text = shift;
+       if (($output_mode eq "text") || ($output_mode eq "man")) {
+               return $text;
+       }
+       $text =~ s/\\\\\\\\lt:/</g;
+       $text =~ s/\\\\\\\\gt:/>/g;
+       return $text;
+}
+
 sub process_file($) {
     my $file;
     my $identifier;
@@ -1903,7 +1926,7 @@ sub process_file($) {
        } elsif ($state == 4) {
                # Documentation block
                if (/$doc_block/) {
-                       dump_section($section, $contents);
+                       dump_section($section, xml_escape($contents));
                        output_intro({'sectionlist' => \@sectionlist,
                                      'sections' => \%sections });
                        $contents = "";
@@ -1923,7 +1946,7 @@ sub process_file($) {
                }
                elsif (/$doc_end/)
                {
-                       dump_section($section, $contents);
+                       dump_section($section, xml_escape($contents));
                        output_intro({'sectionlist' => \@sectionlist,
                                      'sections' => \%sections });
                        $contents = "";
index 460e5c9cf496c725b830d8f34bc8dcf0bd8bff56..8086e61058e373e68054dd166be2e942f4db2e4c 100644 (file)
@@ -74,15 +74,25 @@ config SECURITY_NETWORK_XFRM
          If you are unsure how to answer this question, answer N.
 
 config SECURITY_CAPABILITIES
-       tristate "Default Linux Capabilities"
+       bool "Default Linux Capabilities"
        depends on SECURITY
        help
          This enables the "default" Linux capabilities functionality.
          If you are unsure how to answer this question, answer Y.
 
+config SECURITY_FILE_CAPABILITIES
+       bool "File POSIX Capabilities (EXPERIMENTAL)"
+       depends on (SECURITY=n || SECURITY_CAPABILITIES!=n) && EXPERIMENTAL
+       default n
+       help
+         This enables filesystem capabilities, allowing you to give
+         binaries a subset of root's powers without using setuid 0.
+
+         If in doubt, answer N.
+
 config SECURITY_ROOTPLUG
-       tristate "Root Plug Support"
-       depends on USB && SECURITY
+       bool "Root Plug Support"
+       depends on USB=y && SECURITY
        help
          This is a sample LSM module that should only be used as such.
          It prevents any programs running with egid == 0 if a specific
index 38296a0054653f9180bd554f167e077bb311a35a..9e99f36a8b5c1f023533c0fab0ee0530e021075a 100644 (file)
@@ -8,7 +8,6 @@
  *
  */
 
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/security.h>
@@ -38,7 +37,13 @@ static struct security_operations capability_ops = {
 
        .inode_setxattr =               cap_inode_setxattr,
        .inode_removexattr =            cap_inode_removexattr,
+       .inode_need_killpriv =          cap_inode_need_killpriv,
+       .inode_killpriv =               cap_inode_killpriv,
 
+       .task_kill =                    cap_task_kill,
+       .task_setscheduler =            cap_task_setscheduler,
+       .task_setioprio =               cap_task_setioprio,
+       .task_setnice =                 cap_task_setnice,
        .task_post_setuid =             cap_task_post_setuid,
        .task_reparent_to_init =        cap_task_reparent_to_init,
 
@@ -52,7 +57,6 @@ static int secondary;
 
 static int capability_disable;
 module_param_named(disable, capability_disable, int, 0);
-MODULE_PARM_DESC(disable, "To disable capabilities module set disable = 1");
 
 static int __init capability_init (void)
 {
@@ -75,26 +79,4 @@ static int __init capability_init (void)
        return 0;
 }
 
-static void __exit capability_exit (void)
-{
-       if (capability_disable)
-               return;
-       /* remove ourselves from the security framework */
-       if (secondary) {
-               if (mod_unreg_security (KBUILD_MODNAME, &capability_ops))
-                       printk (KERN_INFO "Failure unregistering capabilities "
-                               "with primary module.\n");
-               return;
-       }
-
-       if (unregister_security (&capability_ops)) {
-               printk (KERN_INFO
-                       "Failure unregistering capabilities with the kernel\n");
-       }
-}
-
 security_initcall (capability_init);
-module_exit (capability_exit);
-
-MODULE_DESCRIPTION("Standard Linux Capabilities Security Module");
-MODULE_LICENSE("GPL");
index 7520361663e88eef2dc96cf42e3c62571fe7a4d7..778cb0cfc5d892fa9ae3f001d35d2560779dd15c 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/ptrace.h>
 #include <linux/xattr.h>
 #include <linux/hugetlb.h>
+#include <linux/mount.h>
 
 int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
 {
@@ -29,8 +30,6 @@ int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
        return 0;
 }
 
-EXPORT_SYMBOL(cap_netlink_send);
-
 int cap_netlink_recv(struct sk_buff *skb, int cap)
 {
        if (!cap_raised(NETLINK_CB(skb).eff_cap, cap))
@@ -108,14 +107,130 @@ void cap_capset_set (struct task_struct *target, kernel_cap_t *effective,
        target->cap_permitted = *permitted;
 }
 
+static inline void bprm_clear_caps(struct linux_binprm *bprm)
+{
+       cap_clear(bprm->cap_inheritable);
+       cap_clear(bprm->cap_permitted);
+       bprm->cap_effective = false;
+}
+
+#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
+
+int cap_inode_need_killpriv(struct dentry *dentry)
+{
+       struct inode *inode = dentry->d_inode;
+       int error;
+
+       if (!inode->i_op || !inode->i_op->getxattr)
+              return 0;
+
+       error = inode->i_op->getxattr(dentry, XATTR_NAME_CAPS, NULL, 0);
+       if (error <= 0)
+               return 0;
+       return 1;
+}
+
+int cap_inode_killpriv(struct dentry *dentry)
+{
+       struct inode *inode = dentry->d_inode;
+
+       if (!inode->i_op || !inode->i_op->removexattr)
+              return 0;
+
+       return inode->i_op->removexattr(dentry, XATTR_NAME_CAPS);
+}
+
+static inline int cap_from_disk(__le32 *caps, struct linux_binprm *bprm,
+                               int size)
+{
+       __u32 magic_etc;
+
+       if (size != XATTR_CAPS_SZ)
+               return -EINVAL;
+
+       magic_etc = le32_to_cpu(caps[0]);
+
+       switch ((magic_etc & VFS_CAP_REVISION_MASK)) {
+       case VFS_CAP_REVISION:
+               if (magic_etc & VFS_CAP_FLAGS_EFFECTIVE)
+                       bprm->cap_effective = true;
+               else
+                       bprm->cap_effective = false;
+               bprm->cap_permitted = to_cap_t( le32_to_cpu(caps[1]) );
+               bprm->cap_inheritable = to_cap_t( le32_to_cpu(caps[2]) );
+               return 0;
+       default:
+               return -EINVAL;
+       }
+}
+
+/* Locate any VFS capabilities: */
+static int get_file_caps(struct linux_binprm *bprm)
+{
+       struct dentry *dentry;
+       int rc = 0;
+       __le32 v1caps[XATTR_CAPS_SZ];
+       struct inode *inode;
+
+       if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) {
+               bprm_clear_caps(bprm);
+               return 0;
+       }
+
+       dentry = dget(bprm->file->f_dentry);
+       inode = dentry->d_inode;
+       if (!inode->i_op || !inode->i_op->getxattr)
+               goto out;
+
+       rc = inode->i_op->getxattr(dentry, XATTR_NAME_CAPS, &v1caps,
+                                                       XATTR_CAPS_SZ);
+       if (rc == -ENODATA || rc == -EOPNOTSUPP) {
+               /* no data, that's ok */
+               rc = 0;
+               goto out;
+       }
+       if (rc < 0)
+               goto out;
+
+       rc = cap_from_disk(v1caps, bprm, rc);
+       if (rc)
+               printk(KERN_NOTICE "%s: cap_from_disk returned %d for %s\n",
+                       __FUNCTION__, rc, bprm->filename);
+
+out:
+       dput(dentry);
+       if (rc)
+               bprm_clear_caps(bprm);
+
+       return rc;
+}
+
+#else
+int cap_inode_need_killpriv(struct dentry *dentry)
+{
+       return 0;
+}
+
+int cap_inode_killpriv(struct dentry *dentry)
+{
+       return 0;
+}
+
+static inline int get_file_caps(struct linux_binprm *bprm)
+{
+       bprm_clear_caps(bprm);
+       return 0;
+}
+#endif
+
 int cap_bprm_set_security (struct linux_binprm *bprm)
 {
-       /* Copied from fs/exec.c:prepare_binprm. */
+       int ret;
 
-       /* We don't have VFS support for capabilities yet */
-       cap_clear (bprm->cap_inheritable);
-       cap_clear (bprm->cap_permitted);
-       cap_clear (bprm->cap_effective);
+       ret = get_file_caps(bprm);
+       if (ret)
+               printk(KERN_NOTICE "%s: get_file_caps returned %d for %s\n",
+                       __FUNCTION__, ret, bprm->filename);
 
        /*  To support inheritance of root-permissions and suid-root
         *  executables under compatibility mode, we raise all three
@@ -131,9 +246,10 @@ int cap_bprm_set_security (struct linux_binprm *bprm)
                        cap_set_full (bprm->cap_permitted);
                }
                if (bprm->e_uid == 0)
-                       cap_set_full (bprm->cap_effective);
+                       bprm->cap_effective = true;
        }
-       return 0;
+
+       return ret;
 }
 
 void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
@@ -149,6 +265,7 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
        if (bprm->e_uid != current->uid || bprm->e_gid != current->gid ||
            !cap_issubset (new_permitted, current->cap_permitted)) {
                set_dumpable(current->mm, suid_dumpable);
+               current->pdeath_signal = 0;
 
                if (unsafe & ~LSM_UNSAFE_PTRACE_CAP) {
                        if (!capable(CAP_SETUID)) {
@@ -170,8 +287,8 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
         * capability rules */
        if (!is_init(current)) {
                current->cap_permitted = new_permitted;
-               current->cap_effective =
-                   cap_intersect (new_permitted, bprm->cap_effective);
+               current->cap_effective = bprm->cap_effective ?
+                               new_permitted : 0;
        }
 
        /* AUD: Audit candidate if current->cap_effective is set */
@@ -181,11 +298,15 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
 
 int cap_bprm_secureexec (struct linux_binprm *bprm)
 {
-       /* If/when this module is enhanced to incorporate capability
-          bits on files, the test below should be extended to also perform a 
-          test between the old and new capability sets.  For now,
-          it simply preserves the legacy decision algorithm used by
-          the old userland. */
+       if (current->uid != 0) {
+               if (bprm->cap_effective)
+                       return 1;
+               if (!cap_isclear(bprm->cap_permitted))
+                       return 1;
+               if (!cap_isclear(bprm->cap_inheritable))
+                       return 1;
+       }
+
        return (current->euid != current->uid ||
                current->egid != current->gid);
 }
@@ -193,7 +314,11 @@ int cap_bprm_secureexec (struct linux_binprm *bprm)
 int cap_inode_setxattr(struct dentry *dentry, char *name, void *value,
                       size_t size, int flags)
 {
-       if (!strncmp(name, XATTR_SECURITY_PREFIX,
+       if (!strcmp(name, XATTR_NAME_CAPS)) {
+               if (!capable(CAP_SETFCAP))
+                       return -EPERM;
+               return 0;
+       } else if (!strncmp(name, XATTR_SECURITY_PREFIX,
                     sizeof(XATTR_SECURITY_PREFIX) - 1)  &&
            !capable(CAP_SYS_ADMIN))
                return -EPERM;
@@ -202,7 +327,11 @@ int cap_inode_setxattr(struct dentry *dentry, char *name, void *value,
 
 int cap_inode_removexattr(struct dentry *dentry, char *name)
 {
-       if (!strncmp(name, XATTR_SECURITY_PREFIX,
+       if (!strcmp(name, XATTR_NAME_CAPS)) {
+               if (!capable(CAP_SETFCAP))
+                       return -EPERM;
+               return 0;
+       } else if (!strncmp(name, XATTR_SECURITY_PREFIX,
                     sizeof(XATTR_SECURITY_PREFIX) - 1)  &&
            !capable(CAP_SYS_ADMIN))
                return -EPERM;
@@ -299,6 +428,83 @@ int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid,
        return 0;
 }
 
+#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
+/*
+ * Rationale: code calling task_setscheduler, task_setioprio, and
+ * task_setnice, assumes that
+ *   . if capable(cap_sys_nice), then those actions should be allowed
+ *   . if not capable(cap_sys_nice), but acting on your own processes,
+ *     then those actions should be allowed
+ * This is insufficient now since you can call code without suid, but
+ * yet with increased caps.
+ * So we check for increased caps on the target process.
+ */
+static inline int cap_safe_nice(struct task_struct *p)
+{
+       if (!cap_issubset(p->cap_permitted, current->cap_permitted) &&
+           !__capable(current, CAP_SYS_NICE))
+               return -EPERM;
+       return 0;
+}
+
+int cap_task_setscheduler (struct task_struct *p, int policy,
+                          struct sched_param *lp)
+{
+       return cap_safe_nice(p);
+}
+
+int cap_task_setioprio (struct task_struct *p, int ioprio)
+{
+       return cap_safe_nice(p);
+}
+
+int cap_task_setnice (struct task_struct *p, int nice)
+{
+       return cap_safe_nice(p);
+}
+
+int cap_task_kill(struct task_struct *p, struct siginfo *info,
+                               int sig, u32 secid)
+{
+       if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
+               return 0;
+
+       if (secid)
+               /*
+                * Signal sent as a particular user.
+                * Capabilities are ignored.  May be wrong, but it's the
+                * only thing we can do at the moment.
+                * Used only by usb drivers?
+                */
+               return 0;
+       if (cap_issubset(p->cap_permitted, current->cap_permitted))
+               return 0;
+       if (capable(CAP_KILL))
+               return 0;
+
+       return -EPERM;
+}
+#else
+int cap_task_setscheduler (struct task_struct *p, int policy,
+                          struct sched_param *lp)
+{
+       return 0;
+}
+int cap_task_setioprio (struct task_struct *p, int ioprio)
+{
+       return 0;
+}
+int cap_task_setnice (struct task_struct *p, int nice)
+{
+       return 0;
+}
+int cap_task_kill(struct task_struct *p, struct siginfo *info,
+                               int sig, u32 secid)
+{
+       return 0;
+}
+#endif
+
 void cap_task_reparent_to_init (struct task_struct *p)
 {
        p->cap_effective = CAP_INIT_EFF_SET;
@@ -324,21 +530,3 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages)
        return __vm_enough_memory(mm, pages, cap_sys_admin);
 }
 
-EXPORT_SYMBOL(cap_capable);
-EXPORT_SYMBOL(cap_settime);
-EXPORT_SYMBOL(cap_ptrace);
-EXPORT_SYMBOL(cap_capget);
-EXPORT_SYMBOL(cap_capset_check);
-EXPORT_SYMBOL(cap_capset_set);
-EXPORT_SYMBOL(cap_bprm_set_security);
-EXPORT_SYMBOL(cap_bprm_apply_creds);
-EXPORT_SYMBOL(cap_bprm_secureexec);
-EXPORT_SYMBOL(cap_inode_setxattr);
-EXPORT_SYMBOL(cap_inode_removexattr);
-EXPORT_SYMBOL(cap_task_post_setuid);
-EXPORT_SYMBOL(cap_task_reparent_to_init);
-EXPORT_SYMBOL(cap_syslog);
-EXPORT_SYMBOL(cap_vm_enough_memory);
-
-MODULE_DESCRIPTION("Standard Linux Common Capabilities Security Module");
-MODULE_LICENSE("GPL");
index 64b647a0d9a648c0d59a7622103a2c10ebf2a14d..bc43d4c7383e89e5675e3ab1b031aa33fe7d7fc2 100644 (file)
@@ -15,7 +15,6 @@
 #undef DEBUG
 
 #include <linux/capability.h>
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/mman.h>
 #include <linux/pagemap.h>
@@ -377,6 +376,16 @@ static int dummy_inode_removexattr (struct dentry *dentry, char *name)
        return 0;
 }
 
+static int dummy_inode_need_killpriv(struct dentry *dentry)
+{
+       return 0;
+}
+
+static int dummy_inode_killpriv(struct dentry *dentry)
+{
+       return 0;
+}
+
 static int dummy_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
 {
        return -EOPNOTSUPP;
@@ -392,11 +401,6 @@ static int dummy_inode_listsecurity(struct inode *inode, char *buffer, size_t bu
        return 0;
 }
 
-static const char *dummy_inode_xattr_getsuffix(void)
-{
-       return NULL;
-}
-
 static int dummy_file_permission (struct file *file, int mask)
 {
        return 0;
@@ -906,11 +910,6 @@ static int dummy_register_security (const char *name, struct security_operations
        return -EINVAL;
 }
 
-static int dummy_unregister_security (const char *name, struct security_operations *ops)
-{
-       return -EINVAL;
-}
-
 static void dummy_d_instantiate (struct dentry *dentry, struct inode *inode)
 {
        return;
@@ -1023,7 +1022,8 @@ void security_fixup_ops (struct security_operations *ops)
        set_to_dummy_if_null(ops, inode_getxattr);
        set_to_dummy_if_null(ops, inode_listxattr);
        set_to_dummy_if_null(ops, inode_removexattr);
-       set_to_dummy_if_null(ops, inode_xattr_getsuffix);
+       set_to_dummy_if_null(ops, inode_need_killpriv);
+       set_to_dummy_if_null(ops, inode_killpriv);
        set_to_dummy_if_null(ops, inode_getsecurity);
        set_to_dummy_if_null(ops, inode_setsecurity);
        set_to_dummy_if_null(ops, inode_listsecurity);
@@ -1084,7 +1084,6 @@ void security_fixup_ops (struct security_operations *ops)
        set_to_dummy_if_null(ops, netlink_send);
        set_to_dummy_if_null(ops, netlink_recv);
        set_to_dummy_if_null(ops, register_security);
-       set_to_dummy_if_null(ops, unregister_security);
        set_to_dummy_if_null(ops, d_instantiate);
        set_to_dummy_if_null(ops, getprocattr);
        set_to_dummy_if_null(ops, setprocattr);
index 307211ac73461d3d86e1e2830c3257872041f637..b28a8acae34d7082dcb52519f1ebb927a2e1c9ae 100644 (file)
@@ -332,14 +332,6 @@ static int __init securityfs_init(void)
        return retval;
 }
 
-static void __exit securityfs_exit(void)
-{
-       simple_release_fs(&mount, &mount_count);
-       unregister_filesystem(&fs_type);
-       subsystem_unregister(&security_subsys);
-}
-
 core_initcall(securityfs_init);
-module_exit(securityfs_exit);
 MODULE_LICENSE("GPL");
 
index 1bb416f4bbcef7aa9315e9efcb59d292389ee8b2..d36d693933565f00e688274752893767ae8c61d8 100644 (file)
@@ -1,6 +1,6 @@
 /* internal.h: authentication token and access key management internal defs
  *
- * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved.
+ * Copyright (C) 2003-5, 2007 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
  *
  * This program is free software; you can redistribute it and/or
 #ifndef _INTERNAL_H
 #define _INTERNAL_H
 
-#include <linux/key.h>
+#include <linux/key-type.h>
 #include <linux/key-ui.h>
 
-#if 0
-#define kenter(FMT, a...)      printk("==> %s("FMT")\n",__FUNCTION__ , ## a)
-#define kleave(FMT, a...)      printk("<== %s()"FMT"\n",__FUNCTION__ , ## a)
-#define kdebug(FMT, a...)      printk(FMT"\n" , ## a)
+static inline __attribute__((format(printf, 1, 2)))
+void no_printk(const char *fmt, ...)
+{
+}
+
+#ifdef __KDEBUG
+#define kenter(FMT, ...) \
+       printk(KERN_DEBUG "==> %s("FMT")\n", __FUNCTION__, ##__VA_ARGS__)
+#define kleave(FMT, ...) \
+       printk(KERN_DEBUG "<== %s()"FMT"\n", __FUNCTION__, ##__VA_ARGS__)
+#define kdebug(FMT, ...) \
+       printk(KERN_DEBUG "xxx" FMT"yyy\n", ##__VA_ARGS__)
 #else
-#define kenter(FMT, a...)      do {} while(0)
-#define kleave(FMT, a...)      do {} while(0)
-#define kdebug(FMT, a...)      do {} while(0)
+#define kenter(FMT, ...) \
+       no_printk(KERN_DEBUG "==> %s("FMT")\n", __FUNCTION__, ##__VA_ARGS__)
+#define kleave(FMT, ...) \
+       no_printk(KERN_DEBUG "<== %s()"FMT"\n", __FUNCTION__, ##__VA_ARGS__)
+#define kdebug(FMT, ...) \
+       no_printk(KERN_DEBUG FMT"\n", ##__VA_ARGS__)
 #endif
 
 extern struct key_type key_type_user;
@@ -36,7 +47,7 @@ extern struct key_type key_type_user;
  */
 struct key_user {
        struct rb_node          node;
-       struct list_head        consq;          /* construction queue */
+       struct mutex            cons_lock;      /* construction initiation lock */
        spinlock_t              lock;
        atomic_t                usage;          /* for accessing qnkeys & qnbytes */
        atomic_t                nkeys;          /* number of keys */
@@ -62,7 +73,7 @@ extern void key_user_put(struct key_user *user);
 extern struct rb_root key_serial_tree;
 extern spinlock_t key_serial_lock;
 extern struct semaphore key_alloc_sem;
-extern struct rw_semaphore key_construction_sem;
+extern struct mutex key_construction_mutex;
 extern wait_queue_head_t request_key_conswq;
 
 
@@ -109,7 +120,7 @@ extern struct key *request_key_and_link(struct key_type *type,
 struct request_key_auth {
        struct key              *target_key;
        struct task_struct      *context;
-       const char              *callout_info;
+       char                    *callout_info;
        pid_t                   pid;
 };
 
index 01bbc6d9d19b0997a8d984cdd2373d9adc96090b..fdd5ca6d89fc1680975604d28ffa261398c650a6 100644 (file)
@@ -1,6 +1,6 @@
-/* key.c: basic authentication token and access key management
+/* Basic authentication token and access key management
  *
- * Copyright (C) 2004-6 Red Hat, Inc. All Rights Reserved.
+ * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
  *
  * This program is free software; you can redistribute it and/or
@@ -34,7 +34,7 @@ static void key_cleanup(struct work_struct *work);
 static DECLARE_WORK(key_cleanup_task, key_cleanup);
 
 /* we serialise key instantiation and link */
-DECLARE_RWSEM(key_construction_sem);
+DEFINE_MUTEX(key_construction_mutex);
 
 /* any key who's type gets unegistered will be re-typed to this */
 static struct key_type key_type_dead = {
@@ -104,7 +104,7 @@ struct key_user *key_user_lookup(uid_t uid)
        candidate->qnkeys = 0;
        candidate->qnbytes = 0;
        spin_lock_init(&candidate->lock);
-       INIT_LIST_HEAD(&candidate->consq);
+       mutex_init(&candidate->cons_lock);
 
        rb_link_node(&candidate->node, parent, p);
        rb_insert_color(&candidate->node, &key_user_tree);
@@ -418,7 +418,7 @@ static int __key_instantiate_and_link(struct key *key,
        awaken = 0;
        ret = -EBUSY;
 
-       down_write(&key_construction_sem);
+       mutex_lock(&key_construction_mutex);
 
        /* can't instantiate twice */
        if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {
@@ -443,11 +443,11 @@ static int __key_instantiate_and_link(struct key *key,
                }
        }
 
-       up_write(&key_construction_sem);
+       mutex_unlock(&key_construction_mutex);
 
        /* wake up anyone waiting for a key to be constructed */
        if (awaken)
-               wake_up_all(&request_key_conswq);
+               wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
 
        return ret;
 
@@ -500,7 +500,7 @@ int key_negate_and_link(struct key *key,
        if (keyring)
                down_write(&keyring->sem);
 
-       down_write(&key_construction_sem);
+       mutex_lock(&key_construction_mutex);
 
        /* can't instantiate twice */
        if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {
@@ -525,14 +525,14 @@ int key_negate_and_link(struct key *key,
                        key_revoke(instkey);
        }
 
-       up_write(&key_construction_sem);
+       mutex_unlock(&key_construction_mutex);
 
        if (keyring)
                up_write(&keyring->sem);
 
        /* wake up anyone waiting for a key to be constructed */
        if (awaken)
-               wake_up_all(&request_key_conswq);
+               wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
 
        return ret;
 
@@ -899,12 +899,14 @@ void key_revoke(struct key *key)
 {
        key_check(key);
 
-       /* make sure no one's trying to change or use the key when we mark
-        * it */
-       down_write(&key->sem);
-       set_bit(KEY_FLAG_REVOKED, &key->flags);
-
-       if (key->type->revoke)
+       /* make sure no one's trying to change or use the key when we mark it
+        * - we tell lockdep that we might nest because we might be revoking an
+        *   authorisation key whilst holding the sem on a key we've just
+        *   instantiated
+        */
+       down_write_nested(&key->sem, 1);
+       if (!test_and_set_bit(KEY_FLAG_REVOKED, &key->flags) &&
+           key->type->revoke)
                key->type->revoke(key);
 
        up_write(&key->sem);
index b6f86808475a0aedfb28e9d677fda7db553f006b..2a0eb946fc7ee84f95b7b32cc39149c8e510a2f5 100644 (file)
@@ -26,7 +26,7 @@ static DEFINE_MUTEX(key_session_mutex);
 /* the root user's tracking struct */
 struct key_user root_key_user = {
        .usage          = ATOMIC_INIT(3),
-       .consq          = LIST_HEAD_INIT(root_key_user.consq),
+       .cons_lock      = __MUTEX_INITIALIZER(root_key_user.cons_lock),
        .lock           = __SPIN_LOCK_UNLOCKED(root_key_user.lock),
        .nkeys          = ATOMIC_INIT(2),
        .nikeys         = ATOMIC_INIT(2),
@@ -679,8 +679,18 @@ key_ref_t lookup_user_key(struct task_struct *context, key_serial_t id,
                break;
        }
 
-       /* check the status */
-       if (perm) {
+       if (!partial) {
+               ret = wait_for_key_construction(key, true);
+               switch (ret) {
+               case -ERESTARTSYS:
+                       goto invalid_key;
+               default:
+                       if (perm)
+                               goto invalid_key;
+               case 0:
+                       break;
+               }
+       } else if (perm) {
                ret = key_validate(key);
                if (ret < 0)
                        goto invalid_key;
index 557500110a13ccd319515a8f96a6d44bc9e13667..6381e616c47744904b6efe0f412b0039289bec7d 100644 (file)
@@ -1,6 +1,6 @@
-/* request_key.c: request a key from userspace
+/* Request a key from userspace
  *
- * Copyright (C) 2004-6 Red Hat, Inc. All Rights Reserved.
+ * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
  *
  * This program is free software; you can redistribute it and/or
 #include <linux/keyctl.h>
 #include "internal.h"
 
-struct key_construction {
-       struct list_head        link;   /* link in construction queue */
-       struct key              *key;   /* key being constructed */
-};
+/*
+ * wait_on_bit() sleep function for uninterruptible waiting
+ */
+static int key_wait_bit(void *flags)
+{
+       schedule();
+       return 0;
+}
+
+/*
+ * wait_on_bit() sleep function for interruptible waiting
+ */
+static int key_wait_bit_intr(void *flags)
+{
+       schedule();
+       return signal_pending(current) ? -ERESTARTSYS : 0;
+}
+
+/*
+ * call to complete the construction of a key
+ */
+void complete_request_key(struct key_construction *cons, int error)
+{
+       kenter("{%d,%d},%d", cons->key->serial, cons->authkey->serial, error);
 
-/* when waiting for someone else's keys, you get added to this */
-DECLARE_WAIT_QUEUE_HEAD(request_key_conswq);
+       if (error < 0)
+               key_negate_and_link(cons->key, key_negative_timeout, NULL,
+                                   cons->authkey);
+       else
+               key_revoke(cons->authkey);
+
+       key_put(cons->key);
+       key_put(cons->authkey);
+       kfree(cons);
+}
+EXPORT_SYMBOL(complete_request_key);
 
-/*****************************************************************************/
 /*
  * request userspace finish the construction of a key
  * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>"
  */
-static int call_sbin_request_key(struct key *key,
-                                struct key *authkey,
+static int call_sbin_request_key(struct key_construction *cons,
                                 const char *op,
                                 void *aux)
 {
        struct task_struct *tsk = current;
        key_serial_t prkey, sskey;
-       struct key *keyring;
+       struct key *key = cons->key, *authkey = cons->authkey, *keyring;
        char *argv[9], *envp[3], uid_str[12], gid_str[12];
        char key_str[12], keyring_str[3][12];
        char desc[20];
@@ -82,8 +109,7 @@ static int call_sbin_request_key(struct key *key,
                rcu_read_lock();
                sskey = rcu_dereference(tsk->signal->session_keyring)->serial;
                rcu_read_unlock();
-       }
-       else {
+       } else {
                sskey = tsk->user->session_keyring->serial;
        }
 
@@ -110,228 +136,77 @@ static int call_sbin_request_key(struct key *key,
        /* do it */
        ret = call_usermodehelper_keys(argv[0], argv, envp, keyring,
                                       UMH_WAIT_PROC);
+       kdebug("usermode -> 0x%x", ret);
+       if (ret >= 0) {
+               /* ret is the exit/wait code */
+               if (test_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags) ||
+                   key_validate(key) < 0)
+                       ret = -ENOKEY;
+               else
+                       /* ignore any errors from userspace if the key was
+                        * instantiated */
+                       ret = 0;
+       }
 
 error_link:
        key_put(keyring);
 
 error_alloc:
        kleave(" = %d", ret);
+       complete_request_key(cons, ret);
        return ret;
+}
 
-} /* end call_sbin_request_key() */
-
-/*****************************************************************************/
 /*
- * call out to userspace for the key
- * - called with the construction sem held, but the sem is dropped here
+ * call out to userspace for key construction
  * - we ignore program failure and go on key status instead
  */
-static struct key *__request_key_construction(struct key_type *type,
-                                             const char *description,
-                                             const char *callout_info,
-                                             void *aux,
-                                             unsigned long flags)
+static int construct_key(struct key *key, const char *callout_info, void *aux)
 {
+       struct key_construction *cons;
        request_key_actor_t actor;
-       struct key_construction cons;
-       struct timespec now;
-       struct key *key, *authkey;
-       int ret, negated;
+       struct key *authkey;
+       int ret;
 
-       kenter("%s,%s,%s,%lx", type->name, description, callout_info, flags);
+       kenter("%d,%s,%p", key->serial, callout_info, aux);
 
-       /* create a key and add it to the queue */
-       key = key_alloc(type, description,
-                       current->fsuid, current->fsgid, current, KEY_POS_ALL,
-                       flags);
-       if (IS_ERR(key))
-               goto alloc_failed;
-
-       set_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags);
-
-       cons.key = key;
-       list_add_tail(&cons.link, &key->user->consq);
-
-       /* we drop the construction sem here on behalf of the caller */
-       up_write(&key_construction_sem);
+       cons = kmalloc(sizeof(*cons), GFP_KERNEL);
+       if (!cons)
+               return -ENOMEM;
 
        /* allocate an authorisation key */
        authkey = request_key_auth_new(key, callout_info);
        if (IS_ERR(authkey)) {
+               kfree(cons);
                ret = PTR_ERR(authkey);
                authkey = NULL;
-               goto alloc_authkey_failed;
-       }
-
-       /* make the call */
-       actor = call_sbin_request_key;
-       if (type->request_key)
-               actor = type->request_key;
-       ret = actor(key, authkey, "create", aux);
-       if (ret < 0)
-               goto request_failed;
-
-       /* if the key wasn't instantiated, then we want to give an error */
-       ret = -ENOKEY;
-       if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags))
-               goto request_failed;
-
-       key_revoke(authkey);
-       key_put(authkey);
-
-       down_write(&key_construction_sem);
-       list_del(&cons.link);
-       up_write(&key_construction_sem);
-
-       /* also give an error if the key was negatively instantiated */
-check_not_negative:
-       if (test_bit(KEY_FLAG_NEGATIVE, &key->flags)) {
-               key_put(key);
-               key = ERR_PTR(-ENOKEY);
-       }
-
-out:
-       kleave(" = %p", key);
-       return key;
-
-request_failed:
-       key_revoke(authkey);
-       key_put(authkey);
-
-alloc_authkey_failed:
-       /* it wasn't instantiated
-        * - remove from construction queue
-        * - mark the key as dead
-        */
-       negated = 0;
-       down_write(&key_construction_sem);
-
-       list_del(&cons.link);
-
-       /* check it didn't get instantiated between the check and the down */
-       if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {
-               set_bit(KEY_FLAG_NEGATIVE, &key->flags);
-               set_bit(KEY_FLAG_INSTANTIATED, &key->flags);
-               negated = 1;
-       }
-
-       clear_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags);
-
-       up_write(&key_construction_sem);
-
-       if (!negated)
-               goto check_not_negative; /* surprisingly, the key got
-                                         * instantiated */
-
-       /* set the timeout and store in the session keyring if we can */
-       now = current_kernel_time();
-       key->expiry = now.tv_sec + key_negative_timeout;
-
-       if (current->signal->session_keyring) {
-               struct key *keyring;
-
-               rcu_read_lock();
-               keyring = rcu_dereference(current->signal->session_keyring);
-               atomic_inc(&keyring->usage);
-               rcu_read_unlock();
-
-               key_link(keyring, key);
-               key_put(keyring);
-       }
-
-       key_put(key);
-
-       /* notify anyone who was waiting */
-       wake_up_all(&request_key_conswq);
-
-       key = ERR_PTR(ret);
-       goto out;
-
-alloc_failed:
-       up_write(&key_construction_sem);
-       goto out;
-
-} /* end __request_key_construction() */
-
-/*****************************************************************************/
-/*
- * call out to userspace to request the key
- * - we check the construction queue first to see if an appropriate key is
- *   already being constructed by userspace
- */
-static struct key *request_key_construction(struct key_type *type,
-                                           const char *description,
-                                           const char *callout_info,
-                                           void *aux,
-                                           struct key_user *user,
-                                           unsigned long flags)
-{
-       struct key_construction *pcons;
-       struct key *key, *ckey;
-
-       DECLARE_WAITQUEUE(myself, current);
-
-       kenter("%s,%s,{%d},%s,%lx",
-              type->name, description, user->uid, callout_info, flags);
-
-       /* see if there's such a key under construction already */
-       down_write(&key_construction_sem);
-
-       list_for_each_entry(pcons, &user->consq, link) {
-               ckey = pcons->key;
-
-               if (ckey->type != type)
-                       continue;
-
-               if (type->match(ckey, description))
-                       goto found_key_under_construction;
+       } else {
+               cons->authkey = key_get(authkey);
+               cons->key = key_get(key);
+
+               /* make the call */
+               actor = call_sbin_request_key;
+               if (key->type->request_key)
+                       actor = key->type->request_key;
+
+               ret = actor(cons, "create", aux);
+
+               /* check that the actor called complete_request_key() prior to
+                * returning an error */
+               WARN_ON(ret < 0 &&
+                       !test_bit(KEY_FLAG_REVOKED, &authkey->flags));
+               key_put(authkey);
        }
 
-       /* see about getting userspace to construct the key */
-       key = __request_key_construction(type, description, callout_info, aux,
-                                        flags);
- error:
-       kleave(" = %p", key);
-       return key;
-
-       /* someone else has the same key under construction
-        * - we want to keep an eye on their key
-        */
- found_key_under_construction:
-       atomic_inc(&ckey->usage);
-       up_write(&key_construction_sem);
-
-       /* wait for the key to be completed one way or another */
-       add_wait_queue(&request_key_conswq, &myself);
-
-       for (;;) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               if (!test_bit(KEY_FLAG_USER_CONSTRUCT, &ckey->flags))
-                       break;
-               if (signal_pending(current))
-                       break;
-               schedule();
-       }
-
-       set_current_state(TASK_RUNNING);
-       remove_wait_queue(&request_key_conswq, &myself);
-
-       /* we'll need to search this process's keyrings to see if the key is
-        * now there since we can't automatically assume it's also available
-        * there */
-       key_put(ckey);
-       ckey = NULL;
-
-       key = NULL; /* request a retry */
-       goto error;
-
-} /* end request_key_construction() */
+       kleave(" = %d", ret);
+       return ret;
+}
 
-/*****************************************************************************/
 /*
- * link a freshly minted key to an appropriate destination keyring
+ * link a key to the appropriate destination keyring
+ * - the caller must hold a write lock on the destination keyring
  */
-static void request_key_link(struct key *key, struct key *dest_keyring)
+static void construct_key_make_link(struct key *key, struct key *dest_keyring)
 {
        struct task_struct *tsk = current;
        struct key *drop = NULL;
@@ -363,11 +238,11 @@ static void request_key_link(struct key *key, struct key *dest_keyring)
                                break;
 
                case KEY_REQKEY_DEFL_USER_SESSION_KEYRING:
-                       dest_keyring = current->user->session_keyring;
+                       dest_keyring = tsk->user->session_keyring;
                        break;
 
                case KEY_REQKEY_DEFL_USER_KEYRING:
-                       dest_keyring = current->user->uid_keyring;
+                       dest_keyring = tsk->user->uid_keyring;
                        break;
 
                case KEY_REQKEY_DEFL_GROUP_KEYRING:
@@ -377,15 +252,115 @@ static void request_key_link(struct key *key, struct key *dest_keyring)
        }
 
        /* and attach the key to it */
-       key_link(dest_keyring, key);
-
+       __key_link(dest_keyring, key);
        key_put(drop);
-
        kleave("");
+}
 
-} /* end request_key_link() */
+/*
+ * allocate a new key in under-construction state and attempt to link it in to
+ * the requested place
+ * - may return a key that's already under construction instead
+ */
+static int construct_alloc_key(struct key_type *type,
+                              const char *description,
+                              struct key *dest_keyring,
+                              unsigned long flags,
+                              struct key_user *user,
+                              struct key **_key)
+{
+       struct key *key;
+       key_ref_t key_ref;
+
+       kenter("%s,%s,,,", type->name, description);
+
+       mutex_lock(&user->cons_lock);
+
+       key = key_alloc(type, description,
+                       current->fsuid, current->fsgid, current, KEY_POS_ALL,
+                       flags);
+       if (IS_ERR(key))
+               goto alloc_failed;
+
+       set_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags);
+
+       if (dest_keyring)
+               down_write(&dest_keyring->sem);
+
+       /* attach the key to the destination keyring under lock, but we do need
+        * to do another check just in case someone beat us to it whilst we
+        * waited for locks */
+       mutex_lock(&key_construction_mutex);
+
+       key_ref = search_process_keyrings(type, description, type->match,
+                                         current);
+       if (!IS_ERR(key_ref))
+               goto key_already_present;
+
+       if (dest_keyring)
+               construct_key_make_link(key, dest_keyring);
+
+       mutex_unlock(&key_construction_mutex);
+       if (dest_keyring)
+               up_write(&dest_keyring->sem);
+       mutex_unlock(&user->cons_lock);
+       *_key = key;
+       kleave(" = 0 [%d]", key_serial(key));
+       return 0;
+
+key_already_present:
+       mutex_unlock(&key_construction_mutex);
+       if (dest_keyring)
+               up_write(&dest_keyring->sem);
+       mutex_unlock(&user->cons_lock);
+       key_put(key);
+       *_key = key = key_ref_to_ptr(key_ref);
+       kleave(" = -EINPROGRESS [%d]", key_serial(key));
+       return -EINPROGRESS;
+
+alloc_failed:
+       mutex_unlock(&user->cons_lock);
+       *_key = NULL;
+       kleave(" = %ld", PTR_ERR(key));
+       return PTR_ERR(key);
+}
+
+/*
+ * commence key construction
+ */
+static struct key *construct_key_and_link(struct key_type *type,
+                                         const char *description,
+                                         const char *callout_info,
+                                         void *aux,
+                                         struct key *dest_keyring,
+                                         unsigned long flags)
+{
+       struct key_user *user;
+       struct key *key;
+       int ret;
+
+       user = key_user_lookup(current->fsuid);
+       if (!user)
+               return ERR_PTR(-ENOMEM);
+
+       ret = construct_alloc_key(type, description, dest_keyring, flags, user,
+                                 &key);
+       key_user_put(user);
+
+       if (ret == 0) {
+               ret = construct_key(key, callout_info, aux);
+               if (ret < 0)
+                       goto construction_failed;
+       }
+
+       return key;
+
+construction_failed:
+       key_negate_and_link(key, key_negative_timeout, NULL, NULL);
+       key_put(key);
+       return ERR_PTR(ret);
+}
 
-/*****************************************************************************/
 /*
  * request a key
  * - search the process's keyrings
@@ -400,7 +375,6 @@ struct key *request_key_and_link(struct key_type *type,
                                 struct key *dest_keyring,
                                 unsigned long flags)
 {
-       struct key_user *user;
        struct key *key;
        key_ref_t key_ref;
 
@@ -412,112 +386,124 @@ struct key *request_key_and_link(struct key_type *type,
        key_ref = search_process_keyrings(type, description, type->match,
                                          current);
 
-       kdebug("search 1: %p", key_ref);
-
        if (!IS_ERR(key_ref)) {
                key = key_ref_to_ptr(key_ref);
-       }
-       else if (PTR_ERR(key_ref) != -EAGAIN) {
+       } else if (PTR_ERR(key_ref) != -EAGAIN) {
                key = ERR_PTR(PTR_ERR(key_ref));
-       }
-       else  {
+       } else  {
                /* the search failed, but the keyrings were searchable, so we
                 * should consult userspace if we can */
                key = ERR_PTR(-ENOKEY);
                if (!callout_info)
                        goto error;
 
-               /* - get hold of the user's construction queue */
-               user = key_user_lookup(current->fsuid);
-               if (!user)
-                       goto nomem;
-
-               for (;;) {
-                       if (signal_pending(current))
-                               goto interrupted;
-
-                       /* ask userspace (returns NULL if it waited on a key
-                        * being constructed) */
-                       key = request_key_construction(type, description,
-                                                      callout_info, aux,
-                                                      user, flags);
-                       if (key)
-                               break;
-
-                       /* someone else made the key we want, so we need to
-                        * search again as it might now be available to us */
-                       key_ref = search_process_keyrings(type, description,
-                                                         type->match,
-                                                         current);
-
-                       kdebug("search 2: %p", key_ref);
-
-                       if (!IS_ERR(key_ref)) {
-                               key = key_ref_to_ptr(key_ref);
-                               break;
-                       }
-
-                       if (PTR_ERR(key_ref) != -EAGAIN) {
-                               key = ERR_PTR(PTR_ERR(key_ref));
-                               break;
-                       }
-               }
-
-               key_user_put(user);
-
-               /* link the new key into the appropriate keyring */
-               if (!IS_ERR(key))
-                       request_key_link(key, dest_keyring);
+               key = construct_key_and_link(type, description, callout_info,
+                                            aux, dest_keyring, flags);
        }
 
 error:
        kleave(" = %p", key);
        return key;
+}
 
-nomem:
-       key = ERR_PTR(-ENOMEM);
-       goto error;
-
-interrupted:
-       key_user_put(user);
-       key = ERR_PTR(-EINTR);
-       goto error;
+/*
+ * wait for construction of a key to complete
+ */
+int wait_for_key_construction(struct key *key, bool intr)
+{
+       int ret;
 
-} /* end request_key_and_link() */
+       ret = wait_on_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT,
+                         intr ? key_wait_bit_intr : key_wait_bit,
+                         intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
+       if (ret < 0)
+               return ret;
+       return key_validate(key);
+}
+EXPORT_SYMBOL(wait_for_key_construction);
 
-/*****************************************************************************/
 /*
  * request a key
  * - search the process's keyrings
  * - check the list of keys being created or updated
  * - call out to userspace for a key if supplementary info was provided
+ * - waits uninterruptible for creation to complete
  */
 struct key *request_key(struct key_type *type,
                        const char *description,
                        const char *callout_info)
 {
-       return request_key_and_link(type, description, callout_info, NULL,
-                                   NULL, KEY_ALLOC_IN_QUOTA);
-
-} /* end request_key() */
-
+       struct key *key;
+       int ret;
+
+       key = request_key_and_link(type, description, callout_info, NULL,
+                                  NULL, KEY_ALLOC_IN_QUOTA);
+       if (!IS_ERR(key)) {
+               ret = wait_for_key_construction(key, false);
+               if (ret < 0) {
+                       key_put(key);
+                       return ERR_PTR(ret);
+               }
+       }
+       return key;
+}
 EXPORT_SYMBOL(request_key);
 
-/*****************************************************************************/
 /*
  * request a key with auxiliary data for the upcaller
  * - search the process's keyrings
  * - check the list of keys being created or updated
  * - call out to userspace for a key if supplementary info was provided
+ * - waits uninterruptible for creation to complete
  */
 struct key *request_key_with_auxdata(struct key_type *type,
                                     const char *description,
                                     const char *callout_info,
                                     void *aux)
 {
-       return request_key_and_link(type, description, callout_info, aux,
-                                   NULL, KEY_ALLOC_IN_QUOTA);
+       struct key *key;
+       int ret;
+
+       key = request_key_and_link(type, description, callout_info, aux,
+                                  NULL, KEY_ALLOC_IN_QUOTA);
+       if (!IS_ERR(key)) {
+               ret = wait_for_key_construction(key, false);
+               if (ret < 0) {
+                       key_put(key);
+                       return ERR_PTR(ret);
+               }
+       }
+       return key;
+}
+EXPORT_SYMBOL(request_key_with_auxdata);
 
-} /* end request_key_with_auxdata() */
+/*
+ * request a key (allow async construction)
+ * - search the process's keyrings
+ * - check the list of keys being created or updated
+ * - call out to userspace for a key if supplementary info was provided
+ */
+struct key *request_key_async(struct key_type *type,
+                             const char *description,
+                             const char *callout_info)
+{
+       return request_key_and_link(type, description, callout_info, NULL,
+                                   NULL, KEY_ALLOC_IN_QUOTA);
+}
+EXPORT_SYMBOL(request_key_async);
 
-EXPORT_SYMBOL(request_key_with_auxdata);
+/*
+ * request a key with auxiliary data for the upcaller (allow async construction)
+ * - search the process's keyrings
+ * - check the list of keys being created or updated
+ * - call out to userspace for a key if supplementary info was provided
+ */
+struct key *request_key_async_with_auxdata(struct key_type *type,
+                                          const char *description,
+                                          const char *callout_info,
+                                          void *aux)
+{
+       return request_key_and_link(type, description, callout_info, aux,
+                                   NULL, KEY_ALLOC_IN_QUOTA);
+}
+EXPORT_SYMBOL(request_key_async_with_auxdata);
index cbf58a91b00a4c945ec72ca7db2867c19548dd6c..510f7be73a2d4e954cc8de34bed9580e5cc4a47b 100644 (file)
@@ -127,6 +127,7 @@ static void request_key_auth_destroy(struct key *key)
        }
 
        key_put(rka->target_key);
+       kfree(rka->callout_info);
        kfree(rka);
 
 } /* end request_key_auth_destroy() */
@@ -151,6 +152,12 @@ struct key *request_key_auth_new(struct key *target, const char *callout_info)
                kleave(" = -ENOMEM");
                return ERR_PTR(-ENOMEM);
        }
+       rka->callout_info = kmalloc(strlen(callout_info) + 1, GFP_KERNEL);
+       if (!rka->callout_info) {
+               kleave(" = -ENOMEM");
+               kfree(rka);
+               return ERR_PTR(-ENOMEM);
+       }
 
        /* see if the calling process is already servicing the key request of
         * another process */
@@ -179,7 +186,7 @@ struct key *request_key_auth_new(struct key *target, const char *callout_info)
        }
 
        rka->target_key = key_get(target);
-       rka->callout_info = callout_info;
+       strcpy(rka->callout_info, callout_info);
 
        /* allocate the auth key */
        sprintf(desc, "%x", target->serial);
@@ -203,6 +210,7 @@ struct key *request_key_auth_new(struct key *target, const char *callout_info)
 
 auth_key_revoked:
        up_read(&current->request_key_auth->sem);
+       kfree(rka->callout_info);
        kfree(rka);
        kleave("= -EKEYREVOKED");
        return ERR_PTR(-EKEYREVOKED);
@@ -212,6 +220,7 @@ error_inst:
        key_put(authkey);
 error_alloc:
        key_put(rka->target_key);
+       kfree(rka->callout_info);
        kfree(rka);
        kleave("= %d", ret);
        return ERR_PTR(ret);
index 38dd4f3e641fc8a1891f145ff0f77f8745a64a33..870f13095bb65c3cc93d0df568658d191ece74fc 100644 (file)
  *     License.
  */
 
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/security.h>
 #include <linux/usb.h>
+#include <linux/moduleparam.h>
 
 /* flag to keep track of how we were registered */
 static int secondary;
@@ -36,22 +36,14 @@ static int vendor_id = 0x0557;
 static int product_id = 0x2008;
 
 module_param(vendor_id, uint, 0400);
-MODULE_PARM_DESC(vendor_id, "USB Vendor ID of device to look for");
-
 module_param(product_id, uint, 0400);
-MODULE_PARM_DESC(product_id, "USB Product ID of device to look for");
 
 /* should we print out debug messages */
 static int debug = 0;
 
 module_param(debug, bool, 0600);
-MODULE_PARM_DESC(debug, "Debug enabled or not");
 
-#if defined(CONFIG_SECURITY_ROOTPLUG_MODULE)
-#define MY_NAME THIS_MODULE->name
-#else
 #define MY_NAME "root_plug"
-#endif
 
 #define root_dbg(fmt, arg...)                                  \
        do {                                                    \
@@ -117,25 +109,4 @@ static int __init rootplug_init (void)
        return 0;
 }
 
-static void __exit rootplug_exit (void)
-{
-       /* remove ourselves from the security framework */
-       if (secondary) {
-               if (mod_unreg_security (MY_NAME, &rootplug_security_ops))
-                       printk (KERN_INFO "Failure unregistering Root Plug "
-                               " module with primary module.\n");
-       } else { 
-               if (unregister_security (&rootplug_security_ops)) {
-                       printk (KERN_INFO "Failure unregistering Root Plug "
-                               "module with the kernel\n");
-               }
-       }
-       printk (KERN_INFO "Root Plug module removed\n");
-}
-
 security_initcall (rootplug_init);
-module_exit (rootplug_exit);
-
-MODULE_DESCRIPTION("Root Plug sample LSM module, written for Linux Journal article");
-MODULE_LICENSE("GPL");
-
index 27e5863d30f1f916393e855a6bfa496475a8fa71..0e1f1f124368b03aa31df48552030ed17bf7946e 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/kernel.h>
 #include <linux/security.h>
 
-#define SECURITY_FRAMEWORK_VERSION     "1.0.0"
 
 /* things that live in dummy.c */
 extern struct security_operations dummy_security_ops;
@@ -52,8 +51,7 @@ static void __init do_security_initcalls(void)
  */
 int __init security_init(void)
 {
-       printk(KERN_INFO "Security Framework v" SECURITY_FRAMEWORK_VERSION
-              " initialized\n");
+       printk(KERN_INFO "Security Framework initialized\n");
 
        if (verify(&dummy_security_ops)) {
                printk(KERN_ERR "%s could not verify "
@@ -73,8 +71,7 @@ int __init security_init(void)
  *
  * This function is to allow a security module to register itself with the
  * kernel security subsystem.  Some rudimentary checking is done on the @ops
- * value passed to this function.  A call to unregister_security() should be
- * done to remove this security_options structure from the kernel.
+ * value passed to this function.
  *
  * If there is already a security module registered with the kernel,
  * an error will be returned.  Otherwise 0 is returned on success.
@@ -95,31 +92,6 @@ int register_security(struct security_operations *ops)
        return 0;
 }
 
-/**
- * unregister_security - unregisters a security framework with the kernel
- * @ops: a pointer to the struct security_options that is to be registered
- *
- * This function removes a struct security_operations variable that had
- * previously been registered with a successful call to register_security().
- *
- * If @ops does not match the valued previously passed to register_security()
- * an error is returned.  Otherwise the default security options is set to the
- * the dummy_security_ops structure, and 0 is returned.
- */
-int unregister_security(struct security_operations *ops)
-{
-       if (ops != security_ops) {
-               printk(KERN_INFO "%s: trying to unregister "
-                      "a security_opts structure that is not "
-                      "registered, failing.\n", __FUNCTION__);
-               return -EINVAL;
-       }
-
-       security_ops = &dummy_security_ops;
-
-       return 0;
-}
-
 /**
  * mod_reg_security - allows security modules to be "stacked"
  * @name: a pointer to a string with the name of the security_options to be registered
@@ -149,32 +121,962 @@ int mod_reg_security(const char *name, struct security_operations *ops)
        return security_ops->register_security(name, ops);
 }
 
-/**
- * mod_unreg_security - allows a security module registered with mod_reg_security() to be unloaded
- * @name: a pointer to a string with the name of the security_options to be removed
- * @ops: a pointer to the struct security_options that is to be removed
- *
- * This function allows security modules that have been successfully registered
- * with a call to mod_reg_security() to be unloaded from the system.
- * This calls the currently loaded security module's unregister_security() call
- * with the @name and @ops variables.
- *
- * The return value depends on the currently loaded security module, with 0 as
- * success.
- */
-int mod_unreg_security(const char *name, struct security_operations *ops)
+/* Security operations */
+
+int security_ptrace(struct task_struct *parent, struct task_struct *child)
 {
-       if (ops == security_ops) {
-               printk(KERN_INFO "%s invalid attempt to unregister "
-                      " primary security ops.\n", __FUNCTION__);
-               return -EINVAL;
-       }
+       return security_ops->ptrace(parent, child);
+}
+
+int security_capget(struct task_struct *target,
+                    kernel_cap_t *effective,
+                    kernel_cap_t *inheritable,
+                    kernel_cap_t *permitted)
+{
+       return security_ops->capget(target, effective, inheritable, permitted);
+}
+
+int security_capset_check(struct task_struct *target,
+                          kernel_cap_t *effective,
+                          kernel_cap_t *inheritable,
+                          kernel_cap_t *permitted)
+{
+       return security_ops->capset_check(target, effective, inheritable, permitted);
+}
+
+void security_capset_set(struct task_struct *target,
+                         kernel_cap_t *effective,
+                         kernel_cap_t *inheritable,
+                         kernel_cap_t *permitted)
+{
+       security_ops->capset_set(target, effective, inheritable, permitted);
+}
+
+int security_capable(struct task_struct *tsk, int cap)
+{
+       return security_ops->capable(tsk, cap);
+}
+
+int security_acct(struct file *file)
+{
+       return security_ops->acct(file);
+}
+
+int security_sysctl(struct ctl_table *table, int op)
+{
+       return security_ops->sysctl(table, op);
+}
+
+int security_quotactl(int cmds, int type, int id, struct super_block *sb)
+{
+       return security_ops->quotactl(cmds, type, id, sb);
+}
+
+int security_quota_on(struct dentry *dentry)
+{
+       return security_ops->quota_on(dentry);
+}
+
+int security_syslog(int type)
+{
+       return security_ops->syslog(type);
+}
+
+int security_settime(struct timespec *ts, struct timezone *tz)
+{
+       return security_ops->settime(ts, tz);
+}
+
+int security_vm_enough_memory(long pages)
+{
+       return security_ops->vm_enough_memory(current->mm, pages);
+}
+
+int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
+{
+       return security_ops->vm_enough_memory(mm, pages);
+}
+
+int security_bprm_alloc(struct linux_binprm *bprm)
+{
+       return security_ops->bprm_alloc_security(bprm);
+}
+
+void security_bprm_free(struct linux_binprm *bprm)
+{
+       security_ops->bprm_free_security(bprm);
+}
+
+void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
+{
+       security_ops->bprm_apply_creds(bprm, unsafe);
+}
+
+void security_bprm_post_apply_creds(struct linux_binprm *bprm)
+{
+       security_ops->bprm_post_apply_creds(bprm);
+}
+
+int security_bprm_set(struct linux_binprm *bprm)
+{
+       return security_ops->bprm_set_security(bprm);
+}
+
+int security_bprm_check(struct linux_binprm *bprm)
+{
+       return security_ops->bprm_check_security(bprm);
+}
+
+int security_bprm_secureexec(struct linux_binprm *bprm)
+{
+       return security_ops->bprm_secureexec(bprm);
+}
+
+int security_sb_alloc(struct super_block *sb)
+{
+       return security_ops->sb_alloc_security(sb);
+}
+
+void security_sb_free(struct super_block *sb)
+{
+       security_ops->sb_free_security(sb);
+}
+
+int security_sb_copy_data(struct file_system_type *type, void *orig, void *copy)
+{
+       return security_ops->sb_copy_data(type, orig, copy);
+}
+
+int security_sb_kern_mount(struct super_block *sb, void *data)
+{
+       return security_ops->sb_kern_mount(sb, data);
+}
+
+int security_sb_statfs(struct dentry *dentry)
+{
+       return security_ops->sb_statfs(dentry);
+}
+
+int security_sb_mount(char *dev_name, struct nameidata *nd,
+                       char *type, unsigned long flags, void *data)
+{
+       return security_ops->sb_mount(dev_name, nd, type, flags, data);
+}
+
+int security_sb_check_sb(struct vfsmount *mnt, struct nameidata *nd)
+{
+       return security_ops->sb_check_sb(mnt, nd);
+}
+
+int security_sb_umount(struct vfsmount *mnt, int flags)
+{
+       return security_ops->sb_umount(mnt, flags);
+}
+
+void security_sb_umount_close(struct vfsmount *mnt)
+{
+       security_ops->sb_umount_close(mnt);
+}
+
+void security_sb_umount_busy(struct vfsmount *mnt)
+{
+       security_ops->sb_umount_busy(mnt);
+}
+
+void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data)
+{
+       security_ops->sb_post_remount(mnt, flags, data);
+}
+
+void security_sb_post_mountroot(void)
+{
+       security_ops->sb_post_mountroot();
+}
+
+void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd)
+{
+       security_ops->sb_post_addmount(mnt, mountpoint_nd);
+}
+
+int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd)
+{
+       return security_ops->sb_pivotroot(old_nd, new_nd);
+}
+
+void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd)
+{
+       security_ops->sb_post_pivotroot(old_nd, new_nd);
+}
+
+int security_inode_alloc(struct inode *inode)
+{
+       inode->i_security = NULL;
+       return security_ops->inode_alloc_security(inode);
+}
+
+void security_inode_free(struct inode *inode)
+{
+       security_ops->inode_free_security(inode);
+}
+
+int security_inode_init_security(struct inode *inode, struct inode *dir,
+                                 char **name, void **value, size_t *len)
+{
+       if (unlikely(IS_PRIVATE(inode)))
+               return -EOPNOTSUPP;
+       return security_ops->inode_init_security(inode, dir, name, value, len);
+}
+EXPORT_SYMBOL(security_inode_init_security);
+
+int security_inode_create(struct inode *dir, struct dentry *dentry, int mode)
+{
+       if (unlikely(IS_PRIVATE(dir)))
+               return 0;
+       return security_ops->inode_create(dir, dentry, mode);
+}
+
+int security_inode_link(struct dentry *old_dentry, struct inode *dir,
+                        struct dentry *new_dentry)
+{
+       if (unlikely(IS_PRIVATE(old_dentry->d_inode)))
+               return 0;
+       return security_ops->inode_link(old_dentry, dir, new_dentry);
+}
+
+int security_inode_unlink(struct inode *dir, struct dentry *dentry)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_unlink(dir, dentry);
+}
+
+int security_inode_symlink(struct inode *dir, struct dentry *dentry,
+                           const char *old_name)
+{
+       if (unlikely(IS_PRIVATE(dir)))
+               return 0;
+       return security_ops->inode_symlink(dir, dentry, old_name);
+}
+
+int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+{
+       if (unlikely(IS_PRIVATE(dir)))
+               return 0;
+       return security_ops->inode_mkdir(dir, dentry, mode);
+}
+
+int security_inode_rmdir(struct inode *dir, struct dentry *dentry)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_rmdir(dir, dentry);
+}
+
+int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
+{
+       if (unlikely(IS_PRIVATE(dir)))
+               return 0;
+       return security_ops->inode_mknod(dir, dentry, mode, dev);
+}
+
+int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
+                          struct inode *new_dir, struct dentry *new_dentry)
+{
+        if (unlikely(IS_PRIVATE(old_dentry->d_inode) ||
+            (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode))))
+               return 0;
+       return security_ops->inode_rename(old_dir, old_dentry,
+                                          new_dir, new_dentry);
+}
+
+int security_inode_readlink(struct dentry *dentry)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_readlink(dentry);
+}
+
+int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_follow_link(dentry, nd);
+}
+
+int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd)
+{
+       if (unlikely(IS_PRIVATE(inode)))
+               return 0;
+       return security_ops->inode_permission(inode, mask, nd);
+}
+
+int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_setattr(dentry, attr);
+}
+
+int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_getattr(mnt, dentry);
+}
+
+void security_inode_delete(struct inode *inode)
+{
+       if (unlikely(IS_PRIVATE(inode)))
+               return;
+       security_ops->inode_delete(inode);
+}
+
+int security_inode_setxattr(struct dentry *dentry, char *name,
+                            void *value, size_t size, int flags)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_setxattr(dentry, name, value, size, flags);
+}
+
+void security_inode_post_setxattr(struct dentry *dentry, char *name,
+                                  void *value, size_t size, int flags)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return;
+       security_ops->inode_post_setxattr(dentry, name, value, size, flags);
+}
+
+int security_inode_getxattr(struct dentry *dentry, char *name)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_getxattr(dentry, name);
+}
+
+int security_inode_listxattr(struct dentry *dentry)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_listxattr(dentry);
+}
+
+int security_inode_removexattr(struct dentry *dentry, char *name)
+{
+       if (unlikely(IS_PRIVATE(dentry->d_inode)))
+               return 0;
+       return security_ops->inode_removexattr(dentry, name);
+}
+
+int security_inode_need_killpriv(struct dentry *dentry)
+{
+       return security_ops->inode_need_killpriv(dentry);
+}
+
+int security_inode_killpriv(struct dentry *dentry)
+{
+       return security_ops->inode_killpriv(dentry);
+}
+
+int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
+{
+       if (unlikely(IS_PRIVATE(inode)))
+               return 0;
+       return security_ops->inode_getsecurity(inode, name, buffer, size, err);
+}
+
+int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
+{
+       if (unlikely(IS_PRIVATE(inode)))
+               return 0;
+       return security_ops->inode_setsecurity(inode, name, value, size, flags);
+}
+
+int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
+{
+       if (unlikely(IS_PRIVATE(inode)))
+               return 0;
+       return security_ops->inode_listsecurity(inode, buffer, buffer_size);
+}
+
+int security_file_permission(struct file *file, int mask)
+{
+       return security_ops->file_permission(file, mask);
+}
+
+int security_file_alloc(struct file *file)
+{
+       return security_ops->file_alloc_security(file);
+}
+
+void security_file_free(struct file *file)
+{
+       security_ops->file_free_security(file);
+}
+
+int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       return security_ops->file_ioctl(file, cmd, arg);
+}
+
+int security_file_mmap(struct file *file, unsigned long reqprot,
+                       unsigned long prot, unsigned long flags,
+                       unsigned long addr, unsigned long addr_only)
+{
+       return security_ops->file_mmap(file, reqprot, prot, flags, addr, addr_only);
+}
+
+int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
+                           unsigned long prot)
+{
+       return security_ops->file_mprotect(vma, reqprot, prot);
+}
+
+int security_file_lock(struct file *file, unsigned int cmd)
+{
+       return security_ops->file_lock(file, cmd);
+}
+
+int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+       return security_ops->file_fcntl(file, cmd, arg);
+}
+
+int security_file_set_fowner(struct file *file)
+{
+       return security_ops->file_set_fowner(file);
+}
+
+int security_file_send_sigiotask(struct task_struct *tsk,
+                                 struct fown_struct *fown, int sig)
+{
+       return security_ops->file_send_sigiotask(tsk, fown, sig);
+}
+
+int security_file_receive(struct file *file)
+{
+       return security_ops->file_receive(file);
+}
+
+int security_dentry_open(struct file *file)
+{
+       return security_ops->dentry_open(file);
+}
+
+int security_task_create(unsigned long clone_flags)
+{
+       return security_ops->task_create(clone_flags);
+}
+
+int security_task_alloc(struct task_struct *p)
+{
+       return security_ops->task_alloc_security(p);
+}
+
+void security_task_free(struct task_struct *p)
+{
+       security_ops->task_free_security(p);
+}
+
+int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags)
+{
+       return security_ops->task_setuid(id0, id1, id2, flags);
+}
 
-       return security_ops->unregister_security(name, ops);
+int security_task_post_setuid(uid_t old_ruid, uid_t old_euid,
+                              uid_t old_suid, int flags)
+{
+       return security_ops->task_post_setuid(old_ruid, old_euid, old_suid, flags);
+}
+
+int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags)
+{
+       return security_ops->task_setgid(id0, id1, id2, flags);
+}
+
+int security_task_setpgid(struct task_struct *p, pid_t pgid)
+{
+       return security_ops->task_setpgid(p, pgid);
+}
+
+int security_task_getpgid(struct task_struct *p)
+{
+       return security_ops->task_getpgid(p);
+}
+
+int security_task_getsid(struct task_struct *p)
+{
+       return security_ops->task_getsid(p);
+}
+
+void security_task_getsecid(struct task_struct *p, u32 *secid)
+{
+       security_ops->task_getsecid(p, secid);
+}
+EXPORT_SYMBOL(security_task_getsecid);
+
+int security_task_setgroups(struct group_info *group_info)
+{
+       return security_ops->task_setgroups(group_info);
+}
+
+int security_task_setnice(struct task_struct *p, int nice)
+{
+       return security_ops->task_setnice(p, nice);
+}
+
+int security_task_setioprio(struct task_struct *p, int ioprio)
+{
+       return security_ops->task_setioprio(p, ioprio);
+}
+
+int security_task_getioprio(struct task_struct *p)
+{
+       return security_ops->task_getioprio(p);
+}
+
+int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim)
+{
+       return security_ops->task_setrlimit(resource, new_rlim);
+}
+
+int security_task_setscheduler(struct task_struct *p,
+                               int policy, struct sched_param *lp)
+{
+       return security_ops->task_setscheduler(p, policy, lp);
+}
+
+int security_task_getscheduler(struct task_struct *p)
+{
+       return security_ops->task_getscheduler(p);
+}
+
+int security_task_movememory(struct task_struct *p)
+{
+       return security_ops->task_movememory(p);
+}
+
+int security_task_kill(struct task_struct *p, struct siginfo *info,
+                       int sig, u32 secid)
+{
+       return security_ops->task_kill(p, info, sig, secid);
+}
+
+int security_task_wait(struct task_struct *p)
+{
+       return security_ops->task_wait(p);
+}
+
+int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
+                        unsigned long arg4, unsigned long arg5)
+{
+       return security_ops->task_prctl(option, arg2, arg3, arg4, arg5);
+}
+
+void security_task_reparent_to_init(struct task_struct *p)
+{
+       security_ops->task_reparent_to_init(p);
+}
+
+void security_task_to_inode(struct task_struct *p, struct inode *inode)
+{
+       security_ops->task_to_inode(p, inode);
+}
+
+int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag)
+{
+       return security_ops->ipc_permission(ipcp, flag);
+}
+
+int security_msg_msg_alloc(struct msg_msg *msg)
+{
+       return security_ops->msg_msg_alloc_security(msg);
+}
+
+void security_msg_msg_free(struct msg_msg *msg)
+{
+       security_ops->msg_msg_free_security(msg);
+}
+
+int security_msg_queue_alloc(struct msg_queue *msq)
+{
+       return security_ops->msg_queue_alloc_security(msq);
+}
+
+void security_msg_queue_free(struct msg_queue *msq)
+{
+       security_ops->msg_queue_free_security(msq);
+}
+
+int security_msg_queue_associate(struct msg_queue *msq, int msqflg)
+{
+       return security_ops->msg_queue_associate(msq, msqflg);
+}
+
+int security_msg_queue_msgctl(struct msg_queue *msq, int cmd)
+{
+       return security_ops->msg_queue_msgctl(msq, cmd);
+}
+
+int security_msg_queue_msgsnd(struct msg_queue *msq,
+                              struct msg_msg *msg, int msqflg)
+{
+       return security_ops->msg_queue_msgsnd(msq, msg, msqflg);
+}
+
+int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg,
+                              struct task_struct *target, long type, int mode)
+{
+       return security_ops->msg_queue_msgrcv(msq, msg, target, type, mode);
+}
+
+int security_shm_alloc(struct shmid_kernel *shp)
+{
+       return security_ops->shm_alloc_security(shp);
+}
+
+void security_shm_free(struct shmid_kernel *shp)
+{
+       security_ops->shm_free_security(shp);
+}
+
+int security_shm_associate(struct shmid_kernel *shp, int shmflg)
+{
+       return security_ops->shm_associate(shp, shmflg);
+}
+
+int security_shm_shmctl(struct shmid_kernel *shp, int cmd)
+{
+       return security_ops->shm_shmctl(shp, cmd);
+}
+
+int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg)
+{
+       return security_ops->shm_shmat(shp, shmaddr, shmflg);
+}
+
+int security_sem_alloc(struct sem_array *sma)
+{
+       return security_ops->sem_alloc_security(sma);
+}
+
+void security_sem_free(struct sem_array *sma)
+{
+       security_ops->sem_free_security(sma);
+}
+
+int security_sem_associate(struct sem_array *sma, int semflg)
+{
+       return security_ops->sem_associate(sma, semflg);
+}
+
+int security_sem_semctl(struct sem_array *sma, int cmd)
+{
+       return security_ops->sem_semctl(sma, cmd);
+}
+
+int security_sem_semop(struct sem_array *sma, struct sembuf *sops,
+                       unsigned nsops, int alter)
+{
+       return security_ops->sem_semop(sma, sops, nsops, alter);
+}
+
+void security_d_instantiate(struct dentry *dentry, struct inode *inode)
+{
+       if (unlikely(inode && IS_PRIVATE(inode)))
+               return;
+       security_ops->d_instantiate(dentry, inode);
+}
+EXPORT_SYMBOL(security_d_instantiate);
+
+int security_getprocattr(struct task_struct *p, char *name, char **value)
+{
+       return security_ops->getprocattr(p, name, value);
+}
+
+int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
+{
+       return security_ops->setprocattr(p, name, value, size);
+}
+
+int security_netlink_send(struct sock *sk, struct sk_buff *skb)
+{
+       return security_ops->netlink_send(sk, skb);
+}
+
+int security_netlink_recv(struct sk_buff *skb, int cap)
+{
+       return security_ops->netlink_recv(skb, cap);
+}
+EXPORT_SYMBOL(security_netlink_recv);
+
+int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
+{
+       return security_ops->secid_to_secctx(secid, secdata, seclen);
+}
+EXPORT_SYMBOL(security_secid_to_secctx);
+
+void security_release_secctx(char *secdata, u32 seclen)
+{
+       return security_ops->release_secctx(secdata, seclen);
+}
+EXPORT_SYMBOL(security_release_secctx);
+
+#ifdef CONFIG_SECURITY_NETWORK
+
+int security_unix_stream_connect(struct socket *sock, struct socket *other,
+                                struct sock *newsk)
+{
+       return security_ops->unix_stream_connect(sock, other, newsk);
+}
+EXPORT_SYMBOL(security_unix_stream_connect);
+
+int security_unix_may_send(struct socket *sock,  struct socket *other)
+{
+       return security_ops->unix_may_send(sock, other);
+}
+EXPORT_SYMBOL(security_unix_may_send);
+
+int security_socket_create(int family, int type, int protocol, int kern)
+{
+       return security_ops->socket_create(family, type, protocol, kern);
+}
+
+int security_socket_post_create(struct socket *sock, int family,
+                               int type, int protocol, int kern)
+{
+       return security_ops->socket_post_create(sock, family, type,
+                                               protocol, kern);
+}
+
+int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen)
+{
+       return security_ops->socket_bind(sock, address, addrlen);
+}
+
+int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen)
+{
+       return security_ops->socket_connect(sock, address, addrlen);
+}
+
+int security_socket_listen(struct socket *sock, int backlog)
+{
+       return security_ops->socket_listen(sock, backlog);
+}
+
+int security_socket_accept(struct socket *sock, struct socket *newsock)
+{
+       return security_ops->socket_accept(sock, newsock);
+}
+
+void security_socket_post_accept(struct socket *sock, struct socket *newsock)
+{
+       security_ops->socket_post_accept(sock, newsock);
+}
+
+int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size)
+{
+       return security_ops->socket_sendmsg(sock, msg, size);
+}
+
+int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
+                           int size, int flags)
+{
+       return security_ops->socket_recvmsg(sock, msg, size, flags);
+}
+
+int security_socket_getsockname(struct socket *sock)
+{
+       return security_ops->socket_getsockname(sock);
+}
+
+int security_socket_getpeername(struct socket *sock)
+{
+       return security_ops->socket_getpeername(sock);
+}
+
+int security_socket_getsockopt(struct socket *sock, int level, int optname)
+{
+       return security_ops->socket_getsockopt(sock, level, optname);
+}
+
+int security_socket_setsockopt(struct socket *sock, int level, int optname)
+{
+       return security_ops->socket_setsockopt(sock, level, optname);
+}
+
+int security_socket_shutdown(struct socket *sock, int how)
+{
+       return security_ops->socket_shutdown(sock, how);
+}
+
+int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
+{
+       return security_ops->socket_sock_rcv_skb(sk, skb);
+}
+EXPORT_SYMBOL(security_sock_rcv_skb);
+
+int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
+                                     int __user *optlen, unsigned len)
+{
+       return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
+}
+
+int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
+{
+       return security_ops->socket_getpeersec_dgram(sock, skb, secid);
+}
+EXPORT_SYMBOL(security_socket_getpeersec_dgram);
+
+int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
+{
+       return security_ops->sk_alloc_security(sk, family, priority);
+}
+
+void security_sk_free(struct sock *sk)
+{
+       return security_ops->sk_free_security(sk);
+}
+
+void security_sk_clone(const struct sock *sk, struct sock *newsk)
+{
+       return security_ops->sk_clone_security(sk, newsk);
+}
+
+void security_sk_classify_flow(struct sock *sk, struct flowi *fl)
+{
+       security_ops->sk_getsecid(sk, &fl->secid);
+}
+EXPORT_SYMBOL(security_sk_classify_flow);
+
+void security_req_classify_flow(const struct request_sock *req, struct flowi *fl)
+{
+       security_ops->req_classify_flow(req, fl);
+}
+EXPORT_SYMBOL(security_req_classify_flow);
+
+void security_sock_graft(struct sock *sk, struct socket *parent)
+{
+       security_ops->sock_graft(sk, parent);
+}
+EXPORT_SYMBOL(security_sock_graft);
+
+int security_inet_conn_request(struct sock *sk,
+                       struct sk_buff *skb, struct request_sock *req)
+{
+       return security_ops->inet_conn_request(sk, skb, req);
+}
+EXPORT_SYMBOL(security_inet_conn_request);
+
+void security_inet_csk_clone(struct sock *newsk,
+                       const struct request_sock *req)
+{
+       security_ops->inet_csk_clone(newsk, req);
+}
+
+void security_inet_conn_established(struct sock *sk,
+                       struct sk_buff *skb)
+{
+       security_ops->inet_conn_established(sk, skb);
+}
+
+#endif /* CONFIG_SECURITY_NETWORK */
+
+#ifdef CONFIG_SECURITY_NETWORK_XFRM
+
+int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
+{
+       return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
+}
+EXPORT_SYMBOL(security_xfrm_policy_alloc);
+
+int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
+{
+       return security_ops->xfrm_policy_clone_security(old, new);
+}
+
+void security_xfrm_policy_free(struct xfrm_policy *xp)
+{
+       security_ops->xfrm_policy_free_security(xp);
+}
+EXPORT_SYMBOL(security_xfrm_policy_free);
+
+int security_xfrm_policy_delete(struct xfrm_policy *xp)
+{
+       return security_ops->xfrm_policy_delete_security(xp);
+}
+
+int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
+{
+       return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0);
+}
+EXPORT_SYMBOL(security_xfrm_state_alloc);
+
+int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
+                                     struct xfrm_sec_ctx *polsec, u32 secid)
+{
+       if (!polsec)
+               return 0;
+       /*
+        * We want the context to be taken from secid which is usually
+        * from the sock.
+        */
+       return security_ops->xfrm_state_alloc_security(x, NULL, secid);
+}
+
+int security_xfrm_state_delete(struct xfrm_state *x)
+{
+       return security_ops->xfrm_state_delete_security(x);
+}
+EXPORT_SYMBOL(security_xfrm_state_delete);
+
+void security_xfrm_state_free(struct xfrm_state *x)
+{
+       security_ops->xfrm_state_free_security(x);
+}
+
+int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
+{
+       return security_ops->xfrm_policy_lookup(xp, fl_secid, dir);
+}
+
+int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
+                                      struct xfrm_policy *xp, struct flowi *fl)
+{
+       return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
+}
+
+int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
+{
+       return security_ops->xfrm_decode_session(skb, secid, 1);
+}
+
+void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl)
+{
+       int rc = security_ops->xfrm_decode_session(skb, &fl->secid, 0);
+
+       BUG_ON(rc);
+}
+EXPORT_SYMBOL(security_skb_classify_flow);
+
+#endif /* CONFIG_SECURITY_NETWORK_XFRM */
+
+#ifdef CONFIG_KEYS
+
+int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long flags)
+{
+       return security_ops->key_alloc(key, tsk, flags);
+}
+
+void security_key_free(struct key *key)
+{
+       security_ops->key_free(key);
+}
+
+int security_key_permission(key_ref_t key_ref,
+                           struct task_struct *context, key_perm_t perm)
+{
+       return security_ops->key_permission(key_ref, context, perm);
 }
 
-EXPORT_SYMBOL_GPL(register_security);
-EXPORT_SYMBOL_GPL(unregister_security);
-EXPORT_SYMBOL_GPL(mod_reg_security);
-EXPORT_SYMBOL_GPL(mod_unreg_security);
-EXPORT_SYMBOL(security_ops);
+#endif /* CONFIG_KEYS */
index 97b7e2738097961f54ae0a38a8e60363a036aeee..24e1b1885de7c5b379b7c19c9cf7b760e1664c41 100644 (file)
@@ -22,7 +22,6 @@
  *      as published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/ptrace.h>
@@ -86,6 +85,7 @@
 extern unsigned int policydb_loaded_version;
 extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
 extern int selinux_compat_net;
+extern struct security_operations *security_ops;
 
 #ifdef CONFIG_SECURITY_SELINUX_DEVELOP
 int selinux_enforcing = 0;
@@ -2297,6 +2297,25 @@ static int selinux_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
        return dentry_has_perm(current, mnt, dentry, FILE__GETATTR);
 }
 
+static int selinux_inode_setotherxattr(struct dentry *dentry, char *name)
+{
+       if (!strncmp(name, XATTR_SECURITY_PREFIX,
+                    sizeof XATTR_SECURITY_PREFIX - 1)) {
+               if (!strcmp(name, XATTR_NAME_CAPS)) {
+                       if (!capable(CAP_SETFCAP))
+                               return -EPERM;
+               } else if (!capable(CAP_SYS_ADMIN)) {
+                       /* A different attribute in the security namespace.
+                          Restrict to administrator. */
+                       return -EPERM;
+               }
+       }
+
+       /* Not an attribute we recognize, so just check the
+          ordinary setattr permission. */
+       return dentry_has_perm(current, NULL, dentry, FILE__SETATTR);
+}
+
 static int selinux_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags)
 {
        struct task_security_struct *tsec = current->security;
@@ -2307,19 +2326,8 @@ static int selinux_inode_setxattr(struct dentry *dentry, char *name, void *value
        u32 newsid;
        int rc = 0;
 
-       if (strcmp(name, XATTR_NAME_SELINUX)) {
-               if (!strncmp(name, XATTR_SECURITY_PREFIX,
-                            sizeof XATTR_SECURITY_PREFIX - 1) &&
-                   !capable(CAP_SYS_ADMIN)) {
-                       /* A different attribute in the security namespace.
-                          Restrict to administrator. */
-                       return -EPERM;
-               }
-
-               /* Not an attribute we recognize, so just check the
-                  ordinary setattr permission. */
-               return dentry_has_perm(current, NULL, dentry, FILE__SETATTR);
-       }
+       if (strcmp(name, XATTR_NAME_SELINUX))
+               return selinux_inode_setotherxattr(dentry, name);
 
        sbsec = inode->i_sb->s_security;
        if (sbsec->behavior == SECURITY_FS_USE_MNTPOINT)
@@ -2393,31 +2401,14 @@ static int selinux_inode_listxattr (struct dentry *dentry)
 
 static int selinux_inode_removexattr (struct dentry *dentry, char *name)
 {
-       if (strcmp(name, XATTR_NAME_SELINUX)) {
-               if (!strncmp(name, XATTR_SECURITY_PREFIX,
-                            sizeof XATTR_SECURITY_PREFIX - 1) &&
-                   !capable(CAP_SYS_ADMIN)) {
-                       /* A different attribute in the security namespace.
-                          Restrict to administrator. */
-                       return -EPERM;
-               }
-
-               /* Not an attribute we recognize, so just check the
-                  ordinary setattr permission. Might want a separate
-                  permission for removexattr. */
-               return dentry_has_perm(current, NULL, dentry, FILE__SETATTR);
-       }
+       if (strcmp(name, XATTR_NAME_SELINUX))
+               return selinux_inode_setotherxattr(dentry, name);
 
        /* No one is allowed to remove a SELinux security label.
           You can change the label, but all data must be labeled. */
        return -EACCES;
 }
 
-static const char *selinux_inode_xattr_getsuffix(void)
-{
-      return XATTR_SELINUX_SUFFIX;
-}
-
 /*
  * Copy the in-core inode security context value to the user.  If the
  * getxattr() prior to this succeeded, check to see if we need to
@@ -2464,6 +2455,16 @@ static int selinux_inode_listsecurity(struct inode *inode, char *buffer, size_t
        return len;
 }
 
+static int selinux_inode_need_killpriv(struct dentry *dentry)
+{
+       return secondary_ops->inode_need_killpriv(dentry);
+}
+
+static int selinux_inode_killpriv(struct dentry *dentry)
+{
+       return secondary_ops->inode_killpriv(dentry);
+}
+
 /* file security operations */
 
 static int selinux_revalidate_file_permission(struct file *file, int mask)
@@ -2882,6 +2883,12 @@ static int selinux_task_setnice(struct task_struct *p, int nice)
 
 static int selinux_task_setioprio(struct task_struct *p, int ioprio)
 {
+       int rc;
+
+       rc = secondary_ops->task_setioprio(p, ioprio);
+       if (rc)
+               return rc;
+
        return task_has_perm(current, p, PROCESS__SETSCHED);
 }
 
@@ -2911,6 +2918,12 @@ static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim
 
 static int selinux_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp)
 {
+       int rc;
+
+       rc = secondary_ops->task_setscheduler(p, policy, lp);
+       if (rc)
+               return rc;
+
        return task_has_perm(current, p, PROCESS__SETSCHED);
 }
 
@@ -4536,19 +4549,6 @@ static int selinux_register_security (const char *name, struct security_operatio
        return 0;
 }
 
-static int selinux_unregister_security (const char *name, struct security_operations *ops)
-{
-       if (ops != secondary_ops) {
-               printk(KERN_ERR "%s:  trying to unregister a security module "
-                       "that is not registered.\n", __FUNCTION__);
-               return -EINVAL;
-       }
-
-       secondary_ops = original_ops;
-
-       return 0;
-}
-
 static void selinux_d_instantiate (struct dentry *dentry, struct inode *inode)
 {
        if (inode)
@@ -4826,10 +4826,11 @@ static struct security_operations selinux_ops = {
        .inode_getxattr =               selinux_inode_getxattr,
        .inode_listxattr =              selinux_inode_listxattr,
        .inode_removexattr =            selinux_inode_removexattr,
-       .inode_xattr_getsuffix =        selinux_inode_xattr_getsuffix,
        .inode_getsecurity =            selinux_inode_getsecurity,
        .inode_setsecurity =            selinux_inode_setsecurity,
        .inode_listsecurity =           selinux_inode_listsecurity,
+       .inode_need_killpriv =          selinux_inode_need_killpriv,
+       .inode_killpriv =               selinux_inode_killpriv,
 
        .file_permission =              selinux_file_permission,
        .file_alloc_security =          selinux_file_alloc_security,
@@ -4894,7 +4895,6 @@ static struct security_operations selinux_ops = {
        .sem_semop =                    selinux_sem_semop,
 
        .register_security =            selinux_register_security,
-       .unregister_security =          selinux_unregister_security,
 
        .d_instantiate =                selinux_d_instantiate,
 
index ba715f40b658e4dfd63a05024ab566bcb81daf9c..cb008d9f0a823235265464197b8e2cd311b084e2 100644 (file)
@@ -31,7 +31,6 @@
  *   2. Emulating a reasonable SO_PEERSEC across machines
  *   3. Testing addition of sk_policy's with security context via setsockopt
  */
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/security.h>